home-atom 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/bin/home-atom.js +135 -0
- package/dist/client/.vite/manifest.json +184 -0
- package/dist/client/_next/static/chunks/app-top-nav-Dh0jEt8u.js +1 -0
- package/dist/client/_next/static/chunks/chevron-left-Dn3noAqV.js +1 -0
- package/dist/client/_next/static/chunks/framework-BQUlGUOV.js +9 -0
- package/dist/client/_next/static/chunks/hls-CgexCc5Z.js +40 -0
- package/dist/client/_next/static/chunks/house-DQz6VeTk.js +1 -0
- package/dist/client/_next/static/chunks/index-hn3AiVww.js +33 -0
- package/dist/client/_next/static/chunks/layout-segment-context-DRM8YCgm.js +1 -0
- package/dist/client/_next/static/chunks/manage-profiles-modal-Doi6QM4e.js +1 -0
- package/dist/client/_next/static/chunks/navigation-errors-C_V42-00.js +1 -0
- package/dist/client/_next/static/chunks/netflix-browser-L_Vb9wXK.js +2 -0
- package/dist/client/_next/static/chunks/playback-activity-Dug3BRYr.js +1 -0
- package/dist/client/_next/static/chunks/playback-activity-track-switcher-CbO6kl8K.js +1 -0
- package/dist/client/_next/static/chunks/rolldown-runtime-QTnfLwEv.js +1 -0
- package/dist/client/_next/static/chunks/spotify-app-f93K4FG_.js +1 -0
- package/dist/client/_next/static/chunks/step-forward-CV8I5pPb.js +1 -0
- package/dist/client/_next/static/chunks/storefront-C_nmcuvH.js +1 -0
- package/dist/client/_next/static/chunks/streamed-icons-DwsKSgMb.js +1 -0
- package/dist/client/_next/static/css/index.BGXy8e6j.css +1 -0
- package/dist/client/_next/static/css/layout.AKSLtSR6.css +1 -0
- package/dist/client/_next/static/css/layout.D8T68cCD.css +1 -0
- package/dist/client/_next/static/css/manage-profiles-modal.BAVyxRRR.css +1 -0
- package/dist/client/_next/static/e1ce9af7-d770-43d6-845a-511443f19971/_buildManifest.js +1 -0
- package/dist/client/_next/static/e1ce9af7-d770-43d6-845a-511443f19971/_ssgManifest.js +1 -0
- package/dist/client/_next/static/media/roboto-cyrillic-ext-wght-normal.BCp_3N7R.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-cyrillic-wght-normal.fOt7epNf.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-greek-ext-wght-normal.Bgw4czJT.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-greek-wght-normal.DlT9XTxE.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-latin-ext-wght-normal.DYIxWhlt.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-latin-wght-normal.ccAYIvAh.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-math-wght-normal.4a3xuzGk.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-symbols-wght-normal.B7iHSfaG.woff2 +0 -0
- package/dist/client/_next/static/media/roboto-vietnamese-wght-normal._f1XEJpo.woff2 +0 -0
- package/dist/client/icons/home.ico +0 -0
- package/dist/client/icons/keyboard.ico +0 -0
- package/dist/client/icons/netflix.ico +0 -0
- package/dist/client/icons/remote-screen.ico +0 -0
- package/dist/client/icons/spotify.ico +0 -0
- package/dist/client/vinext-client-entry-manifest.json +3 -0
- package/dist/server/BUILD_ID +1 -0
- package/dist/server/__vite_rsc_assets_manifest.js +162 -0
- package/dist/server/_next/static/app-page-cache-DcrtN14Y.js +1 -0
- package/dist/server/_next/static/app-page-cache-render-DoCquoNb.js +1 -0
- package/dist/server/_next/static/app-prerender-endpoints-rDLH8gfm.js +1 -0
- package/dist/server/_next/static/app-route-handler-dispatch-Be2YIqVp.js +1 -0
- package/dist/server/_next/static/app-static-generation-BX8cz43B.js +1 -0
- package/dist/server/_next/static/app-top-nav-aGPkB57A.js +1 -0
- package/dist/server/_next/static/automation-UGP78ei5.js +172 -0
- package/dist/server/_next/static/automation-tAN_1u1H.js +118 -0
- package/dist/server/_next/static/base-path-Cmiu3HvG.js +1 -0
- package/dist/server/_next/static/cache-headers-BQ-QuzWN.js +1 -0
- package/dist/server/_next/static/catalog-BS93IoWO.js +1 -0
- package/dist/server/_next/static/css/index.BGXy8e6j.css +1 -0
- package/dist/server/_next/static/css/layout.AKSLtSR6.css +1 -0
- package/dist/server/_next/static/css/layout.D8T68cCD.css +1 -0
- package/dist/server/_next/static/database-BNnYfHmT.js +114 -0
- package/dist/server/_next/static/db-BE1J0NNS.js +98 -0
- package/dist/server/_next/static/downloader-DgnjNL5T.js +21 -0
- package/dist/server/_next/static/framework~index-B2E_Di_-.js +18 -0
- package/dist/server/_next/static/framework~index~layout~layout~page~page~page~layout~page~app-page-cache-render~app-page-cac~nvd6h53m-ydvR7YSg.js +1 -0
- package/dist/server/_next/static/http-B2HyuWoI.js +1 -0
- package/dist/server/_next/static/input-platform-C0756QEt.js +1 -0
- package/dist/server/_next/static/instrumentation-BV3gg-L-.js +1 -0
- package/dist/server/_next/static/isr-decision-D1zHgPSI.js +1 -0
- package/dist/server/_next/static/layout-ClEWbCcj.js +1 -0
- package/dist/server/_next/static/layout-Ds3pFa6r.js +1 -0
- package/dist/server/_next/static/media/roboto-cyrillic-ext-wght-normal.BCp_3N7R.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-cyrillic-wght-normal.fOt7epNf.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-greek-ext-wght-normal.Bgw4czJT.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-greek-wght-normal.DlT9XTxE.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-latin-ext-wght-normal.DYIxWhlt.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-latin-wght-normal.ccAYIvAh.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-math-wght-normal.4a3xuzGk.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-symbols-wght-normal.B7iHSfaG.woff2 +0 -0
- package/dist/server/_next/static/media/roboto-vietnamese-wght-normal._f1XEJpo.woff2 +0 -0
- package/dist/server/_next/static/netflix-page-BRbORN1F.js +1 -0
- package/dist/server/_next/static/page-C457kN_n.js +1 -0
- package/dist/server/_next/static/page-Cs-erYTy.js +1 -0
- package/dist/server/_next/static/page-DlBGATQp.js +1 -0
- package/dist/server/_next/static/page-DlRXyzSQ.js +1 -0
- package/dist/server/_next/static/providers-B3YELr_F.js +108 -0
- package/dist/server/_next/static/providers-CMBIwNGs.js +1 -0
- package/dist/server/_next/static/request-context-C1ZJzkex.js +1 -0
- package/dist/server/_next/static/request-profile-B1yGQ0l6.js +1 -0
- package/dist/server/_next/static/rolldown-runtime-DaDcL9Zw.js +1 -0
- package/dist/server/_next/static/route-96DdgJBs.js +1 -0
- package/dist/server/_next/static/route-B0WNLJZp.js +1 -0
- package/dist/server/_next/static/route-BBmE0xf12.js +1 -0
- package/dist/server/_next/static/route-BPcAdbz_.js +1 -0
- package/dist/server/_next/static/route-BWk9YK7r.js +1 -0
- package/dist/server/_next/static/route-BdG5ojMj2.js +1 -0
- package/dist/server/_next/static/route-BovNctFc.js +1 -0
- package/dist/server/_next/static/route-C2LuSjoh.js +1 -0
- package/dist/server/_next/static/route-C74RA7va.js +1 -0
- package/dist/server/_next/static/route-CCUsQ7AG.js +1 -0
- package/dist/server/_next/static/route-CHJzaQu2.js +73 -0
- package/dist/server/_next/static/route-CN6VdJwN.js +1 -0
- package/dist/server/_next/static/route-CNNiXZoM2.js +1 -0
- package/dist/server/_next/static/route-CVPPmUto.js +1 -0
- package/dist/server/_next/static/route-CeVsDcbj2.js +1 -0
- package/dist/server/_next/static/route-Cim7D4XQ.js +1 -0
- package/dist/server/_next/static/route-CjUCKwSj2.js +1 -0
- package/dist/server/_next/static/route-CkH7Cg-p.js +1 -0
- package/dist/server/_next/static/route-Cn40NftM.js +1 -0
- package/dist/server/_next/static/route-DAyF4BHS.js +1 -0
- package/dist/server/_next/static/route-DWAMZHLa.js +1 -0
- package/dist/server/_next/static/route-DXTJyFWD.js +1 -0
- package/dist/server/_next/static/route-D_G2SOlz.js +1 -0
- package/dist/server/_next/static/route-Dbs39TkC.js +1 -0
- package/dist/server/_next/static/route-DiT9UYUd.js +1 -0
- package/dist/server/_next/static/route-DslPFTAK.js +1 -0
- package/dist/server/_next/static/route-UWQN8uYr.js +1 -0
- package/dist/server/_next/static/route-ipFkK3iA.js +1 -0
- package/dist/server/_next/static/route-jMq6H_yh.js +1 -0
- package/dist/server/_next/static/route-mzLdjDCs2.js +1 -0
- package/dist/server/_next/static/route-vD15s2A8.js +1 -0
- package/dist/server/_next/static/route-xtz48fti.js +1 -0
- package/dist/server/_next/static/route-zazqen-A2.js +1 -0
- package/dist/server/_next/static/seed-cache-oCd9Lfdw.js +1 -0
- package/dist/server/_next/static/server-CS40XqUP.js +1 -0
- package/dist/server/_next/static/storage-D1zF0J_t.js +288 -0
- package/dist/server/_next/static/streamer-B1PRR-dj.js +2 -0
- package/dist/server/_next/static/subtitles-DYBlMnha.js +2 -0
- package/dist/server/_next/static/title-progress-CQBrSxvN.js +1 -0
- package/dist/server/_next/static/unified-request-context-CgIMz2dD.js +1 -0
- package/dist/server/index.js +17 -0
- package/dist/server/prerendered-routes/404.html +2 -0
- package/dist/server/prerendered-routes/index.html +2 -0
- package/dist/server/prerendered-routes/index.rsc +13 -0
- package/dist/server/ssr/__vite_rsc_assets_manifest.js +162 -0
- package/dist/server/ssr/_next/static/app-elements-Psr6bSdJ.js +1 -0
- package/dist/server/ssr/_next/static/app-prefetch-fetch-queue-Dm_lGOGz.js +1 -0
- package/dist/server/ssr/_next/static/app-router-context-QPmikWPX.js +1 -0
- package/dist/server/ssr/_next/static/app-router-scroll-C0MNOLz-.js +1 -0
- package/dist/server/ssr/_next/static/app-top-nav-a5vUAoEs.js +1 -0
- package/dist/server/ssr/_next/static/base-path-DtcGyvwb.js +1 -0
- package/dist/server/ssr/_next/static/chevron-left-CkBJG8E2.js +1 -0
- package/dist/server/ssr/_next/static/css/refresh-cw.BAVyxRRR.css +1 -0
- package/dist/server/ssr/_next/static/default-global-error-B62cHCkh.js +31 -0
- package/dist/server/ssr/_next/static/error-boundary-C28whqLB.js +1 -0
- package/dist/server/ssr/_next/static/hls-CgexCc5Z.js +40 -0
- package/dist/server/ssr/_next/static/house-l1u9dUbj.js +1 -0
- package/dist/server/ssr/_next/static/layout-segment-context-DK0O-NeY.js +1 -0
- package/dist/server/ssr/_next/static/minimize-C9JLgte-.js +1 -0
- package/dist/server/ssr/_next/static/navigation-BCDRWdBm.js +1 -0
- package/dist/server/ssr/_next/static/navigation-context-state-BnWorqxb.js +1 -0
- package/dist/server/ssr/_next/static/navigation-errors-BRIEcp79.js +1 -0
- package/dist/server/ssr/_next/static/navigation-server-CCLiCOcy.js +1 -0
- package/dist/server/ssr/_next/static/netflix-browser-CMAehdwi.js +2 -0
- package/dist/server/ssr/_next/static/pin-BQre-tQY.js +1 -0
- package/dist/server/ssr/_next/static/playback-activity-D5TYX2Ae.js +1 -0
- package/dist/server/ssr/_next/static/refresh-cw-CWdWHjqY.js +1 -0
- package/dist/server/ssr/_next/static/rolldown-runtime-DSjMdhoD.js +1 -0
- package/dist/server/ssr/_next/static/slot-CE_M6qTT.js +1 -0
- package/dist/server/ssr/_next/static/spotify-app-CE-RaTjZ.js +1 -0
- package/dist/server/ssr/_next/static/storefront-C5NNzPMa.js +1 -0
- package/dist/server/ssr/_next/static/streamed-icons-D2p1hUS_.js +1 -0
- package/dist/server/ssr/_next/static/url-safety-CnwxMXYX.js +1 -0
- package/dist/server/ssr/index.js +3 -0
- package/dist/server/ssr/vinext-client-assets.js +1 -0
- package/dist/server/ssr/vinext-server.json +1 -0
- package/dist/server/vinext-client-assets.js +1 -0
- package/dist/server/vinext-externals.json +5 -0
- package/dist/server/vinext-prerender-paths.json +7 -0
- package/dist/server/vinext-prerender.json +219 -0
- package/dist/server/vinext-server.json +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n}from"./framework-BQUlGUOV.js";import{r}from"./index-hn3AiVww.js";import{n as i,t as a}from"./chevron-left-Dn3noAqV.js";import{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p,t as m}from"./step-forward-CV8I5pPb.js";import{a as h,c as g,i as _,l as v,n as ee,o as y,r as te,s as b,t as ne,u as re}from"./playback-activity-Dug3BRYr.js";import{a as x,c as S,d as ie,f as ae,h as C,i as w,l as T,m as E,n as oe,o as D,p as se,r as ce,s as le,t as ue,u as de}from"./manage-profiles-modal-Doi6QM4e.js";var fe=i(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),pe=i(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),me=i(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),he=i(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ge=i(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),_e=i(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),ve=i(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ye=i(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),be=i(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),O=e(n()),xe=Object.defineProperty,k=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,A=(e,t,n)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||={})Se.call(t,n)&&A(e,n,t[n]);if(k)for(var n of k(t))Ce.call(t,n)&&A(e,n,t[n]);return e},M=(e,t)=>{var n={};for(var r in e)Se.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&k)for(var r of k(e))t.indexOf(r)<0&&Ce.call(e,r)&&(n[r]=e[r]);return n},N;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(N||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(N||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(N||={});var we=N,Te={L:we.QrCode.Ecc.LOW,M:we.QrCode.Ecc.MEDIUM,Q:we.QrCode.Ecc.QUARTILE,H:we.QrCode.Ecc.HIGH},P=128,Ee=`L`,De=`#FFFFFF`,Oe=`#000000`,F=!1,I=1,L=4,R=0,ke=.1;function z(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Ae(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function je(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ke),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function B(e,t){return t==null?e?L:R:Math.max(Math.floor(t),0)}function Me({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=O.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...we.QrSegment.makeSegments(t)),e),[]);return we.QrCode.encodeSegments(r,Te[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=O.useMemo(()=>{let e=c.getModules(),t=B(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:je(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var V=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),H=O.forwardRef(function(e,t){let n=e,{value:r,size:i=P,level:a=Ee,bgColor:o=De,fgColor:s=Oe,includeMargin:c=F,minVersion:l=I,boostLevel:u,marginSize:d,imageSettings:f}=n,p=M(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=M(p,[`style`]),g=f?.src,_=O.useRef(null),v=O.useRef(null),ee=O.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[y,te]=O.useState(!1),{margin:b,cells:ne,numCells:re,calculatedImageSettings:x}=Me({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});O.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=ne,r=v.current,a=x!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&x.excavation!=null&&(n=Ae(ne,x.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/re*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,re,re),t.fillStyle=s,V?t.fill(new Path2D(z(n,b))):ne.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+b,n+b,1,1)})}),x&&(t.globalAlpha=x.opacity),a&&t.drawImage(r,x.x+b,x.y+b,x.w,x.h)}}),O.useEffect(()=>{te(!1)},[g]);let S=j({height:i,width:i},m),ie=null;return g!=null&&(ie=O.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{te(!0)},ref:v,crossOrigin:x?.crossOrigin})),O.createElement(O.Fragment,null,O.createElement(`canvas`,j({style:S,height:i,width:i,ref:ee,role:`img`},h)),ie)});H.displayName=`QRCodeCanvas`;var Ne=O.forwardRef(function(e,t){let n=e,{value:r,size:i=P,level:a=Ee,bgColor:o=De,fgColor:s=Oe,includeMargin:c=F,minVersion:l=I,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=M(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Me({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),ee=g,y=null;p!=null&&v!=null&&(v.excavation!=null&&(ee=Ae(g,v.excavation)),y=O.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let te=z(ee,h);return O.createElement(`svg`,j({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&O.createElement(`title`,null,d),O.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),O.createElement(`path`,{fill:s,d:te,shapeRendering:`crispEdges`}),y)});Ne.displayName=`QRCodeSVG`;function Pe(e){return e.normalize(`NFD`).replace(/\p{M}/gu,``).toLowerCase().replace(/\b(?:19|20)\d{2}\b/g,` `).replace(/&/g,` and `).replace(/[^a-z0-9]+/g,` `).trim()}function U(e){return Array.from(new Set([e.title,e.originalTitle].filter(e=>!!e?.trim()).map(Pe).filter(Boolean))).map(t=>`${t}:${e.year}`)}function W(e){return e.sourceProvider===`phimhdcss`?0:e.sourceProvider?2:1}function Fe(e){let t=e.map((e,t)=>({movie:e,index:t})).sort((e,t)=>W(e.movie)-W(t.movie)||e.index-t.index),n=new Set,r=new Set,i=[];for(let{movie:e}of t){if(e.sourceUrl&&r.has(e.sourceUrl))continue;let t=U(e);if(!t.some(e=>n.has(e))){i.push(e),e.sourceUrl&&r.add(e.sourceUrl);for(let e of t)n.add(e)}}return i}function Ie(e,t){let n=t.trim().toLocaleLowerCase();return n?[e.title,e.originalTitle??``,e.synopsis,e.genres.join(` `),e.cast.join(` `),e.creators?.join(` `)??``,e.director??``].join(` `).toLocaleLowerCase().includes(n):!1}var G=t(),Le={myList:[],likedTitles:[],progress:[],subtitlePreferences:{fontSize:32,positionX:50,positionY:78,fontColor:`#ffffff`,backgroundColor:`rgba(0,0,0,0.75)`,fontFamily:`default`,captionsOn:!1,updatedAt:``}},Re=[{label:`Home`,href:`/netflix`},{label:`Series`,href:`/netflix#netflix-originals`},{label:`Films`,href:`/netflix#movie-night`},{label:`New & Popular`,href:`/netflix#top-10`},{label:`My List`,href:`/netflix#my-list`},{label:`Browse by language`,href:`/netflix#footer`}];function ze(e){return e?`/netflix/search?q=${encodeURIComponent(e)}`:`/netflix/search`}function Be(){let e=(0,O.useRef)(null);return(0,O.useEffect)(()=>{let t=document.activeElement,n=()=>Array.from(e.current?.querySelectorAll(`button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??[]).filter(e=>!e.hasAttribute(`disabled`)),r=window.requestAnimationFrame(()=>n()[0]?.focus()),i=t=>{if(t.key!==`Tab`)return;let r=n();if(!r.length)return;let i=r[0],a=r[r.length-1];t.shiftKey&&document.activeElement===i?(t.preventDefault(),a.focus()):(!t.shiftKey&&document.activeElement===a||document.activeElement&&!e.current?.contains(document.activeElement))&&(t.preventDefault(),i.focus())};return document.addEventListener(`keydown`,i),()=>{window.cancelAnimationFrame(r),document.removeEventListener(`keydown`,i),t?.isConnected&&t.focus()}},[]),e}function Ve({featured:e,rows:t,initialImportedTitles:n,initialProviders:r,initialProfiles:i,initialActiveProfile:a,initialProfileLibrary:o,initialSearchOpen:s=!1,initialSearchQuery:c=``}){let[l,u]=(0,O.useState)(!1),[d,f]=(0,O.useState)(!1),[p,m]=(0,O.useState)(!1),[h,g]=(0,O.useState)(!1),[_,v]=(0,O.useState)(s),[ee,y]=(0,O.useState)(!1),[te,b]=(0,O.useState)(!1),[ne,re]=(0,O.useState)(!1),[x,ie]=(0,O.useState)(!1),[ae,C]=(0,O.useState)(r),[w,T]=(0,O.useState)(n),[E,oe]=(0,O.useState)(i),[D,se]=(0,O.useState)(a),[ce,le]=(0,O.useState)(o),[de,fe]=(0,O.useState)(``),[pe,me]=(0,O.useState)(c),[he,ge]=(0,O.useState)([]),[_e,ve]=(0,O.useState)(``),[ye,be]=(0,O.useState)(`idle`),[xe,k]=(0,O.useState)(``),[Se,Ce]=(0,O.useState)(null),[A,j]=(0,O.useState)(null),[M,N]=(0,O.useState)(null),[we,Te]=(0,O.useState)(!1),[P,Ee]=(0,O.useState)(new Set(o.myList)),[De,Oe]=(0,O.useState)(new Set(o.likedTitles)),F=(0,O.useRef)(null),I=(0,O.useRef)(s),L=(0,O.useRef)(c),R=(0,O.useRef)({version:0,controller:null}),ke=(0,O.useRef)(a.id),z=(0,O.useRef)(0),Ae=(0,O.useRef)(0),je=(0,O.useCallback)(e=>{ke.current!==e&&(ke.current=e,z.current+=1,R.current.version+=1,R.current.controller?.abort(),R.current.controller=null,C([]),T([]),le(Le),Ee(new Set),Oe(new Set),j(null),N(null),fe(``))},[]),B=(0,O.useCallback)(()=>{R.current.version+=1,R.current.controller?.abort(),R.current.controller=null},[]),Me=(0,O.useCallback)(()=>{B(),N(null)},[B]);(0,O.useEffect)(()=>()=>{B()},[B]);let V=(0,O.useCallback)((e,t,n)=>{let r=e?ze(t):`/netflix`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==r&&(n===`push`?window.history.pushState(null,``,r):window.history.replaceState(null,``,r))},[]),H=(0,O.useCallback)(e=>{let t=I.current;if(I.current=e,v(e),e){t||V(!0,L.current,`push`);return}L.current=``,me(``),t&&V(!1,``,`push`)},[V]),Ne=(0,O.useCallback)(e=>{L.current=e,me(e),I.current&&V(!0,e,`replace`)},[V]),Pe=(0,O.useMemo)(()=>{let n=[e,...w,...t.flatMap(e=>e.items)];return Array.from(new Map(n.map(e=>[e.id,e])).values())},[e,w,t]),U=(0,O.useMemo)(()=>{let e=new Map(ce.progress.map(e=>[e.titleId,e]));return Pe.map(t=>{let n=e.get(t.id);return!n||n.completed||n.positionSeconds<1?{...t,progress:void 0,resumeSeason:void 0,resumeEpisode:void 0,resumePositionSeconds:void 0,resumeDurationSeconds:void 0,resumeUpdatedAt:void 0}:{...t,progress:n.durationSeconds>0?Math.min(100,n.positionSeconds/n.durationSeconds*100):0,resumeSeason:n.seasonNumber,resumeEpisode:n.episodeNumber,resumePositionSeconds:n.positionSeconds,resumeDurationSeconds:n.durationSeconds,resumeUpdatedAt:n.updatedAt}})},[Pe,ce.progress]),W=(0,O.useMemo)(()=>new Map(U.map(e=>[e.id,e])),[U]),Re=(0,O.useMemo)(()=>{let e=pe.trim();return e?U.filter(t=>Ie(t,e)):[]},[U,pe]),Be=pe.trim(),Ve=Be.length>=2&&_e===Be?he:[],Ue=Be.length<2?`idle`:_e===Be?ye:`loading`,We=_e===Be?xe:``,Ge=Fe([...Re,...Ve]),Ke=(0,O.useMemo)(()=>U.filter(e=>P.has(e.id)),[P,U]),qe=(0,O.useMemo)(()=>{let e=new Map(ce.progress.map(e=>[e.titleId,e]));return U.filter(t=>{let n=e.get(t.id);return!!(n&&!n.completed&&n.positionSeconds>=1&&(n.durationSeconds<=0||n.positionSeconds/n.durationSeconds<.95))}).sort((t,n)=>{let r=e.get(t.id)?.updatedAt??``;return(e.get(n.id)?.updatedAt??``).localeCompare(r)})},[ce.progress,U]);(0,O.useEffect)(()=>{let e=()=>u(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),(0,O.useEffect)(()=>{let e=()=>{let e=window.location.pathname.replace(/\/+$/,``)===`/netflix/search`,t=e?new URLSearchParams(window.location.search).get(`q`)??``:``;I.current=e,L.current=t,v(e),me(t)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,O.useEffect)(()=>{_&&(window.scrollTo(0,0),F.current?.focus())},[_]),(0,O.useEffect)(()=>{let e=pe.trim();if(!_||e.length<2)return;let t=new AbortController,n=window.setTimeout(()=>{ve(e),ge([]),be(`loading`),k(``),fetch(`/api/netflix/search?q=${encodeURIComponent(e)}`,{cache:`no-store`,signal:t.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||`Provider search failed.`);ge(t.titles??[]),be(`ready`),t.failedProviders?.length&&k(`Some providers could not be searched: ${t.failedProviders.join(`, `)}.`)}).catch(e=>{t.signal.aborted||(be(`error`),k(e instanceof Error?e.message:`Provider search failed.`))})},350);return()=>{window.clearTimeout(n),t.abort()}},[_,pe]),(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(M?Me():A?j(null):x?ie(!1):ne?re(!1):_&&pe?Ne(``):_?H(!1):(y(!1),b(!1),f(!1),m(!1),g(!1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[ne,Me,x,M,_,pe,A,H,Ne]);let Je=(0,O.useCallback)(async e=>{let t=++z.current,n=await fetch(`/api/netflix/library?profileId=${encodeURIComponent(e)}`,{cache:`no-store`});if(!n.ok)return;let r=await n.json();ke.current!==e||t!==z.current||(C(r.providers),T(r.titles))},[]),Ze=(0,O.useCallback)(async e=>{let t=D.id,n=U.find(t=>t.id===e.id||e.sourceUrl&&t.sourceUrl===e.sourceUrl);if(n||!e.sourceProvider||!e.sourceUrl){H(!1),j(n??e);return}Ce(e.id),k(``);try{let n=await fetch(`/api/netflix/movies/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({url:e.sourceUrl,mode:`stream`,profileId:t})}),r=await n.json();if(!n.ok||!r.title)throw Error(r.error||`Movie details could not be loaded.`);if(ke.current!==t)return;T(e=>[r.title,...e.filter(e=>e.id!==r.title.id&&e.sourceUrl!==r.title.sourceUrl)]),H(!1),j(r.title)}catch(e){k(e instanceof Error?e.message:`Movie details could not be loaded.`)}finally{Ce(null)}},[D.id,U,H]);(0,O.useEffect)(()=>{let e=D.id,t=window.setTimeout(()=>void Je(e),0);return()=>window.clearTimeout(t)},[D.id,Je]),(0,O.useEffect)(()=>{if(!w.some(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`))return;let e=D.id,t=window.setInterval(()=>void Je(e),3e3);return()=>window.clearInterval(t)},[D.id,w,Je]),(0,O.useEffect)(()=>(document.body.style.overflow=A||M||ne?`hidden`:``,()=>{document.body.style.overflow=``}),[ne,M,A]);let J=(0,O.useCallback)(e=>{le(e),Ee(new Set(e.myList)),Oe(new Set(e.likedTitles))},[]),$e=(0,O.useCallback)(async e=>{let t=await fetch(`/api/netflix/profiles/${encodeURIComponent(e)}/library`,{cache:`no-store`});if(!t.ok)throw Error(`Profile library could not be loaded.`);let n=await t.json();ke.current===e&&J(n)},[J]),et=(0,O.useCallback)(async e=>{let t=++Ae.current,n=await fetch(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});if(!n.ok)return;let r=await n.json();t===Ae.current&&(je(r.activeProfile.id),se(r.activeProfile),J(r.library),m(!1),j(null),B(),N(null))},[J,je,B]),tt=(0,O.useCallback)(async(e,t)=>{let n=D.id!==t.id;n&&je(t.id),oe(e),se(t),n&&await $e(t.id)},[D.id,je,$e]),nt=e=>{let t=D.id,n=!P.has(e.id);Ee(t=>{let r=new Set(t);return n?r.add(e.id):r.delete(e.id),r}),fetch(`/api/netflix/profiles/${encodeURIComponent(t)}/library`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({titleId:e.id,inMyList:n})}).then(async e=>{if(!e.ok)throw Error();ke.current===t&&J(await e.json())}).catch(()=>void $e(t))},rt=e=>{let t=D.id,n=!De.has(e.id);Oe(t=>{let r=new Set(t);return n?r.add(e.id):r.delete(e.id),r}),fetch(`/api/netflix/profiles/${encodeURIComponent(t)}/library`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({titleId:e.id,liked:n})}).then(async e=>{if(!e.ok)throw Error();ke.current===t&&J(await e.json())}).catch(()=>void $e(t))},it=(e,t)=>{if(B(),e.sourceProvider&&!e.playbackPath&&!e.canStream){j(e);return}let n=t??e.resumeEpisode,r=e.episodes?.find(e=>e.episode===n)||(e.episode?.episode===n?e.episode:void 0)||(n?{season:e.resumeSeason??e.episode?.season??1,episode:n,title:`Episode ${n}`,duration:e.resumeDurationSeconds?`${Math.max(1,Math.round(e.resumeDurationSeconds/60))}m`:`45m`}:e.episode||e.episodes?.[0]),i=t===void 0||t===e.resumeEpisode;j(null),N(r?{...e,episode:r,resumePositionSeconds:i?e.resumePositionSeconds:void 0,resumeDurationSeconds:i?e.resumeDurationSeconds:void 0}:e)},Y=(0,O.useCallback)(async e=>{let t=R.current;t.version+=1;let n=t.version;t.controller?.abort();let r=new AbortController;t.controller=r;try{let t=await fetch(`/api/netflix/titles/${encodeURIComponent(e)}?profileId=${encodeURIComponent(D.id)}`,{cache:`no-store`,signal:r.signal}),i=await t.json();if(!t.ok||!i.title)throw Error(i.error||`The requested movie was not found.`);if(r.signal.aborted||n!==R.current.version)return;let a=i.title;if(a.sourceProvider&&!a.playbackPath&&!a.canStream)throw Error(`The requested movie is not available to stream.`);a.sourceProvider&&T(e=>[a,...e.filter(e=>e.id!==a.id)]);let o=a.resumeEpisode??a.episode?.episode,s=a.episodes?.find(e=>e.episode===o)||(a.episode?.episode===o?a.episode:void 0)||(o?{season:a.resumeSeason??a.episode?.season??1,episode:o,title:`Episode ${o}`,duration:a.resumeDurationSeconds?`${Math.max(1,Math.round(a.resumeDurationSeconds/60))}m`:`45m`}:a.episode||a.episodes?.[0]);j(null),N(s?{...a,episode:s}:a)}catch(e){if(r.signal.aborted||n!==R.current.version)return;throw e}finally{R.current.controller===r&&(R.current.controller=null)}},[D.id]),at=(0,O.useCallback)(e=>{le(t=>({...t,progress:[e,...t.progress.filter(t=>t.titleId!==e.titleId)]}))},[]);return(0,G.jsxs)(`main`,{className:`site-shell`,children:[(0,G.jsx)(He,{isScrolled:l,mobileMenuOpen:d,setMobileMenuOpen:f,searchOpen:_,setSearchOpen:H,searchQuery:pe,setSearchQuery:Ne,searchInputRef:F,profileOpen:p,setProfileOpen:m,notificationsOpen:h,setNotificationsOpen:g,sourcesOpen:ee,setSourcesOpen:y,downloadsOpen:te,setDownloadsOpen:b,downloads:w.map(e=>W.get(e.id)??e),onPlay:e=>{b(!1),it(e)},providers:ae,syncMessage:de,onSync:async e=>{let t=D.id;C(t=>t.map(t=>t.id===e?{...t,syncStatus:`syncing`,lastError:null}:t)),fe(`Syncing provider homepage…`);let n=await fetch(`/api/netflix/providers/${e}/sync?profileId=${encodeURIComponent(t)}`,{method:`POST`}),r=await n.json();ke.current===t&&(fe(n.ok?`${r.count??0} titles synced to SQLite.`:r.error||`Provider sync failed.`),await Je(t))},onAddMovie:()=>{y(!1),b(!1),re(!0)},profiles:E,activeProfile:D,onSelectProfile:et,onManageProfiles:()=>{m(!1),ie(!0)}}),_?(0,G.jsx)(q,{query:pe,results:Ge,providerStatus:Ue,error:We,resolvingTitleId:Se,onSelect:e=>void Ze(e)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xe,{title:W.get(e.id)??e,previewPaused:we,setPreviewPaused:Te,onPlay:()=>it(W.get(e.id)??e),onMoreInfo:()=>j(W.get(e.id)??e)}),(0,G.jsxs)(`section`,{className:`catalog`,"aria-label":`Netflix catalog`,children:[w.length>0&&(0,G.jsx)(K,{row:{id:`provider-library`,title:`Your Provider Library`,kind:`standard`,items:w.map(e=>W.get(e.id)??e)},rowIndex:-2,myList:P,likedTitles:De,onSelect:j,onPlay:it,onToggleMyList:nt,onToggleLike:rt}),qe.length>0&&(0,G.jsx)(K,{row:{id:`continue-watching`,title:`Continue Watching for ${D.name}`,kind:`continue-watching`,items:qe},rowIndex:-3,myList:P,likedTitles:De,onSelect:j,onPlay:it,onToggleMyList:nt,onToggleLike:rt}),(0,G.jsx)(`div`,{className:`my-list-anchor`,id:`my-list`,children:Ke.length>0?(0,G.jsx)(K,{row:{id:`my-list-row`,title:`My List`,kind:`standard`,items:Ke},rowIndex:-1,myList:P,likedTitles:De,onSelect:j,onPlay:it,onToggleMyList:nt,onToggleLike:rt}):(0,G.jsxs)(`div`,{className:`my-list-empty`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:(0,G.jsx)(S,{})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{children:`Your list is ready for something great`}),(0,G.jsx)(`p`,{children:`Use the plus button on any title to save it here for later.`})]})]})}),t.map((e,t)=>(0,G.jsx)(K,{row:{...e,items:e.items.map(e=>W.get(e.id)??e)},rowIndex:t,myList:P,likedTitles:De,onSelect:j,onPlay:it,onToggleMyList:nt,onToggleLike:rt},e.id))]}),(0,G.jsx)(X,{})]}),A&&(0,G.jsx)(Qe,{title:A,isInMyList:P.has(A.id),isLiked:De.has(A.id),onClose:()=>j(null),onPlay:e=>it(A,e),onToggleMyList:()=>nt(A),onToggleLike:()=>rt(A)}),M&&(0,G.jsx)(ot,{title:M,profileId:D.id,subtitlePreferences:ce.subtitlePreferences,onProgressChange:at,onSubtitlePreferencesChange:e=>le(t=>({...t,subtitlePreferences:e})),onSwitchTitle:Y,onClose:Me},M.id),x&&(0,G.jsx)(ue,{profiles:E,activeProfile:D,onClose:()=>ie(!1),onProfilesChanged:tt}),ne&&(0,G.jsx)(Ye,{profileId:D.id,onClose:()=>re(!1),onImported:async()=>{re(!1),fe(`Title and episode metadata added to your library.`),await Je(D.id)}})]})}function He({isScrolled:e,mobileMenuOpen:t,setMobileMenuOpen:n,searchOpen:r,setSearchOpen:i,searchQuery:a,setSearchQuery:o,searchInputRef:s,profileOpen:c,setProfileOpen:l,notificationsOpen:u,setNotificationsOpen:d,sourcesOpen:f,setSourcesOpen:p,downloadsOpen:m,setDownloadsOpen:h,downloads:_,onPlay:ee,providers:y,syncMessage:te,onSync:b,onAddMovie:ne,profiles:x,activeProfile:S,onSelectProfile:ie,onManageProfiles:ae}){let[C,w]=(0,O.useState)(!1);return(0,G.jsxs)(`header`,{className:`top-nav${e?` top-nav--solid`:``}${r?` top-nav--search`:``}`,children:[(0,G.jsxs)(`div`,{className:`nav-start`,children:[(0,G.jsx)(`button`,{className:`icon-button mobile-menu-button`,"aria-label":t?`Close navigation`:`Open navigation`,onClick:()=>{w(!1),n(!t)},children:t?(0,G.jsx)(oe,{}):(0,G.jsx)(_e,{})}),(0,G.jsx)(`a`,{className:`netflix-wordmark`,href:`/netflix`,"aria-label":`Netflix home`,children:`NETFLIX`}),(0,G.jsx)(`nav`,{className:`primary-nav${t?` primary-nav--open`:``}`,"aria-label":`Primary navigation`,children:Re.map((e,t)=>(0,G.jsx)(`a`,{className:t===0?`active`:``,href:e.href,onClick:()=>n(!1),children:e.label},e.label))})]}),(0,G.jsxs)(`div`,{className:`nav-end`,children:[(0,G.jsxs)(`div`,{className:`nav-popover-wrap`,children:[(0,G.jsx)(`button`,{className:`icon-button access-button`,"aria-label":`Access Home Atom`,"aria-expanded":C,"aria-controls":`access-popover`,onClick:()=>{w(!C),p(!1),h(!1),l(!1),d(!1),i(!1)},children:(0,G.jsx)(be,{})}),C&&(0,G.jsx)(We,{})]}),(0,G.jsxs)(`div`,{className:`nav-popover-wrap`,children:[(0,G.jsx)(`button`,{className:`icon-button source-button`,"aria-label":`Movie sources`,"aria-expanded":f,onClick:()=>{w(!1),p(!f),h(!1),l(!1),d(!1),i(!1)},children:(0,G.jsx)(v,{})}),f&&(0,G.jsx)(Ge,{providers:y,message:te,onSync:b,onAddMovie:ne})]}),(0,G.jsxs)(`div`,{className:`nav-popover-wrap`,children:[(0,G.jsxs)(`button`,{className:`icon-button download-button`,"aria-label":`Downloads`,"aria-expanded":m,onClick:()=>{w(!1),h(!m),p(!1),l(!1),d(!1),i(!1)},children:[(0,G.jsx)(g,{}),_.some(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`)&&(0,G.jsx)(`span`,{className:`download-badge`,"aria-hidden":`true`,children:_.filter(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`).length})]}),m&&(0,G.jsx)(Ke,{titles:_,onPlay:ee})]}),(0,G.jsxs)(`div`,{className:`search-box${r?` search-box--open`:``}`,children:[(0,G.jsx)(`button`,{className:`icon-button search-trigger`,"aria-label":r?`Focus search`:`Search`,onClick:()=>{w(!1),p(!1),h(!1),l(!1),d(!1),r?s.current?.focus():i(!0)},children:(0,G.jsx)(D,{})}),(0,G.jsx)(`input`,{ref:s,tabIndex:r?0:-1,"aria-label":`Search for titles, people, and genres`,placeholder:`Titles, people, genres`,value:a,onChange:e=>o(e.target.value)}),r&&(0,G.jsx)(`button`,{className:`search-clear`,"aria-label":a?`Clear search`:`Close search`,onClick:()=>{a?o(``):i(!1)},children:(0,G.jsx)(oe,{})})]}),(0,G.jsxs)(`div`,{className:`nav-popover-wrap`,children:[(0,G.jsxs)(`button`,{className:`icon-button notification-button`,"aria-label":`Notifications`,"aria-expanded":u,onClick:()=>{w(!1),p(!1),h(!1),d(!u),l(!1)},children:[(0,G.jsx)(re,{}),(0,G.jsx)(`span`,{className:`notification-dot`})]}),u&&(0,G.jsx)(qe,{})]}),(0,G.jsxs)(`div`,{className:`nav-popover-wrap`,children:[(0,G.jsxs)(`button`,{className:`profile-trigger`,"aria-label":`Open profile menu`,"aria-expanded":c,onClick:()=>{w(!1),p(!1),h(!1),l(!c),d(!1)},children:[(0,G.jsxs)(`span`,{className:`profile-avatar`,"aria-hidden":`true`,style:{backgroundColor:S.avatarColor},children:[(0,G.jsx)(`span`,{}),(0,G.jsx)(`span`,{}),(0,G.jsx)(`span`,{})]}),(0,G.jsx)(E,{className:c?`rotate`:``})]}),c&&(0,G.jsx)(Je,{profiles:x,activeProfile:S,onSelectProfile:ie,onManageProfiles:ae})]})]})]})}function Ue(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);if(t.remove(),!n)throw Error(`Copy is not available.`)}function We(){let[e,t]=(0,O.useState)(`lan`),[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(``),[o,s]=(0,O.useState)(!1),c=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=new AbortController,t=`${window.location.pathname}${window.location.search}`;return fetch(`/api/access?path=${encodeURIComponent(t)}`,{cache:`no-store`,signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||`Could not detect network addresses.`);r(t)}).catch(t=>{e.signal.aborted||a(t instanceof Error?t.message:`Could not detect network addresses.`)}),()=>{e.abort(),c.current&&clearTimeout(c.current)}},[]);let l=n?.[e]??null,u=e===`lan`?`LAN`:`VPN (Tailscale)`,d=async()=>{if(l){try{navigator.clipboard?.writeText?await navigator.clipboard.writeText(l.url):Ue(l.url)}catch{Ue(l.url)}s(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>s(!1),1800)}};return(0,G.jsxs)(`div`,{className:`nav-popover access-popover`,id:`access-popover`,role:`dialog`,"aria-label":`Access Home Atom from another device`,children:[(0,G.jsx)(`div`,{className:`popover-caret`}),(0,G.jsxs)(`div`,{className:`access-heading`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(be,{})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`b`,{children:`Open on another device`}),(0,G.jsx)(`small`,{children:`Scan or copy an address on the same network`})]})]}),(0,G.jsx)(`div`,{className:`access-tabs`,role:`tablist`,"aria-label":`Network`,children:[[`lan`,`LAN`],[`vpn`,`VPN (Tailscale)`]].map(([n,r])=>(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===n,"aria-controls":`access-tab-panel`,onClick:()=>{t(n),s(!1)},children:r},n))}),(0,G.jsx)(`div`,{className:`access-tab-panel`,id:`access-tab-panel`,role:`tabpanel`,children:!n&&!i?(0,G.jsxs)(`div`,{className:`access-loading`,role:`status`,children:[(0,G.jsx)(ae,{className:`spin`}),`Detecting `,u,` address…`]}):i?(0,G.jsxs)(`div`,{className:`access-unavailable`,role:`alert`,children:[(0,G.jsx)(be,{}),(0,G.jsx)(`b`,{children:`Network address unavailable`}),(0,G.jsx)(`small`,{children:i})]}):l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`access-url-row`,children:[(0,G.jsxs)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,title:l.url,children:[(0,G.jsx)(`span`,{children:l.url}),(0,G.jsx)(b,{"aria-hidden":`true`})]}),(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy ${u} URL`,onClick:()=>void d(),children:[o?(0,G.jsx)(C,{}):(0,G.jsx)(fe,{}),(0,G.jsx)(`span`,{children:o?`Copied`:`Copy`})]})]}),(0,G.jsx)(`div`,{className:`access-qr`,children:(0,G.jsx)(Ne,{value:l.url,size:184,level:`M`,marginSize:3,title:`${u} access QR code`})}),(0,G.jsx)(`p`,{children:`Scan with your phone or tablet to open Home Atom.`})]}):(0,G.jsxs)(`div`,{className:`access-unavailable`,role:`status`,children:[(0,G.jsx)(be,{}),(0,G.jsxs)(`b`,{children:[u,` address not found`]}),(0,G.jsx)(`small`,{children:e===`lan`?`Connect the server to your local network and try again.`:`Start Tailscale on the server, then reopen this panel.`})]})})]})}function Ge({providers:e,message:t,onSync:n,onAddMovie:r}){return(0,G.jsxs)(`div`,{className:`nav-popover sources-popover`,children:[(0,G.jsx)(`div`,{className:`popover-caret`}),(0,G.jsxs)(`div`,{className:`sources-heading`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(v,{})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`b`,{children:`Content sources`}),(0,G.jsx)(`small`,{children:`Sync homepage metadata to SQLite`})]})]}),(0,G.jsx)(`div`,{className:`provider-list`,children:e.map(e=>(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`span`,{className:`provider-mark`,children:e.name.slice(0,1).toUpperCase()}),(0,G.jsxs)(`span`,{className:`provider-copy`,children:[(0,G.jsx)(`b`,{children:e.name}),(0,G.jsx)(`a`,{href:e.baseUrl,target:`_blank`,rel:`noreferrer`,children:new URL(e.baseUrl).hostname}),(0,G.jsx)(`small`,{children:e.lastError||(e.lastSyncedAt?`Synced ${new Date(e.lastSyncedAt).toLocaleString()}`:`Not synced yet`)})]}),(0,G.jsx)(`button`,{className:`provider-sync`,"aria-label":`Sync ${e.name}`,title:`Sync ${e.name}`,disabled:e.syncStatus===`syncing`,onClick:()=>void n(e.id),children:e.syncStatus===`syncing`?(0,G.jsx)(ae,{className:`spin`}):(0,G.jsx)(le,{})})]},e.id))}),t&&(0,G.jsx)(`p`,{className:`source-message`,role:`status`,children:t}),(0,G.jsxs)(`button`,{className:`add-movie-button`,onClick:r,children:[(0,G.jsx)(S,{}),` Add movie from link`]})]})}function Ke({titles:e,onPlay:t}){let n=e.filter(e=>e.sourceProvider&&e.downloadStatus&&e.downloadStatus!==`metadata`).sort((e,t)=>{let n=new Set([`queued`,`downloading`]);return Number(n.has(t.downloadStatus??``))-Number(n.has(e.downloadStatus??``))}),r=n.filter(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`).length;return(0,G.jsxs)(`div`,{className:`nav-popover downloads-popover`,children:[(0,G.jsx)(`div`,{className:`popover-caret`}),(0,G.jsxs)(`div`,{className:`downloads-heading`,children:[(0,G.jsx)(`span`,{children:(0,G.jsx)(g,{})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`b`,{children:`Downloads`}),(0,G.jsx)(`small`,{children:r>0?`${r} ${r===1?`movie`:`movies`} downloading`:n.length>0?`All downloads are up to date`:`No movies added yet`})]})]}),n.length>0?(0,G.jsx)(`div`,{className:`download-list`,"aria-live":`polite`,children:n.map(e=>{let n=Math.min(100,Math.max(0,e.downloadProgress??0)),r=e.downloadStatus===`queued`||e.downloadStatus===`downloading`,i=e.downloadStatus===`ready`?`Ready to play`:e.downloadStatus===`failed`?`Download failed`:e.downloadStatus===`queued`?`Waiting to download`:`Downloading — ${n}%`;return(0,G.jsxs)(`article`,{className:`download-item download-item--${e.downloadStatus}`,children:[(0,G.jsx)(`button`,{type:`button`,className:`download-thumb`,"aria-label":`Play ${e.title}`,onClick:()=>t(e),style:{backgroundImage:`linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2)), url("${e.backdropImage}")`},children:(0,G.jsx)(`span`,{className:`download-thumb-play`,"aria-hidden":`true`,children:(0,G.jsx)(T,{fill:`currentColor`})})}),(0,G.jsxs)(`div`,{className:`download-copy`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`b`,{children:e.title}),(0,G.jsx)(`span`,{className:`download-status-icon`,"aria-hidden":`true`,children:e.downloadStatus===`ready`?(0,G.jsx)(C,{}):e.downloadStatus===`failed`?(0,G.jsx)(oe,{}):(0,G.jsx)(ae,{className:r?`spin`:``})})]}),(0,G.jsx)(`small`,{children:i}),(0,G.jsx)(`div`,{className:`download-progress`,role:`progressbar`,"aria-label":`${e.title} download progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n,children:(0,G.jsx)(`span`,{style:{width:`${n}%`}})}),e.downloadError&&(0,G.jsx)(`em`,{title:e.downloadError,children:e.downloadError})]})]},e.id)})}):(0,G.jsxs)(`div`,{className:`downloads-empty`,children:[(0,G.jsx)(g,{}),(0,G.jsx)(`b`,{children:`Your downloads will appear here`}),(0,G.jsx)(`small`,{children:`Add a movie from the Sources menu to get started.`})]})]})}function qe(){return(0,G.jsxs)(`div`,{className:`nav-popover notification-popover`,children:[(0,G.jsx)(`div`,{className:`popover-caret`}),(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`span`,{className:`notification-thumb notification-thumb--one`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`New Arrival`}),(0,G.jsx)(`small`,{children:`What We Watched is now available.`}),(0,G.jsx)(`em`,{children:`2 days ago`})]})]}),(0,G.jsxs)(`article`,{children:[(0,G.jsx)(`span`,{className:`notification-thumb notification-thumb--two`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`Top picks for you`}),(0,G.jsx)(`small`,{children:`Explore this week's most watched.`}),(0,G.jsx)(`em`,{children:`5 days ago`})]})]})]})}function Je({profiles:e,activeProfile:t,onSelectProfile:n,onManageProfiles:r}){return(0,G.jsxs)(`div`,{className:`nav-popover profile-popover`,children:[(0,G.jsx)(`div`,{className:`popover-caret`}),e.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`profile-option`,"aria-current":e.id===t.id?`true`:void 0,onClick:()=>void n(e),children:[(0,G.jsx)(`span`,{className:`mini-avatar`,style:{backgroundColor:e.avatarColor},children:e.name.slice(0,1).toUpperCase()}),(0,G.jsx)(`span`,{children:e.name}),e.id===t.id&&(0,G.jsx)(C,{className:`profile-active-check`,"aria-label":`Active profile`})]},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:r,children:[(0,G.jsx)(de,{}),`Manage profile`]}),(0,G.jsxs)(`a`,{href:`#account`,children:[(0,G.jsx)(ve,{}),`Account`]}),(0,G.jsxs)(`a`,{href:`#help`,children:[(0,G.jsx)(p,{}),`Help Center`]}),(0,G.jsxs)(`a`,{className:`profile-signout`,href:`#signout`,children:[(0,G.jsx)(ge,{}),`Sign out of Netflix`]})]})}function Ye({profileId:e,onClose:t,onImported:n}){let r=Be(),[i,a]=(0,O.useState)(``),[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(!1),[u,d]=(0,O.useState)(``);return(0,G.jsx)(`div`,{className:`modal-backdrop add-movie-backdrop`,onMouseDown:t,children:(0,G.jsxs)(`article`,{ref:r,className:`add-movie-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-movie-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:t,children:(0,G.jsx)(oe,{})}),(0,G.jsx)(`span`,{className:`add-movie-icon`,children:(0,G.jsx)(y,{})}),(0,G.jsx)(`h2`,{id:`add-movie-title`,children:`Add a movie`}),(0,G.jsx)(`p`,{children:`Paste a supported movie page. Metadata is stored in SQLite and the video can stream directly from its provider.`}),(0,G.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),l(!0),d(``);try{let t=await fetch(`/api/netflix/movies/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({url:i,mode:o?`download`:`stream`,profileId:e})}),r=await t.json();if(!t.ok)throw Error(r.error||`Movie import failed.`);await n()}catch(e){d(e instanceof Error?e.message:`Movie import failed.`),l(!1)}},children:[(0,G.jsx)(`label`,{htmlFor:`movie-url`,children:`Movie link`}),(0,G.jsx)(`input`,{id:`movie-url`,type:`url`,required:!0,autoFocus:!0,placeholder:`https://phimhdcss.com/linh-hao-truy-sat-22642`,value:i,onChange:e=>a(e.target.value)}),(0,G.jsx)(`small`,{children:`Supported: phimhdcss.com, phimhdcss.net, and fsharetv.com`}),(0,G.jsxs)(`label`,{className:`offline-option`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.currentTarget.checked)}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:`Save an offline copy`}),(0,G.jsx)(`small`,{children:`Optional. Downloads the media and subtitles into the local data folder.`})]})]}),u&&(0,G.jsx)(`p`,{className:`form-error`,role:`alert`,children:u}),(0,G.jsxs)(`div`,{className:`add-movie-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`button button--secondary`,onClick:t,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`submit`,className:`button button--primary`,disabled:c,children:[c?(0,G.jsx)(ae,{className:`spin`}):o?(0,G.jsx)(g,{}):(0,G.jsx)(T,{fill:`currentColor`}),c?`Fetching movie…`:o?`Add & download`:`Add & stream`]})]})]})]})})}function Xe({title:e,previewPaused:t,setPreviewPaused:n,onPlay:r,onMoreInfo:i}){let a={"--hero-image":`url("${e.backdropImage}")`,"--hero-accent":e.accentColor};return(0,G.jsxs)(`section`,{className:`hero${t?` hero--paused`:``}`,id:`top`,style:a,children:[(0,G.jsx)(`div`,{className:`hero-backdrop`}),(0,G.jsx)(`div`,{className:`hero-vignette`}),(0,G.jsxs)(`div`,{className:`hero-content`,children:[(0,G.jsxs)(`p`,{className:`netflix-series`,children:[(0,G.jsx)(`span`,{children:`N`}),` SERIES`]}),e.logoImage?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h1`,{className:`visually-hidden`,children:e.title}),(0,G.jsx)(`img`,{className:`hero-title-logo`,src:e.logoImage,alt:``,"aria-hidden":`true`})]}):(0,G.jsx)(`h1`,{children:e.title}),(0,G.jsxs)(`p`,{className:`hero-rank`,children:[(0,G.jsxs)(`span`,{children:[`TOP`,(0,G.jsx)(`br`,{}),`10`]}),`#`,e.rank??1,` in TV Shows Today`]}),(0,G.jsx)(`p`,{className:`hero-description`,children:e.synopsis}),(0,G.jsxs)(`div`,{className:`hero-actions`,children:[(0,G.jsxs)(`button`,{className:`button button--primary`,onClick:r,children:[(0,G.jsx)(T,{fill:`currentColor`}),` Play`]}),(0,G.jsxs)(`button`,{className:`button button--secondary`,onClick:i,children:[(0,G.jsx)(he,{}),` More Info`]})]})]}),(0,G.jsxs)(`div`,{className:`hero-side-controls`,children:[(0,G.jsx)(`button`,{className:`round-button`,"aria-label":t?`Resume preview motion`:`Pause preview motion`,onClick:()=>n(!t),children:t?(0,G.jsx)(T,{fill:`currentColor`}):(0,G.jsx)(ie,{fill:`currentColor`})}),(0,G.jsx)(`span`,{className:`maturity-badge`,children:e.maturityRating})]}),(0,G.jsx)(`div`,{className:`hero-scroll-cue`,children:(0,G.jsx)(E,{})})]})}function K({row:e,rowIndex:t,myList:n,likedTitles:r,onSelect:i,onPlay:o,onToggleMyList:s,onToggleLike:c}){let l=(0,O.useRef)(null),u=e=>{let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`;l.current?.scrollBy({left:e*l.current.clientWidth*.82,behavior:t})};return(0,G.jsxs)(`section`,{className:`title-row title-row--${e.kind}`,id:t===0?`new-popular`:e.id,"aria-labelledby":`${e.id}-heading`,children:[(0,G.jsxs)(`div`,{className:`row-heading`,children:[(0,G.jsx)(`h2`,{id:`${e.id}-heading`,children:e.title}),(0,G.jsxs)(`button`,{className:`explore-link`,onClick:()=>l.current?.scrollTo({left:l.current.scrollWidth,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),children:[`Explore All `,(0,G.jsx)(se,{})]})]}),(0,G.jsxs)(`div`,{className:`rail-shell`,children:[(0,G.jsx)(`button`,{className:`rail-control rail-control--left`,"aria-label":`Scroll ${e.title} left`,onClick:()=>u(-1),children:(0,G.jsx)(a,{})}),(0,G.jsx)(`div`,{className:`title-rail`,ref:l,children:e.items.map((t,a)=>(0,G.jsx)(Ze,{title:t,index:a,kind:e.kind,isInMyList:n.has(t.id),isLiked:r.has(t.id),onSelect:()=>i(t),onPlay:()=>o(t),onPlayEpisode:e=>o(t,e),onToggleMyList:()=>s(t),onToggleLike:()=>c(t)},`${e.id}-${t.id}`))}),(0,G.jsx)(`button`,{className:`rail-control rail-control--right`,"aria-label":`Scroll ${e.title} right`,onClick:()=>u(1),children:(0,G.jsx)(se,{})})]})]})}function Ze({title:e,index:t,kind:n,isInMyList:r,isLiked:i,onSelect:a,onPlay:o,onPlayEpisode:s,onToggleMyList:c,onToggleLike:l}){let u=n===`ranked`,d=n===`originals`,f=n===`continue-watching`,p=d||u?e.posterImage:e.backdropImage,m=Math.min(100,Math.max(0,e.progress??0)),h=f?o:a;return(0,G.jsxs)(`div`,{className:`title-card${u?` title-card--ranked`:``}${d?` title-card--portrait`:``}`,tabIndex:0,role:`button`,"aria-label":f?`Resume ${e.title}`:`Open details for ${e.title}`,onClick:h,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),h())},children:[u&&(0,G.jsx)(`span`,{className:`rank-number`,"aria-hidden":`true`,children:e.rank??t+1}),(0,G.jsxs)(`div`,{className:`card-visual`,children:[(0,G.jsx)(`img`,{src:p,alt:``,loading:`lazy`}),(0,G.jsx)(`div`,{className:`card-image-shade`}),e.isOriginal&&(0,G.jsxs)(`span`,{className:`card-n`,children:[`N`,(0,G.jsx)(`small`,{children:e.mediaType===`movie`?`FILM`:`SERIES`})]}),e.isNew&&(0,G.jsx)(`span`,{className:`new-season`,children:`New`}),(0,G.jsx)(`span`,{className:`card-title-fallback`,children:e.title})]}),n===`continue-watching`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`resume-checkpoint`,children:e.resumeEpisode?`E${e.resumeEpisode} · ${Y(e.resumePositionSeconds??0)}`:Y(e.resumePositionSeconds??0)}),(0,G.jsx)(`div`,{className:`progress-track`,role:`progressbar`,"aria-label":`${e.title} watch progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m,children:(0,G.jsx)(`span`,{style:{width:`${m}%`}})})]}),(0,G.jsxs)(`div`,{className:`card-details`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`card-controls`,children:[(0,G.jsx)(`button`,{"aria-label":`Play ${e.title}`,onClick:o,children:(0,G.jsx)(T,{fill:`currentColor`})}),(0,G.jsx)(`button`,{"aria-label":r?`Remove from My List`:`Add to My List`,onClick:c,children:r?(0,G.jsx)(C,{}):(0,G.jsx)(S,{})}),(0,G.jsx)(`button`,{className:i?`is-active`:``,"aria-label":i?`Remove rating`:`I like this`,"aria-pressed":i,onClick:l,children:(0,G.jsx)(ye,{fill:i?`currentColor`:`none`})}),(0,G.jsx)(`button`,{className:`card-more-button`,"aria-label":`More information about ${e.title}`,onClick:a,children:(0,G.jsx)(E,{})})]}),(0,G.jsxs)(`div`,{className:`card-meta`,children:[(0,G.jsxs)(`strong`,{children:[e.match,`% Match`]}),(0,G.jsx)(`span`,{className:`mini-maturity`,children:e.maturityRating}),(0,G.jsx)(`span`,{children:e.duration}),e.isHD&&(0,G.jsx)(`span`,{className:`quality-badge`,children:`HD`})]}),(0,G.jsx)(`p`,{children:e.genres.slice(0,3).join(` • `)}),e.episodes?.length?(0,G.jsx)(`div`,{className:`card-episode-strip`,"aria-label":`${e.title} episodes`,children:e.episodes.map(t=>(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Play ${t.title}`,title:t.title,onClick:()=>s(t.episode),children:[(0,G.jsx)(`img`,{src:t.image||e.backdropImage,alt:``,loading:`lazy`}),(0,G.jsx)(`span`,{children:t.episode})]},t.id||t.episode))}):null]})]})}function q({query:e,results:t,providerStatus:n,error:r,resolvingTitleId:i,onSelect:a}){let o=!!e.trim(),s=n===`loading`,c=t.find(e=>e.id===i);return(0,G.jsxs)(`section`,{className:`netflix-search-page`,"aria-label":o?`Search results for ${e}`:`Search titles`,children:[(0,G.jsx)(`p`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,children:o?c?`Loading “${c.title}” from its provider…`:s?`Searching your library and all providers for “${e}”…`:t.length?`${t.length} titles related to “${e}”`:`We couldn't find “${e}”`:`Enter a movie, series, person, or genre to search.`}),r&&(0,G.jsx)(`p`,{className:`netflix-search-notice`,role:`alert`,children:r}),o?t.length?(0,G.jsx)(`div`,{className:`netflix-search-grid`,children:t.map(e=>(0,G.jsxs)(`button`,{className:`netflix-search-card`,"aria-label":`${e.title} · ${e.sourceProvider===`phimhdcss`?`PhimHDC`:e.sourceProvider===`fsharetv`?`FshareTV`:`Netflix library`}`,disabled:!!i,onClick:()=>a(e),children:[(0,G.jsxs)(`span`,{className:`netflix-search-artwork`,children:[(0,G.jsx)(`img`,{src:e.backdropImage,alt:``}),i===e.id&&(0,G.jsx)(ae,{className:`netflix-search-loader spin`})]}),(0,G.jsx)(`span`,{className:`netflix-search-title`,title:e.title,children:e.title})]},`${e.sourceProvider??`catalog`}:${e.id}`))}):s?(0,G.jsxs)(`div`,{className:`empty-search`,children:[(0,G.jsx)(ae,{className:`spin`}),(0,G.jsx)(`h2`,{children:`Searching all providers`}),(0,G.jsx)(`p`,{children:`PhimHDC results will be preferred when the same movie is found.`})]}):(0,G.jsxs)(`div`,{className:`empty-search`,children:[(0,G.jsx)(D,{}),(0,G.jsx)(`h2`,{children:`No matches found`}),(0,G.jsx)(`p`,{children:`Try a title, actor, director, or genre.`})]}):(0,G.jsxs)(`div`,{className:`empty-search`,children:[(0,G.jsx)(D,{}),(0,G.jsx)(`h2`,{children:`Find something to watch`}),(0,G.jsx)(`p`,{children:`Search by movie, series, actor, director, or genre.`})]})]})}function Qe({title:e,isInMyList:t,isLiked:n,onClose:r,onPlay:i,onToggleMyList:a,onToggleLike:o}){let s=Be(),c=e.episodes?.length?e.episodes:e.episode?[e.episode]:[];return(0,G.jsx)(`div`,{className:`modal-backdrop`,role:`presentation`,onMouseDown:r,children:(0,G.jsxs)(`article`,{ref:s,className:`details-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`${e.title} details`,onMouseDown:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:r,children:(0,G.jsx)(oe,{})}),(0,G.jsx)(`div`,{className:`modal-hero`,style:{"--modal-image":`url("${e.backdropImage}")`},children:(0,G.jsxs)(`div`,{className:`modal-hero-content`,children:[(0,G.jsxs)(`p`,{className:`netflix-series`,children:[(0,G.jsx)(`span`,{children:`N`}),` `,e.mediaType===`movie`?`FILM`:`SERIES`]}),(0,G.jsx)(`h2`,{children:e.title}),(0,G.jsxs)(`div`,{className:`modal-actions`,children:[(0,G.jsxs)(`button`,{className:`button button--primary`,onClick:()=>i(),disabled:!!(e.sourceProvider&&!e.playbackPath&&!e.canStream),children:[(0,G.jsx)(T,{fill:`currentColor`}),e.sourceProvider&&!e.playbackPath&&!e.canStream?`Metadata only`:e.sourceProvider&&e.downloadStatus!==`ready`?`Stream now`:e.resumePositionSeconds?`Resume at ${Y(e.resumePositionSeconds)}`:`Play`]}),(0,G.jsx)(`button`,{className:`round-button`,"aria-label":t?`Remove from My List`:`Add to My List`,onClick:a,children:t?(0,G.jsx)(C,{}):(0,G.jsx)(S,{})}),(0,G.jsx)(`button`,{className:`round-button${n?` is-active`:``}`,"aria-label":n?`Remove rating`:`I like this`,"aria-pressed":n,onClick:o,children:(0,G.jsx)(ye,{fill:n?`currentColor`:`none`})})]})]})}),(0,G.jsxs)(`div`,{className:`modal-body`,children:[(0,G.jsxs)(`div`,{className:`modal-main-copy`,children:[e.sourceProvider&&(0,G.jsxs)(`div`,{className:`download-state download-state--${e.downloadStatus}`,children:[e.downloadStatus===`ready`?(0,G.jsx)(C,{}):e.downloadStatus===`metadata`?(0,G.jsx)(y,{}):(0,G.jsx)(g,{}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:e.downloadStatus===`ready`?`Ready to play locally`:e.downloadStatus===`failed`?`Offline download failed · Streaming available`:e.downloadStatus===`metadata`?e.canStream?`Ready to stream`:`Metadata synced`:`Streaming available · Downloading offline — ${e.downloadProgress??0}%`}),(0,G.jsx)(`small`,{children:e.downloadError||`Source: ${e.sourceProvider} · Metadata stored in SQLite`})]})]}),(0,G.jsxs)(`div`,{className:`modal-meta`,children:[(0,G.jsxs)(`strong`,{children:[e.match,`% Match`]}),(0,G.jsx)(`span`,{children:e.year}),(0,G.jsx)(`span`,{children:e.duration}),(0,G.jsx)(`span`,{className:`quality-badge`,children:`HD`}),e.hasAudioDescription&&(0,G.jsx)(`span`,{className:`quality-badge`,children:`AD`})]}),(0,G.jsx)(`span`,{className:`modal-maturity`,children:e.maturityRating}),(0,G.jsx)(`p`,{className:`modal-synopsis`,children:e.synopsis})]}),(0,G.jsxs)(`dl`,{className:`modal-facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Cast:`}),(0,G.jsx)(`dd`,{children:e.cast.slice(0,4).join(`, `)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Genres:`}),(0,G.jsx)(`dd`,{children:e.genres.join(`, `)})]}),e.creators?.length?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Creators:`}),(0,G.jsx)(`dd`,{children:e.creators.join(`, `)})]}):null]})]}),c.length>0&&(0,G.jsxs)(`div`,{className:`episode-panel`,children:[(0,G.jsxs)(`header`,{className:`episode-panel-header`,children:[(0,G.jsx)(`h3`,{children:`Episodes`}),(0,G.jsxs)(`span`,{children:[`Season `,c[0].season,` · `,c.length,` episodes`]})]}),(0,G.jsx)(`div`,{className:`episode-card-list`,children:c.map(t=>(0,G.jsxs)(`button`,{className:`episode-card`,"aria-label":`Play ${t.title}`,onClick:()=>i(t.episode),children:[(0,G.jsx)(`span`,{className:`episode-number`,children:t.episode}),(0,G.jsx)(`span`,{className:`episode-image`,style:{backgroundImage:`linear-gradient(90deg, transparent, rgba(0,0,0,.25)), url("${t.image||e.backdropImage}")`},children:(0,G.jsx)(T,{fill:`currentColor`})}),(0,G.jsxs)(`span`,{className:`episode-copy`,children:[(0,G.jsx)(`b`,{children:t.title}),(0,G.jsx)(`small`,{children:t.duration}),(0,G.jsx)(`em`,{children:t.synopsis||e.tagline||e.synopsis})]})]},t.id||t.episode))})]})]})})}var J=4140,$e=`home-atom:subtitle-preferences`,et={x:50,y:78},tt={label:`English`,language:`en`,src:`demo`};function nt(e){return{x:Math.max(7,Math.min(93,e.x)),y:Math.max(10,Math.min(86,e.y))}}function rt(e,t,n){let r=Math.min(49,Math.max(7,(n.width/2+12)/t.width*100)),i=Math.min(49,Math.max(10,(n.height/2+12)/t.height*100));return{x:Math.max(r,Math.min(100-r,e.x)),y:Math.max(i,Math.min(86,100-i,e.y))}}function it(e){return Array.from(e.activeCues??[]).flatMap(e=>(`text`in e&&typeof e.text==`string`?e.text:``).replace(/<br\s*\/?>/gi,`
|
|
2
|
+
`).replace(/<[^>]*>/g,``).split(/\r?\n/).map(e=>e.trim()).filter(Boolean))}function Y(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function at(e){let t=e?.match(/(\d+)\s*h/i)?.[1],n=e?.match(/(\d+)\s*(?:m|ph(?:út)?)/i)?.[1];return!t&&!n?J:(Number(t??0)*60+Number(n??0))*60}function ot({title:e,profileId:t,subtitlePreferences:n,onProgressChange:i,onSubtitlePreferencesChange:a,onSwitchTitle:p,onClose:g}){let v=Be(),y=(0,O.useRef)(null),b=(0,O.useRef)(null),re=(0,O.useRef)(0),S=(0,O.useRef)(null),E=(0,O.useRef)(null),D=(0,O.useRef)(null),se=(0,O.useRef)(null),le=(0,O.useRef)(null),ue=(0,O.useRef)(null),de=(0,O.useRef)(!1),fe=(0,O.useRef)(null),he=(0,O.useRef)(!0),ge=(0,O.useRef)(null),_e=(0,O.useRef)(!1),ye=(0,O.useRef)(new Set),be=(0,O.useRef)(0),xe=(0,O.useRef)(()=>{}),[k]=(0,O.useState)(ee),[Se,Ce]=(0,O.useState)(e.episodes??[]),[A,j]=(0,O.useState)(e.subtitles??[]),M=Se[0]?.episode,N=e.episode?.episode||M||1,we=Se.find(e=>e.episode===N)||e.episode,Te=!!(e.playbackPath&&(!M||N===M)),P=!!(e.sourceProvider&&e.canStream&&!Te),Ee=e.resumeEpisode===void 0||e.resumeEpisode===N?Math.max(0,e.resumePositionSeconds??0):0,De=e.resumeDurationSeconds&&e.resumeDurationSeconds>0?e.resumeDurationSeconds:at(we?.duration),Oe=De>0?Ee/De*100:0,[F,I]=(0,O.useState)(!1),L=(0,O.useRef)(!1),[R,ke]=(0,O.useState)(!1),[z,Ae]=(0,O.useState)(1),je=(0,O.useRef)(1),[B,Me]=(0,O.useState)(n.captionsOn),[V,H]=(0,O.useState)(!1),[Ne,Pe]=(0,O.useState)(0),[U,W]=(0,O.useState)([]),[Fe,Ie]=(0,O.useState)(n.fontSize),[Le,Re]=(0,O.useState)({x:n.positionX,y:n.positionY}),[ze,Ve]=(0,O.useState)(n.fontColor),[He,Ue]=(0,O.useState)(n.backgroundColor),[We,Ge]=(0,O.useState)(n.fontFamily),Ke=(0,O.useRef)({fontSize:n.fontSize,positionX:n.positionX,positionY:n.positionY,fontColor:n.fontColor,backgroundColor:n.backgroundColor,fontFamily:n.fontFamily,captionsOn:n.captionsOn}),[qe,Je]=(0,O.useState)(!0),[Ye,Xe]=(0,O.useState)(!1),[K,Ze]=(0,O.useState)(!1),[q,Qe]=(0,O.useState)(N),[J,ot]=(0,O.useState)(De),[X,st]=(0,O.useState)(Ee),[ct,lt]=(0,O.useState)(Math.min(100,Oe+4)),[ut,dt]=(0,O.useState)(1),[ft,pt]=(0,O.useState)(!1),[mt,Z]=(0,O.useState)(``),[ht,gt]=(0,O.useState)(P?`Connecting to provider…`:``),[_t,vt]=(0,O.useState)(P),[Q,yt]=(0,O.useState)(Te&&e.playbackPath?{path:e.playbackPath,kind:e.playbackKind===`hls`?`hls`:`file`}:null),[bt,xt]=(0,O.useState)(!1),[St,Ct]=(0,O.useState)(null),[$,wt]=(0,O.useState)(null),[Tt,Et]=(0,O.useState)(null),[Dt,Ot]=(0,O.useState)(!1),[kt,At]=(0,O.useState)(!1),[jt,Mt]=(0,O.useState)(!1),Nt=(0,O.useRef)(null),Pt=(0,O.useRef)(null);(0,O.useRef)(null);let Ft=(0,O.useRef)(!1),It=(0,O.useRef)(``),Lt=!!(e.playbackPath||e.sourceProvider&&e.canStream),Rt=Math.max(8,(e.episode?.episode??1)+2),zt=(0,O.useMemo)(()=>Se.length?Se.map(t=>({season:t.season,number:t.episode,title:t.title,duration:t.duration,synopsis:t.synopsis||e.synopsis,image:t.image||e.backdropImage,subtitles:t.subtitles||[]})):Array.from({length:Rt},(t,n)=>{let r=n+1,i=r===e.episode?.episode;return{season:e.episode?.season??1,number:r,title:i?e.episode.title:`Episode ${r}`,duration:i?e.episode.duration:`${46+r*7%15}m`,synopsis:r===q?e.synopsis:e.tagline??e.synopsis,image:e.backdropImage,subtitles:[]}}),[q,Rt,Se,e.backdropImage,e.episode,e.synopsis,e.tagline]),Bt=J>0?X/J*100:0,Vt=zt.find(e=>e.number===q)??zt[0],Ht=zt.findIndex(e=>e.number===q),Ut=Ht>=0&&Ht<zt.length-1,Wt=Vt?.season??we?.season??1,Gt=Vt?.subtitles.length?Vt.subtitles:A,Kt=Gt.length>0?Gt:Lt?[]:[tt],qt=Math.min(Ne,Math.max(0,Kt.length-1)),Jt=Kt.length>0,Yt={"--player-progress":`${Bt}%`,"--player-buffered":`${Math.max(Bt,ct)}%`},Xt=(0,O.useMemo)(()=>{let t=e.synopsis.split(/[.!?]/).map(e=>e.trim()).find(Boolean)??e.synopsis,n=t.length>42?`${t.slice(0,41).trimEnd()}…`:t;return[`– ${e.tagline??Vt?.title??e.title}`,`– ${n}`]},[Vt?.title,e.synopsis,e.tagline,e.title]),Zt=Lt?U:Xt,Qt=(0,O.useRef)({seasonNumber:Wt,episodeNumber:q,positionSeconds:X,durationSeconds:J});(0,O.useEffect)(()=>{Qt.current={seasonNumber:Wt,episodeNumber:q,positionSeconds:X,durationSeconds:J}},[q,X,J,Wt]);let $t=(0,O.useCallback)((n={},r=!1)=>{let a={...Qt.current,...n};if(a.positionSeconds<1&&!a.completed)return;let o=[a.seasonNumber,a.episodeNumber,Math.round(a.positionSeconds*10),Math.round(a.durationSeconds*10),!!a.completed].join(`:`);if(It.current===o)return;It.current=o;let s=!!a.completed||a.durationSeconds>0&&a.positionSeconds/a.durationSeconds>=.95,c={titleId:e.id,seasonNumber:a.seasonNumber,episodeNumber:a.episodeNumber,positionSeconds:a.positionSeconds,durationSeconds:a.durationSeconds,completed:s,updatedAt:new Date().toISOString()};i(c),fetch(`/api/netflix/progress`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({profileId:t,...c}),keepalive:r}).then(async e=>{if(!e.ok)throw Error();i(await e.json())}).catch(()=>{r||Z(`Watch position could not be saved`)})},[i,t,e.id]);(0,O.useEffect)(()=>{let e=window.setInterval(()=>$t(),5e3),t=()=>{document.visibilityState===`hidden`&&$t({},!0)},n=()=>$t({},!0);return document.addEventListener(`visibilitychange`,t),window.addEventListener(`beforeunload`,n),()=>{window.clearInterval(e),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`beforeunload`,n),$t({},!0)}},[$t]),(0,O.useEffect)(()=>{let n=new AbortController;return fetch(`/api/netflix/markers?titleId=${encodeURIComponent(e.id)}&profileId=${encodeURIComponent(t)}`,{cache:`no-store`,signal:n.signal}).then(async e=>{if(!e.ok)return;let t=await e.json();if(!n.signal.aborted)for(let e of t.markers??[])e.markerType===`intro`?wt(e.timeSeconds):e.markerType===`outro`&&Et(e.timeSeconds)}).catch(()=>{}),()=>n.abort()},[e.id,t]),(0,O.useEffect)(()=>($!==null&&X>=0&&X<=$&&!F?(kt||At(!0),Pt.current!==null&&window.clearTimeout(Pt.current),Pt.current=window.setTimeout(()=>{At(!1),Pt.current=null},8e3)):kt&&(X>($??0)||F)&&At(!1),Tt!==null&&X>=Tt&&J>0&&!F&&Ut?jt||Mt(!0):jt&&(X<(Tt??1/0)||F)&&Mt(!1),()=>{Pt.current!==null&&window.clearTimeout(Pt.current)}),[X,$,Tt,F,kt,jt,J,Ut]),(0,O.useEffect)(()=>{if(!Dt)return;let e=e=>{e.target instanceof Node&&!Nt.current?.contains(e.target)&&Ot(!1)},t=e=>{e.key===`Escape`&&Ot(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Dt]),(0,O.useEffect)(()=>{let n=!!(e.playbackPath&&(!M||q===M));if(!e.sourceProvider||!e.canStream||n)return;let r=new AbortController,i=new URLSearchParams({profileId:t});return e.episodes?.length&&i.set(`episode`,String(q)),fetch(`/api/netflix/stream/${encodeURIComponent(e.id)}?${i}`,{cache:`no-store`,signal:r.signal}).then(async e=>{let t=await e.json();if(!e.ok||!t.path||!t.kind)throw Error(t.error||`The provider stream is unavailable.`);if(t.episodeMetadata){let e={...t.episodeMetadata,subtitles:t.subtitles??t.episodeMetadata.subtitles};Ce(t=>[...t.some(t=>t.id===e.id||t.episode===e.episode)?t.map(t=>t.id===e.id||t.episode===e.episode?e:t):[...t,e]].sort((e,t)=>e.episode-t.episode))}else Array.isArray(t.subtitles)&&j(t.subtitles);yt({path:t.path,kind:t.kind}),gt(``),vt(!1)}).catch(e=>{r.signal.aborted||(gt(e instanceof Error?e.message:`The provider stream is unavailable.`),vt(!1),I(!0))}),()=>r.abort()},[q,M,e.canStream,e.episodes,e.id,e.playbackPath,e.sourceProvider,t]),(0,O.useEffect)(()=>{let e=y.current;if(!e||!Q)return;let t=!1,n=()=>{};return Q.kind===`hls`&&!e.canPlayType(`application/vnd.apple.mpegurl`)?r(async()=>{let{default:e}=await import(`./hls-CgexCc5Z.js`);return{default:e}},[]).then(({default:e})=>{if(t||!y.current||!e.isSupported())return;let r=new e;r.loadSource(Q.path),r.attachMedia(y.current),r.on(e.Events.MANIFEST_PARSED,()=>{t||(L.current?y.current?.pause():y.current?.play().catch(()=>I(!0)))}),r.on(e.Events.ERROR,(e,n)=>{n.fatal&&!t&&(gt(`The provider stream stopped unexpectedly.`),I(!0))}),n=()=>r.destroy()}):(e.src=Q.path,L.current?e.pause():e.play().catch(()=>I(!0))),()=>{t=!0,n(),e.removeAttribute(`src`),e.load()}},[Q]),(0,O.useEffect)(()=>{L.current=F;let e=y.current;e&&(F?e.pause():e.play().catch(()=>I(!0)))},[F]),(0,O.useEffect)(()=>{let e=y.current;e&&(e.playbackRate=ut)},[ut]),(0,O.useEffect)(()=>{let e=y.current;z>0&&(je.current=z),e&&(e.volume=z)},[Q,z]),(0,O.useEffect)(()=>{let e=y.current;if(!e){W([]);return}let t=Array.from(e.textTracks),n=t[qt],r=()=>{W(B&&n?it(n):[])};for(let[e,n]of t.entries())n.mode=B&&e===qt?`hidden`:`disabled`;return n?.addEventListener(`cuechange`,r),r(),()=>{n?.removeEventListener(`cuechange`,r)}},[q,B,Q,qt,Gt.length]),(0,O.useEffect)(()=>{let e=window.requestAnimationFrame(()=>{try{window.localStorage.getItem($e)&&window.localStorage.removeItem($e)}catch{}});return()=>window.cancelAnimationFrame(e)},[]),(0,O.useEffect)(()=>{if(!qe)return;if(he.current){he.current=!1;return}let e={fontSize:Fe,positionX:Le.x,positionY:Le.y,fontColor:ze,backgroundColor:He,fontFamily:We,captionsOn:B},n=Ke.current,r={};if(e.fontSize!==n.fontSize&&(r.fontSize=e.fontSize),(e.positionX!==n.positionX||e.positionY!==n.positionY)&&(r.positionX=e.positionX,r.positionY=e.positionY),e.fontColor!==n.fontColor&&(r.fontColor=e.fontColor),e.backgroundColor!==n.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.fontFamily!==n.fontFamily&&(r.fontFamily=e.fontFamily),e.captionsOn!==n.captionsOn&&(r.captionsOn=e.captionsOn),Object.keys(r).length)return fe.current!==null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,Ke.current=e,fetch(`/api/netflix/subtitle-preferences`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({profileId:t,...r})}).then(async e=>{e.ok&&a(await e.json())}).catch(()=>{})},600),()=>{fe.current!==null&&window.clearTimeout(fe.current)}},[t,Fe,Le,ze,He,We,B,qe,a]),(0,O.useEffect)(()=>{if(!V)return;let e=e=>{e.target instanceof Node&&!se.current?.contains(e.target)&&H(!1)},t=e=>{e.key===`Escape`&&H(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[V]),(0,O.useEffect)(()=>{if(!B||!Zt.length)return;let e=()=>{let e=v.current?.getBoundingClientRect(),t=le.current?.getBoundingClientRect();!e||!t||Re(n=>{let r=rt(n,e,t);return r.x===n.x&&r.y===n.y?n:r})},t=window.requestAnimationFrame(e);return window.addEventListener(`resize`,e),document.addEventListener(`fullscreenchange`,e),()=>{window.cancelAnimationFrame(t),window.removeEventListener(`resize`,e),document.removeEventListener(`fullscreenchange`,e)}},[B,v,Fe,Zt]),(0,O.useEffect)(()=>{if(Lt||F)return;let e=window.setInterval(()=>{st(e=>{let t=e+.5,n=Math.min(t,J);return Qt.current.positionSeconds=n,n})},500);return()=>window.clearInterval(e)},[J,Lt,F]),(0,O.useEffect)(()=>{if(Lt||F||J<=0||X<J)return;$t({positionSeconds:J,completed:!0});let e=window.requestAnimationFrame(()=>I(!0));return()=>window.cancelAnimationFrame(e)},[X,J,Lt,F,$t]),(0,O.useEffect)(()=>{let e=()=>pt(document.fullscreenElement===v.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[v]),(0,O.useEffect)(()=>()=>{E.current&&window.clearTimeout(E.current)},[]);let en=(0,O.useCallback)(()=>{xt(!1),D.current&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>xt(!0),5e3)},[]);(0,O.useEffect)(()=>{if(F||K||V||Ye||Dt){D.current&&window.clearTimeout(D.current);let e=window.requestAnimationFrame(()=>xt(!1));return()=>window.cancelAnimationFrame(e)}let e=window.requestAnimationFrame(en),t=v.current;if(!t)return()=>window.cancelAnimationFrame(e);let n=[`mousemove`,`mousedown`,`keydown`,`touchstart`,`scroll`];for(let e of n)t.addEventListener(e,en);return()=>{window.cancelAnimationFrame(e);for(let e of n)t.removeEventListener(e,en);D.current&&window.clearTimeout(D.current)}},[K,Dt,F,v,en,Ye,V]);let tn=e=>{let t=Math.max(0,Math.min(J,e));y.current&&(y.current.currentTime=t),Qt.current.positionSeconds=t,st(t)},nn=(0,O.useCallback)(()=>{let e=b.current;if(!e||e.readyState<HTMLMediaElement.HAVE_METADATA)return;let t=re.current,n=Number.isFinite(e.duration)&&e.duration>0?Math.max(0,e.duration-.05):t;try{e.currentTime=Math.min(t,n)}catch{}},[]),rn=e=>{re.current=e,S.current===null&&(S.current=window.requestAnimationFrame(()=>{S.current=null,nn()}))},an=e=>{let t=Math.max(0,Math.min(J,e));rn(t),Ct({position:J>0?t/J*100:0,time:t})},on=(e,t)=>{let n=t.getBoundingClientRect(),r=n.width>0?Math.max(0,Math.min(1,(e-n.left)/n.width)):0;an(r*J)};(0,O.useEffect)(()=>{let e=b.current;if(!e||!Q)return;let t=!1,n=()=>{};return Q.kind===`hls`&&!e.canPlayType(`application/vnd.apple.mpegurl`)?r(async()=>{let{default:e}=await import(`./hls-CgexCc5Z.js`);return{default:e}},[]).then(({default:e})=>{if(t||!b.current||!e.isSupported())return;let r=new e;r.loadSource(Q.path),r.attachMedia(b.current),r.on(e.Events.MANIFEST_PARSED,()=>{t||nn()}),n=()=>r.destroy()}):(e.src=Q.path,e.load()),()=>{t=!0,n(),S.current!==null&&(window.cancelAnimationFrame(S.current),S.current=null),e.removeAttribute(`src`),e.load()}},[Q,nn]);let sn=()=>{let e=y.current;if(e){e.paused?e.play():e.pause();return}I(e=>(L.current=!e,!e))},cn=e=>{!e&&z<=0&&Ae(je.current||1),ke(e)},ln=(e,t=!1)=>{let n=e.currentTime;Number.isFinite(e.duration)&&e.duration>0&&(Qt.current.durationSeconds=e.duration,ot(e.duration),t&&!Ft.current&&Ee>0&&(n=Math.min(Ee,Math.max(0,e.duration-.1)),e.currentTime=n,Ft.current=!0),e.buffered.length&<(e.buffered.end(e.buffered.length-1)/e.duration*100)),Number.isFinite(n)&&(Qt.current.positionSeconds=n,st(n))},un=()=>{let e=[1,1.25,1.5,.75],t=e.indexOf(ut);dt(e[(t+1)%e.length])},dn=async()=>{try{document.fullscreenElement===v.current?await document.exitFullscreen():await v.current?.requestFullscreen()}catch{Z(`Fullscreen is unavailable in this window`)}},fn=()=>{E.current&&window.clearTimeout(E.current),Z(`Thanks — the playback issue was reported`),E.current=window.setTimeout(()=>Z(``),2600)},pn=n=>{let r=X;n===`intro`?wt(r):Et(r),Ot(!1),Z(n===`intro`?`Intro end set at ${Y(r)}`:`Outro start set at ${Y(r)}`),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>Z(``),2600),fetch(`/api/netflix/markers`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({titleId:e.id,markerType:n,timeSeconds:r,profileId:t})}).catch(()=>{Z(`Marker could not be saved`)})},mn=n=>{n===`intro`?wt(null):Et(null),Ot(!1),Z(n===`intro`?`Intro marker removed`:`Outro marker removed`),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>Z(``),2600),fetch(`/api/netflix/markers`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({titleId:e.id,markerType:n,profileId:t})}).catch(()=>{Z(`Marker could not be removed`)})},hn=e=>{let t=ue.current,n=v.current?.getBoundingClientRect();!t||t.pointerId!==e.pointerId||!n||Re(rt({x:(e.clientX-t.offsetX-n.left)/n.width*100,y:(e.clientY-t.offsetY-n.top)/n.height*100},n,e.currentTarget.getBoundingClientRect()))},gn=e=>{if(e.button!==0)return;let t=v.current?.getBoundingClientRect();t&&(e.preventDefault(),e.stopPropagation(),ue.current={pointerId:e.pointerId,offsetX:e.clientX-(t.left+Le.x/100*t.width),offsetY:e.clientY-(t.top+Le.y/100*t.height)},e.currentTarget.setPointerCapture(e.pointerId),Xe(!0),L.current?de.current=!1:(de.current=!0,L.current=!0,I(!0)))},_n=e=>{ue.current?.pointerId===e.pointerId&&(hn(e),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),ue.current=null,Xe(!1),de.current&&(de.current=!1,L.current=!1,I(!1)))},vn=e=>{let t={ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0},ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1}}[e.key];if(!t)return;e.preventDefault();let n=e.shiftKey?5:1,r=v.current?.getBoundingClientRect(),i=e.currentTarget.getBoundingClientRect();Re(e=>{let a={x:e.x+t.x*n,y:e.y+t.y*n};return r?rt(a,r,i):nt(a)})},yn=e=>{if(e===null){Me(!1),W([]);return}Pe(e),Me(!0)},bn=t=>{if(Ze(!1),H(!1),t===q)return;$t();let n=zt.find(e=>e.number===t),r=!!(e.playbackPath&&(!M||t===M));Qe(t),Ft.current=!0,It.current=``,st(0),lt(0);let i=at(n?.duration);Qt.current={seasonNumber:n?.season??1,episodeNumber:t,positionSeconds:0,durationSeconds:i},ot(i),L.current=!1,I(!1),!n?.subtitles.length&&!e.subtitles?.length&&Me(!1),r&&e.playbackPath?(yt({path:e.playbackPath,kind:e.playbackKind===`hls`?`hls`:`file`}),gt(``),vt(!1)):e.sourceProvider&&e.canStream&&(yt(null),gt(`Loading ${n?.title||`Episode ${t}`}…`),vt(!0))},xn=()=>{let e=zt[Ht+1];e&&bn(e.number)};(0,O.useEffect)(()=>{ge.current={sessionId:k,profileId:t,titleId:e.id,title:e.title,artwork:Vt?.image||e.backdropImage,seasonNumber:Wt,episodeNumber:q,episodeTitle:Vt?.title||`Episode ${q}`,episodes:zt.map(e=>({season:e.season,number:e.number,title:e.title})),currentTime:X,duration:J,paused:F,muted:R,volume:z,subtitles:{available:Jt,captionsOn:B,fontSize:Fe,fontColor:ze,backgroundColor:He},machineName:te(),deviceType:_(),updatedAt:Date.now()}});let Sn=(0,O.useCallback)(()=>{if(_e.current)return;let e=ge.current;if(!e)return;let t=new AbortController;ye.current.add(t),fetch(`/api/netflix/activity`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({activity:{...e,updatedAt:Date.now()}}),cache:`no-store`,signal:t.signal}).catch(()=>{}).finally(()=>{ye.current.delete(t)})},[]);return(0,O.useEffect)(()=>{xe.current=e=>{switch(e.type){case`set-paused`:{let t=y.current;L.current=e.paused,I(e.paused),t&&(e.paused?t.pause():t.play().catch(()=>I(!0)));break}case`seek-relative`:tn(Qt.current.positionSeconds+e.seconds);break;case`seek-to`:tn(e.seconds);break;case`set-muted`:cn(e.muted);break;case`set-volume`:{let t=Math.max(0,Math.min(1,e.volume));t>0&&(je.current=t),Ae(t),ke(t<=0);break}case`next-episode`:xn();break;case`select-episode`:bn(e.episodeNumber);break;case`switch-title`:p(e.titleId).catch(()=>{Z(`Movie could not be switched`)});break;case`switch-track`:case`switch-playlist`:break;case`set-captions`:Me(e.enabled&&Jt),e.enabled||W([]);break;case`set-subtitle-font-size`:Ie(Math.max(18,Math.min(64,e.fontSize)));break;case`set-subtitle-font-color`:Ve(e.color);break;case`set-subtitle-background`:Ue(e.background);break;case`reset-subtitle-position`:Re(et);break}window.requestAnimationFrame(Sn)}}),(0,O.useEffect)(()=>{_e.current=!1,be.current=0;let e=!1,n=null,r=new AbortController,i=()=>{if(!_e.current){_e.current=!0;for(let e of ye.current)e.abort();ye.current.clear(),r.abort(),fetch(`/api/netflix/activity`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:k,profileId:t}),cache:`no-store`,keepalive:!0}).catch(()=>{})}},a=async()=>{if(!(e||_e.current||r.signal.aborted)){try{let e=be.current,n=await fetch(`/api/netflix/activity/${encodeURIComponent(k)}/commands?after=${encodeURIComponent(e)}&profileId=${encodeURIComponent(t)}`,{cache:`no-store`,signal:r.signal});if(n.ok){let t=await n.json();if(typeof t==`object`&&t&&!Array.isArray(t)){let n=t,r=Array.isArray(n.commands)?n.commands:[],i=new Set,a=[];for(let t of r){if(typeof t!=`object`||!t||Array.isArray(t))continue;let n=t,r=n.id;if(typeof r!=`number`||!Number.isSafeInteger(r)||r<=e||i.has(r)||n.sessionId!==k)continue;let o={kind:`command`,sessionId:k,command:n.command};!h(o)||o.kind!==`command`||(i.add(r),a.push({id:r,command:o.command}))}a.sort((e,t)=>e.id-t.id);for(let e of a)xe.current(e.command);let o=n.cursor,s=a.length>0?a[a.length-1].id:e;typeof o==`number`&&Number.isSafeInteger(o)&&o>=s?be.current=o:a.length&&(be.current=s)}}}catch{}!e&&!_e.current&&!r.signal.aborted&&(n=window.setTimeout(()=>void a(),Math.min(500,ne)))}};window.addEventListener(`pagehide`,i),Sn();let o=window.setInterval(Sn,ne);return a(),()=>{e=!0,window.clearInterval(o),n!==null&&window.clearTimeout(n),window.removeEventListener(`pagehide`,i),i()}},[k,t,Sn]),(0,O.useEffect)(()=>{Sn()},[q,B,J,Jt,R,F,He,ze,Fe,z,Sn]),(0,G.jsxs)(`section`,{ref:v,className:`player${F?` player--paused`:``}${Lt?` player--local`:``}${bt?` player--idle`:``}`,role:`dialog`,"aria-modal":`true`,"aria-label":`Playing ${e.title}`,style:{"--player-image":`url("${e.backdropImage}")`},children:[Lt&&(0,G.jsx)(`video`,{ref:y,className:`player-video`,autoPlay:!0,playsInline:!0,muted:R,poster:e.backdropImage,onClick:sn,onLoadedMetadata:e=>ln(e.currentTarget,!0),onProgress:e=>ln(e.currentTarget),onTimeUpdate:e=>ln(e.currentTarget),onPlay:()=>{L.current=!1,I(!1)},onPause:()=>{L.current=!0,I(!0),$t()},onEnded:()=>{let e=y.current,t=e&&Number.isFinite(e.duration)?e.duration:J;st(t),$t({positionSeconds:t,durationSeconds:t||J,completed:!0}),L.current=!0,I(!0)},onError:()=>{gt(`The browser could not play this provider stream.`),L.current=!0,I(!0)},children:Gt.map(e=>(0,G.jsx)(`track`,{kind:`subtitles`,src:e.src,srcLang:e.language,label:e.label},`${q}-${e.language}-${e.src}`))}),ht&&(0,G.jsxs)(`div`,{className:`player-stream-status${_t?``:` player-stream-status--error`}`,role:`status`,children:[_t&&(0,G.jsx)(ae,{className:`spin`}),(0,G.jsx)(`span`,{children:ht})]}),(0,G.jsx)(`div`,{className:`player-cinematic-bars`}),(0,G.jsx)(`div`,{className:`player-noise`}),(0,G.jsxs)(`header`,{className:`player-topbar`,children:[(0,G.jsx)(`button`,{className:`player-icon-button player-back`,onClick:()=>{$t(),g()},"aria-label":`Exit player`,children:(0,G.jsx)(l,{})}),(0,G.jsx)(`button`,{className:`player-icon-button player-report`,onClick:fn,"aria-label":`Report a problem`,children:(0,G.jsx)(pe,{})})]}),B&&Zt.length>0&&(0,G.jsx)(`div`,{ref:le,className:`player-subtitles${Ye?` player-subtitles--dragging`:``}`,style:{"--player-subtitle-font-size":`${Fe}px`,"--player-subtitle-color":ze,"--player-subtitle-bg":He,"--player-subtitle-font-family":We==="default"?void 0:We,left:`${Le.x}%`,top:`${Le.y}%`},role:`group`,"aria-label":`Draggable subtitles`,"aria-live":`polite`,tabIndex:0,onClick:e=>e.stopPropagation(),onKeyDown:vn,onPointerDown:gn,onPointerMove:hn,onPointerUp:_n,onPointerCancel:_n,children:Zt.map((e,t)=>(0,G.jsx)(`span`,{children:e},`${t}-${e}`))}),K&&(0,G.jsxs)(`aside`,{className:`player-episodes`,"aria-label":`Episodes`,children:[(0,G.jsx)(`h2`,{children:e.mediaType===`limited-series`?`Limited Series`:`Season ${Wt}`}),(0,G.jsx)(`div`,{className:`player-episode-list`,children:zt.map(e=>{let t=e.number===q;return(0,G.jsxs)(`button`,{className:`player-episode${t?` player-episode--active`:``}`,"aria-label":`${e.number}. ${e.title}, ${e.duration}`,"aria-current":t?`true`:void 0,onClick:()=>bn(e.number),children:[(0,G.jsxs)(`span`,{className:`player-episode-heading`,children:[(0,G.jsx)(`span`,{children:e.number}),(0,G.jsx)(`strong`,{children:e.title}),(0,G.jsx)(`i`,{"aria-hidden":`true`})]}),t&&(0,G.jsxs)(`span`,{className:`player-episode-details`,children:[(0,G.jsx)(`span`,{className:`player-episode-thumbnail`,style:{backgroundImage:`linear-gradient(rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.48)), url("${e.image}")`},children:(0,G.jsxs)(`span`,{className:`player-now-playing`,children:[(0,G.jsxs)(`span`,{className:`player-playing-bars`,"aria-hidden":`true`,children:[(0,G.jsx)(`i`,{}),(0,G.jsx)(`i`,{}),(0,G.jsx)(`i`,{}),(0,G.jsx)(`i`,{})]}),`Now playing`]})}),(0,G.jsx)(`span`,{className:`player-episode-synopsis`,children:e.synopsis})]})]},e.number)})})]}),F&&!ht&&(0,G.jsx)(`button`,{className:`big-play`,onClick:sn,"aria-label":`Resume`,children:(0,G.jsx)(T,{fill:`currentColor`})}),mt&&(0,G.jsx)(`div`,{className:`player-notice`,role:`status`,children:mt}),(0,G.jsxs)(`div`,{className:`player-bottom${K?` player-bottom--drawer-open`:``}`,children:[!K&&(0,G.jsxs)(`div`,{className:`player-timeline-row`,children:[(0,G.jsxs)(`div`,{className:`player-timeline-wrap${St?` player-timeline-wrap--previewing`:``}`,style:{"--seek-preview-position":`${St?.position??0}%`},onPointerEnter:e=>on(e.clientX,e.currentTarget),onPointerMove:e=>on(e.clientX,e.currentTarget),onPointerLeave:()=>Ct(null),children:[(0,G.jsxs)(`div`,{className:`player-seek-preview`,"aria-hidden":`true`,children:[Q?(0,G.jsx)(`video`,{ref:b,className:`player-seek-preview-frame`,muted:!0,playsInline:!0,preload:`metadata`,poster:Vt?.image||e.backdropImage,onLoadedMetadata:nn,onSeeked:e=>e.currentTarget.pause()}):(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(`img`,{src:Vt?.image||e.backdropImage,alt:``,draggable:!1})}),(0,G.jsx)(`time`,{children:Y(St?.time??X)})]}),(0,G.jsx)(`input`,{className:`player-timeline`,type:`range`,min:0,max:J||1,step:.1,value:Math.min(X,J||1),style:Yt,onFocus:e=>an(Number(e.currentTarget.value)),onBlur:()=>Ct(null),onInput:e=>an(Number(e.currentTarget.value)),onChange:e=>tn(Number(e.currentTarget.value)),"aria-label":`Seek`,"aria-valuetext":`${Y(X)} of ${Y(J)}`}),$!==null&&J>0&&(0,G.jsx)(`div`,{className:`player-timeline-marker player-timeline-marker--intro`,style:{left:`${$/J*100}%`},"aria-label":`Intro end at ${Y($)}`}),Tt!==null&&J>0&&(0,G.jsx)(`div`,{className:`player-timeline-marker player-timeline-marker--outro`,style:{left:`${Tt/J*100}%`},"aria-label":`Outro start at ${Y(Tt)}`}),F&&!ht&&(0,G.jsxs)(`div`,{ref:Nt,className:`player-marker-control`,style:{left:`${Bt}%`},onPointerEnter:e=>{e.stopPropagation(),Ct(null)},onPointerMove:e=>e.stopPropagation(),onPointerLeave:e=>e.stopPropagation(),children:[(0,G.jsx)(`button`,{className:`player-marker-trigger`,"aria-label":`Timeline marker settings`,"aria-expanded":Dt,onClick:e=>{e.stopPropagation(),Ot(e=>!e)},children:(0,G.jsx)(ve,{})}),Dt&&(0,G.jsxs)(`div`,{className:`player-marker-menu`,role:`menu`,"aria-label":`Set timeline marker`,children:[(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>pn(`intro`),children:[(0,G.jsx)(x,{}),(0,G.jsx)(`span`,{children:`Set as Intro`}),$!==null&&(0,G.jsx)(`small`,{children:Y($)})]}),(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>pn(`outro`),children:[(0,G.jsx)(m,{}),(0,G.jsx)(`span`,{children:`Set as Outro`}),Tt!==null&&(0,G.jsx)(`small`,{children:Y(Tt)})]}),$!==null&&(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`player-marker-menu-remove`,onClick:()=>mn(`intro`),children:[(0,G.jsx)(oe,{}),(0,G.jsx)(`span`,{children:`Remove Intro`}),(0,G.jsx)(`small`,{children:Y($)})]}),Tt!==null&&(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`player-marker-menu-remove`,onClick:()=>mn(`outro`),children:[(0,G.jsx)(oe,{}),(0,G.jsx)(`span`,{children:`Remove Outro`}),(0,G.jsx)(`small`,{children:Y(Tt)})]})]})]})]}),(0,G.jsx)(`time`,{children:Y(J-X)})]}),(0,G.jsxs)(`div`,{className:`player-controls`,children:[(0,G.jsxs)(`div`,{className:`player-controls-left`,children:[(0,G.jsx)(`button`,{className:`player-control-button`,onClick:sn,"aria-label":F?`Play`:`Pause`,children:F?(0,G.jsx)(T,{fill:`currentColor`}):(0,G.jsx)(ie,{fill:`currentColor`})}),(0,G.jsxs)(`button`,{className:`player-control-button player-ten-second`,"aria-label":`Rewind 10 seconds`,onClick:()=>tn(X-10),children:[(0,G.jsx)(f,{}),(0,G.jsx)(`span`,{children:`10`})]}),(0,G.jsxs)(`button`,{className:`player-control-button player-ten-second`,"aria-label":`Forward 10 seconds`,onClick:()=>tn(X+10),children:[(0,G.jsx)(u,{}),(0,G.jsx)(`span`,{children:`10`})]}),(0,G.jsx)(`button`,{className:`player-control-button`,"aria-label":R?`Unmute`:`Mute`,"aria-pressed":R,onClick:()=>cn(!R),children:R?(0,G.jsx)(ce,{}):(0,G.jsx)(w,{})})]}),(0,G.jsxs)(`div`,{className:`player-program`,children:[(0,G.jsx)(`strong`,{children:e.title}),(0,G.jsxs)(`span`,{children:[`Season `,Wt,`\xA0\xA0 Episode `,q]})]}),(0,G.jsxs)(`div`,{className:`player-controls-right`,children:[(0,G.jsx)(`button`,{className:`player-control-button`,"aria-label":`Next episode`,onClick:xn,disabled:!Ut,children:(0,G.jsx)(m,{})}),(0,G.jsx)(`button`,{className:`player-control-button${K?` is-active player-episodes-trigger`:``}`,"aria-label":K?`Hide episodes`:`Show episodes`,"aria-expanded":K,onClick:()=>{H(!1),Ze(e=>!e)},children:(0,G.jsx)(d,{})}),(0,G.jsxs)(`div`,{className:`player-subtitle-control`,ref:se,children:[V&&(0,G.jsxs)(`div`,{className:`player-subtitle-menu`,role:`dialog`,"aria-label":`Subtitles`,children:[(0,G.jsx)(`h2`,{children:`Subtitles`}),(0,G.jsxs)(`div`,{className:`player-subtitle-options`,role:`listbox`,"aria-label":`Subtitle language`,children:[(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!B,onClick:()=>yn(null),children:[(0,G.jsx)(`span`,{className:`player-subtitle-check`,"aria-hidden":`true`,children:!B&&(0,G.jsx)(C,{})}),(0,G.jsx)(`span`,{children:`Off`})]}),Kt.map((e,t)=>{let n=B&&t===qt;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,onClick:()=>yn(t),children:[(0,G.jsx)(`span`,{className:`player-subtitle-check`,"aria-hidden":`true`,children:n&&(0,G.jsx)(C,{})}),(0,G.jsx)(`span`,{children:e.label})]},`${e.language}-${e.src}`)})]}),(0,G.jsxs)(`div`,{className:`player-subtitle-settings`,children:[(0,G.jsxs)(`div`,{className:`player-subtitle-setting-heading`,children:[(0,G.jsx)(`label`,{htmlFor:`player-subtitle-font-size`,children:`Font size`}),(0,G.jsxs)(`output`,{htmlFor:`player-subtitle-font-size`,children:[Fe,`px`]})]}),(0,G.jsxs)(`div`,{className:`player-subtitle-size-control`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`A`}),(0,G.jsx)(`input`,{id:`player-subtitle-font-size`,type:`range`,min:18,max:64,step:2,value:Fe,"aria-label":`Subtitle font size`,onChange:e=>Ie(Number(e.currentTarget.value))}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`A`})]}),(0,G.jsxs)(`div`,{className:`player-subtitle-position-setting`,children:[(0,G.jsx)(`p`,{children:`Drag subtitles on screen to move them.`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>Re(et),children:`Reset position`})]}),(0,G.jsxs)(`div`,{className:`player-subtitle-color-setting`,children:[(0,G.jsx)(`label`,{htmlFor:`player-subtitle-font-color`,children:`Font color`}),(0,G.jsx)(`input`,{id:`player-subtitle-font-color`,type:`color`,value:ze,onChange:e=>Ve(e.currentTarget.value)})]}),(0,G.jsxs)(`div`,{className:`player-subtitle-color-setting`,children:[(0,G.jsx)(`label`,{htmlFor:`player-subtitle-bg-color`,children:`Background`}),(0,G.jsxs)(`select`,{id:`player-subtitle-bg-color`,value:He,onChange:e=>Ue(e.currentTarget.value),children:[(0,G.jsx)(`option`,{value:`transparent`,children:`None`}),(0,G.jsx)(`option`,{value:`rgba(0,0,0,0.75)`,children:`Dark`}),(0,G.jsx)(`option`,{value:`rgba(0,0,0,0.5)`,children:`Semi-dark`}),(0,G.jsx)(`option`,{value:`rgba(0,0,0,0.3)`,children:`Light`}),(0,G.jsx)(`option`,{value:`rgba(0,0,0,1)`,children:`Solid black`})]})]})]})]}),(0,G.jsx)(`button`,{className:`player-control-button player-subtitle-trigger${B?` is-active`:``}`,"aria-label":Jt?`Subtitles`:`Subtitles unavailable`,"aria-haspopup":`dialog`,"aria-expanded":V,"aria-pressed":B,disabled:!Jt,onClick:()=>{Ze(!1),H(e=>!e)},children:(0,G.jsx)(s,{})})]}),(0,G.jsxs)(`button`,{className:`player-control-button player-speed`,"aria-label":`Change playback speed, currently ${ut}x`,onClick:un,children:[(0,G.jsx)(me,{}),ut!==1&&(0,G.jsxs)(`span`,{children:[ut,`×`]})]}),(0,G.jsx)(`button`,{className:`player-control-button`,"aria-label":ft?`Exit fullscreen`:`Enter fullscreen`,onClick:()=>void dn(),children:ft?(0,G.jsx)(c,{}):(0,G.jsx)(o,{})})]})]})]}),kt&&!F&&(0,G.jsx)(`button`,{className:`player-skip-intro`,onClick:()=>{$!==null&&tn($),At(!1)},children:`Skip Intro`}),jt&&!F&&Ut&&(0,G.jsxs)(`button`,{className:`player-next-episode-prompt`,onClick:()=>{Mt(!1),xn()},children:[(0,G.jsx)(T,{fill:`currentColor`}),`Next Episode`]})]})}function X(){return(0,G.jsxs)(`footer`,{className:`site-footer`,id:`footer`,children:[(0,G.jsxs)(`div`,{className:`social-links`,"aria-label":`Social media`,children:[(0,G.jsx)(`a`,{href:`#facebook`,"aria-label":`Facebook`,children:`f`}),(0,G.jsx)(`a`,{href:`#instagram`,"aria-label":`Instagram`,children:`◎`}),(0,G.jsx)(`a`,{href:`#twitter`,"aria-label":`X`,children:`𝕏`}),(0,G.jsx)(`a`,{href:`#youtube`,"aria-label":`YouTube`,children:`▶`})]}),(0,G.jsx)(`div`,{className:`footer-links`,children:[`Audio Description`,`Help Center`,`Gift Cards`,`Media Center`,`Investor Relations`,`Jobs`,`Terms of Use`,`Privacy`,`Legal Notices`,`Cookie Preferences`,`Corporate Information`,`Contact Us`].map(e=>(0,G.jsx)(`a`,{href:`#${st(e)}`,children:e},e))}),(0,G.jsx)(`span`,{className:`service-code`,children:`Service Code`}),(0,G.jsx)(`p`,{children:`© 1997–2026 Netflix Clone. Built for demonstration purposes.`})]})}function st(e){return e.toLowerCase().replace(/&/g,`and`).replace(/ /g,`-`)}export{Ve as NetflixBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-Dn3noAqV.js";var t=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),n=e(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),r=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),i=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),a=e(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]);function o(){if(typeof navigator>`u`)return`unknown`;let e=navigator.userAgent;return/android/i.test(e)?/Mobile/i.test(e)?`phone`:`tablet`:/iPad/i.test(e)||/Macintosh/i.test(e)&&`ontouchend`in document?`tablet`:/iPhone|iPod/i.test(e)?`phone`:/Macintosh|Mac OS X/i.test(e)||/CrOS/i.test(e)?`laptop`:/Windows/i.test(e)||/Linux/i.test(e)?`desktop`:`unknown`}function s(){if(typeof navigator>`u`)return`Unknown`;let e=navigator.userAgent;if(/android/i.test(e)){let t=e.match(/;\s*([^;)]+)\s+Build\//);return t?t[1].trim():`Android`}return/iPad/i.test(e)||/Macintosh/i.test(e)&&`ontouchend`in document?`iPad`:/iPhone/i.test(e)?`iPhone`:/iPod/i.test(e)?`iPod`:/Windows/i.test(e)?`Windows PC`:/Macintosh|Mac OS X/i.test(e)?`Mac`:/CrOS/i.test(e)?`Chromebook`:/Linux/i.test(e)?`Linux PC`:`Unknown`}var c=1e3,l=0;function u(){let e=globalThis.crypto;return typeof e?.randomUUID==`function`?e.randomUUID():(l+=1,[`playback`,Date.now().toString(36),l.toString(36),Math.random().toString(36).slice(2)].join(`-`))}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0}function p(e){return typeof e==`number`&&Number.isFinite(e)}function m(e){return p(e)&&e>=0}function h(e){return Number.isInteger(e)&&typeof e==`number`&&e>0}function g(e){return p(e)&&e>=0&&e<=1}function _(e){return d(e)&&h(e.season)&&h(e.number)&&f(e.title)}function v(e){return d(e)&&typeof e.available==`boolean`&&typeof e.captionsOn==`boolean`&&p(e.fontSize)&&e.fontSize>=18&&e.fontSize<=64&&f(e.fontColor)&&f(e.backgroundColor)}function y(e){return d(e)&&f(e.sessionId)&&f(e.profileId)&&f(e.titleId)&&f(e.title)&&f(e.artwork)&&m(e.currentTime)&&m(e.duration)&&typeof e.paused==`boolean`&&typeof e.muted==`boolean`&&g(e.volume)&&m(e.updatedAt)?e.service===`spotify`?f(e.artist)&&f(e.album)&&(e.provider===void 0||f(e.provider)):(e.service===void 0||e.service===`netflix`)&&h(e.seasonNumber)&&h(e.episodeNumber)&&f(e.episodeTitle)&&Array.isArray(e.episodes)&&e.episodes.every(_)&&v(e.subtitles):!1}function b(e){if(!d(e)||typeof e.type!=`string`)return!1;switch(e.type){case`set-paused`:return typeof e.paused==`boolean`;case`seek-relative`:return p(e.seconds);case`seek-to`:return m(e.seconds);case`set-muted`:return typeof e.muted==`boolean`;case`set-volume`:return g(e.volume);case`previous-track`:case`next-track`:case`next-episode`:case`reset-subtitle-position`:return!0;case`select-episode`:return h(e.episodeNumber);case`switch-track`:return f(e.trackId);case`switch-playlist`:return f(e.playlistId);case`switch-title`:return f(e.titleId);case`set-captions`:return typeof e.enabled==`boolean`;case`set-subtitle-font-size`:return p(e.fontSize)&&e.fontSize>=18&&e.fontSize<=64;case`set-subtitle-font-color`:return f(e.color);case`set-subtitle-background`:return f(e.background);default:return!1}}function x(e){if(!d(e)||typeof e.kind!=`string`)return!1;switch(e.kind){case`announce`:return y(e.activity);case`command`:return f(e.sessionId)&&b(e.command);default:return!1}}function S(e){try{return x(e)}catch{return!1}}export{S as a,r as c,o as i,n as l,u as n,a as o,s as r,i as s,c as t,t as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r}from"./framework-BQUlGUOV.js";import{n as i}from"./chevron-left-Dn3noAqV.js";import{a,d as o,f as s,h as c,i as l,l as u,m as d,n as f,o as p,r as m,t as h,u as g}from"./manage-profiles-modal-Doi6QM4e.js";var _=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),v=i(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),y=i(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),b=i(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),x=i(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),S=i(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),C=i(`skip-back`,[[`path`,{d:`M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`15892j`}],[`path`,{d:`M3 20V4`,key:`1ptbpl`}]]),w=i(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),T=i(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),E=i(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),D=e(r(),1),O=e(n(),1),k=t();function A({profiles:e,activeProfile:t,onSelectProfile:n,onProfilesChanged:r}){let i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=(0,D.useRef)(null),s=(0,D.useId)(),[l,u]=(0,D.useState)(!1),[f,p]=(0,D.useState)(!1),[m,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(``);(0,D.useEffect)(()=>{if(!l)return;let e=window.requestAnimationFrame(()=>{o.current?.querySelector(`[role="menuitemradio"]:not(:disabled), [role="menuitem"]`)?.focus()}),t=e=>{e.target instanceof Node&&!i.current?.contains(e.target)&&u(!1)},n=e=>{e.key===`Escape`&&(e.preventDefault(),u(!1),a.current?.focus())};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[l]);let b=e=>{e.relatedTarget instanceof Node&&i.current?.contains(e.relatedTarget)||u(!1)},x=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(o.current?.querySelectorAll(`[role="menuitemradio"]:not(:disabled), [role="menuitem"]`)??[]);if(!t.length)return;e.preventDefault();let n=t.findIndex(e=>e===document.activeElement),r=0;e.key===`End`?r=t.length-1:e.key===`ArrowUp`?r=n<=0?t.length-1:Math.max(0,n-1):e.key===`ArrowDown`&&(r=n<0||n===t.length-1?0:n+1),t[r]?.focus()},S=async e=>{if(!m){if(e.id===t.id){u(!1),a.current?.focus();return}y(``),_(e.id);try{await n(e),u(!1),a.current?.focus()}catch{y(`Profile could not be selected. Please try again.`)}finally{_(null)}}};return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`store-profile-menu`,ref:i,onBlur:b,children:[(0,k.jsxs)(`button`,{className:`store-profile-trigger`,ref:a,type:`button`,"aria-label":`Profile: ${t.name}. Open profile menu`,"aria-haspopup":`menu`,"aria-expanded":l,"aria-controls":l?s:void 0,onClick:()=>{y(``),u(e=>!e)},onKeyDown:e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),y(``),u(!0))},children:[(0,k.jsxs)(`span`,{className:`store-profile-avatar`,"aria-hidden":`true`,style:{backgroundColor:t.avatarColor},children:[(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{})]}),(0,k.jsx)(d,{className:`store-profile-chevron${l?` store-profile-chevron--open`:``}`,"aria-hidden":`true`})]}),l&&(0,k.jsxs)(`div`,{className:`store-profile-popover`,id:s,ref:o,role:`menu`,"aria-label":`Choose a Netflix profile`,"aria-busy":m!==null,onKeyDown:x,children:[(0,k.jsx)(`span`,{className:`store-profile-caret`,"aria-hidden":`true`}),(0,k.jsx)(`div`,{className:`store-profile-options`,children:e.map(e=>{let n=e.id===t.id,r=e.id===m;return(0,k.jsxs)(`button`,{className:`store-profile-option`,type:`button`,role:`menuitemradio`,"aria-checked":n,disabled:m!==null,onClick:()=>void S(e),children:[(0,k.jsx)(`span`,{className:`store-profile-mini-avatar`,style:{backgroundColor:e.avatarColor},"aria-hidden":`true`,children:e.name.slice(0,1).toUpperCase()}),(0,k.jsxs)(`span`,{className:`store-profile-name`,children:[e.name,r?` — switching…`:``]}),n&&(0,k.jsx)(c,{className:`store-profile-active-check`,"aria-hidden":`true`})]},e.id)})}),(0,k.jsxs)(`button`,{className:`store-profile-manage`,type:`button`,role:`menuitem`,onClick:()=>{u(!1),p(!0)},children:[(0,k.jsx)(g,{"aria-hidden":`true`}),(0,k.jsx)(`span`,{children:`Manage profile`})]}),v&&(0,k.jsx)(`p`,{className:`store-profile-error`,role:`alert`,children:v})]})]}),f&&(0,O.createPortal)((0,k.jsx)(h,{profiles:[...e],activeProfile:t,onClose:()=>{p(!1),window.requestAnimationFrame(()=>a.current?.focus())},onProfilesChanged:r}),document.body)]})}function j({type:e}){switch(e){case`phone`:return(0,k.jsx)(w,{"aria-hidden":`true`});case`tablet`:return(0,k.jsx)(E,{"aria-hidden":`true`});case`laptop`:return(0,k.jsx)(b,{"aria-hidden":`true`});default:return(0,k.jsx)(x,{"aria-hidden":`true`})}}function M(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function N({activity:e,tabLabel:t,searchOpen:n,onSearchToggle:r,onCommand:i}){let[s,c]=(0,D.useState)(null),d=Math.max(1,Math.round(e.duration)),f=Math.max(0,Math.min(d,Math.round(s??e.currentTime))),h=e.duration>0?Math.max(0,Math.min(100,f/e.duration*100)):0,g=Math.round(e.volume*100),_=t=>{let n=Math.max(0,Math.min(e.duration,Math.round(t)));c(null),i({type:`seek-to`,seconds:n})};return(0,k.jsxs)(`article`,{className:`activity-card activity-card--spotify`,"aria-label":`${e.title} playback in ${t}`,style:{"--activity-artwork":`url("${e.artwork}")`},children:[(0,k.jsxs)(`div`,{className:`activity-card__art`,children:[(0,k.jsxs)(`div`,{className:`activity-card__source`,children:[(0,k.jsxs)(`span`,{className:`activity-spotify-mark`,"aria-label":`Spotify`,children:[(0,k.jsx)(`i`,{}),(0,k.jsx)(`i`,{}),(0,k.jsx)(`i`,{})]}),(0,k.jsxs)(`span`,{className:`activity-live`,children:[(0,k.jsx)(`i`,{"aria-hidden":`true`}),(0,k.jsx)(j,{type:e.deviceType}),t]})]}),(0,k.jsxs)(`div`,{className:`activity-card__copy`,children:[(0,k.jsx)(`span`,{children:`Now listening`}),(0,k.jsx)(`h3`,{children:e.title}),(0,k.jsxs)(`p`,{children:[e.artist,(0,k.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.album]})]})]}),(0,k.jsxs)(`div`,{className:`activity-card__remote`,children:[(0,k.jsx)(`input`,{className:`activity-progress`,type:`range`,min:0,max:d,step:1,value:f,disabled:e.duration<=0,"aria-label":`${e.title} progress`,"aria-valuetext":`${M(f)} of ${M(e.duration)}`,title:`Seek ${e.title}`,style:{"--activity-progress":`${h}%`},onChange:e=>c(Number(e.currentTarget.value)),onPointerUp:e=>_(Number(e.currentTarget.value)),onPointerCancel:()=>c(null),onKeyUp:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Home`||e.key===`End`||e.key===`PageUp`||e.key===`PageDown`)&&_(Number(e.currentTarget.value))},onBlur:e=>{s!==null&&_(Number(e.currentTarget.value))}}),(0,k.jsxs)(`div`,{className:`activity-time`,children:[(0,k.jsx)(`time`,{children:M(f)}),(0,k.jsx)(`span`,{children:M(e.duration)})]}),(0,k.jsxs)(`div`,{className:`activity-controls activity-controls--spotify`,role:`group`,"aria-label":`Controls for ${e.title} by ${e.artist}`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>i({type:`previous-track`}),"aria-label":`Previous track before ${e.title}`,children:(0,k.jsx)(C,{fill:`currentColor`})}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>i({type:`set-paused`,paused:!e.paused}),"aria-label":`${e.paused?`Play`:`Pause`} ${e.title}`,children:e.paused?(0,k.jsx)(u,{fill:`currentColor`}):(0,k.jsx)(o,{fill:`currentColor`})}),(0,k.jsx)(`button`,{type:`button`,onClick:()=>i({type:`next-track`}),"aria-label":`Next track after ${e.title}`,children:(0,k.jsx)(a,{fill:`currentColor`})}),(0,k.jsxs)(`div`,{className:`activity-volume`,children:[(0,k.jsx)(`button`,{type:`button`,onClick:()=>i({type:`set-muted`,muted:!e.muted}),"aria-label":`${e.muted?`Unmute`:`Mute`} ${e.title}`,"aria-pressed":e.muted,children:e.muted?(0,k.jsx)(m,{}):(0,k.jsx)(l,{})}),(0,k.jsx)(`input`,{type:`range`,min:0,max:100,step:1,value:g,style:{"--activity-volume":`${g}%`},onChange:e=>i({type:`set-volume`,volume:Number(e.currentTarget.value)/100}),"aria-label":`Volume for ${e.title}`,"aria-valuetext":e.muted?`Muted, level ${g}%`:`${g}%`})]}),(0,k.jsx)(`button`,{className:n?`is-active`:``,type:`button`,onClick:r,"aria-label":`Switch ${e.title} to another track`,"aria-expanded":n,"aria-controls":`activity-tracks-${e.sessionId}`,children:(0,k.jsx)(p,{})})]})]})]})}var P={chromaticWeather:{from:`#3659f7`,to:`#ed5b98`,accent:`#d9f8ff`,glyph:`✦`},stillFrames:{from:`#d16b5d`,to:`#4a1f35`,accent:`#ffe4c7`,glyph:`◌`},parallelStreets:{from:`#121c3d`,to:`#af2f78`,accent:`#65e4ff`,glyph:`//`},blueHour:{from:`#204b78`,to:`#9b6db2`,accent:`#d9edff`,glyph:`◐`},orbiting:{from:`#322063`,to:`#e34f86`,accent:`#f5d5ff`,glyph:`◎`},smallHours:{from:`#b66a35`,to:`#2b483b`,accent:`#ffe3a8`,glyph:`☕`},lowTide:{from:`#22676c`,to:`#102e46`,accent:`#b7f5df`,glyph:`≈`},dreamingMono:{from:`#3c3d42`,to:`#8e718f`,accent:`#f2ebd9`,glyph:`◇`},liked:{from:`#3f2db8`,to:`#8ed8c8`,accent:`#ffffff`,glyph:`♥`},coding:{from:`#083d35`,to:`#151d28`,accent:`#53f2b0`,glyph:`</>`},nightDrive:{from:`#15152f`,to:`#7b205d`,accent:`#ff6cc7`,glyph:`☾`},coffeehouse:{from:`#9d5c3e`,to:`#2e2924`,accent:`#ffd59d`,glyph:`AM`},sundayReset:{from:`#d9846a`,to:`#687c67`,accent:`#fff0d2`,glyph:`SUN`},neonPulse:{from:`#4d1ec9`,to:`#e31f74`,accent:`#67f6da`,glyph:`N`},softPop:{from:`#e995b5`,to:`#8e70c9`,accent:`#fff1b8`,glyph:`POP`},deepFocus:{from:`#174d4b`,to:`#18233e`,accent:`#79d6bb`,glyph:`∞`},morningLight:{from:`#ee9b52`,to:`#f0cf78`,accent:`#4e3628`,glyph:`✺`}},F=[{id:`neon-skyline`,title:`Neon Skyline`,artist:`Luma Coast`,album:`Chromatic Weather`,durationSec:224,palette:P.chromaticWeather},{id:`open-windows`,title:`Open Windows`,artist:`Luma Coast`,album:`Chromatic Weather`,durationSec:197,palette:P.chromaticWeather},{id:`slow-motion`,title:`Slow Motion`,artist:`Arlo Vale`,album:`Still Frames`,durationSec:208,palette:P.stillFrames},{id:`paper-moons`,title:`Paper Moons`,artist:`Arlo Vale`,album:`Still Frames`,durationSec:186,palette:P.stillFrames},{id:`after-hours-drive`,title:`After Hours Drive`,artist:`Night Atlas`,album:`Parallel Streets`,durationSec:251,palette:P.parallelStreets},{id:`city-rain`,title:`City Rain`,artist:`Night Atlas`,album:`Parallel Streets`,durationSec:239,palette:P.parallelStreets},{id:`blue-hour`,title:`Blue Hour`,artist:`Mira Lane`,album:`Northbound`,durationSec:216,palette:P.blueHour},{id:`velvet-morning`,title:`Velvet Morning`,artist:`Mira Lane`,album:`Northbound`,durationSec:203,palette:P.blueHour},{id:`satellite-hearts`,title:`Satellite Hearts`,artist:`Nova Bloom`,album:`Orbiting`,durationSec:232,palette:P.orbiting},{id:`signal-fires`,title:`Signal Fires`,artist:`Nova Bloom`,album:`Orbiting`,durationSec:245,palette:P.orbiting},{id:`coffee-stains`,title:`Coffee Stains`,artist:`The Daylights`,album:`Small Hours`,durationSec:194,palette:P.smallHours},{id:`golden-lines`,title:`Golden Lines`,artist:`The Daylights`,album:`Small Hours`,durationSec:211,palette:P.smallHours},{id:`quiet-current`,title:`Quiet Current`,artist:`Elio Pines`,album:`Low Tide Letters`,durationSec:263,palette:P.lowTide},{id:`tides-in-reverse`,title:`Tides in Reverse`,artist:`Elio Pines`,album:`Low Tide Letters`,durationSec:228,palette:P.lowTide},{id:`soft-static`,title:`Soft Static`,artist:`Static Garden`,album:`Dreaming in Mono`,durationSec:274,palette:P.dreamingMono},{id:`midnight-orchard`,title:`Midnight Orchard`,artist:`Static Garden`,album:`Dreaming in Mono`,durationSec:257,palette:P.dreamingMono}],I=[{id:`daily-mix-one`,title:`Daily Mix 01`,description:`Luma Coast, Nova Bloom, Mira Lane and more`,curator:`Spotify Atom`,trackIds:[`neon-skyline`,`satellite-hearts`,`blue-hour`,`open-windows`,`signal-fires`],palette:P.chromaticWeather},{id:`daily-mix-two`,title:`Daily Mix 02`,description:`Night Atlas, Static Garden, Elio Pines and more`,curator:`Spotify Atom`,trackIds:[`after-hours-drive`,`soft-static`,`city-rain`,`quiet-current`,`midnight-orchard`],palette:P.parallelStreets},{id:`daily-mix-three`,title:`Daily Mix 03`,description:`Arlo Vale, The Daylights, Mira Lane and more`,curator:`Spotify Atom`,trackIds:[`slow-motion`,`coffee-stains`,`velvet-morning`,`paper-moons`,`golden-lines`],palette:P.stillFrames},{id:`discover-weekly`,title:`Discover Weekly`,description:`A fresh collection picked for your week`,curator:`Spotify Atom`,trackIds:[`tides-in-reverse`,`signal-fires`,`open-windows`,`midnight-orchard`,`golden-lines`],palette:P.orbiting},{id:`coding-mode`,title:`Coding Mode`,description:`Steady electronic focus without the distractions`,curator:`Spotify Atom`,trackIds:[`soft-static`,`quiet-current`,`midnight-orchard`,`tides-in-reverse`,`city-rain`],palette:P.coding},{id:`night-drive`,title:`Night Drive`,description:`Glowing synths for roads after dark`,curator:`Spotify Atom`,trackIds:[`after-hours-drive`,`neon-skyline`,`city-rain`,`satellite-hearts`,`signal-fires`],palette:P.nightDrive},{id:`coffeehouse`,title:`Coffeehouse`,description:`Warm voices, soft strings, unhurried mornings`,curator:`Spotify Atom`,trackIds:[`coffee-stains`,`slow-motion`,`paper-moons`,`velvet-morning`,`golden-lines`],palette:P.coffeehouse},{id:`sunday-reset`,title:`Sunday Reset`,description:`Easy songs for a slower kind of day`,curator:`Spotify Atom`,trackIds:[`velvet-morning`,`open-windows`,`coffee-stains`,`quiet-current`,`paper-moons`],palette:P.sundayReset},{id:`neon-pulse`,title:`Neon Pulse`,description:`Electric color and late-night momentum`,curator:`Atom Editorial`,trackIds:[`neon-skyline`,`satellite-hearts`,`after-hours-drive`,`signal-fires`,`soft-static`],palette:P.neonPulse},{id:`soft-pop`,title:`Soft Pop`,description:`Bright hooks with all the edges smoothed out`,curator:`Atom Editorial`,trackIds:[`blue-hour`,`open-windows`,`slow-motion`,`satellite-hearts`,`golden-lines`],palette:P.softPop},{id:`acoustic-mornings`,title:`Acoustic Mornings`,description:`A gentle start in wood, wire, and sunlight`,curator:`Atom Editorial`,trackIds:[`velvet-morning`,`coffee-stains`,`paper-moons`,`golden-lines`,`tides-in-reverse`],palette:P.morningLight},{id:`deep-focus`,title:`Deep Focus`,description:`Ambient textures for long stretches of concentration`,curator:`Atom Editorial`,trackIds:[`quiet-current`,`soft-static`,`midnight-orchard`,`city-rain`,`tides-in-reverse`],palette:P.deepFocus},{id:`slow-sundays`,title:`Slow Sundays`,description:`Stay in, breathe out, let the afternoon drift`,curator:`For your mood`,trackIds:[`slow-motion`,`paper-moons`,`coffee-stains`,`quiet-current`,`velvet-morning`],palette:P.sundayReset},{id:`city-after-dark`,title:`City After Dark`,description:`Streetlights, reflections, and midnight motion`,curator:`For your mood`,trackIds:[`city-rain`,`after-hours-drive`,`neon-skyline`,`soft-static`,`signal-fires`],palette:P.nightDrive},{id:`morning-light`,title:`Morning Light`,description:`Optimistic songs for opening the curtains`,curator:`For your mood`,trackIds:[`velvet-morning`,`golden-lines`,`open-windows`,`blue-hour`,`coffee-stains`],palette:P.morningLight},{id:`headphones-on`,title:`Headphones On`,description:`Detailed production made for getting lost in`,curator:`For your mood`,trackIds:[`satellite-hearts`,`midnight-orchard`,`tides-in-reverse`,`blue-hour`,`soft-static`],palette:P.dreamingMono}],L=[{id:`made-for-you`,title:`Made for you`,description:`Personal mixes shaped around your listening`,playlistIds:[`daily-mix-one`,`daily-mix-two`,`daily-mix-three`,`discover-weekly`]},{id:`recently-played`,title:`Recently played`,playlistIds:[`coding-mode`,`night-drive`,`coffeehouse`,`sunday-reset`]},{id:`popular-playlists`,title:`Popular playlists`,playlistIds:[`neon-pulse`,`soft-pop`,`acoustic-mornings`,`deep-focus`]},{id:`mood-mixes`,title:`Mood mixes`,description:`Pick a soundtrack that meets you where you are`,playlistIds:[`slow-sundays`,`city-after-dark`,`morning-light`,`headphones-on`]}],R=[{id:`liked-songs`,title:`Liked Songs`,subtitle:`Playlist · 16 songs`,kind:`collection`,palette:P.liked,pinned:!0},{id:`library-coding-mode`,title:`Coding Mode`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:P.coding,playlistId:`coding-mode`,pinned:!0},{id:`library-night-drive`,title:`Night Drive`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:P.nightDrive,playlistId:`night-drive`},{id:`library-sunday-reset`,title:`Sunday Reset`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:P.sundayReset,playlistId:`sunday-reset`},{id:`library-luma-coast`,title:`Luma Coast`,subtitle:`Artist`,kind:`artist`,palette:P.chromaticWeather},{id:`library-blue-hour`,title:`Northbound`,subtitle:`Album · Mira Lane`,kind:`album`,palette:P.blueHour},{id:`library-deep-focus`,title:`Deep Focus`,subtitle:`Playlist · Atom Editorial`,kind:`playlist`,palette:P.deepFocus,playlistId:`deep-focus`},{id:`library-nova-bloom`,title:`Nova Bloom`,subtitle:`Artist`,kind:`artist`,palette:P.orbiting}];function z(e){return e.kind===`track`?`track:${e.track.id}`:`playlist:${e.playlist.id}`}function B({activity:e,onClose:t,onSelectTrack:n,onSelectPlaylist:r}){let i=(0,D.useRef)(null),[a,o]=(0,D.useState)(``),[c,l]=(0,D.useState)(F),[u,d]=(0,D.useState)(I.map(e=>({...e,trackCount:e.totalTracks??e.trackIds.length}))),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)(!0),[v,y]=(0,D.useState)(``),[b,x]=(0,D.useState)(null),S=a.trim().toLocaleLowerCase(),C=`activity-tracks-${e.sessionId}`,w=(0,D.useMemo)(()=>{let t=S?[...c.map(e=>({kind:`track`,track:e})),...u.map(e=>({kind:`playlist`,playlist:e}))]:m,n=new Set;return t.filter(t=>{if(t.kind===`track`&&t.track.id===e.titleId||S&&!(t.kind===`track`?[t.track.title,t.track.artist,t.track.album,t.track.provider]:[t.playlist.title,t.playlist.description,t.playlist.curator,t.playlist.provider]).filter(Boolean).some(e=>e?.toLocaleLowerCase().includes(S)))return!1;let r=z(t);return n.has(r)?!1:(n.add(r),!0)}).slice(0,S?void 0:10)},[e.titleId,S,u,m,c]),T=(0,D.useMemo)(()=>I.map(e=>({...e,trackCount:e.totalTracks??e.trackIds.length})),[]);(0,D.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return i.current?.focus(),()=>{e?.isConnected&&e.focus()}},[]),(0,D.useEffect)(()=>{let t=new AbortController,n=`profileId=${encodeURIComponent(e.profileId)}`;return Promise.all([fetch(`/api/spotify/recently-played?${n}`,{cache:`no-store`,signal:t.signal}),fetch(`/api/spotify/tracks?${n}`,{cache:`no-store`,signal:t.signal}),fetch(`/api/spotify/playlists?${n}`,{cache:`no-store`,signal:t.signal})]).then(async([e,t,n])=>{let r=await e.json(),i=await t.json(),a=await n.json();if(!e.ok||!t.ok||!n.ok)throw Error(r.error||i.error||a.error||`Recently played music could not be loaded.`);let o=Array.isArray(i.tracks)?i.tracks:[],s=new Set(o.map(e=>e.id));l([...o,...F.filter(e=>!s.has(e.id))]);let c=Array.isArray(a.playlists)?a.playlists.map(e=>({id:e.id,title:e.title,description:e.description,curator:e.curator,trackCount:e.totalTracks??e.trackIds?.length??0,imageUrl:e.imageUrl,palette:e.palette,provider:e.provider})):[],u=new Set(c.map(e=>e.id));d([...c,...T.filter(e=>!u.has(e.id))]),h(Array.isArray(r.items)?r.items.slice(0,10):[])}).catch(e=>{t.signal.aborted||y(e instanceof Error?e.message:`Recently played music could not be loaded.`)}).finally(()=>{t.signal.aborted||_(!1)}),()=>t.abort()},[e.profileId,T]);let E=async e=>{let i=z(e);x(i),y(``);try{e.kind===`track`?await n(e.track):await r(e.playlist),t()}catch(e){y(e instanceof Error?e.message:`The music could not be switched.`),x(null)}};return(0,O.createPortal)((0,k.jsx)(`div`,{className:`activity-movie-search-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&t()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},children:(0,k.jsxs)(`div`,{className:`activity-movie-search activity-track-search`,id:C,role:`dialog`,"aria-label":`Search another track for ${e.title}`,children:[(0,k.jsxs)(`div`,{className:`activity-movie-search__header`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{children:`Switch music`}),(0,k.jsxs)(`span`,{className:`activity-movie-search__now`,children:[`Now playing: `,e.title]})]}),(0,k.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close track search`,children:(0,k.jsx)(f,{})})]}),(0,k.jsxs)(`div`,{className:`activity-movie-search__field`,children:[(0,k.jsx)(p,{"aria-hidden":`true`}),(0,k.jsx)(`input`,{ref:i,type:`search`,value:a,onChange:e=>o(e.currentTarget.value),placeholder:`Search songs, artists, albums, and playlists`,"aria-label":`Search another track for ${e.title}`,autoComplete:`off`}),a&&(0,k.jsx)(`button`,{type:`button`,onClick:()=>{o(``),i.current?.focus()},"aria-label":`Clear track search`,children:(0,k.jsx)(f,{})})]}),(0,k.jsx)(`div`,{className:`activity-movie-search__heading`,children:(0,k.jsx)(`strong`,{children:S?`Search results`:`Recently played`})}),(0,k.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:b?`Switching from ${e.title}…`:g?`Loading recently played music…`:`${w.length} ${S?`search`:`recent`} ${w.length===1?`result`:`results`}.`}),v&&(0,k.jsx)(`p`,{className:`activity-movie-search__notice`,role:`alert`,children:v}),g?(0,k.jsxs)(`div`,{className:`activity-movie-search__empty`,children:[(0,k.jsx)(s,{className:`spin`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{children:`Loading recently played music…`})]}):w.length?(0,k.jsx)(`div`,{className:`activity-movie-search__results`,"aria-label":S?`Music search results`:`Recently played`,children:w.map(e=>{let t=z(e),n=e.kind===`track`?e.track:e.playlist;return(0,k.jsxs)(`button`,{type:`button`,onClick:()=>void E(e),disabled:b!==null,"aria-label":e.kind===`track`?`Switch to ${e.track.title} by ${e.track.artist}`:`Switch to playlist ${e.playlist.title}`,children:[(0,k.jsxs)(`span`,{className:`activity-movie-search__art activity-track-search__art`,style:n.imageUrl?{backgroundImage:`url(${JSON.stringify(n.imageUrl)})`}:n.palette?{backgroundImage:`linear-gradient(135deg, ${n.palette.from}, ${n.palette.to})`,color:n.palette.accent}:void 0,children:[!n.imageUrl&&(0,k.jsx)(`span`,{"aria-hidden":`true`,children:n.palette?.glyph??(e.kind===`playlist`?`☷`:`♫`)}),b===t&&(0,k.jsx)(s,{className:`spin`,"aria-hidden":`true`})]}),(0,k.jsxs)(`span`,{className:`activity-movie-search__copy`,children:[(0,k.jsx)(`strong`,{children:n.title}),(0,k.jsx)(`small`,{children:e.kind===`track`?(0,k.jsxs)(k.Fragment,{children:[e.track.artist,(0,k.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.track.album]}):(0,k.jsxs)(k.Fragment,{children:[`Playlist`,(0,k.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.playlist.curator,(0,k.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.playlist.trackCount,` `,e.playlist.trackCount===1?`song`:`songs`]})})]})]},t)})}):(0,k.jsxs)(`div`,{className:`activity-movie-search__empty`,children:[(0,k.jsx)(p,{"aria-hidden":`true`}),(0,k.jsx)(`span`,{children:S?`No music found for “${a.trim()}”.`:`No recently played songs or playlists yet.`})]})]})}),document.body)}export{v as _,I as a,A as c,w as d,C as f,y as g,b as h,L as i,E as l,x as m,P as n,F as o,S as p,R as r,N as s,B as t,T as u,_ as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));export{s as n,l as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n}from"./framework-BQUlGUOV.js";import{n as r,t as i}from"./chevron-left-Dn3noAqV.js";import{_ as a,a as o,c as s,f as c,g as l,i as u,n as d,o as f,p,r as ee,s as te,t as ne,u as m,v as re}from"./playback-activity-track-switcher-CbO6kl8K.js";import{a as h,c as g,i as _,l as ie,n as v,o as y,r as ae,s as oe,t as se,u as ce}from"./playback-activity-Dug3BRYr.js";import{a as le,c as ue,d as b,f as x,h as de,i as fe,l as S,n as C,o as w,p as pe,r as T,s as me}from"./manage-profiles-modal-Doi6QM4e.js";import{t as he}from"./house-DQz6VeTk.js";var ge=r(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),_e=r(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),E=r(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),ve=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ye=r(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),be=r(`list-music`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M11 19H3`,key:`zflm78`}],[`path`,{d:`M21 16V5`,key:`yxg4q8`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),xe=r(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Se=r(`monitor-speaker`,[[`path`,{d:`M5.5 20H8`,key:`1k40s5`}],[`path`,{d:`M17 9h.01`,key:`1j24nn`}],[`rect`,{width:`10`,height:`16`,x:`12`,y:`4`,rx:`2`,key:`ixliua`}],[`path`,{d:`M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4`,key:`1mp6e1`}],[`circle`,{cx:`17`,cy:`15`,r:`1`,key:`tqvash`}]]),Ce=r(`repeat-2`,[[`path`,{d:`m2 9 3-3 3 3`,key:`1ltn5i`}],[`path`,{d:`M13 18H7a2 2 0 0 1-2-2V6`,key:`1r6tfw`}],[`path`,{d:`m22 15-3 3-3-3`,key:`4rnwn2`}],[`path`,{d:`M11 6h6a2 2 0 0 1 2 2v10`,key:`2f72bc`}]]),D=r(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),O=e(n(),1),k=t();function A({palette:e,title:t,className:n=``,imageUrl:r,rounded:i=!1}){let a={"--cover-from":e.from,"--cover-to":e.to,"--cover-accent":e.accent,backgroundImage:r?`url(${JSON.stringify(r)})`:void 0};return(0,k.jsxs)(`div`,{"aria-label":`${t} cover`,className:`coverArt ${r?`coverArtHasImage`:``} ${i?`coverArtRound`:``} ${n}`,role:`img`,style:a,children:[(0,k.jsx)(`span`,{className:`coverOrb coverOrbOne`}),(0,k.jsx)(`span`,{className:`coverOrb coverOrbTwo`}),(0,k.jsx)(`span`,{className:`coverLine`}),(0,k.jsx)(`span`,{className:`coverGlyph`,"aria-hidden":`true`,children:e.glyph}),(0,k.jsx)(`span`,{className:`coverNoise`})]})}function we(e){return e.replace(/[<>&"']/g,e=>{switch(e){case`<`:return`<`;case`>`:return`>`;case`&`:return`&`;case`"`:return`"`;default:return`'`}})}function Te(e){if(e.imageUrl)return e.imageUrl;let t=[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 540">`,`<defs>`,`<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">`,`<stop stop-color="${we(e.palette.from)}"/>`,`<stop offset="1" stop-color="${we(e.palette.to)}"/>`,`</linearGradient>`,`</defs>`,`<rect width="960" height="540" fill="url(#g)"/>`,`<circle cx="760" cy="95" r="250" fill="${we(e.palette.accent)}" opacity=".18"/>`,`<circle cx="190" cy="485" r="225" fill="#000" opacity=".2"/>`,`<text x="480" y="315" fill="${we(e.palette.accent)}" font-family="Arial,sans-serif" font-size="150" font-weight="700" text-anchor="middle">${we(e.palette.glyph)}</text>`,`</svg>`].join(``);return`data:image/svg+xml,${encodeURIComponent(t)}`}function Ee(e,t){return{service:`spotify`,sessionId:t.id,profileId:t.profileId,titleId:e.track.id,title:e.track.title||`Untitled track`,artist:e.track.artist||`Unknown artist`,album:e.track.album||`Unknown album`,provider:e.track.provider||`Spotify Atom`,artwork:Te(e.track),currentTime:Math.max(0,e.currentTime),duration:Math.max(0,e.duration),paused:!e.isPlaying,muted:e.volume<=0,volume:Math.max(0,Math.min(1,e.volume/100)),machineName:ae(),deviceType:_(),updatedAt:Date.now()}}function De(e){let t=(0,O.useRef)(e),n=(0,O.useRef)(null),r=(0,O.useMemo)(()=>e.active&&e.profileId?{id:v(),profileId:e.profileId}:null,[e.active,e.profileId]);(0,O.useEffect)(()=>{t.current=e},[e]),(0,O.useEffect)(()=>{if(!r)return;let e=!1,i=0,a=null,o=new Set,s=new AbortController,c=()=>{let n=t.current;if(e||!n.active||n.profileId!==r.profileId)return;let i=new AbortController;o.add(i),fetch(`/api/netflix/activity`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({activity:Ee(n,r)}),cache:`no-store`,signal:i.signal}).catch(()=>{}).finally(()=>{o.delete(i)})};n.current=c;let l=e=>{let n=t.current;switch(e.type){case`set-paused`:n.onSetPaused(e.paused);break;case`seek-relative`:n.onSeek(n.currentTime+e.seconds);break;case`seek-to`:n.onSeek(e.seconds);break;case`set-muted`:n.onSetMuted(e.muted);break;case`set-volume`:n.onSetVolume(e.volume);break;case`previous-track`:n.onPrevious();break;case`next-track`:n.onNext();break;case`switch-track`:n.onSelectTrack(e.trackId);break;case`switch-playlist`:n.onSelectPlaylist(e.playlistId);break;case`next-episode`:case`select-episode`:case`switch-title`:case`set-captions`:case`set-subtitle-font-size`:case`set-subtitle-font-color`:case`set-subtitle-background`:case`reset-subtitle-position`:break}window.requestAnimationFrame(c)},u=async()=>{if(!(e||s.signal.aborted)){try{let e=await fetch(`/api/netflix/activity/${encodeURIComponent(r.id)}/commands?after=${encodeURIComponent(i)}&profileId=${encodeURIComponent(r.profileId)}`,{cache:`no-store`,signal:s.signal});if(e.ok){let t=await e.json();if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,n=Array.isArray(e.commands)?e.commands:[];for(let e of n){if(typeof e!=`object`||!e||Array.isArray(e))continue;let t=e;if(typeof t.id!=`number`||!Number.isSafeInteger(t.id)||t.id<=i||t.sessionId!==r.id)continue;let n={kind:`command`,sessionId:r.id,command:t.command};!h(n)||n.kind!==`command`||(l(n.command),i=t.id)}typeof e.cursor==`number`&&Number.isSafeInteger(e.cursor)&&e.cursor>=i&&(i=e.cursor)}}}catch{}!e&&!s.signal.aborted&&(a=window.setTimeout(()=>void u(),Math.min(500,se)))}},d=()=>{if(!e){e=!0,s.abort();for(let e of o)e.abort();o.clear(),fetch(`/api/netflix/activity`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r.id,profileId:r.profileId}),cache:`no-store`,keepalive:!0}).catch(()=>{})}};window.addEventListener(`pagehide`,d),c();let f=window.setInterval(c,se);return u(),()=>{window.clearInterval(f),a!==null&&window.clearTimeout(a),window.removeEventListener(`pagehide`,d),n.current===c&&(n.current=null),d()}},[r]),(0,O.useEffect)(()=>{n.current?.()},[e.track.id,e.currentTime,e.duration,e.isPlaying,e.volume])}function Oe(e){return e.kind===`track`?`track:${e.track.id}`:`playlist:${e.playlist.id}`}var ke=[{id:`zing-mp3`,name:`Zing MP3`,homeUrl:`https://zingmp3.vn/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`tiktok`,name:`TikTok`,homeUrl:`https://www.tiktok.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`youtube`,name:`YouTube`,homeUrl:`https://www.youtube.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`nhac-cua-tui`,name:`NhacCuaTui`,homeUrl:`https://www.nhaccuatui.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null}];async function j(e,t){let n=t?.method?.toUpperCase()??`GET`,r=await fetch(e,{cache:`no-store`,...t,headers:{Accept:`application/json`,...n!==`GET`&&n!==`HEAD`?{"X-Spotify-Atom-Request":`1`}:{},...t?.headers}}),i=await r.json().catch(()=>null);if(!r.ok){let e=i?.error||i?.message||`Request failed with status ${r.status}`;throw Error(e)}if(!i)throw Error(`The server returned an empty response.`);return i}function M(e,t){return t?`${e}${e.includes(`?`)?`&`:`?`}profileId=${encodeURIComponent(t)}`:e}function Ae(e){let t=e.provider.toLowerCase(),n=d.chromaticWeather;return t.includes(`zing`)?n=d.neonPulse:t.includes(`tiktok`)?n=d.parallelStreets:t.includes(`youtube`)?n=d.stillFrames:t.includes(`nhac`)&&(n=d.blueHour),{...e,durationSec:Number.isFinite(e.durationSec)?e.durationSec:0,imageUrl:e.imageUrl??void 0,palette:n}}function je(e){let t=e.totalTracks>0&&e.availableTracks>=e.totalTracks;return{id:e.id,title:e.title,description:t?e.description:`${e.availableTracks} of ${e.totalTracks} songs ready`,curator:e.curator,trackIds:e.trackIds,palette:d.stillFrames,imageUrl:e.imageUrl??void 0,provider:e.provider,sourceUrl:e.sourceUrl,totalTracks:e.totalTracks,availableTracks:e.availableTracks}}function Me(e){if(e===null||!Number.isFinite(e)||e<=0)return``;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Ne(e){if(e.status===`completed`)return 100;let t=e.totalBytes!==null&&e.totalBytes>0?e.bytesDownloaded/e.totalBytes*100:0;return Math.round(Math.min(100,Math.max(0,Math.max(e.progress||0,t))))}function Pe(e){switch(e){case`queued`:return`Queued`;case`fetching`:return`Fetching details`;case`downloading`:return`Downloading`;case`completed`:return`Ready to play`;case`failed`:return`Download failed`}}function Fe(e){if(!e)return`Not synced yet`;let t=new Date(e);return Number.isNaN(t.getTime())?`Previously synced`:`Synced ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}`}function Ie(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function Le(e){let t=Number.isFinite(e)?Math.max(0,e):0;return`${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,`0`)}`}function Re(){return(0,k.jsxs)(`span`,{className:`spotifyMark`,"aria-hidden":`true`,children:[(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{})]})}function N({autoFocus:e=!1,buttonRef:t,label:n,children:r,className:i=``,pressed:a,expanded:o,controls:s,hasPopup:c,onClick:l}){return(0,k.jsx)(`button`,{"aria-controls":s,"aria-expanded":o,"aria-haspopup":c,"aria-label":n,"aria-pressed":a,autoFocus:e,className:`iconButton ${a?`isActive`:``} ${i}`,onClick:l,ref:t,title:n,type:`button`,children:r})}function P({playing:e,label:t,size:n=`normal`,onClick:r}){return(0,k.jsx)(`button`,{"aria-label":t,className:`playButton playButton-${n}`,onClick:r,type:`button`,children:e?(0,k.jsx)(b,{fill:`currentColor`}):(0,k.jsx)(S,{fill:`currentColor`})})}function ze({item:e,active:t,onSelect:n}){return(0,k.jsxs)(`button`,{className:`libraryRow ${t?`libraryRowActive`:``}`,onClick:n,type:`button`,children:[(0,k.jsx)(A,{className:`libraryCover`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),(0,k.jsxs)(`span`,{className:`libraryRowText`,children:[(0,k.jsx)(`span`,{className:`libraryRowTitle`,children:e.title}),(0,k.jsxs)(`span`,{className:`libraryRowMeta`,children:[e.pinned?(0,k.jsx)(p,{"aria-hidden":`true`,fill:`currentColor`,size:12}):null,e.subtitle]})]}),(0,k.jsx)(ve,{"aria-hidden":`true`,className:`libraryRowMore`,size:19})]})}function Be({playlist:e,active:t,playing:n,onPlay:r}){return(0,k.jsxs)(`article`,{className:`playlistCard ${t?`playlistCardActive`:``}`,children:[(0,k.jsxs)(`div`,{className:`playlistCardArt`,children:[(0,k.jsx)(A,{imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsx)(P,{label:`${n&&t?`Pause`:`Play`} ${e.title}`,onClick:e=>{e.stopPropagation(),r()},playing:n&&t}),t&&n?(0,k.jsxs)(`span`,{className:`playingBadge`,children:[(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{}),(0,k.jsx)(`span`,{})]}):null]}),(0,k.jsxs)(`button`,{className:`cardCopy`,onClick:r,type:`button`,children:[(0,k.jsx)(`span`,{className:`playlistCardTitle`,children:e.title}),(0,k.jsx)(`span`,{className:`playlistCardDescription`,children:e.description})]})]})}function Ve({track:e,active:t,playing:n,liked:r,onSelect:i,onLike:a}){return(0,k.jsxs)(`div`,{className:`trackResult ${t?`trackResultActive`:``}`,children:[(0,k.jsxs)(`button`,{"aria-label":`${n&&t?`Pause`:`Play`} ${e.title}`,className:`trackResultMain`,onClick:i,type:`button`,children:[(0,k.jsxs)(`span`,{className:`trackResultArtWrap`,children:[(0,k.jsx)(A,{className:`trackResultArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsx)(`span`,{className:`trackResultPlay`,children:n&&t?(0,k.jsx)(b,{fill:`currentColor`,size:18}):(0,k.jsx)(S,{fill:`currentColor`,size:18})})]}),(0,k.jsxs)(`span`,{className:`trackResultCopy`,children:[(0,k.jsx)(`span`,{className:`trackResultTitle`,children:e.title}),(0,k.jsx)(`span`,{children:e.artist})]})]}),(0,k.jsx)(`span`,{className:`trackResultAlbum`,children:e.album}),(0,k.jsx)(N,{className:`trackResultLike`,label:`${r?`Remove`:`Add`} ${e.title} ${r?`from`:`to`} Liked Songs`,onClick:a,pressed:r,children:(0,k.jsx)(l,{fill:r?`currentColor`:`none`,size:18})}),(0,k.jsx)(`span`,{className:`trackResultDuration`,children:Le(e.durationSec)}),(0,k.jsx)(N,{label:`More options for ${e.title}`,children:(0,k.jsx)(ve,{size:19})})]})}function He({providers:e,syncingProviderIds:t,providerError:n,musicUrl:r,addMusicError:i,addingMusic:o,onClose:s,onMusicUrlChange:c,onAddMusic:l,onSync:u}){return(0,k.jsxs)(`div`,{"aria-label":`Music sources`,className:`headerPopover sourcePopover`,id:`source-popover`,role:`dialog`,children:[(0,k.jsxs)(`div`,{className:`popoverHeader`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`span`,{className:`popoverEyebrow`,children:`YOUR MUSIC`}),(0,k.jsx)(`h2`,{children:`Sources`})]}),(0,k.jsx)(N,{label:`Close music sources`,onClick:s,children:(0,k.jsx)(C,{size:18})})]}),n?(0,k.jsxs)(`div`,{className:`popoverError`,role:`alert`,children:[(0,k.jsx)(a,{size:16}),(0,k.jsx)(`span`,{children:n})]}):null,(0,k.jsx)(`div`,{className:`providerList`,children:e.map(e=>{let n=t.has(e.id)||e.syncStatus.toLowerCase()===`syncing`;return(0,k.jsxs)(`article`,{className:`providerRow`,children:[(0,k.jsx)(`span`,{className:`providerMark providerMark--${e.id}`,"aria-hidden":`true`,children:e.name.slice(0,1).toUpperCase()}),(0,k.jsxs)(`div`,{className:`providerCopy`,children:[(0,k.jsxs)(`a`,{href:e.homeUrl,rel:`noreferrer`,target:`_blank`,children:[(0,k.jsx)(`strong`,{children:e.name}),(0,k.jsx)(oe,{size:13})]}),(0,k.jsxs)(`span`,{children:[Fe(e.lastSyncedAt),` · `,e.itemCount,` `,e.itemCount===1?`item`:`items`]}),e.error?(0,k.jsx)(`span`,{className:`providerError`,children:e.error}):null]}),(0,k.jsxs)(`button`,{"aria-label":`Sync ${e.name}`,className:`syncProviderButton`,disabled:n,onClick:()=>u(e),type:`button`,children:[n?(0,k.jsx)(x,{"aria-hidden":`true`,className:`spin`,size:17}):(0,k.jsx)(me,{"aria-hidden":`true`,size:17}),(0,k.jsx)(`span`,{children:n?`Syncing`:`Sync`})]})]},e.id)})}),(0,k.jsxs)(`form`,{className:`addMusicForm`,onSubmit:l,children:[(0,k.jsxs)(`div`,{className:`addMusicHeading`,children:[(0,k.jsx)(`span`,{className:`addMusicIcon`,children:(0,k.jsx)(y,{size:17})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:`Add music`}),(0,k.jsx)(`span`,{children:`Paste a song or YouTube playlist link.`})]})]}),(0,k.jsx)(`label`,{htmlFor:`music-source-url`,children:`Music link`}),(0,k.jsxs)(`div`,{className:`musicUrlControl`,children:[(0,k.jsx)(`input`,{autoComplete:`url`,id:`music-source-url`,onChange:e=>c(e.target.value),placeholder:`Paste a Zing MP3, TikTok, YouTube, or NCT link`,required:!0,type:`url`,value:r}),(0,k.jsxs)(`button`,{disabled:o||!r.trim(),type:`submit`,children:[o?(0,k.jsx)(x,{"aria-hidden":`true`,className:`spin`,size:17}):(0,k.jsx)(ue,{"aria-hidden":`true`,size:17}),(0,k.jsx)(`span`,{children:o?`Adding`:`Add`})]})]}),i?(0,k.jsx)(`span`,{className:`fieldError`,role:`alert`,children:i}):null]})]})}function Ue({downloads:e,error:t,currentTrackId:n,isPlaying:r,onClose:i,onPlay:o}){let s=e.filter(e=>e.status!==`completed`&&e.status!==`failed`).length;return(0,k.jsxs)(`div`,{"aria-label":`Music downloads`,className:`headerPopover downloadsPopover`,id:`downloads-popover`,role:`dialog`,children:[(0,k.jsxs)(`div`,{className:`popoverHeader`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`span`,{className:`popoverEyebrow`,children:`OFFLINE MUSIC`}),(0,k.jsx)(`h2`,{children:`Downloads`})]}),(0,k.jsxs)(`div`,{className:`downloadHeaderActions`,children:[s?(0,k.jsxs)(`span`,{className:`activeDownloadCount`,children:[(0,k.jsx)(x,{"aria-hidden":`true`,className:`spin`,size:13}),s,` active`]}):null,(0,k.jsx)(N,{label:`Close downloads`,onClick:i,children:(0,k.jsx)(C,{size:18})})]})]}),t?(0,k.jsxs)(`div`,{className:`popoverError`,role:`alert`,children:[(0,k.jsx)(a,{size:16}),(0,k.jsx)(`span`,{children:t})]}):null,(0,k.jsx)(`div`,{"aria-live":`polite`,className:`downloadList`,children:e.length?e.map(e=>{let t=e.track?Ae(e.track):null,i=e.status===`completed`&&!!t?.audioUrl&&!!e.track,s=t?.id===n,c=Ne(e),l=Me(e.bytesDownloaded),u=Me(e.totalBytes);return(0,k.jsxs)(`article`,{className:`downloadRow ${e.status===`failed`?`downloadRowFailed`:``}`,children:[(0,k.jsxs)(`button`,{"aria-label":i?`${s&&r?`Pause`:`Play`} ${t?.title}`:`Music is not ready to play`,className:`downloadArtworkButton ${i?`downloadArtworkPlayable`:``} ${s?`downloadArtworkActive`:``}`,disabled:!i,onClick:()=>e.track&&o(e.track),type:`button`,children:[(0,k.jsx)(A,{className:`downloadArtwork`,imageUrl:t?.imageUrl,palette:t?.palette??d.deepFocus,title:t?.title??`Preparing music`}),(0,k.jsx)(`span`,{className:`downloadPlayOverlay`,"aria-hidden":`true`,children:s&&r?(0,k.jsx)(b,{fill:`currentColor`,size:20}):i?(0,k.jsx)(S,{fill:`currentColor`,size:20}):e.status===`failed`?(0,k.jsx)(a,{size:18}):(0,k.jsx)(x,{className:`spin`,size:18})})]}),(0,k.jsxs)(`div`,{className:`downloadCopy`,children:[(0,k.jsxs)(`div`,{className:`downloadTitleRow`,children:[(0,k.jsx)(`strong`,{children:t?.title??Ie(e.sourceUrl)}),e.status===`completed`?(0,k.jsx)(ge,{"aria-label":`Download complete`,className:`downloadCompleteIcon`,size:16}):null]}),(0,k.jsx)(`span`,{children:t?.artist??(e.status===`fetching`?`Reading song information`:Pe(e.status))}),(0,k.jsxs)(`div`,{className:`downloadProgressMeta`,children:[(0,k.jsx)(`span`,{children:Pe(e.status)}),(0,k.jsxs)(`span`,{children:[l,l&&u?` / ${u}`:``,!l&&e.status!==`failed`?`${c}%`:``]})]}),(0,k.jsx)(`span`,{"aria-label":`${c}% downloaded`,className:`downloadProgressTrack`,role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,children:(0,k.jsx)(`span`,{style:{width:`${c}%`}})}),e.error?(0,k.jsx)(`span`,{className:`downloadError`,children:e.error}):null]})]},e.id)}):(0,k.jsxs)(`div`,{className:`emptyDownloads`,children:[(0,k.jsx)(`span`,{children:(0,k.jsx)(g,{size:23})}),(0,k.jsx)(`strong`,{children:`No downloads yet`}),(0,k.jsx)(`p`,{children:`Add a song or playlist from Sources and its progress will appear here.`})]})})]})}function We({initialProfiles:e=[],initialActiveProfile:t=null}){let[n,r]=(0,O.useState)(`home`),[a,c]=(0,O.useState)(f[0].id),[u,d]=(0,O.useState)(o[0].id),[p,m]=(0,O.useState)(!1),[h,_]=(0,O.useState)(0),[v,y]=(0,O.useState)(74),[ae,oe]=(0,O.useState)(74),[se,le]=(0,O.useState)(!1),[x,fe]=(0,O.useState)(!1),[T,me]=(0,O.useState)(``),[ge,_e]=(0,O.useState)(``),[E,ve]=(0,O.useState)(`all`),[Se,Ce]=(0,O.useState)(!0),[D,we]=(0,O.useState)(()=>new Set([`neon-skyline`,`blue-hour`,`satellite-hearts`])),[Ee,Me]=(0,O.useState)([]),[Ne,Pe]=(0,O.useState)([]),[Fe,Ie]=(0,O.useState)([]),[Le,P]=(0,O.useState)(ke),[Be,Ve]=(0,O.useState)([]),[We,qe]=(0,O.useState)(``),[Ze,Qe]=(0,O.useState)(``),[F,I]=(0,O.useState)(!1),[L,R]=(0,O.useState)(!1),[$e,et]=(0,O.useState)(!1),[tt,nt]=(0,O.useState)(!1),[rt,it]=(0,O.useState)(!1),[at,ot]=(0,O.useState)(``),[st,ct]=(0,O.useState)(e),[z,lt]=(0,O.useState)(t),[ut,dt]=(0,O.useState)(!1),[ft,pt]=(0,O.useState)(``),[mt,ht]=(0,O.useState)(``),[gt,_t]=(0,O.useState)(!1),[vt,yt]=(0,O.useState)(()=>new Set),[bt,xt]=(0,O.useState)(null),St=(0,O.useRef)(null),Ct=(0,O.useRef)(null),wt=(0,O.useRef)(null),Tt=(0,O.useRef)(null),Et=(0,O.useRef)(null),B=(0,O.useRef)(h),Dt=(0,O.useRef)(null),Ot=(0,O.useRef)(null),kt=(0,O.useRef)(``),At=(0,O.useRef)(0),jt=(0,O.useRef)(!1),V=(0,O.useRef)(t?.id??null),H=(0,O.useMemo)(()=>{let e=new Set(Ee.map(e=>e.id));return[...Ee,...f.filter(t=>!e.has(t.id))]},[Ee]),U=(0,O.useMemo)(()=>{let e=new Set(Ne.map(e=>e.id));return[...Ne,...o.filter(t=>!e.has(t.id))]},[Ne]),W=H.find(e=>e.id===a)??f[0],Mt=U.find(e=>e.id===u)??o[0],G=(0,O.useMemo)(()=>{let e=Mt.trackIds.map(e=>H.find(t=>t.id===e)).filter(e=>!!e);return e.length?e:H},[H,Mt.trackIds]),Nt=(0,O.useMemo)(()=>{let e=G.findIndex(e=>e.id===W.id);return e<0?G:[...G.slice(e+1),...G.slice(0,e)]},[W.id,G]),K=bt?.trackId===W.id&&bt.duration>0?bt.duration:W.durationSec,Pt=Be.filter(e=>e.status!==`completed`&&e.status!==`failed`).length,q=(0,O.useCallback)(e=>{ot(e),Ot.current&&clearTimeout(Ot.current),Ot.current=setTimeout(()=>ot(``),2400)},[]),Ft=(0,O.useCallback)(()=>{et(!1),window.requestAnimationFrame(()=>wt.current?.focus())},[]),It=(0,O.useCallback)(()=>{it(!1),nt(!1),window.requestAnimationFrame(()=>Tt.current?.focus())},[]),J=(0,O.useCallback)(e=>{let t=V.current;if(!t)return;let n=Date.now(),r=Oe(e);Ie(t=>[{...e,playedAt:n},...t.filter(e=>Oe(e)!==r)].slice(0,10)),j(M(`/api/spotify/recently-played`,t),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({item:e,profileId:t})}).catch(()=>{})},[]),Lt=(0,O.useCallback)(e=>{if(V.current===e)return;V.current=e;let t=Ct.current;t&&(t.pause(),t.removeAttribute(`src`),delete t.dataset.trackId,t.load()),kt.current=``,m(!1),dt(!1),nt(!1),it(!1),_(0),B.current=0,xt(null),c(f[0].id),d(o[0].id),Me([]),Pe([]),Ie([]),P(ke),Ve([]),qe(``),Qe(``),yt(new Set),_t(!1),ht(``)},[]),Rt=(0,O.useCallback)(async e=>{let t=At.current;try{let n=await j(`/api/netflix/profiles`,{signal:e});if(jt.current||t!==At.current)return;let r=Array.isArray(n.profiles)?n.profiles:[],i=n.activeProfile&&r.some(e=>e.id===n.activeProfile?.id)?n.activeProfile:r[0]??null;Lt(i?.id??null),ct(r),lt(i)}catch{}},[Lt]),zt=(0,O.useCallback)(async e=>{jt.current=!0,At.current+=1;try{let t=await j(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});At.current+=1;let n=t.activeProfile??e;Lt(n.id),lt(n)}finally{jt.current=!1}},[Lt]),Bt=(0,O.useCallback)(async(e,t)=>{At.current+=1,Lt(t.id),ct(e),lt(t)},[Lt]),Vt=(0,O.useCallback)(async e=>{let t=e??null;try{let n=await j(M(`/api/spotify/providers`,e));if(V.current!==t)return;P(n.providers.length?n.providers:ke),qe(``)}catch(e){if(V.current!==t)return;qe(e instanceof Error?e.message:`Could not load music sources.`)}},[]),Ht=(0,O.useCallback)(async e=>{let t=e??null;try{let n=await j(M(`/api/spotify/downloads`,e));if(V.current!==t)return;Ve([...n.downloads].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())),Qe(``)}catch(e){if(V.current!==t)return;Qe(e instanceof Error?e.message:`Could not load downloads.`)}},[]),Ut=(0,O.useCallback)(async e=>{let t=e??null;try{let n=await j(M(`/api/spotify/tracks`,e));if(V.current!==t)return;Me(n.tracks.map(Ae))}catch{}},[]),Wt=(0,O.useCallback)(async e=>{let t=e??null;try{let n=await j(M(`/api/spotify/playlists`,e));if(V.current!==t)return;Pe(n.playlists.map(je))}catch{}},[]),Gt=(0,O.useCallback)(async e=>{let t=e??null;try{let n=await j(M(`/api/spotify/recently-played`,e));if(V.current!==t)return;Ie(Array.isArray(n.items)?n.items.slice(0,10):[])}catch{}},[]);(0,O.useEffect)(()=>{let e=z?.id,t=window.setTimeout(()=>{Vt(e),Ht(e),Ut(e),Wt(e),Gt(e)},0),n=window.setInterval(()=>{Ht(e)},1600),r=window.setInterval(()=>{Ut(e),Wt(e),Gt(e)},3e3),i=window.setInterval(()=>{Vt(e)},6e3);return()=>{window.clearTimeout(t),window.clearInterval(n),window.clearInterval(r),window.clearInterval(i)}},[z?.id,Ht,Vt,Gt,Wt,Ut]),(0,O.useEffect)(()=>{let n=new AbortController,r=()=>void Rt(n.signal),i=()=>{document.visibilityState===`visible`&&r()},a=window.setInterval(r,3e3);if(window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,i),!e.length||!t){let e=window.requestAnimationFrame(r);return()=>{n.abort(),window.cancelAnimationFrame(e),window.clearInterval(a),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,i)}}return()=>{n.abort(),window.clearInterval(a),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,i)}},[t,e.length,Rt]);let Y=(0,O.useCallback)((e,t)=>{let n=Ct.current;if(!(!n||!e.audioUrl)){if((n.dataset.trackId!==e.id||n.getAttribute(`src`)!==e.audioUrl)&&(n.src=e.audioUrl,n.dataset.trackId=e.id,kt.current=``,n.load()),!t){n.pause();return}n.play().catch(()=>{m(!1),q(`This downloaded track could not be played.`)})}},[q]),Kt=(0,O.useCallback)((e,t=!0)=>{if(e.id===a&&t){let t=!p;m(t),t&&(dt(!0),J({kind:`track`,track:e})),Y(e,t);return}c(e.id),B.current=0,_(0),m(t),t&&(dt(!0),J({kind:`track`,track:e})),Y(e,t)},[a,p,J,Y]),qt=(0,O.useCallback)(e=>{let t=H.find(t=>t.id===e.trackIds[0]);if(!t){q(`${e.title} has no playable songs yet`);return}let n=e.id===u,r=e.trackIds.includes(a),i=!(n&&r&&p);dt(!0),d(e.id),i&&J({kind:`playlist`,playlist:{id:e.id,title:e.title,description:e.description,curator:e.curator,trackCount:e.totalTracks??e.trackIds.length,imageUrl:e.imageUrl,palette:e.palette,provider:e.provider}}),n&&r?m(e=>!e):(c(t.id),B.current=0,_(0),m(!0))},[H,u,a,p,J,q]),X=(0,O.useCallback)(()=>{G.length&&(c(e=>{let t=G.findIndex(t=>t.id===e),n=t>=0?(t+1)%G.length:0;if(se&&G.length>1)do n=Math.floor(Math.random()*G.length);while(n===t);return G[n]?.id??e}),B.current=0,_(0))},[G,se]),Z=(0,O.useCallback)(e=>{let t=Math.max(0,Math.min(e,K||e));B.current=t,_(t);let n=Ct.current;W.audioUrl&&n?.dataset.trackId===W.id&&(n.currentTime=t)},[W.audioUrl,W.id,K]),Jt=(0,O.useCallback)(()=>{if(B.current>4){Z(0);return}G.length&&(c(e=>{let t=G.findIndex(t=>t.id===e),n=(Math.max(0,t)-1+G.length)%G.length;return G[n]?.id??e}),B.current=0,_(0))},[Z,G]);(0,O.useEffect)(()=>{if(!p||W.audioUrl)return;let e=window.setInterval(()=>{_(e=>{if(e+1>=W.durationSec)return B.current=W.durationSec,window.setTimeout(()=>{x?(B.current=0,_(0)):X()},0),W.durationSec;let t=e+1;return B.current=t,t})},1e3);return()=>window.clearInterval(e)},[W.audioUrl,W.durationSec,X,p,x]),(0,O.useEffect)(()=>{let e=Ct.current;e&&(e.volume=v/100)},[v]),(0,O.useEffect)(()=>{let e=Ct.current;if(e){if(!W.audioUrl){e.dataset.trackId&&(e.pause(),e.removeAttribute(`src`),delete e.dataset.trackId,e.load());return}(e.dataset.trackId!==W.id||e.getAttribute(`src`)!==W.audioUrl)&&(e.src=W.audioUrl,e.dataset.trackId=W.id,kt.current=``,e.load()),p&&e.paused?e.play().catch(()=>{m(!1),q(`This downloaded track could not be played.`)}):!p&&!e.paused&&e.pause()}},[W.audioUrl,W.id,p,q]);let Yt=(0,O.useCallback)(()=>{let e=!p;m(e),e&&dt(!0),Y(W,e)},[W,p,Y]),Xt=(0,O.useCallback)(e=>{m(!e),Y(W,!e)},[W,Y]),Zt=(0,O.useCallback)(e=>{y(t=>e?(t>0&&oe(t),0):t>0?t:ae||74)},[ae]),Qt=(0,O.useCallback)(e=>{let t=Math.max(0,Math.min(100,Math.round(e*100)));y(t),t>0&&oe(t)},[]),$t=(0,O.useCallback)(e=>{let t=H.find(t=>t.id===e);t&&(c(t.id),B.current=0,_(0),m(!0),dt(!0),J({kind:`track`,track:t}),Y(t,!0))},[H,J,Y]),en=(0,O.useCallback)(e=>{let t=U.find(t=>t.id===e);t&&qt(t)},[U,qt]);De({active:ut,profileId:z?.id??``,track:W,currentTime:h,duration:K,isPlaying:p,volume:v,onSetPaused:Xt,onSeek:Z,onSetMuted:Zt,onSetVolume:Qt,onPrevious:Jt,onNext:X,onSelectTrack:$t,onSelectPlaylist:en});let tn=(0,O.useCallback)(e=>{switch(e.type){case`set-paused`:Xt(e.paused);break;case`seek-relative`:Z(B.current+e.seconds);break;case`seek-to`:Z(e.seconds);break;case`set-muted`:Zt(e.muted);break;case`set-volume`:Qt(e.volume);break;case`previous-track`:Jt();break;case`next-track`:X();break;case`switch-track`:$t(e.trackId);break;case`switch-playlist`:en(e.playlistId);break;case`next-episode`:case`select-episode`:case`switch-title`:case`set-captions`:case`set-subtitle-font-size`:case`set-subtitle-font-color`:case`set-subtitle-background`:case`reset-subtitle-position`:break}},[X,Jt,Z,en,$t,Zt,Xt,Qt]);(0,O.useEffect)(()=>{let e=e=>{let t=e.target,n=t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`)e.preventDefault(),r(`search`),window.requestAnimationFrame(()=>St.current?.focus());else if(e.key===`Escape`){if(tt){It();return}let e=F||L||$e;I(!1),R(!1),$e?Ft():et(!1),!e&&T&&me(``)}else e.code===`Space`&&!n&&(e.preventDefault(),Yt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ft,It,L,tt,T,$e,F,Yt]),(0,O.useEffect)(()=>{if(!tt)return;let e=window.requestAnimationFrame(()=>Et.current?.focus());return()=>window.cancelAnimationFrame(e)},[tt]),(0,O.useEffect)(()=>{if(!F&&!L)return;let e=e=>{e.target instanceof Node&&!Dt.current?.contains(e.target)&&(I(!1),R(!1))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[L,F]),(0,O.useEffect)(()=>()=>{Ot.current&&clearTimeout(Ot.current)},[]);let nn=(0,O.useMemo)(()=>{let e=Ne.map(e=>{let t=e.totalTracks??e.trackIds.length,n=e.availableTracks??e.trackIds.length;return{id:`library-${e.id}`,title:e.title,subtitle:n>=t?`Playlist · ${t} ${t===1?`song`:`songs`}`:`Playlist · ${n} of ${t} ready`,kind:`playlist`,palette:e.palette,imageUrl:e.imageUrl,playlistId:e.id}});return[ee[0],...e,...ee.slice(1)]},[Ne]),rn=(0,O.useMemo)(()=>{let e=ge.trim().toLowerCase(),t=nn.filter(t=>{let n=E===`all`||t.kind===E||E===`playlist`&&t.kind===`collection`,r=!e||`${t.title} ${t.subtitle}`.toLowerCase().includes(e);return n&&r});return Se?t:[...t].reverse()},[nn,E,Se,ge]),Q=T.trim().toLowerCase(),an=(0,O.useMemo)(()=>Q?H.filter(e=>`${e.title} ${e.artist} ${e.album}`.toLowerCase().includes(Q)):[],[H,Q]),on=(0,O.useMemo)(()=>Q?U.filter(e=>`${e.title} ${e.description}`.toLowerCase().includes(Q)):[],[U,Q]),sn=(0,O.useMemo)(()=>Fe.map(e=>{if(e.kind===`track`){let t=H.find(t=>t.id===e.track.id);return t?{kind:`track`,track:t}:null}let t=U.find(t=>t.id===e.playlist.id);return t?{kind:`playlist`,playlist:t}:null}).filter(e=>e!==null).slice(0,10),[U,H,Fe]),cn=e=>{we(t=>{let n=new Set(t),r=H.find(t=>t.id===e);return n.has(e)?(n.delete(e),q(`Removed ${r?.title??`track`} from Liked Songs`)):(n.add(e),q(`Added ${r?.title??`track`} to Liked Songs`)),n})},ln=e=>{if(e.playlistId){let t=U.find(t=>t.id===e.playlistId);if(t){qt(t),q(`Playing ${t.title}`);return}}if(e.id===`liked-songs`){Kt(H.find(e=>D.has(e.id))??f[0]),q(`Playing Liked Songs`);return}let t=H.find(t=>`${t.artist} ${t.album}`.includes(e.title));t&&(Kt(t),q(`Playing ${e.title}`))},un=async e=>{let t=z?.id??null;yt(t=>new Set(t).add(e.id)),P(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`syncing`,error:null}:t));try{let n=await j(M(`/api/spotify/providers/${encodeURIComponent(e.id)}/sync`,t),{method:`POST`});if(V.current!==t)return;P(t=>t.map(t=>t.id===e.id?n.provider:t)),qe(``),q(`${e.name} is synced`),Ut(t)}catch(n){if(V.current!==t)return;let r=n instanceof Error?n.message:`Could not sync ${e.name}.`;P(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`failed`,error:r}:t)),q(`Could not sync ${e.name}`)}finally{V.current===t&&yt(t=>{let n=new Set(t);return n.delete(e.id),n})}},dn=async e=>{e.preventDefault();let t=z?.id??null,n=ft.trim();ht(``);try{let e=new URL(n);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw Error(`Enter a valid http or https music link.`)}catch{ht(`Enter a valid music link.`);return}_t(!0);try{let e=await j(`/api/spotify/music`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:n,profileId:t})});if(V.current!==t)return;if(e.download){let t=e.download;Ve(e=>[t,...e.filter(e=>e.id!==t.id)])}if(e.playlist){let t=je(e.playlist);Pe(e=>[t,...e.filter(e=>e.id!==t.id)])}if(!e.download&&!e.playlist)throw Error(`The server did not create a download or playlist.`);pt(``),I(!1),R(!0),q(e.playlist?`${e.playlist.title} added to Your Library`:`Music added to downloads`),Ht(t),Wt(t),Ut(t)}catch(e){if(V.current!==t)return;ht(e instanceof Error?e.message:`Could not add this music link.`)}finally{V.current===t&&_t(!1)}},fn=e=>{let t=Ae(e);Me(e=>[t,...e.filter(e=>e.id!==t.id)]),Kt(t)},$=e=>{r(e),I(!1),R(!1),e===`search`&&window.requestAnimationFrame(()=>St.current?.focus())},pn=K>0?Math.min(100,h/K*100):0,mn={"--range-progress":`${pn}%`},hn={"--range-progress":`${v}%`},gn={service:`spotify`,sessionId:`mobile-now-playing`,profileId:z?.id??`local-profile`,titleId:W.id,title:W.title,artist:W.artist,album:W.album,provider:W.provider??`Spotify Atom`,artwork:Te(W),currentTime:h,duration:K,paused:!p,muted:v<=0,volume:v/100,deviceType:`phone`,updatedAt:0};return(0,k.jsxs)(`div`,{className:`spotifyApp`,children:[(0,k.jsxs)(`aside`,{className:`sidebar`,children:[(0,k.jsxs)(`div`,{className:`sidebarTop`,children:[(0,k.jsxs)(`button`,{className:`brand`,onClick:()=>$(`home`),type:`button`,children:[(0,k.jsx)(Re,{}),(0,k.jsx)(`span`,{children:`Spotify`})]}),(0,k.jsxs)(`div`,{className:`sidebarPrimaryNav`,children:[(0,k.jsxs)(`button`,{className:n===`home`?`sidebarNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[(0,k.jsx)(he,{fill:n===`home`?`currentColor`:`none`,size:24}),`Home`]}),(0,k.jsxs)(`button`,{className:n===`search`?`sidebarNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[(0,k.jsx)(w,{size:24}),`Search`]})]})]}),(0,k.jsxs)(`section`,{className:`libraryPanel`,children:[(0,k.jsxs)(`div`,{className:`libraryHeader`,children:[(0,k.jsxs)(`button`,{onClick:()=>$(`library`),type:`button`,children:[(0,k.jsx)(ye,{size:23}),(0,k.jsx)(`span`,{children:`Your Library`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(N,{label:`Create playlist or folder`,onClick:()=>q(`Your new playlist is ready to name`),children:(0,k.jsx)(ue,{size:20})}),(0,k.jsx)(N,{label:`Expand your library`,onClick:()=>$(`library`),children:(0,k.jsx)(re,{size:20})})]})]}),(0,k.jsx)(`div`,{className:`filterChips`,"aria-label":`Library filters`,children:[`all`,`playlist`,`artist`,`album`].map(e=>(0,k.jsx)(`button`,{className:E===e?`chipActive`:``,onClick:()=>ve(e),type:`button`,children:e===`all`?`All`:e===`playlist`?`Playlists`:`${e[0].toUpperCase()}${e.slice(1)}s`},e))}),(0,k.jsxs)(`div`,{className:`libraryTools`,children:[(0,k.jsxs)(`label`,{children:[(0,k.jsx)(w,{"aria-hidden":`true`,size:17}),(0,k.jsx)(`input`,{"aria-label":`Search in Your Library`,onChange:e=>_e(e.target.value),placeholder:`Search in Your Library`,value:ge}),ge?(0,k.jsx)(`button`,{"aria-label":`Clear library search`,onClick:()=>_e(``),type:`button`,children:(0,k.jsx)(C,{size:15})}):null]}),(0,k.jsxs)(`button`,{className:`recentsButton`,onClick:()=>Ce(e=>!e),type:`button`,children:[Se?`Recents`:`Oldest`,(0,k.jsx)(be,{size:17})]})]}),(0,k.jsxs)(`div`,{className:`libraryList`,children:[rn.map(e=>(0,k.jsx)(ze,{active:!!(e.playlistId&&e.playlistId===u),item:e,onSelect:()=>ln(e)},e.id)),rn.length?null:(0,k.jsxs)(`div`,{className:`emptyLibrary`,children:[(0,k.jsx)(w,{size:24}),(0,k.jsx)(`strong`,{children:`No matches found`}),(0,k.jsx)(`span`,{children:`Try another search or filter.`})]})]})]})]}),(0,k.jsxs)(`main`,{className:`mainPanel`,children:[(0,k.jsxs)(`header`,{className:`topBar`,children:[(0,k.jsxs)(`div`,{className:`historyButtons`,children:[(0,k.jsx)(N,{label:`Go back`,onClick:()=>$(`home`),children:(0,k.jsx)(i,{size:25})}),(0,k.jsx)(N,{label:`Go forward`,children:(0,k.jsx)(pe,{size:25})})]}),(0,k.jsxs)(`div`,{className:`globalSearch ${n===`search`?`searchEmphasis`:``}`,children:[(0,k.jsx)(w,{"aria-hidden":`true`,size:21}),(0,k.jsx)(`input`,{onChange:e=>{me(e.target.value),e.target.value&&r(`search`)},onFocus:()=>r(`search`),placeholder:`What do you want to play?`,ref:St,value:T}),T?(0,k.jsx)(`button`,{"aria-label":`Clear search`,className:`clearSearch`,onClick:()=>me(``),type:`button`,children:(0,k.jsx)(C,{size:18})}):(0,k.jsx)(`kbd`,{children:`⌘ K`})]}),(0,k.jsxs)(`div`,{className:`topActions`,ref:Dt,children:[(0,k.jsx)(`button`,{className:`explorePremium`,onClick:()=>q(`Premium looks good on you`),type:`button`,children:`Explore Premium`}),(0,k.jsxs)(`button`,{className:`installButton`,onClick:()=>q(`Spotify is ready in your browser`),type:`button`,children:[(0,k.jsx)(g,{size:16}),`Install App`]}),(0,k.jsxs)(`div`,{className:`headerPopoverWrap`,children:[(0,k.jsx)(N,{className:`sourceActionButton`,controls:`source-popover`,expanded:F,hasPopup:`dialog`,label:`Music sources`,onClick:()=>{let e=!F;I(e),R(!1),et(!1),e&&Vt(z?.id)},children:(0,k.jsx)(ie,{size:19})}),F?(0,k.jsx)(He,{addMusicError:mt,addingMusic:gt,musicUrl:ft,onAddMusic:dn,onClose:()=>I(!1),onMusicUrlChange:e=>{pt(e),mt&&ht(``)},onSync:e=>{un(e)},providerError:We,providers:Le,syncingProviderIds:vt}):null]}),(0,k.jsxs)(`div`,{className:`headerPopoverWrap`,children:[(0,k.jsxs)(N,{className:`downloadsActionButton`,controls:`downloads-popover`,expanded:L,hasPopup:`dialog`,label:Pt?`Downloads, ${Pt} active`:`Downloads`,onClick:()=>{let e=!L;R(e),I(!1),et(!1),e&&(Ht(z?.id),Ut(z?.id))},children:[(0,k.jsx)(g,{size:19}),Pt?(0,k.jsx)(`span`,{className:`downloadActionBadge`,"aria-hidden":`true`,children:Pt>9?`9+`:Pt}):null]}),L?(0,k.jsx)(Ue,{currentTrackId:a,downloads:Be,error:Ze,isPlaying:p,onClose:()=>R(!1),onPlay:fn}):null]}),(0,k.jsx)(N,{label:`What’s New`,onClick:()=>{I(!1),R(!1)},children:(0,k.jsx)(ce,{size:19})}),z?(0,k.jsx)(`div`,{className:`sharedProfileAction`,onFocus:()=>{I(!1),R(!1)},onPointerDown:()=>{I(!1),R(!1)},children:(0,k.jsx)(s,{profiles:st,activeProfile:z,onSelectProfile:zt,onProfilesChanged:Bt})}):null]})]}),(0,k.jsxs)(`div`,{className:`mainScroll`,children:[n===`home`?(0,k.jsx)(Ge,{currentPlaylistId:u,isPlaying:p,onPlayPlaylist:qt,onShowSearch:()=>$(`search`)}):null,n===`search`?(0,k.jsx)(Ke,{currentPlaylistId:u,currentTrackId:a,isPlaying:p,likedTracks:D,matchingPlaylists:on,matchingTracks:an,normalizedQuery:Q,onLike:cn,onPlayPlaylist:qt,onSelectTrack:Kt,query:T,recentItems:sn,setQuery:me}):null,n===`library`?(0,k.jsx)(Je,{availableTracks:H,currentPlaylistId:u,currentTrackId:a,filteredLibrary:rn,isPlaying:p,likedTracks:D,onOpenItem:ln,onSelectTrack:Kt}):null,(0,k.jsxs)(`footer`,{className:`contentFooter`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:`Spotify Atom`}),(0,k.jsx)(`span`,{children:`A Next.js listening experience.`})]}),(0,k.jsx)(`span`,{children:`Fictional artists and demo content`})]})]}),$e?(0,k.jsx)(Ye,{currentTrack:W,onClose:Ft,onSelectTrack:Kt,playlistTitle:Mt.title,tracks:Nt}):null]}),(0,k.jsx)(`audio`,{"aria-hidden":`true`,className:`audioEngine`,onEnded:e=>{x?(e.currentTarget.currentTime=0,e.currentTarget.play().catch(()=>{m(!1),q(`This downloaded track could not be replayed.`)})):X()},onError:e=>{let t=e.currentTarget.dataset.trackId;t&&t===W.id&&kt.current!==t&&(kt.current=t,m(!1),q(`The downloaded audio file is unavailable.`))},onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&xt({trackId:e.currentTarget.dataset.trackId??W.id,duration:t})},onTimeUpdate:e=>{if(e.currentTarget.dataset.trackId===W.id){let t=e.currentTarget.currentTime;B.current=t,_(t)}},preload:`metadata`,ref:Ct}),(0,k.jsx)(Xe,{currentTrack:W,duration:K,elapsed:h,isPlaying:p,liked:D.has(W.id),onLike:()=>cn(W.id),onNext:X,onPrevious:Jt,onSeek:Z,onTogglePlay:Yt,onToggleQueue:()=>{et(e=>!e),I(!1),R(!1)},onVolumeChange:e=>{y(e),e>0&&oe(e)},progressStyle:mn,queueButtonRef:wt,queueOpen:$e,repeat:x,setRepeat:fe,setShuffle:le,shuffle:se,showToast:q,volume:v,volumeStyle:hn,toggleMute:()=>{v>0?(oe(v),y(0)):y(ae||74)}}),(0,k.jsxs)(`div`,{className:`mobilePlayer`,children:[(0,k.jsx)(`span`,{className:`mobilePlayerProgress`,style:{width:`${pn}%`}}),(0,k.jsx)(A,{className:`mobilePlayerArt`,imageUrl:W.imageUrl,palette:W.palette,title:W.title}),(0,k.jsxs)(`button`,{className:`mobilePlayerCopy`,onClick:()=>q(`${W.title} · ${W.artist}`),type:`button`,children:[(0,k.jsx)(`strong`,{children:W.title}),(0,k.jsx)(`span`,{children:W.artist})]}),(0,k.jsx)(N,{label:`${D.has(W.id)?`Remove from`:`Add to`} Liked Songs`,onClick:()=>cn(W.id),pressed:D.has(W.id),children:(0,k.jsx)(l,{fill:D.has(W.id)?`currentColor`:`none`,size:21})}),(0,k.jsx)(N,{className:`mobilePlayToggle`,label:p?`Pause`:`Play`,onClick:Yt,children:p?(0,k.jsx)(b,{fill:`currentColor`,size:25}):(0,k.jsx)(S,{fill:`currentColor`,size:25})}),(0,k.jsx)(N,{buttonRef:Tt,className:`mobileExpandToggle`,controls:`mobile-expanded-player`,expanded:tt,hasPopup:`dialog`,label:`Expand player`,onClick:()=>{nt(!0),I(!1),R(!1)},children:(0,k.jsx)(xe,{size:21})})]}),tt?(0,k.jsx)(`div`,{className:`mobileExpandedPlayerBackdrop`,onClick:It,children:(0,k.jsxs)(`section`,{"aria-label":`Now playing ${W.title}`,"aria-modal":`true`,className:`mobileExpandedPlayer`,id:`mobile-expanded-player`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`mobileExpandedPlayerHeader`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`span`,{children:`Spotify activity`}),(0,k.jsx)(`h2`,{children:`Now playing`})]}),(0,k.jsx)(N,{autoFocus:!0,buttonRef:Et,label:`Close expanded player`,onClick:It,children:(0,k.jsx)(C,{size:20})})]}),(0,k.jsx)(te,{activity:gn,onCommand:tn,onSearchToggle:()=>it(e=>!e),searchOpen:rt,tabLabel:`This device`})]})}):null,rt?(0,k.jsx)(ne,{activity:gn,onClose:()=>it(!1),onSelectPlaylist:async e=>{en(e.id)},onSelectTrack:async e=>{$t(e.id)}}):null,(0,k.jsxs)(`nav`,{className:`mobileNav`,"aria-label":`Main navigation`,children:[(0,k.jsxs)(`button`,{className:n===`home`?`mobileNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[(0,k.jsx)(he,{fill:n===`home`?`currentColor`:`none`,size:24}),(0,k.jsx)(`span`,{children:`Home`})]}),(0,k.jsxs)(`button`,{className:n===`search`?`mobileNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[(0,k.jsx)(w,{size:24}),(0,k.jsx)(`span`,{children:`Search`})]}),(0,k.jsxs)(`button`,{className:n===`library`?`mobileNavActive`:``,onClick:()=>$(`library`),type:`button`,children:[(0,k.jsx)(ye,{size:24}),(0,k.jsx)(`span`,{children:`Your Library`})]})]}),(0,k.jsxs)(`div`,{"aria-atomic":`true`,"aria-live":`polite`,className:`toast ${at?`toastVisible`:``}`,children:[(0,k.jsx)(de,{size:18}),at]})]})}function Ge({currentPlaylistId:e,isPlaying:t,onPlayPlaylist:n,onShowSearch:r}){let i=o.find(e=>e.id===`discover-weekly`)??o[0],a=o.slice(4,10);return(0,k.jsxs)(`div`,{className:`homeView`,children:[(0,k.jsxs)(`section`,{className:`hero`,children:[(0,k.jsx)(`div`,{className:`heroGlow`}),(0,k.jsxs)(`div`,{className:`heroCopy`,children:[(0,k.jsxs)(`span`,{className:`heroEyebrow`,children:[(0,k.jsx)(m,{size:15}),`MADE FOR YOU`]}),(0,k.jsx)(`h1`,{children:`Soundtrack your every move.`}),(0,k.jsx)(`p`,{children:`New discoveries, old favorites, and the right music for right now.`}),(0,k.jsxs)(`div`,{className:`heroActions`,children:[(0,k.jsxs)(`button`,{className:`primaryButton`,onClick:()=>n(i),type:`button`,children:[e===i.id&&t?(0,k.jsx)(b,{fill:`currentColor`,size:19}):(0,k.jsx)(S,{fill:`currentColor`,size:19}),e===i.id&&t?`Pause your mix`:`Play your mix`]}),(0,k.jsxs)(`button`,{className:`secondaryButton`,onClick:r,type:`button`,children:[(0,k.jsx)(E,{size:19}),`Explore music`]})]})]}),(0,k.jsxs)(`div`,{className:`heroArt`,"aria-hidden":`true`,children:[(0,k.jsx)(A,{className:`heroCover heroCoverBack`,palette:o[1].palette,title:o[1].title}),(0,k.jsx)(A,{className:`heroCover heroCoverMiddle`,palette:o[3].palette,title:o[3].title}),(0,k.jsx)(A,{className:`heroCover heroCoverFront`,palette:o[0].palette,title:o[0].title})]})]}),(0,k.jsxs)(`section`,{className:`quickSection`,children:[(0,k.jsx)(`div`,{className:`sectionTitleRow compactTitleRow`,children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`span`,{className:`sectionEyebrow`,children:`PICK UP WHERE YOU LEFT OFF`}),(0,k.jsx)(`h2`,{children:`Good evening`})]})}),(0,k.jsx)(`div`,{className:`quickGrid`,children:a.map(r=>{let i=r.id===e;return(0,k.jsxs)(`button`,{className:`quickTile ${i?`quickTileActive`:``}`,onClick:()=>n(r),type:`button`,children:[(0,k.jsx)(A,{className:`quickTileArt`,palette:r.palette,title:r.title}),(0,k.jsx)(`strong`,{children:r.title}),(0,k.jsx)(`span`,{className:`quickTilePlay`,"aria-hidden":`true`,children:i&&t?(0,k.jsx)(b,{fill:`currentColor`,size:19}):(0,k.jsx)(S,{fill:`currentColor`,size:19})})]},r.id)})})]}),u.map(r=>{let i=r.playlistIds.map(e=>o.find(t=>t.id===e)).filter(e=>!!e);return(0,k.jsxs)(`section`,{className:`shelfSection`,children:[(0,k.jsxs)(`div`,{className:`sectionTitleRow`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:r.title}),r.description?(0,k.jsx)(`p`,{children:r.description}):null]}),(0,k.jsx)(`button`,{type:`button`,children:`Show all`})]}),(0,k.jsx)(`div`,{className:`playlistGrid`,children:i.map(r=>(0,k.jsx)(Be,{active:r.id===e,onPlay:()=>n(r),playing:t,playlist:r},r.id))})]},r.id)})]})}function Ke({currentPlaylistId:e,currentTrackId:t,isPlaying:n,likedTracks:r,matchingPlaylists:i,matchingTracks:a,normalizedQuery:o,onLike:s,onPlayPlaylist:c,onSelectTrack:l,query:u,recentItems:d,setQuery:f}){return(0,k.jsxs)(`div`,{className:`searchView`,children:[(0,k.jsxs)(`div`,{className:`pageHeading`,children:[(0,k.jsx)(`span`,{className:`sectionEyebrow`,children:`FIND YOUR NEXT FAVORITE`}),(0,k.jsx)(`h1`,{children:`Search`}),(0,k.jsx)(`p`,{children:`Artists, songs, albums, playlists, and everything in between.`})]}),(0,k.jsxs)(`label`,{className:`mobileSearchInput`,children:[(0,k.jsx)(w,{size:21}),(0,k.jsx)(`input`,{onChange:e=>f(e.target.value),placeholder:`What do you want to play?`,value:u}),u?(0,k.jsx)(`button`,{"aria-label":`Clear search`,onClick:()=>f(``),type:`button`,children:(0,k.jsx)(C,{size:19})}):null]}),o?(0,k.jsx)(`div`,{className:`searchResults`,children:a.length||i.length?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`section`,{className:`topResultSection`,children:[(0,k.jsx)(`div`,{className:`sectionTitleRow`,children:(0,k.jsx)(`h2`,{children:`Top result`})}),(0,k.jsxs)(`div`,{className:`topResultLayout`,children:[a[0]?(0,k.jsxs)(`button`,{className:`topResultCard`,onClick:()=>l(a[0]),type:`button`,children:[(0,k.jsx)(A,{className:`topResultArt`,imageUrl:a[0].imageUrl,palette:a[0].palette,title:a[0].title}),(0,k.jsx)(`strong`,{children:a[0].title}),(0,k.jsxs)(`span`,{children:[`Song · `,(0,k.jsx)(`b`,{children:a[0].artist})]}),(0,k.jsx)(`span`,{className:`topResultPlay`,children:t===a[0].id&&n?(0,k.jsx)(b,{fill:`currentColor`,size:26}):(0,k.jsx)(S,{fill:`currentColor`,size:26})})]}):i[0]?(0,k.jsxs)(`button`,{className:`topResultCard`,onClick:()=>c(i[0]),type:`button`,children:[(0,k.jsx)(A,{className:`topResultArt`,imageUrl:i[0].imageUrl,palette:i[0].palette,title:i[0].title}),(0,k.jsx)(`strong`,{children:i[0].title}),(0,k.jsxs)(`span`,{children:[`Playlist · `,i[0].curator]}),(0,k.jsx)(`span`,{className:`topResultPlay`,children:(0,k.jsx)(S,{fill:`currentColor`,size:26})})]}):null,(0,k.jsxs)(`div`,{className:`songResults`,children:[(0,k.jsx)(`div`,{className:`sectionTitleRow`,children:(0,k.jsx)(`h2`,{children:`Songs`})}),a.slice(0,4).map(e=>(0,k.jsx)(Ve,{active:e.id===t,liked:r.has(e.id),onLike:()=>s(e.id),onSelect:()=>l(e),playing:n,track:e},e.id))]})]})]}),i.length?(0,k.jsxs)(`section`,{className:`shelfSection searchPlaylistSection`,children:[(0,k.jsx)(`div`,{className:`sectionTitleRow`,children:(0,k.jsx)(`h2`,{children:`Playlists`})}),(0,k.jsx)(`div`,{className:`playlistGrid`,children:i.slice(0,5).map(e=>(0,k.jsx)(Be,{active:!1,onPlay:()=>c(e),playing:n,playlist:e},e.id))})]}):null]}):(0,k.jsxs)(`div`,{className:`noResults`,children:[(0,k.jsx)(`span`,{children:(0,k.jsx)(w,{size:28})}),(0,k.jsxs)(`h2`,{children:[`No results found for “`,u,`”`]}),(0,k.jsx)(`p`,{children:`Check the spelling or try fewer words.`})]})}):(0,k.jsxs)(`section`,{"aria-labelledby":`search-recent-heading`,className:`searchRecentSection`,children:[(0,k.jsx)(`div`,{className:`sectionTitleRow`,children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{id:`search-recent-heading`,children:`Recently played`}),(0,k.jsx)(`p`,{children:`Your latest songs and playlists.`})]})}),d.length?(0,k.jsx)(`div`,{className:`recentSearchGrid`,children:d.map(r=>(0,k.jsx)(qe,{active:r.kind===`track`?r.track.id===t:r.playlist.id===e,item:r,onPlay:()=>{r.kind===`track`?l(r.track):c(r.playlist)},playing:n},r.kind===`track`?`track:${r.track.id}`:`playlist:${r.playlist.id}`))}):(0,k.jsxs)(`div`,{className:`searchRecentEmpty`,role:`status`,children:[(0,k.jsx)(_e,{"aria-hidden":`true`,size:27}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:`Nothing played yet`}),(0,k.jsx)(`p`,{children:`Play a song or playlist and it will appear here.`})]})]})]})]})}function qe({active:e,item:t,onPlay:n,playing:r}){let i=t.kind===`track`?t.track:t.playlist,a=e&&r;return(0,k.jsxs)(`button`,{"aria-label":`${a?`Pause`:`Play`} ${i.title}`,className:`recentSearchCard ${e?`recentSearchCardActive`:``}`,onClick:n,type:`button`,children:[(0,k.jsxs)(`span`,{className:`recentSearchArt`,children:[(0,k.jsx)(A,{imageUrl:i.imageUrl,palette:i.palette,title:i.title}),(0,k.jsx)(`span`,{className:`recentSearchPlay`,"aria-hidden":`true`,children:a?(0,k.jsx)(b,{fill:`currentColor`,size:20}):(0,k.jsx)(S,{fill:`currentColor`,size:20})})]}),(0,k.jsxs)(`span`,{className:`recentSearchCopy`,children:[(0,k.jsx)(`strong`,{children:i.title}),(0,k.jsx)(`span`,{children:t.kind===`track`?`Song · ${t.track.artist}`:`Playlist · ${t.playlist.curator}`})]})]})}function Je({availableTracks:e,currentPlaylistId:t,currentTrackId:n,filteredLibrary:r,isPlaying:i,likedTracks:a,onOpenItem:o,onSelectTrack:s}){let c=e.filter(e=>a.has(e.id));return(0,k.jsxs)(`div`,{className:`fullLibraryView`,children:[(0,k.jsxs)(`div`,{className:`pageHeading libraryPageHeading`,children:[(0,k.jsx)(`span`,{className:`sectionEyebrow`,children:`SAVED FOR LATER`}),(0,k.jsx)(`h1`,{children:`Your Library`}),(0,k.jsx)(`p`,{children:`Playlists, artists, albums, and the songs you never skip.`})]}),(0,k.jsxs)(`section`,{className:`libraryCollectionGrid`,children:[(0,k.jsxs)(`button`,{className:`likedCollection`,onClick:()=>c[0]&&s(c[0]),type:`button`,children:[(0,k.jsx)(`span`,{className:`likedTrackNames`,children:c.slice(0,3).map(e=>(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`b`,{children:e.title}),` `,(0,k.jsxs)(`span`,{children:[`· `,e.artist]})]},e.id))}),(0,k.jsx)(`strong`,{children:`Liked Songs`}),(0,k.jsxs)(`span`,{children:[c.length,` songs`]}),(0,k.jsx)(`span`,{className:`likedCollectionPlay`,children:c.some(e=>e.id===n)&&i?(0,k.jsx)(b,{fill:`currentColor`,size:24}):(0,k.jsx)(S,{fill:`currentColor`,size:24})})]}),r.filter(e=>e.id!==`liked-songs`).slice(0,5).map(e=>(0,k.jsxs)(`button`,{className:`libraryCollectionCard ${e.playlistId===t?`libraryCollectionActive`:``}`,onClick:()=>o(e),type:`button`,children:[(0,k.jsx)(A,{className:`libraryCollectionArt`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`span`,{children:e.subtitle})]},e.id))]}),(0,k.jsxs)(`section`,{className:`shelfSection likedTracksSection`,children:[(0,k.jsxs)(`div`,{className:`sectionTitleRow`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:`Your liked songs`}),(0,k.jsx)(`p`,{children:`The tracks at the heart of your library.`})]}),(0,k.jsx)(_e,{size:20})]}),(0,k.jsx)(`div`,{className:`likedTracksTable`,children:c.map((e,t)=>(0,k.jsxs)(`button`,{className:e.id===n?`likedTrackActive`:``,onClick:()=>s(e),type:`button`,children:[(0,k.jsx)(`span`,{className:`likedTrackNumber`,children:e.id===n&&i?(0,k.jsxs)(`span`,{className:`miniEqualizer`,children:[(0,k.jsx)(`i`,{}),(0,k.jsx)(`i`,{}),(0,k.jsx)(`i`,{})]}):t+1}),(0,k.jsx)(A,{className:`likedTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsxs)(`span`,{className:`likedTrackCopy`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`span`,{children:e.artist})]}),(0,k.jsx)(`span`,{className:`likedTrackAlbum`,children:e.album}),(0,k.jsx)(l,{"aria-hidden":`true`,fill:`currentColor`,size:17}),(0,k.jsx)(`span`,{children:Le(e.durationSec)})]},e.id))})]})]})}function Ye({currentTrack:e,onClose:t,onSelectTrack:n,playlistTitle:r,tracks:i}){return(0,k.jsxs)(`aside`,{"aria-labelledby":`queue-heading`,className:`queuePanel`,id:`queue-panel`,role:`dialog`,children:[(0,k.jsxs)(`header`,{className:`queueHeader`,children:[(0,k.jsx)(`h2`,{id:`queue-heading`,children:`Queue`}),(0,k.jsx)(N,{autoFocus:!0,label:`Close queue`,onClick:t,children:(0,k.jsx)(C,{size:20})})]}),(0,k.jsxs)(`div`,{className:`queueScroll`,children:[(0,k.jsxs)(`section`,{"aria-labelledby":`queue-now-playing`,children:[(0,k.jsx)(`h3`,{id:`queue-now-playing`,children:`Now playing`}),(0,k.jsxs)(`div`,{className:`queueTrack queueTrackCurrent`,children:[(0,k.jsx)(A,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsxs)(`span`,{className:`queueTrackCopy`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`span`,{children:e.artist})]})]})]}),(0,k.jsxs)(`section`,{className:`queueNext`,"aria-labelledby":`queue-next-heading`,children:[(0,k.jsxs)(`h3`,{id:`queue-next-heading`,children:[`Next from: `,r]}),i.length?(0,k.jsx)(`div`,{className:`queueTrackList`,children:i.map(e=>(0,k.jsxs)(`button`,{className:`queueTrack`,onClick:()=>n(e),type:`button`,children:[(0,k.jsx)(A,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsxs)(`span`,{className:`queueTrackCopy`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`span`,{children:e.artist})]})]},e.id))}):(0,k.jsx)(`p`,{className:`queueEmpty`,children:`There are no more songs in this queue.`})]})]})]})}function Xe({currentTrack:e,duration:t,elapsed:n,isPlaying:r,liked:i,onLike:a,onNext:o,onPrevious:s,onSeek:u,onTogglePlay:d,onToggleQueue:f,onVolumeChange:p,progressStyle:ee,queueButtonRef:te,queueOpen:ne,repeat:m,setRepeat:re,setShuffle:h,shuffle:g,showToast:_,toggleMute:ie,volume:v,volumeStyle:y}){return(0,k.jsxs)(`footer`,{className:`desktopPlayer`,children:[(0,k.jsxs)(`div`,{className:`playerTrack`,children:[(0,k.jsx)(A,{className:`playerCover`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),(0,k.jsxs)(`div`,{className:`playerTrackCopy`,children:[(0,k.jsx)(`strong`,{children:e.title}),(0,k.jsx)(`span`,{children:e.artist})]}),(0,k.jsx)(N,{label:`${i?`Remove from`:`Add to`} Liked Songs`,onClick:a,pressed:i,children:(0,k.jsx)(l,{fill:i?`currentColor`:`none`,size:19})}),(0,k.jsx)(N,{label:`Open Now Playing view`,onClick:()=>_(`Now Playing view is already in focus`),children:(0,k.jsx)(xe,{size:17})})]}),(0,k.jsxs)(`div`,{className:`playerCenter`,children:[(0,k.jsxs)(`div`,{className:`transportControls`,children:[(0,k.jsx)(N,{label:`Turn shuffle ${g?`off`:`on`}`,onClick:()=>h(!g),pressed:g,children:(0,k.jsx)(D,{size:18})}),(0,k.jsx)(N,{label:`Previous`,onClick:s,children:(0,k.jsx)(c,{fill:`currentColor`,size:19})}),(0,k.jsx)(P,{label:r?`Pause`:`Play`,onClick:d,playing:r,size:`small`}),(0,k.jsx)(N,{label:`Next`,onClick:o,children:(0,k.jsx)(le,{fill:`currentColor`,size:19})}),(0,k.jsx)(N,{label:`Turn repeat ${m?`off`:`on`}`,onClick:()=>re(!m),pressed:m,children:(0,k.jsx)(Ce,{size:18})})]}),(0,k.jsxs)(`div`,{className:`progressRow`,children:[(0,k.jsx)(`span`,{children:Le(n)}),(0,k.jsx)(`input`,{"aria-label":`Seek playback position`,className:`range`,max:t,min:0,onChange:e=>u(Number(e.target.value)),onKeyDown:e=>{e.key===`Home`?u(0):e.key===`End`&&u(t)},style:ee,type:`range`,value:Math.min(n,t)}),(0,k.jsx)(`span`,{children:Le(t)})]})]}),(0,k.jsxs)(`div`,{className:`playerTools`,children:[(0,k.jsx)(N,{label:`Now Playing view`,children:(0,k.jsx)(be,{size:18})}),(0,k.jsx)(N,{className:`playerQueueButton`,controls:`queue-panel`,expanded:ne,hasPopup:`dialog`,label:`Queue`,onClick:f,pressed:ne,buttonRef:te,children:(0,k.jsx)(be,{size:18})}),(0,k.jsx)(N,{label:`Connect to a device`,onClick:()=>_(`Listening on this web browser`),children:(0,k.jsx)(Se,{size:18})}),(0,k.jsx)(N,{label:v===0?`Unmute`:`Mute`,onClick:ie,children:v===0?(0,k.jsx)(T,{size:20}):(0,k.jsx)(fe,{size:20})}),(0,k.jsx)(`input`,{"aria-label":`Volume`,className:`range volumeRange`,max:100,min:0,onChange:e=>p(Number(e.target.value)),style:y,type:`range`,value:v}),(0,k.jsx)(N,{label:`Full screen`,children:(0,k.jsx)(xe,{size:17})})]})]})}export{We as SpotifyApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-Dn3noAqV.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`captions`,[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]]),r=e(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),i=e(`list-video`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M10 12H3`,key:`1ulcyk`}],[`path`,{d:`M10 19H3`,key:`108z41`}],[`path`,{d:`M15 12.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997a1 1 0 0 1-1.517-.86z`,key:`ms4nik`}]]),a=e(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),o=e(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),s=e(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),c=e(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),l=e(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]);export{a,n as c,o as i,t as l,c as n,i as o,s as r,r as s,l as t};
|