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 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-CkBJG8E2.js";var t=e(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./navigation-context-state-BnWorqxb.js";import"./navigation-server-CCLiCOcy.js";import{createElement as t,useEffect as n,useRef as r}from"react";var i=new Map;function a(e,t){return e?{...e,...t}:t}function o({providerId:o,segmentMap:s,children:c}){let l=r(null),u=e(),d=a(l.current??(o?i.get(o)??null:null),s);return n(()=>{l.current=d,o&&i.set(o,d)},[d,o]),u?t(u.Provider,{value:d},c):c}export{o as LayoutSegmentProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-CkBJG8E2.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=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`}]]),r=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`}]]),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(`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`}]]),o=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`}]]),s=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`}]]),c=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`}]]),l=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`}]]);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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./app-elements-Psr6bSdJ.js";import{r as e,t}from"./app-router-context-QPmikWPX.js";import{a as n,c as r,o as i}from"./navigation-context-state-BnWorqxb.js";import"./url-safety-CnwxMXYX.js";import*as a from"react";var o=`_b_0_`;String.raw`[\w-]+-Google|Google-[\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|meta-externalagent|meta-externalfetcher|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight`,[`RSC`,`Next-Router-State-Tree`,`Next-Router-Prefetch`,`Next-Router-Segment-Prefetch`,`Next-Url`,`X-Vinext-Interception-Context`,`X-Vinext-Mounted-Slots`,`X-Vinext-Rsc-Render-Mode`].join(`, `),new TextEncoder;var s=Symbol.for(`vinext.navigation.pagesNavigationContextAccessor`);function c(){let e=globalThis[s];if(!e)return null;try{return e()}catch{return null}}function l(e,t){if(e===void 0||e===``)return t;let n=Number(e);return!Number.isFinite(n)||n<0?t:n*1e3}l(`0`,3e4),l(`300`,3e4);function u(){return null}function d(){let e=c();return e?e.pathname:u()?.cachedPathname??`/`}var f=Symbol.for(`vinext.clientNavigationRenderContext`);function p(){if(typeof a.createContext!=`function`)return null;let e=globalThis;return e[f]||(e[f]=a.createContext(null)),e[f]??null}function m(){let e=p();if(!e||typeof a.useContext!=`function`)return null;try{return a.useContext(e)}catch{return null}}function h(e){let t=u();return t?(t.listeners.add(e),()=>{t.listeners.delete(e)}):()=>{}}function g(){{e();let t=r();if(t)return t.pathname;let n=c();return n?n.pathname:`/`}let t=m(),n=a.useSyncExternalStore(h,d,()=>{let e=r();if(e)return e.pathname;let t=c();return t?t.pathname:`/`});return t&&(u()?.navigationSnapshotActiveCount??0)>0?t.pathname:n}function _(e){return!e||e===`0`?o:e}function v(){let e=i(),t=n();if(!e||!t||typeof a.useContext!=`function`)return _(null);try{let n=a.useContext(e),r=a.useContext(t);return _(n===null?null:r?.[n])}catch{return _(null)}}function y(){if(!t||typeof a.useContext!=`function`||typeof a.useMemo!=`function`)throw Error(`invariant expected app router to be mounted`);let e=a.useContext(t);if(e===null)throw Error(`invariant expected app router to be mounted`);let n=v();return a.useMemo(()=>({...e,bfcacheId:n}),[e,n])}export{y as n,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";var t=Symbol.for(`vinext.layoutSegmentContext`),n=Symbol.for(`vinext.serverInsertedHTMLContext`),r=Symbol.for(`vinext.bfcacheIdMapContext`),i=Symbol.for(`vinext.bfcacheSegmentIdContext`),a=Symbol.for(`vinext.navigation.fallback`);function o(t){return typeof e.createContext==`function`?e.createContext(t):null}function s(){let e=globalThis;return e[n]||(e[n]=o(null)),e[n]??null}var c=s();function l(){let e=globalThis;return e[t]||(e[t]=o({children:[]})),e[t]??null}function u(){let e=globalThis;return e[r]||(e[r]=o(null)),e[r]??null}function d(){let e=globalThis;return e[i]||(e[i]=o(null)),e[i]??null}var f=Symbol.for(`vinext.navigation.globalAccessors`);function p(){let e=globalThis;return e[a]??={serverContext:null,serverInsertedHTMLCallbacks:[]}}function m(){return globalThis[f]}var h=()=>m()?.getServerContext()??p().serverContext,g=e=>{let t=m();t?t.setServerContext(e):p().serverContext=e},_=()=>m()?.getInsertedHTMLCallbacks()??p().serverInsertedHTMLCallbacks,v=()=>{let e=m();e?e.clearInsertedHTMLCallbacks():p().serverInsertedHTMLCallbacks=[]};function y(e){h=e.getServerContext,g=e.setServerContext,_=e.getInsertedHTMLCallbacks,v=e.clearInsertedHTMLCallbacks}function b(){return h()}function x(e){g(e)}function S(e){_().push(e)}function C(e){let t=_(),n=[];for(let e of t)try{let t=e();t!=null&&n.push(t)}catch{}return e&&(t.length=0),n}function w(){return C(!1)}function T(){v()}export{u as a,b as c,x as d,T as i,S as l,c as n,d as o,y as r,l as s,f as t,w as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){if(!e.startsWith(`NEXT_REDIRECT;`))return null;let t=e.indexOf(`;`,14);if(t===-1)return null;let n=e.slice(t+1),r=n.match(/;(303|307|308);?$/),i=n!==``&&e.endsWith(`;`);if(i&&!r)return null;let a=r?n.slice(0,-r[0].length):n,o=a;if(!i)try{o=decodeURIComponent(a)}catch{return null}return{status:r?Number(r[1]):307,type:e.slice(14,t)||null,url:o}}var t=class extends Error{digest;constructor(e,t){super(e),this.digest=t}};function n(){throw new t(`NEXT_NOT_FOUND`,`NEXT_HTTP_ERROR_FALLBACK;404`)}function r(e){return!!e&&typeof e==`object`&&`digest`in e&&typeof e.digest==`string`&&e.digest.startsWith(`NEXT_REDIRECT;`)}function i(t){let n=e(t);return n?{url:n.url,type:n.type===`push`?`push`:`replace`}:null}export{e as i,r as n,n as r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./navigation-context-state-BnWorqxb.js";export{};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,t}from"./chevron-left-CkBJG8E2.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u}from"./minimize-C9JLgte-.js";import{a as d,c as f,d as p,f as m,h,i as g,l as _,m as v,n as ee,o as te,p as y,r as ne,s as b,t as x,u as S}from"./refresh-cw-CWdWHjqY.js";import{a as re,c as C,i as ie,l as ae,n as oe,o as w,r as se,s as ce,t as le,u as T}from"./playback-activity-D5TYX2Ae.js";import{Fragment as ue,jsx as E,jsxs as D}from"react/jsx-runtime";import O,{useCallback as k,useEffect as A,useMemo as de,useRef as j,useState as M}from"react";var fe=e(`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=e(`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=e(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),he=e(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),N=e(`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`}]]),ge=e(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),_e=e(`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`}]]),ve=e(`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`}]]),P=e(`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`}]]),ye=Object.defineProperty,be=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,Ce=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,we=(e,t)=>{for(var n in t||={})xe.call(t,n)&&Ce(e,n,t[n]);if(be)for(var n of be(t))Se.call(t,n)&&Ce(e,n,t[n]);return e},Te=(e,t)=>{var n={};for(var r in e)xe.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&be)for(var r of be(e))t.indexOf(r)<0&&Se.call(e,r)&&(n[r]=e[r]);return n},F;(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})(F||={}),(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||={})})(F||={}),(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||={})})(F||={});var I=F,L={L:I.QrCode.Ecc.LOW,M:I.QrCode.Ecc.MEDIUM,Q:I.QrCode.Ecc.QUARTILE,H:I.QrCode.Ecc.HIGH},Ee=128,De=`L`,Oe=`#FFFFFF`,R=`#000000`,ke=!1,Ae=1,z=4,B=0,V=.1;function H(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 U(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 W(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*V),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 je(e,t){return t==null?e?z:B: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(...I.QrSegment.makeSegments(t)),e),[]);return I.QrCode.encodeSegments(r,L[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=je(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:W(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var G=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),K=O.forwardRef(function(e,t){let n=e,{value:r,size:i=Ee,level:a=De,bgColor:o=Oe,fgColor:s=R,includeMargin:c=ke,minVersion:l=Ae,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Te(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Te(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]),[te,y]=O.useState(!1),{margin:ne,cells:b,numCells:x,calculatedImageSettings:S}=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=b,r=v.current,a=S!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&S.excavation!=null&&(n=U(b,S.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/x*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,x,x),t.fillStyle=s,G?t.fill(new Path2D(H(n,ne))):b.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+ne,n+ne,1,1)})}),S&&(t.globalAlpha=S.opacity),a&&t.drawImage(r,S.x+ne,S.y+ne,S.w,S.h)}}),O.useEffect(()=>{y(!1)},[g]);let re=we({height:i,width:i},m),C=null;return g!=null&&(C=O.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{y(!0)},ref:v,crossOrigin:S?.crossOrigin})),O.createElement(O.Fragment,null,O.createElement(`canvas`,we({style:re,height:i,width:i,ref:ee,role:`img`},h)),C)});K.displayName=`QRCodeCanvas`;var Ne=O.forwardRef(function(e,t){let n=e,{value:r,size:i=Ee,level:a=De,bgColor:o=Oe,fgColor:s=R,includeMargin:c=ke,minVersion:l=Ae,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Te(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,te=null;p!=null&&v!=null&&(v.excavation!=null&&(ee=U(g,v.excavation)),te=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 y=H(ee,h);return O.createElement(`svg`,we({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:y,shapeRendering:`crispEdges`}),te)});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 Fe(e){return Array.from(new Set([e.title,e.originalTitle].filter(e=>!!e?.trim()).map(Pe).filter(Boolean))).map(t=>`${t}:${e.year}`)}function Ie(e){return e.sourceProvider===`phimhdcss`?0:e.sourceProvider?2:1}function Le(e){let t=e.map((e,t)=>({movie:e,index:t})).sort((e,t)=>Ie(e.movie)-Ie(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=Fe(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 Re(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 ze={myList:[],likedTitles:[],progress:[],subtitlePreferences:{fontSize:32,positionX:50,positionY:78,fontColor:`#ffffff`,backgroundColor:`rgba(0,0,0,0.75)`,fontFamily:`default`,captionsOn:!1,updatedAt:``}},Be=[{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 Ve(e){return e?`/netflix/search?q=${encodeURIComponent(e)}`:`/netflix/search`}function q(){let e=j(null);return A(()=>{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 He({featured:e,rows:t,initialImportedTitles:n,initialProviders:r,initialProfiles:i,initialActiveProfile:a,initialProfileLibrary:o,initialSearchOpen:s=!1,initialSearchQuery:c=``}){let[l,u]=M(!1),[d,f]=M(!1),[p,m]=M(!1),[h,g]=M(!1),[_,v]=M(s),[ee,y]=M(!1),[ne,x]=M(!1),[S,re]=M(!1),[C,ie]=M(!1),[ae,oe]=M(r),[w,se]=M(n),[ce,le]=M(i),[T,O]=M(a),[fe,pe]=M(o),[me,he]=M(``),[N,ge]=M(c),[_e,ve]=M([]),[P,ye]=M(``),[be,xe]=M(`idle`),[Se,Ce]=M(``),[we,Te]=M(null),[F,I]=M(null),[L,Ee]=M(null),[De,Oe]=M(!1),[R,ke]=M(new Set(o.myList)),[Ae,z]=M(new Set(o.likedTitles)),B=j(null),V=j(s),H=j(c),U=j({version:0,controller:null}),W=j(a.id),je=j(0),Me=j(0),G=k(e=>{W.current!==e&&(W.current=e,je.current+=1,U.current.version+=1,U.current.controller?.abort(),U.current.controller=null,oe([]),se([]),pe(ze),ke(new Set),z(new Set),I(null),Ee(null),he(``))},[]),K=k(()=>{U.current.version+=1,U.current.controller?.abort(),U.current.controller=null},[]),Ne=k(()=>{K(),Ee(null)},[K]);A(()=>()=>{K()},[K]);let Pe=k((e,t,n)=>{let r=e?Ve(t):`/netflix`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==r&&(n===`push`?window.history.pushState(null,``,r):window.history.replaceState(null,``,r))},[]),Fe=k(e=>{let t=V.current;if(V.current=e,v(e),e){t||Pe(!0,H.current,`push`);return}H.current=``,ge(``),t&&Pe(!1,``,`push`)},[Pe]),Ie=k(e=>{H.current=e,ge(e),V.current&&Pe(!0,e,`replace`)},[Pe]),Be=de(()=>{let n=[e,...w,...t.flatMap(e=>e.items)];return Array.from(new Map(n.map(e=>[e.id,e])).values())},[e,w,t]),q=de(()=>{let e=new Map(fe.progress.map(e=>[e.titleId,e]));return Be.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}})},[Be,fe.progress]),He=de(()=>new Map(q.map(e=>[e.id,e])),[q]),We=de(()=>{let e=N.trim();return e?q.filter(t=>Re(t,e)):[]},[q,N]),Ge=N.trim(),Ke=Ge.length>=2&&P===Ge?_e:[],qe=Ge.length<2?`idle`:P===Ge?be:`loading`,Je=P===Ge?Se:``,Ye=Le([...We,...Ke]),$e=de(()=>q.filter(e=>R.has(e.id)),[R,q]),J=de(()=>{let e=new Map(fe.progress.map(e=>[e.titleId,e]));return q.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)})},[fe.progress,q]);A(()=>{let e=()=>u(window.scrollY>24);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),A(()=>{let e=()=>{let e=window.location.pathname.replace(/\/+$/,``)===`/netflix/search`,t=e?new URLSearchParams(window.location.search).get(`q`)??``:``;V.current=e,H.current=t,v(e),ge(t)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),A(()=>{_&&(window.scrollTo(0,0),B.current?.focus())},[_]),A(()=>{let e=N.trim();if(!_||e.length<2)return;let t=new AbortController,n=window.setTimeout(()=>{ye(e),ve([]),xe(`loading`),Ce(``),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.`);ve(t.titles??[]),xe(`ready`),t.failedProviders?.length&&Ce(`Some providers could not be searched: ${t.failedProviders.join(`, `)}.`)}).catch(e=>{t.signal.aborted||(xe(`error`),Ce(e instanceof Error?e.message:`Provider search failed.`))})},350);return()=>{window.clearTimeout(n),t.abort()}},[_,N]),A(()=>{let e=e=>{e.key===`Escape`&&(L?Ne():F?I(null):C?ie(!1):S?re(!1):_&&N?Ie(``):_?Fe(!1):(y(!1),x(!1),f(!1),m(!1),g(!1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[S,Ne,C,L,_,N,F,Fe,Ie]);let nt=k(async e=>{let t=++je.current,n=await fetch(`/api/netflix/library?profileId=${encodeURIComponent(e)}`,{cache:`no-store`});if(!n.ok)return;let r=await n.json();W.current!==e||t!==je.current||(oe(r.providers),se(r.titles))},[]),rt=k(async e=>{let t=T.id,n=q.find(t=>t.id===e.id||e.sourceUrl&&t.sourceUrl===e.sourceUrl);if(n||!e.sourceProvider||!e.sourceUrl){Fe(!1),I(n??e);return}Te(e.id),Ce(``);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(W.current!==t)return;se(e=>[r.title,...e.filter(e=>e.id!==r.title.id&&e.sourceUrl!==r.title.sourceUrl)]),Fe(!1),I(r.title)}catch(e){Ce(e instanceof Error?e.message:`Movie details could not be loaded.`)}finally{Te(null)}},[T.id,q,Fe]);A(()=>{let e=T.id,t=window.setTimeout(()=>void nt(e),0);return()=>window.clearTimeout(t)},[T.id,nt]),A(()=>{if(!w.some(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`))return;let e=T.id,t=window.setInterval(()=>void nt(e),3e3);return()=>window.clearInterval(t)},[T.id,w,nt]),A(()=>(document.body.style.overflow=F||L||S?`hidden`:``,()=>{document.body.style.overflow=``}),[S,L,F]);let it=k(e=>{pe(e),ke(new Set(e.myList)),z(new Set(e.likedTitles))},[]),at=k(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();W.current===e&&it(n)},[it]),ot=k(async e=>{let t=++Me.current,n=await fetch(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});if(!n.ok)return;let r=await n.json();t===Me.current&&(G(r.activeProfile.id),O(r.activeProfile),it(r.library),m(!1),I(null),K(),Ee(null))},[it,G,K]),st=k(async(e,t)=>{let n=T.id!==t.id;n&&G(t.id),le(e),O(t),n&&await at(t.id)},[T.id,G,at]),Y=e=>{let t=T.id,n=!R.has(e.id);ke(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();W.current===t&&it(await e.json())}).catch(()=>void at(t))},ct=e=>{let t=T.id,n=!Ae.has(e.id);z(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();W.current===t&&it(await e.json())}).catch(()=>void at(t))},ut=(e,t)=>{if(K(),e.sourceProvider&&!e.playbackPath&&!e.canStream){I(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;I(null),Ee(r?{...e,episode:r,resumePositionSeconds:i?e.resumePositionSeconds:void 0,resumeDurationSeconds:i?e.resumeDurationSeconds:void 0}:e)},Z=k(async e=>{let t=U.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(T.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!==U.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&&se(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]);I(null),Ee(s?{...a,episode:s}:a)}catch(e){if(r.signal.aborted||n!==U.current.version)return;throw e}finally{U.current.controller===r&&(U.current.controller=null)}},[T.id]),dt=k(e=>{pe(t=>({...t,progress:[e,...t.progress.filter(t=>t.titleId!==e.titleId)]}))},[]);return D(`main`,{className:`site-shell`,children:[E(Ue,{isScrolled:l,mobileMenuOpen:d,setMobileMenuOpen:f,searchOpen:_,setSearchOpen:Fe,searchQuery:N,setSearchQuery:Ie,searchInputRef:B,profileOpen:p,setProfileOpen:m,notificationsOpen:h,setNotificationsOpen:g,sourcesOpen:ee,setSourcesOpen:y,downloadsOpen:ne,setDownloadsOpen:x,downloads:w.map(e=>He.get(e.id)??e),onPlay:e=>{x(!1),ut(e)},providers:ae,syncMessage:me,onSync:async e=>{let t=T.id;oe(t=>t.map(t=>t.id===e?{...t,syncStatus:`syncing`,lastError:null}:t)),he(`Syncing provider homepage…`);let n=await fetch(`/api/netflix/providers/${e}/sync?profileId=${encodeURIComponent(t)}`,{method:`POST`}),r=await n.json();W.current===t&&(he(n.ok?`${r.count??0} titles synced to SQLite.`:r.error||`Provider sync failed.`),await nt(t))},onAddMovie:()=>{y(!1),x(!1),re(!0)},profiles:ce,activeProfile:T,onSelectProfile:ot,onManageProfiles:()=>{m(!1),ie(!0)}}),_?E(et,{query:N,results:Ye,providerStatus:qe,error:Je,resolvingTitleId:we,onSelect:e=>void rt(e)}):D(ue,{children:[E(Ze,{title:He.get(e.id)??e,previewPaused:De,setPreviewPaused:Oe,onPlay:()=>ut(He.get(e.id)??e),onMoreInfo:()=>I(He.get(e.id)??e)}),D(`section`,{className:`catalog`,"aria-label":`Netflix catalog`,children:[w.length>0&&E(Qe,{row:{id:`provider-library`,title:`Your Provider Library`,kind:`standard`,items:w.map(e=>He.get(e.id)??e)},rowIndex:-2,myList:R,likedTitles:Ae,onSelect:I,onPlay:ut,onToggleMyList:Y,onToggleLike:ct}),J.length>0&&E(Qe,{row:{id:`continue-watching`,title:`Continue Watching for ${T.name}`,kind:`continue-watching`,items:J},rowIndex:-3,myList:R,likedTitles:Ae,onSelect:I,onPlay:ut,onToggleMyList:Y,onToggleLike:ct}),E(`div`,{className:`my-list-anchor`,id:`my-list`,children:$e.length>0?E(Qe,{row:{id:`my-list-row`,title:`My List`,kind:`standard`,items:$e},rowIndex:-1,myList:R,likedTitles:Ae,onSelect:I,onPlay:ut,onToggleMyList:Y,onToggleLike:ct}):D(`div`,{className:`my-list-empty`,children:[E(`span`,{"aria-hidden":`true`,children:E(b,{})}),D(`div`,{children:[E(`h2`,{children:`Your list is ready for something great`}),E(`p`,{children:`Use the plus button on any title to save it here for later.`})]})]})}),t.map((e,t)=>E(Qe,{row:{...e,items:e.items.map(e=>He.get(e.id)??e)},rowIndex:t,myList:R,likedTitles:Ae,onSelect:I,onPlay:ut,onToggleMyList:Y,onToggleLike:ct},e.id))]}),E(X,{})]}),F&&E(tt,{title:F,isInMyList:R.has(F.id),isLiked:Ae.has(F.id),onClose:()=>I(null),onPlay:e=>ut(F,e),onToggleMyList:()=>Y(F),onToggleLike:()=>ct(F)}),L&&E(lt,{title:L,profileId:T.id,subtitlePreferences:fe.subtitlePreferences,onProgressChange:dt,onSubtitlePreferencesChange:e=>pe(t=>({...t,subtitlePreferences:e})),onSwitchTitle:Z,onClose:Ne},L.id),C&&E(te,{profiles:ce,activeProfile:T,onClose:()=>ie(!1),onProfilesChanged:st}),S&&E(Xe,{profileId:T.id,onClose:()=>re(!1),onImported:async()=>{re(!1),he(`Title and episode metadata added to your library.`),await nt(T.id)}})]})}function Ue({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:h,downloadsOpen:g,setDownloadsOpen:_,downloads:v,onPlay:ee,providers:te,syncMessage:y,onSync:ne,onAddMovie:b,profiles:x,activeProfile:re,onSelectProfile:ie,onManageProfiles:oe}){let[w,se]=M(!1);return D(`header`,{className:`top-nav${e?` top-nav--solid`:``}${r?` top-nav--search`:``}`,children:[D(`div`,{className:`nav-start`,children:[E(`button`,{className:`icon-button mobile-menu-button`,"aria-label":t?`Close navigation`:`Open navigation`,onClick:()=>{se(!1),n(!t)},children:E(t?p:ge,{})}),E(`a`,{className:`netflix-wordmark`,href:`/netflix`,"aria-label":`Netflix home`,children:`NETFLIX`}),E(`nav`,{className:`primary-nav${t?` primary-nav--open`:``}`,"aria-label":`Primary navigation`,children:Be.map((e,t)=>E(`a`,{className:t===0?`active`:``,href:e.href,onClick:()=>n(!1),children:e.label},e.label))})]}),D(`div`,{className:`nav-end`,children:[D(`div`,{className:`nav-popover-wrap`,children:[E(`button`,{className:`icon-button access-button`,"aria-label":`Access Home Atom`,"aria-expanded":w,"aria-controls":`access-popover`,onClick:()=>{se(!w),h(!1),_(!1),l(!1),d(!1),i(!1)},children:E(P,{})}),w&&E(Ge,{})]}),D(`div`,{className:`nav-popover-wrap`,children:[E(`button`,{className:`icon-button source-button`,"aria-label":`Movie sources`,"aria-expanded":f,onClick:()=>{se(!1),h(!f),_(!1),l(!1),d(!1),i(!1)},children:E(ae,{})}),f&&E(Ke,{providers:te,message:y,onSync:ne,onAddMovie:b})]}),D(`div`,{className:`nav-popover-wrap`,children:[D(`button`,{className:`icon-button download-button`,"aria-label":`Downloads`,"aria-expanded":g,onClick:()=>{se(!1),_(!g),h(!1),l(!1),d(!1),i(!1)},children:[E(C,{}),v.some(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`)&&E(`span`,{className:`download-badge`,"aria-hidden":`true`,children:v.filter(e=>e.downloadStatus===`queued`||e.downloadStatus===`downloading`).length})]}),g&&E(qe,{titles:v,onPlay:ee})]}),D(`div`,{className:`search-box${r?` search-box--open`:``}`,children:[E(`button`,{className:`icon-button search-trigger`,"aria-label":r?`Focus search`:`Search`,onClick:()=>{se(!1),h(!1),_(!1),l(!1),d(!1),r?s.current?.focus():i(!0)},children:E(m,{})}),E(`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&&E(`button`,{className:`search-clear`,"aria-label":a?`Clear search`:`Close search`,onClick:()=>{a?o(``):i(!1)},children:E(p,{})})]}),D(`div`,{className:`nav-popover-wrap`,children:[D(`button`,{className:`icon-button notification-button`,"aria-label":`Notifications`,"aria-expanded":u,onClick:()=>{se(!1),h(!1),_(!1),d(!u),l(!1)},children:[E(T,{}),E(`span`,{className:`notification-dot`})]}),u&&E(Je,{})]}),D(`div`,{className:`nav-popover-wrap`,children:[D(`button`,{className:`profile-trigger`,"aria-label":`Open profile menu`,"aria-expanded":c,onClick:()=>{se(!1),h(!1),_(!1),l(!c),d(!1)},children:[D(`span`,{className:`profile-avatar`,"aria-hidden":`true`,style:{backgroundColor:re.avatarColor},children:[E(`span`,{}),E(`span`,{}),E(`span`,{})]}),E(S,{className:c?`rotate`:``})]}),c&&E(Ye,{profiles:x,activeProfile:re,onSelectProfile:ie,onManageProfiles:oe})]})]})]})}function We(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 Ge(){let[e,t]=M(`lan`),[n,r]=M(null),[i,a]=M(``),[o,s]=M(!1),c=j(null);A(()=>{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):We(l.url)}catch{We(l.url)}s(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>s(!1),1800)}};return D(`div`,{className:`nav-popover access-popover`,id:`access-popover`,role:`dialog`,"aria-label":`Access Home Atom from another device`,children:[E(`div`,{className:`popover-caret`}),D(`div`,{className:`access-heading`,children:[E(`span`,{children:E(P,{})}),D(`div`,{children:[E(`b`,{children:`Open on another device`}),E(`small`,{children:`Scan or copy an address on the same network`})]})]}),E(`div`,{className:`access-tabs`,role:`tablist`,"aria-label":`Network`,children:[[`lan`,`LAN`],[`vpn`,`VPN (Tailscale)`]].map(([n,r])=>E(`button`,{type:`button`,role:`tab`,"aria-selected":e===n,"aria-controls":`access-tab-panel`,onClick:()=>{t(n),s(!1)},children:r},n))}),E(`div`,{className:`access-tab-panel`,id:`access-tab-panel`,role:`tabpanel`,children:!n&&!i?D(`div`,{className:`access-loading`,role:`status`,children:[E(f,{className:`spin`}),`Detecting `,u,` address…`]}):i?D(`div`,{className:`access-unavailable`,role:`alert`,children:[E(P,{}),E(`b`,{children:`Network address unavailable`}),E(`small`,{children:i})]}):l?D(ue,{children:[D(`div`,{className:`access-url-row`,children:[D(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,title:l.url,children:[E(`span`,{children:l.url}),E(ce,{"aria-hidden":`true`})]}),D(`button`,{type:`button`,"aria-label":`Copy ${u} URL`,onClick:()=>void d(),children:[E(o?h:fe,{}),E(`span`,{children:o?`Copied`:`Copy`})]})]}),E(`div`,{className:`access-qr`,children:E(Ne,{value:l.url,size:184,level:`M`,marginSize:3,title:`${u} access QR code`})}),E(`p`,{children:`Scan with your phone or tablet to open Home Atom.`})]}):D(`div`,{className:`access-unavailable`,role:`status`,children:[E(P,{}),D(`b`,{children:[u,` address not found`]}),E(`small`,{children:e===`lan`?`Connect the server to your local network and try again.`:`Start Tailscale on the server, then reopen this panel.`})]})})]})}function Ke({providers:e,message:t,onSync:n,onAddMovie:r}){return D(`div`,{className:`nav-popover sources-popover`,children:[E(`div`,{className:`popover-caret`}),D(`div`,{className:`sources-heading`,children:[E(`span`,{children:E(ae,{})}),D(`div`,{children:[E(`b`,{children:`Content sources`}),E(`small`,{children:`Sync homepage metadata to SQLite`})]})]}),E(`div`,{className:`provider-list`,children:e.map(e=>D(`article`,{children:[E(`span`,{className:`provider-mark`,children:e.name.slice(0,1).toUpperCase()}),D(`span`,{className:`provider-copy`,children:[E(`b`,{children:e.name}),E(`a`,{href:e.baseUrl,target:`_blank`,rel:`noreferrer`,children:new URL(e.baseUrl).hostname}),E(`small`,{children:e.lastError||(e.lastSyncedAt?`Synced ${new Date(e.lastSyncedAt).toLocaleString()}`:`Not synced yet`)})]}),E(`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`?E(f,{className:`spin`}):E(x,{})})]},e.id))}),t&&E(`p`,{className:`source-message`,role:`status`,children:t}),D(`button`,{className:`add-movie-button`,onClick:r,children:[E(b,{}),` Add movie from link`]})]})}function qe({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 D(`div`,{className:`nav-popover downloads-popover`,children:[E(`div`,{className:`popover-caret`}),D(`div`,{className:`downloads-heading`,children:[E(`span`,{children:E(C,{})}),D(`div`,{children:[E(`b`,{children:`Downloads`}),E(`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?E(`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 D(`article`,{className:`download-item download-item--${e.downloadStatus}`,children:[E(`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:E(`span`,{className:`download-thumb-play`,"aria-hidden":`true`,children:E(y,{fill:`currentColor`})})}),D(`div`,{className:`download-copy`,children:[D(`div`,{children:[E(`b`,{children:e.title}),E(`span`,{className:`download-status-icon`,"aria-hidden":`true`,children:e.downloadStatus===`ready`?E(h,{}):e.downloadStatus===`failed`?E(p,{}):E(f,{className:r?`spin`:``})})]}),E(`small`,{children:i}),E(`div`,{className:`download-progress`,role:`progressbar`,"aria-label":`${e.title} download progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n,children:E(`span`,{style:{width:`${n}%`}})}),e.downloadError&&E(`em`,{title:e.downloadError,children:e.downloadError})]})]},e.id)})}):D(`div`,{className:`downloads-empty`,children:[E(C,{}),E(`b`,{children:`Your downloads will appear here`}),E(`small`,{children:`Add a movie from the Sources menu to get started.`})]})]})}function Je(){return D(`div`,{className:`nav-popover notification-popover`,children:[E(`div`,{className:`popover-caret`}),D(`article`,{children:[E(`span`,{className:`notification-thumb notification-thumb--one`}),D(`span`,{children:[E(`b`,{children:`New Arrival`}),E(`small`,{children:`What We Watched is now available.`}),E(`em`,{children:`2 days ago`})]})]}),D(`article`,{children:[E(`span`,{className:`notification-thumb notification-thumb--two`}),D(`span`,{children:[E(`b`,{children:`Top picks for you`}),E(`small`,{children:`Explore this week's most watched.`}),E(`em`,{children:`5 days ago`})]})]})]})}function Ye({profiles:e,activeProfile:t,onSelectProfile:n,onManageProfiles:i}){return D(`div`,{className:`nav-popover profile-popover`,children:[E(`div`,{className:`popover-caret`}),e.map(e=>D(`button`,{type:`button`,className:`profile-option`,"aria-current":e.id===t.id?`true`:void 0,onClick:()=>void n(e),children:[E(`span`,{className:`mini-avatar`,style:{backgroundColor:e.avatarColor},children:e.name.slice(0,1).toUpperCase()}),E(`span`,{children:e.name}),e.id===t.id&&E(h,{className:`profile-active-check`,"aria-label":`Active profile`})]},e.id)),D(`button`,{type:`button`,onClick:i,children:[E(_,{}),`Manage profile`]}),D(`a`,{href:`#account`,children:[E(_e,{}),`Account`]}),D(`a`,{href:`#help`,children:[E(r,{}),`Help Center`]}),D(`a`,{className:`profile-signout`,href:`#signout`,children:[E(N,{}),`Sign out of Netflix`]})]})}function Xe({profileId:e,onClose:t,onImported:n}){let r=q(),[i,a]=M(``),[o,s]=M(!1),[c,l]=M(!1),[u,d]=M(``);return E(`div`,{className:`modal-backdrop add-movie-backdrop`,onMouseDown:t,children:D(`article`,{ref:r,className:`add-movie-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-movie-title`,onMouseDown:e=>e.stopPropagation(),children:[E(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:t,children:E(p,{})}),E(`span`,{className:`add-movie-icon`,children:E(w,{})}),E(`h2`,{id:`add-movie-title`,children:`Add a movie`}),E(`p`,{children:`Paste a supported movie page. Metadata is stored in SQLite and the video can stream directly from its provider.`}),D(`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:[E(`label`,{htmlFor:`movie-url`,children:`Movie link`}),E(`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)}),E(`small`,{children:`Supported: phimhdcss.com, phimhdcss.net, and fsharetv.com`}),D(`label`,{className:`offline-option`,children:[E(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.currentTarget.checked)}),D(`span`,{children:[E(`b`,{children:`Save an offline copy`}),E(`small`,{children:`Optional. Downloads the media and subtitles into the local data folder.`})]})]}),u&&E(`p`,{className:`form-error`,role:`alert`,children:u}),D(`div`,{className:`add-movie-actions`,children:[E(`button`,{type:`button`,className:`button button--secondary`,onClick:t,children:`Cancel`}),D(`button`,{type:`submit`,className:`button button--primary`,disabled:c,children:[c?E(f,{className:`spin`}):o?E(C,{}):E(y,{fill:`currentColor`}),c?`Fetching movie…`:o?`Add & download`:`Add & stream`]})]})]})]})})}function Ze({title:e,previewPaused:t,setPreviewPaused:n,onPlay:r,onMoreInfo:i}){let a={"--hero-image":`url("${e.backdropImage}")`,"--hero-accent":e.accentColor};return D(`section`,{className:`hero${t?` hero--paused`:``}`,id:`top`,style:a,children:[E(`div`,{className:`hero-backdrop`}),E(`div`,{className:`hero-vignette`}),D(`div`,{className:`hero-content`,children:[D(`p`,{className:`netflix-series`,children:[E(`span`,{children:`N`}),` SERIES`]}),e.logoImage?D(ue,{children:[E(`h1`,{className:`visually-hidden`,children:e.title}),E(`img`,{className:`hero-title-logo`,src:e.logoImage,alt:``,"aria-hidden":`true`})]}):E(`h1`,{children:e.title}),D(`p`,{className:`hero-rank`,children:[D(`span`,{children:[`TOP`,E(`br`,{}),`10`]}),`#`,e.rank??1,` in TV Shows Today`]}),E(`p`,{className:`hero-description`,children:e.synopsis}),D(`div`,{className:`hero-actions`,children:[D(`button`,{className:`button button--primary`,onClick:r,children:[E(y,{fill:`currentColor`}),` Play`]}),D(`button`,{className:`button button--secondary`,onClick:i,children:[E(he,{}),` More Info`]})]})]}),D(`div`,{className:`hero-side-controls`,children:[E(`button`,{className:`round-button`,"aria-label":t?`Resume preview motion`:`Pause preview motion`,onClick:()=>n(!t),children:E(t?y:d,{fill:`currentColor`})}),E(`span`,{className:`maturity-badge`,children:e.maturityRating})]}),E(`div`,{className:`hero-scroll-cue`,children:E(S,{})})]})}function Qe({row:e,rowIndex:n,myList:r,likedTitles:i,onSelect:a,onPlay:o,onToggleMyList:s,onToggleLike:c}){let l=j(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 D(`section`,{className:`title-row title-row--${e.kind}`,id:n===0?`new-popular`:e.id,"aria-labelledby":`${e.id}-heading`,children:[D(`div`,{className:`row-heading`,children:[E(`h2`,{id:`${e.id}-heading`,children:e.title}),D(`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 `,E(v,{})]})]}),D(`div`,{className:`rail-shell`,children:[E(`button`,{className:`rail-control rail-control--left`,"aria-label":`Scroll ${e.title} left`,onClick:()=>u(-1),children:E(t,{})}),E(`div`,{className:`title-rail`,ref:l,children:e.items.map((t,n)=>E($e,{title:t,index:n,kind:e.kind,isInMyList:r.has(t.id),isLiked:i.has(t.id),onSelect:()=>a(t),onPlay:()=>o(t),onPlayEpisode:e=>o(t,e),onToggleMyList:()=>s(t),onToggleLike:()=>c(t)},`${e.id}-${t.id}`))}),E(`button`,{className:`rail-control rail-control--right`,"aria-label":`Scroll ${e.title} right`,onClick:()=>u(1),children:E(v,{})})]})]})}function $e({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)),g=f?o:a;return D(`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:g,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())},children:[u&&E(`span`,{className:`rank-number`,"aria-hidden":`true`,children:e.rank??t+1}),D(`div`,{className:`card-visual`,children:[E(`img`,{src:p,alt:``,loading:`lazy`}),E(`div`,{className:`card-image-shade`}),e.isOriginal&&D(`span`,{className:`card-n`,children:[`N`,E(`small`,{children:e.mediaType===`movie`?`FILM`:`SERIES`})]}),e.isNew&&E(`span`,{className:`new-season`,children:`New`}),E(`span`,{className:`card-title-fallback`,children:e.title})]}),n===`continue-watching`&&D(ue,{children:[E(`span`,{className:`resume-checkpoint`,children:e.resumeEpisode?`E${e.resumeEpisode} · ${Y(e.resumePositionSeconds??0)}`:Y(e.resumePositionSeconds??0)}),E(`div`,{className:`progress-track`,role:`progressbar`,"aria-label":`${e.title} watch progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m,children:E(`span`,{style:{width:`${m}%`}})})]}),D(`div`,{className:`card-details`,onClick:e=>e.stopPropagation(),children:[D(`div`,{className:`card-controls`,children:[E(`button`,{"aria-label":`Play ${e.title}`,onClick:o,children:E(y,{fill:`currentColor`})}),E(`button`,{"aria-label":r?`Remove from My List`:`Add to My List`,onClick:c,children:E(r?h:b,{})}),E(`button`,{className:i?`is-active`:``,"aria-label":i?`Remove rating`:`I like this`,"aria-pressed":i,onClick:l,children:E(ve,{fill:i?`currentColor`:`none`})}),E(`button`,{className:`card-more-button`,"aria-label":`More information about ${e.title}`,onClick:a,children:E(S,{})})]}),D(`div`,{className:`card-meta`,children:[D(`strong`,{children:[e.match,`% Match`]}),E(`span`,{className:`mini-maturity`,children:e.maturityRating}),E(`span`,{children:e.duration}),e.isHD&&E(`span`,{className:`quality-badge`,children:`HD`})]}),E(`p`,{children:e.genres.slice(0,3).join(` • `)}),e.episodes?.length?E(`div`,{className:`card-episode-strip`,"aria-label":`${e.title} episodes`,children:e.episodes.map(t=>D(`button`,{type:`button`,"aria-label":`Play ${t.title}`,title:t.title,onClick:()=>s(t.episode),children:[E(`img`,{src:t.image||e.backdropImage,alt:``,loading:`lazy`}),E(`span`,{children:t.episode})]},t.id||t.episode))}):null]})]})}function et({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 D(`section`,{className:`netflix-search-page`,"aria-label":o?`Search results for ${e}`:`Search titles`,children:[E(`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&&E(`p`,{className:`netflix-search-notice`,role:`alert`,children:r}),o?t.length?E(`div`,{className:`netflix-search-grid`,children:t.map(e=>D(`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:[D(`span`,{className:`netflix-search-artwork`,children:[E(`img`,{src:e.backdropImage,alt:``}),i===e.id&&E(f,{className:`netflix-search-loader spin`})]}),E(`span`,{className:`netflix-search-title`,title:e.title,children:e.title})]},`${e.sourceProvider??`catalog`}:${e.id}`))}):s?D(`div`,{className:`empty-search`,children:[E(f,{className:`spin`}),E(`h2`,{children:`Searching all providers`}),E(`p`,{children:`PhimHDC results will be preferred when the same movie is found.`})]}):D(`div`,{className:`empty-search`,children:[E(m,{}),E(`h2`,{children:`No matches found`}),E(`p`,{children:`Try a title, actor, director, or genre.`})]}):D(`div`,{className:`empty-search`,children:[E(m,{}),E(`h2`,{children:`Find something to watch`}),E(`p`,{children:`Search by movie, series, actor, director, or genre.`})]})]})}function tt({title:e,isInMyList:t,isLiked:n,onClose:r,onPlay:i,onToggleMyList:a,onToggleLike:o}){let s=q(),c=e.episodes?.length?e.episodes:e.episode?[e.episode]:[];return E(`div`,{className:`modal-backdrop`,role:`presentation`,onMouseDown:r,children:D(`article`,{ref:s,className:`details-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`${e.title} details`,onMouseDown:e=>e.stopPropagation(),children:[E(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:r,children:E(p,{})}),E(`div`,{className:`modal-hero`,style:{"--modal-image":`url("${e.backdropImage}")`},children:D(`div`,{className:`modal-hero-content`,children:[D(`p`,{className:`netflix-series`,children:[E(`span`,{children:`N`}),` `,e.mediaType===`movie`?`FILM`:`SERIES`]}),E(`h2`,{children:e.title}),D(`div`,{className:`modal-actions`,children:[D(`button`,{className:`button button--primary`,onClick:()=>i(),disabled:!!(e.sourceProvider&&!e.playbackPath&&!e.canStream),children:[E(y,{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`]}),E(`button`,{className:`round-button`,"aria-label":t?`Remove from My List`:`Add to My List`,onClick:a,children:E(t?h:b,{})}),E(`button`,{className:`round-button${n?` is-active`:``}`,"aria-label":n?`Remove rating`:`I like this`,"aria-pressed":n,onClick:o,children:E(ve,{fill:n?`currentColor`:`none`})})]})]})}),D(`div`,{className:`modal-body`,children:[D(`div`,{className:`modal-main-copy`,children:[e.sourceProvider&&D(`div`,{className:`download-state download-state--${e.downloadStatus}`,children:[e.downloadStatus===`ready`?E(h,{}):e.downloadStatus===`metadata`?E(w,{}):E(C,{}),D(`span`,{children:[E(`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}%`}),E(`small`,{children:e.downloadError||`Source: ${e.sourceProvider} · Metadata stored in SQLite`})]})]}),D(`div`,{className:`modal-meta`,children:[D(`strong`,{children:[e.match,`% Match`]}),E(`span`,{children:e.year}),E(`span`,{children:e.duration}),E(`span`,{className:`quality-badge`,children:`HD`}),e.hasAudioDescription&&E(`span`,{className:`quality-badge`,children:`AD`})]}),E(`span`,{className:`modal-maturity`,children:e.maturityRating}),E(`p`,{className:`modal-synopsis`,children:e.synopsis})]}),D(`dl`,{className:`modal-facts`,children:[D(`div`,{children:[E(`dt`,{children:`Cast:`}),E(`dd`,{children:e.cast.slice(0,4).join(`, `)})]}),D(`div`,{children:[E(`dt`,{children:`Genres:`}),E(`dd`,{children:e.genres.join(`, `)})]}),e.creators?.length?D(`div`,{children:[E(`dt`,{children:`Creators:`}),E(`dd`,{children:e.creators.join(`, `)})]}):null]})]}),c.length>0&&D(`div`,{className:`episode-panel`,children:[D(`header`,{className:`episode-panel-header`,children:[E(`h3`,{children:`Episodes`}),D(`span`,{children:[`Season `,c[0].season,` · `,c.length,` episodes`]})]}),E(`div`,{className:`episode-card-list`,children:c.map(t=>D(`button`,{className:`episode-card`,"aria-label":`Play ${t.title}`,onClick:()=>i(t.episode),children:[E(`span`,{className:`episode-number`,children:t.episode}),E(`span`,{className:`episode-image`,style:{backgroundImage:`linear-gradient(90deg, transparent, rgba(0,0,0,.25)), url("${t.image||e.backdropImage}")`},children:E(y,{fill:`currentColor`})}),D(`span`,{className:`episode-copy`,children:[E(`b`,{children:t.title}),E(`small`,{children:t.duration}),E(`em`,{children:t.synopsis||e.tagline||e.synopsis})]})]},t.id||t.episode))})]})]})})}var J=4140,nt=`home-atom:subtitle-preferences`,rt={x:50,y:78},it={label:`English`,language:`en`,src:`demo`};function at(e){return{x:Math.max(7,Math.min(93,e.x)),y:Math.max(10,Math.min(86,e.y))}}function ot(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 st(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 ct(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 lt({title:e,profileId:t,subtitlePreferences:r,onProgressChange:m,onSubtitlePreferencesChange:_,onSwitchTitle:v,onClose:te}){let b=q(),x=j(null),S=j(null),C=j(0),ae=j(null),w=j(null),ce=j(null),T=j(null),O=j(null),fe=j(null),he=j(!1),N=j(null),ge=j(!0),ve=j(null),P=j(!1),ye=j(new Set),be=j(0),xe=j(()=>{}),[Se]=M(oe),[Ce,we]=M(e.episodes??[]),[Te,F]=M(e.subtitles??[]),I=Ce[0]?.episode,L=e.episode?.episode||I||1,Ee=Ce.find(e=>e.episode===L)||e.episode,De=!!(e.playbackPath&&(!I||L===I)),Oe=!!(e.sourceProvider&&e.canStream&&!De),R=e.resumeEpisode===void 0||e.resumeEpisode===L?Math.max(0,e.resumePositionSeconds??0):0,ke=e.resumeDurationSeconds&&e.resumeDurationSeconds>0?e.resumeDurationSeconds:ct(Ee?.duration),Ae=ke>0?R/ke*100:0,[z,B]=M(!1),V=j(!1),[H,U]=M(!1),[W,je]=M(1),Me=j(1),[G,K]=M(r.captionsOn),[Ne,Pe]=M(!1),[Fe,Ie]=M(0),[Le,Re]=M([]),[ze,Be]=M(r.fontSize),[Ve,He]=M({x:r.positionX,y:r.positionY}),[Ue,We]=M(r.fontColor),[Ge,Ke]=M(r.backgroundColor),[qe,Je]=M(r.fontFamily),Ye=j({fontSize:r.fontSize,positionX:r.positionX,positionY:r.positionY,fontColor:r.fontColor,backgroundColor:r.backgroundColor,fontFamily:r.fontFamily,captionsOn:r.captionsOn}),[Xe,Ze]=M(!0),[Qe,$e]=M(!1),[et,tt]=M(!1),[J,lt]=M(L),[X,ut]=M(ke),[Z,dt]=M(R),[ft,pt]=M(Math.min(100,Ae+4)),[mt,ht]=M(1),[gt,_t]=M(!1),[vt,yt]=M(``),[bt,xt]=M(Oe?`Connecting to provider…`:``),[St,Ct]=M(Oe),[Q,wt]=M(De&&e.playbackPath?{path:e.playbackPath,kind:e.playbackKind===`hls`?`hls`:`file`}:null),[Tt,Et]=M(!1),[Dt,Ot]=M(null),[$,kt]=M(null),[At,jt]=M(null),[Mt,Nt]=M(!1),[Pt,Ft]=M(!1),[It,Lt]=M(!1),Rt=j(null),zt=j(null);j(null);let Bt=j(!1),Vt=j(``),Ht=!!(e.playbackPath||e.sourceProvider&&e.canStream),Ut=Math.max(8,(e.episode?.episode??1)+2),Wt=de(()=>Ce.length?Ce.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:Ut},(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===J?e.synopsis:e.tagline??e.synopsis,image:e.backdropImage,subtitles:[]}}),[J,Ut,Ce,e.backdropImage,e.episode,e.synopsis,e.tagline]),Gt=X>0?Z/X*100:0,Kt=Wt.find(e=>e.number===J)??Wt[0],qt=Wt.findIndex(e=>e.number===J),Jt=qt>=0&&qt<Wt.length-1,Yt=Kt?.season??Ee?.season??1,Xt=Kt?.subtitles.length?Kt.subtitles:Te,Zt=Xt.length>0?Xt:Ht?[]:[it],Qt=Math.min(Fe,Math.max(0,Zt.length-1)),$t=Zt.length>0,en={"--player-progress":`${Gt}%`,"--player-buffered":`${Math.max(Gt,ft)}%`},tn=de(()=>{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??Kt?.title??e.title}`,`– ${n}`]},[Kt?.title,e.synopsis,e.tagline,e.title]),nn=Ht?Le:tn,rn=j({seasonNumber:Yt,episodeNumber:J,positionSeconds:Z,durationSeconds:X});A(()=>{rn.current={seasonNumber:Yt,episodeNumber:J,positionSeconds:Z,durationSeconds:X}},[J,Z,X,Yt]);let an=k((n={},r=!1)=>{let i={...rn.current,...n};if(i.positionSeconds<1&&!i.completed)return;let a=[i.seasonNumber,i.episodeNumber,Math.round(i.positionSeconds*10),Math.round(i.durationSeconds*10),!!i.completed].join(`:`);if(Vt.current===a)return;Vt.current=a;let o=!!i.completed||i.durationSeconds>0&&i.positionSeconds/i.durationSeconds>=.95,s={titleId:e.id,seasonNumber:i.seasonNumber,episodeNumber:i.episodeNumber,positionSeconds:i.positionSeconds,durationSeconds:i.durationSeconds,completed:o,updatedAt:new Date().toISOString()};m(s),fetch(`/api/netflix/progress`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({profileId:t,...s}),keepalive:r}).then(async e=>{if(!e.ok)throw Error();m(await e.json())}).catch(()=>{r||yt(`Watch position could not be saved`)})},[m,t,e.id]);A(()=>{let e=window.setInterval(()=>an(),5e3),t=()=>{document.visibilityState===`hidden`&&an({},!0)},n=()=>an({},!0);return document.addEventListener(`visibilitychange`,t),window.addEventListener(`beforeunload`,n),()=>{window.clearInterval(e),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`beforeunload`,n),an({},!0)}},[an]),A(()=>{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`?kt(e.timeSeconds):e.markerType===`outro`&&jt(e.timeSeconds)}).catch(()=>{}),()=>n.abort()},[e.id,t]),A(()=>($!==null&&Z>=0&&Z<=$&&!z?(Pt||Ft(!0),zt.current!==null&&window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{Ft(!1),zt.current=null},8e3)):Pt&&(Z>($??0)||z)&&Ft(!1),At!==null&&Z>=At&&X>0&&!z&&Jt?It||Lt(!0):It&&(Z<(At??1/0)||z)&&Lt(!1),()=>{zt.current!==null&&window.clearTimeout(zt.current)}),[Z,$,At,z,Pt,It,X,Jt]),A(()=>{if(!Mt)return;let e=e=>{e.target instanceof Node&&!Rt.current?.contains(e.target)&&Nt(!1)},t=e=>{e.key===`Escape`&&Nt(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Mt]),A(()=>{let n=!!(e.playbackPath&&(!I||J===I));if(!e.sourceProvider||!e.canStream||n)return;let r=new AbortController,i=new URLSearchParams({profileId:t});return e.episodes?.length&&i.set(`episode`,String(J)),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};we(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)&&F(t.subtitles);wt({path:t.path,kind:t.kind}),xt(``),Ct(!1)}).catch(e=>{r.signal.aborted||(xt(e instanceof Error?e.message:`The provider stream is unavailable.`),Ct(!1),B(!0))}),()=>r.abort()},[J,I,e.canStream,e.episodes,e.id,e.playbackPath,e.sourceProvider,t]),A(()=>{let e=x.current;if(!e||!Q)return;let t=!1,n=()=>{};return Q.kind===`hls`&&!e.canPlayType(`application/vnd.apple.mpegurl`)?import(`./hls-CgexCc5Z.js`).then(({default:e})=>{if(t||!x.current||!e.isSupported())return;let r=new e;r.loadSource(Q.path),r.attachMedia(x.current),r.on(e.Events.MANIFEST_PARSED,()=>{t||(V.current?x.current?.pause():x.current?.play().catch(()=>B(!0)))}),r.on(e.Events.ERROR,(e,n)=>{n.fatal&&!t&&(xt(`The provider stream stopped unexpectedly.`),B(!0))}),n=()=>r.destroy()}):(e.src=Q.path,V.current?e.pause():e.play().catch(()=>B(!0))),()=>{t=!0,n(),e.removeAttribute(`src`),e.load()}},[Q]),A(()=>{V.current=z;let e=x.current;e&&(z?e.pause():e.play().catch(()=>B(!0)))},[z]),A(()=>{let e=x.current;e&&(e.playbackRate=mt)},[mt]),A(()=>{let e=x.current;W>0&&(Me.current=W),e&&(e.volume=W)},[Q,W]),A(()=>{let e=x.current;if(!e){Re([]);return}let t=Array.from(e.textTracks),n=t[Qt],r=()=>{Re(G&&n?st(n):[])};for(let[e,n]of t.entries())n.mode=G&&e===Qt?`hidden`:`disabled`;return n?.addEventListener(`cuechange`,r),r(),()=>{n?.removeEventListener(`cuechange`,r)}},[J,G,Q,Qt,Xt.length]),A(()=>{let e=window.requestAnimationFrame(()=>{try{window.localStorage.getItem(nt)&&window.localStorage.removeItem(nt)}catch{}});return()=>window.cancelAnimationFrame(e)},[]),A(()=>{if(!Xe)return;if(ge.current){ge.current=!1;return}let e={fontSize:ze,positionX:Ve.x,positionY:Ve.y,fontColor:Ue,backgroundColor:Ge,fontFamily:qe,captionsOn:G},n=Ye.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 N.current!==null&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,Ye.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&&_(await e.json())}).catch(()=>{})},600),()=>{N.current!==null&&window.clearTimeout(N.current)}},[t,ze,Ve,Ue,Ge,qe,G,Xe,_]),A(()=>{if(!Ne)return;let e=e=>{e.target instanceof Node&&!T.current?.contains(e.target)&&Pe(!1)},t=e=>{e.key===`Escape`&&Pe(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Ne]),A(()=>{if(!G||!nn.length)return;let e=()=>{let e=b.current?.getBoundingClientRect(),t=O.current?.getBoundingClientRect();!e||!t||He(n=>{let r=ot(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)}},[G,b,ze,nn]),A(()=>{if(Ht||z)return;let e=window.setInterval(()=>{dt(e=>{let t=e+.5,n=Math.min(t,X);return rn.current.positionSeconds=n,n})},500);return()=>window.clearInterval(e)},[X,Ht,z]),A(()=>{if(Ht||z||X<=0||Z<X)return;an({positionSeconds:X,completed:!0});let e=window.requestAnimationFrame(()=>B(!0));return()=>window.cancelAnimationFrame(e)},[Z,X,Ht,z,an]),A(()=>{let e=()=>_t(document.fullscreenElement===b.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[b]),A(()=>()=>{w.current&&window.clearTimeout(w.current)},[]);let on=k(()=>{Et(!1),ce.current&&window.clearTimeout(ce.current),ce.current=window.setTimeout(()=>Et(!0),5e3)},[]);A(()=>{if(z||et||Ne||Qe||Mt){ce.current&&window.clearTimeout(ce.current);let e=window.requestAnimationFrame(()=>Et(!1));return()=>window.cancelAnimationFrame(e)}let e=window.requestAnimationFrame(on),t=b.current;if(!t)return()=>window.cancelAnimationFrame(e);let n=[`mousemove`,`mousedown`,`keydown`,`touchstart`,`scroll`];for(let e of n)t.addEventListener(e,on);return()=>{window.cancelAnimationFrame(e);for(let e of n)t.removeEventListener(e,on);ce.current&&window.clearTimeout(ce.current)}},[et,Mt,z,b,on,Qe,Ne]);let sn=e=>{let t=Math.max(0,Math.min(X,e));x.current&&(x.current.currentTime=t),rn.current.positionSeconds=t,dt(t)},cn=k(()=>{let e=S.current;if(!e||e.readyState<HTMLMediaElement.HAVE_METADATA)return;let t=C.current,n=Number.isFinite(e.duration)&&e.duration>0?Math.max(0,e.duration-.05):t;try{e.currentTime=Math.min(t,n)}catch{}},[]),ln=e=>{C.current=e,ae.current===null&&(ae.current=window.requestAnimationFrame(()=>{ae.current=null,cn()}))},un=e=>{let t=Math.max(0,Math.min(X,e));ln(t),Ot({position:X>0?t/X*100:0,time:t})},dn=(e,t)=>{let n=t.getBoundingClientRect(),r=n.width>0?Math.max(0,Math.min(1,(e-n.left)/n.width)):0;un(r*X)};A(()=>{let e=S.current;if(!e||!Q)return;let t=!1,n=()=>{};return Q.kind===`hls`&&!e.canPlayType(`application/vnd.apple.mpegurl`)?import(`./hls-CgexCc5Z.js`).then(({default:e})=>{if(t||!S.current||!e.isSupported())return;let r=new e;r.loadSource(Q.path),r.attachMedia(S.current),r.on(e.Events.MANIFEST_PARSED,()=>{t||cn()}),n=()=>r.destroy()}):(e.src=Q.path,e.load()),()=>{t=!0,n(),ae.current!==null&&(window.cancelAnimationFrame(ae.current),ae.current=null),e.removeAttribute(`src`),e.load()}},[Q,cn]);let fn=()=>{let e=x.current;if(e){e.paused?e.play():e.pause();return}B(e=>(V.current=!e,!e))},pn=e=>{!e&&W<=0&&je(Me.current||1),U(e)},mn=(e,t=!1)=>{let n=e.currentTime;Number.isFinite(e.duration)&&e.duration>0&&(rn.current.durationSeconds=e.duration,ut(e.duration),t&&!Bt.current&&R>0&&(n=Math.min(R,Math.max(0,e.duration-.1)),e.currentTime=n,Bt.current=!0),e.buffered.length&&pt(e.buffered.end(e.buffered.length-1)/e.duration*100)),Number.isFinite(n)&&(rn.current.positionSeconds=n,dt(n))},hn=()=>{let e=[1,1.25,1.5,.75],t=e.indexOf(mt);ht(e[(t+1)%e.length])},gn=async()=>{try{document.fullscreenElement===b.current?await document.exitFullscreen():await b.current?.requestFullscreen()}catch{yt(`Fullscreen is unavailable in this window`)}},_n=()=>{w.current&&window.clearTimeout(w.current),yt(`Thanks — the playback issue was reported`),w.current=window.setTimeout(()=>yt(``),2600)},vn=n=>{let r=Z;n===`intro`?kt(r):jt(r),Nt(!1),yt(n===`intro`?`Intro end set at ${Y(r)}`:`Outro start set at ${Y(r)}`),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>yt(``),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(()=>{yt(`Marker could not be saved`)})},yn=n=>{n===`intro`?kt(null):jt(null),Nt(!1),yt(n===`intro`?`Intro marker removed`:`Outro marker removed`),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>yt(``),2600),fetch(`/api/netflix/markers`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({titleId:e.id,markerType:n,profileId:t})}).catch(()=>{yt(`Marker could not be removed`)})},bn=e=>{let t=fe.current,n=b.current?.getBoundingClientRect();!t||t.pointerId!==e.pointerId||!n||He(ot({x:(e.clientX-t.offsetX-n.left)/n.width*100,y:(e.clientY-t.offsetY-n.top)/n.height*100},n,e.currentTarget.getBoundingClientRect()))},xn=e=>{if(e.button!==0)return;let t=b.current?.getBoundingClientRect();t&&(e.preventDefault(),e.stopPropagation(),fe.current={pointerId:e.pointerId,offsetX:e.clientX-(t.left+Ve.x/100*t.width),offsetY:e.clientY-(t.top+Ve.y/100*t.height)},e.currentTarget.setPointerCapture(e.pointerId),$e(!0),V.current?he.current=!1:(he.current=!0,V.current=!0,B(!0)))},Sn=e=>{fe.current?.pointerId===e.pointerId&&(bn(e),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),fe.current=null,$e(!1),he.current&&(he.current=!1,V.current=!1,B(!1)))},Cn=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=b.current?.getBoundingClientRect(),i=e.currentTarget.getBoundingClientRect();He(e=>{let a={x:e.x+t.x*n,y:e.y+t.y*n};return r?ot(a,r,i):at(a)})},wn=e=>{if(e===null){K(!1),Re([]);return}Ie(e),K(!0)},Tn=t=>{if(tt(!1),Pe(!1),t===J)return;an();let n=Wt.find(e=>e.number===t),r=!!(e.playbackPath&&(!I||t===I));lt(t),Bt.current=!0,Vt.current=``,dt(0),pt(0);let i=ct(n?.duration);rn.current={seasonNumber:n?.season??1,episodeNumber:t,positionSeconds:0,durationSeconds:i},ut(i),V.current=!1,B(!1),!n?.subtitles.length&&!e.subtitles?.length&&K(!1),r&&e.playbackPath?(wt({path:e.playbackPath,kind:e.playbackKind===`hls`?`hls`:`file`}),xt(``),Ct(!1)):e.sourceProvider&&e.canStream&&(wt(null),xt(`Loading ${n?.title||`Episode ${t}`}…`),Ct(!0))},En=()=>{let e=Wt[qt+1];e&&Tn(e.number)};A(()=>{ve.current={sessionId:Se,profileId:t,titleId:e.id,title:e.title,artwork:Kt?.image||e.backdropImage,seasonNumber:Yt,episodeNumber:J,episodeTitle:Kt?.title||`Episode ${J}`,episodes:Wt.map(e=>({season:e.season,number:e.number,title:e.title})),currentTime:Z,duration:X,paused:z,muted:H,volume:W,subtitles:{available:$t,captionsOn:G,fontSize:ze,fontColor:Ue,backgroundColor:Ge},machineName:se(),deviceType:ie(),updatedAt:Date.now()}});let Dn=k(()=>{if(P.current)return;let e=ve.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 A(()=>{xe.current=e=>{switch(e.type){case`set-paused`:{let t=x.current;V.current=e.paused,B(e.paused),t&&(e.paused?t.pause():t.play().catch(()=>B(!0)));break}case`seek-relative`:sn(rn.current.positionSeconds+e.seconds);break;case`seek-to`:sn(e.seconds);break;case`set-muted`:pn(e.muted);break;case`set-volume`:{let t=Math.max(0,Math.min(1,e.volume));t>0&&(Me.current=t),je(t),U(t<=0);break}case`next-episode`:En();break;case`select-episode`:Tn(e.episodeNumber);break;case`switch-title`:v(e.titleId).catch(()=>{yt(`Movie could not be switched`)});break;case`switch-track`:case`switch-playlist`:break;case`set-captions`:K(e.enabled&&$t),e.enabled||Re([]);break;case`set-subtitle-font-size`:Be(Math.max(18,Math.min(64,e.fontSize)));break;case`set-subtitle-font-color`:We(e.color);break;case`set-subtitle-background`:Ke(e.background);break;case`reset-subtitle-position`:He(rt);break}window.requestAnimationFrame(Dn)}}),A(()=>{P.current=!1,be.current=0;let e=!1,n=null,r=new AbortController,i=()=>{if(!P.current){P.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:Se,profileId:t}),cache:`no-store`,keepalive:!0}).catch(()=>{})}},a=async()=>{if(!(e||P.current||r.signal.aborted)){try{let e=be.current,n=await fetch(`/api/netflix/activity/${encodeURIComponent(Se)}/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!==Se)continue;let o={kind:`command`,sessionId:Se,command:n.command};!re(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&&!P.current&&!r.signal.aborted&&(n=window.setTimeout(()=>void a(),Math.min(500,le)))}};window.addEventListener(`pagehide`,i),Dn();let o=window.setInterval(Dn,le);return a(),()=>{e=!0,window.clearInterval(o),n!==null&&window.clearTimeout(n),window.removeEventListener(`pagehide`,i),i()}},[Se,t,Dn]),A(()=>{Dn()},[J,G,X,$t,H,z,Ge,Ue,ze,W,Dn]),D(`section`,{ref:b,className:`player${z?` player--paused`:``}${Ht?` player--local`:``}${Tt?` player--idle`:``}`,role:`dialog`,"aria-modal":`true`,"aria-label":`Playing ${e.title}`,style:{"--player-image":`url("${e.backdropImage}")`},children:[Ht&&E(`video`,{ref:x,className:`player-video`,autoPlay:!0,playsInline:!0,muted:H,poster:e.backdropImage,onClick:fn,onLoadedMetadata:e=>mn(e.currentTarget,!0),onProgress:e=>mn(e.currentTarget),onTimeUpdate:e=>mn(e.currentTarget),onPlay:()=>{V.current=!1,B(!1)},onPause:()=>{V.current=!0,B(!0),an()},onEnded:()=>{let e=x.current,t=e&&Number.isFinite(e.duration)?e.duration:X;dt(t),an({positionSeconds:t,durationSeconds:t||X,completed:!0}),V.current=!0,B(!0)},onError:()=>{xt(`The browser could not play this provider stream.`),V.current=!0,B(!0)},children:Xt.map(e=>E(`track`,{kind:`subtitles`,src:e.src,srcLang:e.language,label:e.label},`${J}-${e.language}-${e.src}`))}),bt&&D(`div`,{className:`player-stream-status${St?``:` player-stream-status--error`}`,role:`status`,children:[St&&E(f,{className:`spin`}),E(`span`,{children:bt})]}),E(`div`,{className:`player-cinematic-bars`}),E(`div`,{className:`player-noise`}),D(`header`,{className:`player-topbar`,children:[E(`button`,{className:`player-icon-button player-back`,onClick:()=>{an(),te()},"aria-label":`Exit player`,children:E(a,{})}),E(`button`,{className:`player-icon-button player-report`,onClick:_n,"aria-label":`Report a problem`,children:E(pe,{})})]}),G&&nn.length>0&&E(`div`,{ref:O,className:`player-subtitles${Qe?` player-subtitles--dragging`:``}`,style:{"--player-subtitle-font-size":`${ze}px`,"--player-subtitle-color":Ue,"--player-subtitle-bg":Ge,"--player-subtitle-font-family":qe==="default"?void 0:qe,left:`${Ve.x}%`,top:`${Ve.y}%`},role:`group`,"aria-label":`Draggable subtitles`,"aria-live":`polite`,tabIndex:0,onClick:e=>e.stopPropagation(),onKeyDown:Cn,onPointerDown:xn,onPointerMove:bn,onPointerUp:Sn,onPointerCancel:Sn,children:nn.map((e,t)=>E(`span`,{children:e},`${t}-${e}`))}),et&&D(`aside`,{className:`player-episodes`,"aria-label":`Episodes`,children:[E(`h2`,{children:e.mediaType===`limited-series`?`Limited Series`:`Season ${Yt}`}),E(`div`,{className:`player-episode-list`,children:Wt.map(e=>{let t=e.number===J;return D(`button`,{className:`player-episode${t?` player-episode--active`:``}`,"aria-label":`${e.number}. ${e.title}, ${e.duration}`,"aria-current":t?`true`:void 0,onClick:()=>Tn(e.number),children:[D(`span`,{className:`player-episode-heading`,children:[E(`span`,{children:e.number}),E(`strong`,{children:e.title}),E(`i`,{"aria-hidden":`true`})]}),t&&D(`span`,{className:`player-episode-details`,children:[E(`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:D(`span`,{className:`player-now-playing`,children:[D(`span`,{className:`player-playing-bars`,"aria-hidden":`true`,children:[E(`i`,{}),E(`i`,{}),E(`i`,{}),E(`i`,{})]}),`Now playing`]})}),E(`span`,{className:`player-episode-synopsis`,children:e.synopsis})]})]},e.number)})})]}),z&&!bt&&E(`button`,{className:`big-play`,onClick:fn,"aria-label":`Resume`,children:E(y,{fill:`currentColor`})}),vt&&E(`div`,{className:`player-notice`,role:`status`,children:vt}),D(`div`,{className:`player-bottom${et?` player-bottom--drawer-open`:``}`,children:[!et&&D(`div`,{className:`player-timeline-row`,children:[D(`div`,{className:`player-timeline-wrap${Dt?` player-timeline-wrap--previewing`:``}`,style:{"--seek-preview-position":`${Dt?.position??0}%`},onPointerEnter:e=>dn(e.clientX,e.currentTarget),onPointerMove:e=>dn(e.clientX,e.currentTarget),onPointerLeave:()=>Ot(null),children:[D(`div`,{className:`player-seek-preview`,"aria-hidden":`true`,children:[Q?E(`video`,{ref:S,className:`player-seek-preview-frame`,muted:!0,playsInline:!0,preload:`metadata`,poster:Kt?.image||e.backdropImage,onLoadedMetadata:cn,onSeeked:e=>e.currentTarget.pause()}):E(ue,{children:E(`img`,{src:Kt?.image||e.backdropImage,alt:``,draggable:!1})}),E(`time`,{children:Y(Dt?.time??Z)})]}),E(`input`,{className:`player-timeline`,type:`range`,min:0,max:X||1,step:.1,value:Math.min(Z,X||1),style:en,onFocus:e=>un(Number(e.currentTarget.value)),onBlur:()=>Ot(null),onInput:e=>un(Number(e.currentTarget.value)),onChange:e=>sn(Number(e.currentTarget.value)),"aria-label":`Seek`,"aria-valuetext":`${Y(Z)} of ${Y(X)}`}),$!==null&&X>0&&E(`div`,{className:`player-timeline-marker player-timeline-marker--intro`,style:{left:`${$/X*100}%`},"aria-label":`Intro end at ${Y($)}`}),At!==null&&X>0&&E(`div`,{className:`player-timeline-marker player-timeline-marker--outro`,style:{left:`${At/X*100}%`},"aria-label":`Outro start at ${Y(At)}`}),z&&!bt&&D(`div`,{ref:Rt,className:`player-marker-control`,style:{left:`${Gt}%`},onPointerEnter:e=>{e.stopPropagation(),Ot(null)},onPointerMove:e=>e.stopPropagation(),onPointerLeave:e=>e.stopPropagation(),children:[E(`button`,{className:`player-marker-trigger`,"aria-label":`Timeline marker settings`,"aria-expanded":Mt,onClick:e=>{e.stopPropagation(),Nt(e=>!e)},children:E(_e,{})}),Mt&&D(`div`,{className:`player-marker-menu`,role:`menu`,"aria-label":`Set timeline marker`,children:[D(`button`,{type:`button`,role:`menuitem`,onClick:()=>vn(`intro`),children:[E(g,{}),E(`span`,{children:`Set as Intro`}),$!==null&&E(`small`,{children:Y($)})]}),D(`button`,{type:`button`,role:`menuitem`,onClick:()=>vn(`outro`),children:[E(c,{}),E(`span`,{children:`Set as Outro`}),At!==null&&E(`small`,{children:Y(At)})]}),$!==null&&D(`button`,{type:`button`,role:`menuitem`,className:`player-marker-menu-remove`,onClick:()=>yn(`intro`),children:[E(p,{}),E(`span`,{children:`Remove Intro`}),E(`small`,{children:Y($)})]}),At!==null&&D(`button`,{type:`button`,role:`menuitem`,className:`player-marker-menu-remove`,onClick:()=>yn(`outro`),children:[E(p,{}),E(`span`,{children:`Remove Outro`}),E(`small`,{children:Y(At)})]})]})]})]}),E(`time`,{children:Y(X-Z)})]}),D(`div`,{className:`player-controls`,children:[D(`div`,{className:`player-controls-left`,children:[E(`button`,{className:`player-control-button`,onClick:fn,"aria-label":z?`Play`:`Pause`,children:E(z?y:d,{fill:`currentColor`})}),D(`button`,{className:`player-control-button player-ten-second`,"aria-label":`Rewind 10 seconds`,onClick:()=>sn(Z-10),children:[E(n,{}),E(`span`,{children:`10`})]}),D(`button`,{className:`player-control-button player-ten-second`,"aria-label":`Forward 10 seconds`,onClick:()=>sn(Z+10),children:[E(i,{}),E(`span`,{children:`10`})]}),E(`button`,{className:`player-control-button`,"aria-label":H?`Unmute`:`Mute`,"aria-pressed":H,onClick:()=>pn(!H),children:E(H?ee:ne,{})})]}),D(`div`,{className:`player-program`,children:[E(`strong`,{children:e.title}),D(`span`,{children:[`Season `,Yt,`\xA0\xA0 Episode `,J]})]}),D(`div`,{className:`player-controls-right`,children:[E(`button`,{className:`player-control-button`,"aria-label":`Next episode`,onClick:En,disabled:!Jt,children:E(c,{})}),E(`button`,{className:`player-control-button${et?` is-active player-episodes-trigger`:``}`,"aria-label":et?`Hide episodes`:`Show episodes`,"aria-expanded":et,onClick:()=>{Pe(!1),tt(e=>!e)},children:E(s,{})}),D(`div`,{className:`player-subtitle-control`,ref:T,children:[Ne&&D(`div`,{className:`player-subtitle-menu`,role:`dialog`,"aria-label":`Subtitles`,children:[E(`h2`,{children:`Subtitles`}),D(`div`,{className:`player-subtitle-options`,role:`listbox`,"aria-label":`Subtitle language`,children:[D(`button`,{type:`button`,role:`option`,"aria-selected":!G,onClick:()=>wn(null),children:[E(`span`,{className:`player-subtitle-check`,"aria-hidden":`true`,children:!G&&E(h,{})}),E(`span`,{children:`Off`})]}),Zt.map((e,t)=>{let n=G&&t===Qt;return D(`button`,{type:`button`,role:`option`,"aria-selected":n,onClick:()=>wn(t),children:[E(`span`,{className:`player-subtitle-check`,"aria-hidden":`true`,children:n&&E(h,{})}),E(`span`,{children:e.label})]},`${e.language}-${e.src}`)})]}),D(`div`,{className:`player-subtitle-settings`,children:[D(`div`,{className:`player-subtitle-setting-heading`,children:[E(`label`,{htmlFor:`player-subtitle-font-size`,children:`Font size`}),D(`output`,{htmlFor:`player-subtitle-font-size`,children:[ze,`px`]})]}),D(`div`,{className:`player-subtitle-size-control`,children:[E(`span`,{"aria-hidden":`true`,children:`A`}),E(`input`,{id:`player-subtitle-font-size`,type:`range`,min:18,max:64,step:2,value:ze,"aria-label":`Subtitle font size`,onChange:e=>Be(Number(e.currentTarget.value))}),E(`span`,{"aria-hidden":`true`,children:`A`})]}),D(`div`,{className:`player-subtitle-position-setting`,children:[E(`p`,{children:`Drag subtitles on screen to move them.`}),E(`button`,{type:`button`,onClick:()=>He(rt),children:`Reset position`})]}),D(`div`,{className:`player-subtitle-color-setting`,children:[E(`label`,{htmlFor:`player-subtitle-font-color`,children:`Font color`}),E(`input`,{id:`player-subtitle-font-color`,type:`color`,value:Ue,onChange:e=>We(e.currentTarget.value)})]}),D(`div`,{className:`player-subtitle-color-setting`,children:[E(`label`,{htmlFor:`player-subtitle-bg-color`,children:`Background`}),D(`select`,{id:`player-subtitle-bg-color`,value:Ge,onChange:e=>Ke(e.currentTarget.value),children:[E(`option`,{value:`transparent`,children:`None`}),E(`option`,{value:`rgba(0,0,0,0.75)`,children:`Dark`}),E(`option`,{value:`rgba(0,0,0,0.5)`,children:`Semi-dark`}),E(`option`,{value:`rgba(0,0,0,0.3)`,children:`Light`}),E(`option`,{value:`rgba(0,0,0,1)`,children:`Solid black`})]})]})]})]}),E(`button`,{className:`player-control-button player-subtitle-trigger${G?` is-active`:``}`,"aria-label":$t?`Subtitles`:`Subtitles unavailable`,"aria-haspopup":`dialog`,"aria-expanded":Ne,"aria-pressed":G,disabled:!$t,onClick:()=>{tt(!1),Pe(e=>!e)},children:E(l,{})})]}),D(`button`,{className:`player-control-button player-speed`,"aria-label":`Change playback speed, currently ${mt}x`,onClick:hn,children:[E(me,{}),mt!==1&&D(`span`,{children:[mt,`×`]})]}),E(`button`,{className:`player-control-button`,"aria-label":gt?`Exit fullscreen`:`Enter fullscreen`,onClick:()=>void gn(),children:E(gt?u:o,{})})]})]})]}),Pt&&!z&&E(`button`,{className:`player-skip-intro`,onClick:()=>{$!==null&&sn($),Ft(!1)},children:`Skip Intro`}),It&&!z&&Jt&&D(`button`,{className:`player-next-episode-prompt`,onClick:()=>{Lt(!1),En()},children:[E(y,{fill:`currentColor`}),`Next Episode`]})]})}function X(){return D(`footer`,{className:`site-footer`,id:`footer`,children:[D(`div`,{className:`social-links`,"aria-label":`Social media`,children:[E(`a`,{href:`#facebook`,"aria-label":`Facebook`,children:`f`}),E(`a`,{href:`#instagram`,"aria-label":`Instagram`,children:`◎`}),E(`a`,{href:`#twitter`,"aria-label":`X`,children:`𝕏`}),E(`a`,{href:`#youtube`,"aria-label":`YouTube`,children:`▶`})]}),E(`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=>E(`a`,{href:`#${ut(e)}`,children:e},e))}),E(`span`,{className:`service-code`,children:`Service Code`}),E(`p`,{children:`© 1997–2026 Netflix Clone. Built for demonstration purposes.`})]})}function ut(e){return e.toLowerCase().replace(/&/g,`and`).replace(/ /g,`-`)}export{He as NetflixBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-CkBJG8E2.js";import{a as t,c as n,d as r,f as i,h as a,i as o,l as s,n as c,o as l,p as u,r as d,u as f}from"./refresh-cw-CWdWHjqY.js";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{useEffect as g,useId as _,useMemo as v,useRef as y,useState as b}from"react";import{createPortal as x}from"react-dom";var S=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),C=e(`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`}]]),w=e(`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`}]]),T=e(`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`}]]),E=e(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),D=e(`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`}]]),O=e(`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`}]]),k=e(`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`}]]);function A({profiles:e,activeProfile:t,onSelectProfile:n,onProfilesChanged:r}){let i=y(null),o=y(null),c=y(null),u=_(),[d,v]=b(!1),[S,C]=b(!1),[w,T]=b(null),[E,D]=b(``);g(()=>{if(!d)return;let e=window.requestAnimationFrame(()=>{c.current?.querySelector(`[role="menuitemradio"]:not(:disabled), [role="menuitem"]`)?.focus()}),t=e=>{e.target instanceof Node&&!i.current?.contains(e.target)&&v(!1)},n=e=>{e.key===`Escape`&&(e.preventDefault(),v(!1),o.current?.focus())};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[d]);let O=e=>{e.relatedTarget instanceof Node&&i.current?.contains(e.relatedTarget)||v(!1)},k=e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=Array.from(c.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()},A=async e=>{if(!w){if(e.id===t.id){v(!1),o.current?.focus();return}D(``),T(e.id);try{await n(e),v(!1),o.current?.focus()}catch{D(`Profile could not be selected. Please try again.`)}finally{T(null)}}};return h(p,{children:[h(`div`,{className:`store-profile-menu`,ref:i,onBlur:O,children:[h(`button`,{className:`store-profile-trigger`,ref:o,type:`button`,"aria-label":`Profile: ${t.name}. Open profile menu`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-controls":d?u:void 0,onClick:()=>{D(``),v(e=>!e)},onKeyDown:e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),D(``),v(!0))},children:[h(`span`,{className:`store-profile-avatar`,"aria-hidden":`true`,style:{backgroundColor:t.avatarColor},children:[m(`span`,{}),m(`span`,{}),m(`span`,{})]}),m(f,{className:`store-profile-chevron${d?` store-profile-chevron--open`:``}`,"aria-hidden":`true`})]}),d&&h(`div`,{className:`store-profile-popover`,id:u,ref:c,role:`menu`,"aria-label":`Choose a Netflix profile`,"aria-busy":w!==null,onKeyDown:k,children:[m(`span`,{className:`store-profile-caret`,"aria-hidden":`true`}),m(`div`,{className:`store-profile-options`,children:e.map(e=>{let n=e.id===t.id,r=e.id===w;return h(`button`,{className:`store-profile-option`,type:`button`,role:`menuitemradio`,"aria-checked":n,disabled:w!==null,onClick:()=>void A(e),children:[m(`span`,{className:`store-profile-mini-avatar`,style:{backgroundColor:e.avatarColor},"aria-hidden":`true`,children:e.name.slice(0,1).toUpperCase()}),h(`span`,{className:`store-profile-name`,children:[e.name,r?` — switching…`:``]}),n&&m(a,{className:`store-profile-active-check`,"aria-hidden":`true`})]},e.id)})}),h(`button`,{className:`store-profile-manage`,type:`button`,role:`menuitem`,onClick:()=>{v(!1),C(!0)},children:[m(s,{"aria-hidden":`true`}),m(`span`,{children:`Manage profile`})]}),E&&m(`p`,{className:`store-profile-error`,role:`alert`,children:E})]})]}),S&&x(m(l,{profiles:[...e],activeProfile:t,onClose:()=>{C(!1),window.requestAnimationFrame(()=>o.current?.focus())},onProfilesChanged:r}),document.body)]})}var j=e(`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`}]]);function M({type:e}){switch(e){case`phone`:return m(E,{"aria-hidden":`true`});case`tablet`:return m(O,{"aria-hidden":`true`});case`laptop`:return m(w,{"aria-hidden":`true`});default:return m(T,{"aria-hidden":`true`})}}function N(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 P({activity:e,tabLabel:n,searchOpen:r,onSearchToggle:a,onCommand:s}){let[l,f]=b(null),p=Math.max(1,Math.round(e.duration)),g=Math.max(0,Math.min(p,Math.round(l??e.currentTime))),_=e.duration>0?Math.max(0,Math.min(100,g/e.duration*100)):0,v=Math.round(e.volume*100),y=t=>{let n=Math.max(0,Math.min(e.duration,Math.round(t)));f(null),s({type:`seek-to`,seconds:n})};return h(`article`,{className:`activity-card activity-card--spotify`,"aria-label":`${e.title} playback in ${n}`,style:{"--activity-artwork":`url("${e.artwork}")`},children:[h(`div`,{className:`activity-card__art`,children:[h(`div`,{className:`activity-card__source`,children:[h(`span`,{className:`activity-spotify-mark`,"aria-label":`Spotify`,children:[m(`i`,{}),m(`i`,{}),m(`i`,{})]}),h(`span`,{className:`activity-live`,children:[m(`i`,{"aria-hidden":`true`}),m(M,{type:e.deviceType}),n]})]}),h(`div`,{className:`activity-card__copy`,children:[m(`span`,{children:`Now listening`}),m(`h3`,{children:e.title}),h(`p`,{children:[e.artist,m(`span`,{"aria-hidden":`true`,children:` · `}),e.album]})]})]}),h(`div`,{className:`activity-card__remote`,children:[m(`input`,{className:`activity-progress`,type:`range`,min:0,max:p,step:1,value:g,disabled:e.duration<=0,"aria-label":`${e.title} progress`,"aria-valuetext":`${N(g)} of ${N(e.duration)}`,title:`Seek ${e.title}`,style:{"--activity-progress":`${_}%`},onChange:e=>f(Number(e.currentTarget.value)),onPointerUp:e=>y(Number(e.currentTarget.value)),onPointerCancel:()=>f(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`)&&y(Number(e.currentTarget.value))},onBlur:e=>{l!==null&&y(Number(e.currentTarget.value))}}),h(`div`,{className:`activity-time`,children:[m(`time`,{children:N(g)}),m(`span`,{children:N(e.duration)})]}),h(`div`,{className:`activity-controls activity-controls--spotify`,role:`group`,"aria-label":`Controls for ${e.title} by ${e.artist}`,children:[m(`button`,{type:`button`,onClick:()=>s({type:`previous-track`}),"aria-label":`Previous track before ${e.title}`,children:m(j,{fill:`currentColor`})}),m(`button`,{type:`button`,onClick:()=>s({type:`set-paused`,paused:!e.paused}),"aria-label":`${e.paused?`Play`:`Pause`} ${e.title}`,children:e.paused?m(u,{fill:`currentColor`}):m(t,{fill:`currentColor`})}),m(`button`,{type:`button`,onClick:()=>s({type:`next-track`}),"aria-label":`Next track after ${e.title}`,children:m(o,{fill:`currentColor`})}),h(`div`,{className:`activity-volume`,children:[m(`button`,{type:`button`,onClick:()=>s({type:`set-muted`,muted:!e.muted}),"aria-label":`${e.muted?`Unmute`:`Mute`} ${e.title}`,"aria-pressed":e.muted,children:e.muted?m(c,{}):m(d,{})}),m(`input`,{type:`range`,min:0,max:100,step:1,value:v,style:{"--activity-volume":`${v}%`},onChange:e=>s({type:`set-volume`,volume:Number(e.currentTarget.value)/100}),"aria-label":`Volume for ${e.title}`,"aria-valuetext":e.muted?`Muted, level ${v}%`:`${v}%`})]}),m(`button`,{className:r?`is-active`:``,type:`button`,onClick:a,"aria-label":`Switch ${e.title} to another track`,"aria-expanded":r,"aria-controls":`activity-tracks-${e.sessionId}`,children:m(i,{})})]})]})]})}var F={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:`✺`}},I=[{id:`neon-skyline`,title:`Neon Skyline`,artist:`Luma Coast`,album:`Chromatic Weather`,durationSec:224,palette:F.chromaticWeather},{id:`open-windows`,title:`Open Windows`,artist:`Luma Coast`,album:`Chromatic Weather`,durationSec:197,palette:F.chromaticWeather},{id:`slow-motion`,title:`Slow Motion`,artist:`Arlo Vale`,album:`Still Frames`,durationSec:208,palette:F.stillFrames},{id:`paper-moons`,title:`Paper Moons`,artist:`Arlo Vale`,album:`Still Frames`,durationSec:186,palette:F.stillFrames},{id:`after-hours-drive`,title:`After Hours Drive`,artist:`Night Atlas`,album:`Parallel Streets`,durationSec:251,palette:F.parallelStreets},{id:`city-rain`,title:`City Rain`,artist:`Night Atlas`,album:`Parallel Streets`,durationSec:239,palette:F.parallelStreets},{id:`blue-hour`,title:`Blue Hour`,artist:`Mira Lane`,album:`Northbound`,durationSec:216,palette:F.blueHour},{id:`velvet-morning`,title:`Velvet Morning`,artist:`Mira Lane`,album:`Northbound`,durationSec:203,palette:F.blueHour},{id:`satellite-hearts`,title:`Satellite Hearts`,artist:`Nova Bloom`,album:`Orbiting`,durationSec:232,palette:F.orbiting},{id:`signal-fires`,title:`Signal Fires`,artist:`Nova Bloom`,album:`Orbiting`,durationSec:245,palette:F.orbiting},{id:`coffee-stains`,title:`Coffee Stains`,artist:`The Daylights`,album:`Small Hours`,durationSec:194,palette:F.smallHours},{id:`golden-lines`,title:`Golden Lines`,artist:`The Daylights`,album:`Small Hours`,durationSec:211,palette:F.smallHours},{id:`quiet-current`,title:`Quiet Current`,artist:`Elio Pines`,album:`Low Tide Letters`,durationSec:263,palette:F.lowTide},{id:`tides-in-reverse`,title:`Tides in Reverse`,artist:`Elio Pines`,album:`Low Tide Letters`,durationSec:228,palette:F.lowTide},{id:`soft-static`,title:`Soft Static`,artist:`Static Garden`,album:`Dreaming in Mono`,durationSec:274,palette:F.dreamingMono},{id:`midnight-orchard`,title:`Midnight Orchard`,artist:`Static Garden`,album:`Dreaming in Mono`,durationSec:257,palette:F.dreamingMono}],L=[{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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.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:F.dreamingMono}],R=[{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`]}],z=[{id:`liked-songs`,title:`Liked Songs`,subtitle:`Playlist · 16 songs`,kind:`collection`,palette:F.liked,pinned:!0},{id:`library-coding-mode`,title:`Coding Mode`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:F.coding,playlistId:`coding-mode`,pinned:!0},{id:`library-night-drive`,title:`Night Drive`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:F.nightDrive,playlistId:`night-drive`},{id:`library-sunday-reset`,title:`Sunday Reset`,subtitle:`Playlist · Spotify Atom`,kind:`playlist`,palette:F.sundayReset,playlistId:`sunday-reset`},{id:`library-luma-coast`,title:`Luma Coast`,subtitle:`Artist`,kind:`artist`,palette:F.chromaticWeather},{id:`library-blue-hour`,title:`Northbound`,subtitle:`Album · Mira Lane`,kind:`album`,palette:F.blueHour},{id:`library-deep-focus`,title:`Deep Focus`,subtitle:`Playlist · Atom Editorial`,kind:`playlist`,palette:F.deepFocus,playlistId:`deep-focus`},{id:`library-nova-bloom`,title:`Nova Bloom`,subtitle:`Artist`,kind:`artist`,palette:F.orbiting}];function B(e){return e.kind===`track`?`track:${e.track.id}`:`playlist:${e.playlist.id}`}function V({activity:e,onClose:t,onSelectTrack:a,onSelectPlaylist:o}){let s=y(null),[c,l]=b(``),[u,d]=b(I),[f,_]=b(L.map(e=>({...e,trackCount:e.totalTracks??e.trackIds.length}))),[S,C]=b([]),[w,T]=b(!0),[E,D]=b(``),[O,k]=b(null),A=c.trim().toLocaleLowerCase(),j=`activity-tracks-${e.sessionId}`,M=v(()=>{let t=A?[...u.map(e=>({kind:`track`,track:e})),...f.map(e=>({kind:`playlist`,playlist:e}))]:S,n=new Set;return t.filter(t=>{if(t.kind===`track`&&t.track.id===e.titleId||A&&!(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(A)))return!1;let r=B(t);return n.has(r)?!1:(n.add(r),!0)}).slice(0,A?void 0:10)},[e.titleId,A,f,S,u]),N=v(()=>L.map(e=>({...e,trackCount:e.totalTracks??e.trackIds.length})),[]);g(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return s.current?.focus(),()=>{e?.isConnected&&e.focus()}},[]),g(()=>{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));d([...o,...I.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})):[],l=new Set(c.map(e=>e.id));_([...c,...N.filter(e=>!l.has(e.id))]),C(Array.isArray(r.items)?r.items.slice(0,10):[])}).catch(e=>{t.signal.aborted||D(e instanceof Error?e.message:`Recently played music could not be loaded.`)}).finally(()=>{t.signal.aborted||T(!1)}),()=>t.abort()},[e.profileId,N]);let P=async e=>{let n=B(e);k(n),D(``);try{e.kind===`track`?await a(e.track):await o(e.playlist),t()}catch(e){D(e instanceof Error?e.message:`The music could not be switched.`),k(null)}};return x(m(`div`,{className:`activity-movie-search-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&t()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},children:h(`div`,{className:`activity-movie-search activity-track-search`,id:j,role:`dialog`,"aria-label":`Search another track for ${e.title}`,children:[h(`div`,{className:`activity-movie-search__header`,children:[h(`div`,{children:[m(`h3`,{children:`Switch music`}),h(`span`,{className:`activity-movie-search__now`,children:[`Now playing: `,e.title]})]}),m(`button`,{type:`button`,onClick:t,"aria-label":`Close track search`,children:m(r,{})})]}),h(`div`,{className:`activity-movie-search__field`,children:[m(i,{"aria-hidden":`true`}),m(`input`,{ref:s,type:`search`,value:c,onChange:e=>l(e.currentTarget.value),placeholder:`Search songs, artists, albums, and playlists`,"aria-label":`Search another track for ${e.title}`,autoComplete:`off`}),c&&m(`button`,{type:`button`,onClick:()=>{l(``),s.current?.focus()},"aria-label":`Clear track search`,children:m(r,{})})]}),m(`div`,{className:`activity-movie-search__heading`,children:m(`strong`,{children:A?`Search results`:`Recently played`})}),m(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:O?`Switching from ${e.title}…`:w?`Loading recently played music…`:`${M.length} ${A?`search`:`recent`} ${M.length===1?`result`:`results`}.`}),E&&m(`p`,{className:`activity-movie-search__notice`,role:`alert`,children:E}),w?h(`div`,{className:`activity-movie-search__empty`,children:[m(n,{className:`spin`,"aria-hidden":`true`}),m(`span`,{children:`Loading recently played music…`})]}):M.length?m(`div`,{className:`activity-movie-search__results`,"aria-label":A?`Music search results`:`Recently played`,children:M.map(e=>{let t=B(e),r=e.kind===`track`?e.track:e.playlist;return h(`button`,{type:`button`,onClick:()=>void P(e),disabled:O!==null,"aria-label":e.kind===`track`?`Switch to ${e.track.title} by ${e.track.artist}`:`Switch to playlist ${e.playlist.title}`,children:[h(`span`,{className:`activity-movie-search__art activity-track-search__art`,style:r.imageUrl?{backgroundImage:`url(${JSON.stringify(r.imageUrl)})`}:r.palette?{backgroundImage:`linear-gradient(135deg, ${r.palette.from}, ${r.palette.to})`,color:r.palette.accent}:void 0,children:[!r.imageUrl&&m(`span`,{"aria-hidden":`true`,children:r.palette?.glyph??(e.kind===`playlist`?`☷`:`♫`)}),O===t&&m(n,{className:`spin`,"aria-hidden":`true`})]}),h(`span`,{className:`activity-movie-search__copy`,children:[m(`strong`,{children:r.title}),m(`small`,{children:e.kind===`track`?h(p,{children:[e.track.artist,m(`span`,{"aria-hidden":`true`,children:` · `}),e.track.album]}):h(p,{children:[`Playlist`,m(`span`,{"aria-hidden":`true`,children:` · `}),e.playlist.curator,m(`span`,{"aria-hidden":`true`,children:` · `}),e.playlist.trackCount,` `,e.playlist.trackCount===1?`song`:`songs`]})})]})]},t)})}):h(`div`,{className:`activity-movie-search__empty`,children:[m(i,{"aria-hidden":`true`}),m(`span`,{children:A?`No music found for “${c.trim()}”.`:`No recently played songs or playlists yet.`})]})]})}),document.body)}var H=e(`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`}]]);export{C as _,R as a,P as c,k as d,O as f,w as g,T as h,z as i,j as l,E as m,V as n,L as o,D as p,F as r,I as s,H as t,A as u,S as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chevron-left-CkBJG8E2.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{n as e}from"./chevron-left-CkBJG8E2.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useEffect as r,useRef as i,useState as a}from"react";var o=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),s=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),c=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),l=e(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),u=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),d=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=e(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),p=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),m=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),h=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),g={backdrop:`_backdrop_ttlmb_1`,"backdrop-in":`_backdrop-in_ttlmb_1`,modal:`_modal_ttlmb_15`,"modal-in":`_modal-in_ttlmb_1`,close:`_close_ttlmb_29`,header:`_header_ttlmb_59`,icon:`_icon_ttlmb_66`,list:`_list_ttlmb_91`,row:`_row_ttlmb_98`,avatar:`_avatar_ttlmb_113`,name:`_name_ttlmb_125`,iconButton:`_iconButton_ttlmb_142`,button:`_button_ttlmb_161`,iconButtonDanger:`_iconButtonDanger_ttlmb_170`,editor:`_editor_ttlmb_179`,editorFields:`_editorFields_ttlmb_189`,addForm:`_addForm_ttlmb_196`,editorActions:`_editorActions_ttlmb_218`,buttonPrimary:`_buttonPrimary_ttlmb_244`,buttonQuiet:`_buttonQuiet_ttlmb_249`,buttonDanger:`_buttonDanger_ttlmb_253`,colorPicker:`_colorPicker_ttlmb_263`,deleteConfirm:`_deleteConfirm_ttlmb_313`,error:`_error_ttlmb_349`,spin:`_spin_ttlmb_355`},_=[`#1565c0`,`#f05b47`,`#6a4c93`,`#00897b`,`#ef6c00`,`#ad1457`];function v(e){let t=i(null),n=i(e);return r(()=>{n.current=e},[e]),r(()=>{let e=document.activeElement,r=document.body.style.overflow;document.body.style.overflow=`hidden`;let i=()=>Array.from(t.current?.querySelectorAll(`button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)??[]).filter(e=>!e.hasAttribute(`disabled`)),a=window.requestAnimationFrame(()=>i()[0]?.focus()),o=e=>{if(e.key===`Escape`){e.preventDefault(),n.current();return}if(e.key!==`Tab`)return;let r=i();if(!r.length)return;let a=r[0],o=r[r.length-1];e.shiftKey&&document.activeElement===a?(e.preventDefault(),o.focus()):(!e.shiftKey&&document.activeElement===o||document.activeElement&&!t.current?.contains(document.activeElement))&&(e.preventDefault(),a.focus())};return document.addEventListener(`keydown`,o),()=>{window.cancelAnimationFrame(a),document.removeEventListener(`keydown`,o),document.body.style.overflow=r,e?.isConnected&&e.focus()}},[]),t}function y({profiles:e,activeProfile:r,onClose:i,onProfilesChanged:s}){let c=v(i),[l,d]=a(``),[y,x]=a(_[2]),[S,C]=a(null),[w,T]=a(``),[E,D]=a(_[0]),[O,k]=a(null),[A,j]=a(!1),[M,N]=a(``),P=async e=>{let t=await e.json();if(!e.ok||!t.profiles||!t.activeProfile)throw Error(t.error||`Profiles could not be saved.`);await s(t.profiles,t.activeProfile)},F=async t=>{t.preventDefault(),j(!0),N(``);try{let t=await fetch(`/api/netflix/profiles`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:l,avatarColor:y})});await P(t),d(``),x(_[(e.length+1)%_.length])}catch(e){N(e instanceof Error?e.message:`Profile could not be added.`)}finally{j(!1)}},I=async e=>{if(e.preventDefault(),S){j(!0),N(``);try{let e=await fetch(`/api/netflix/profiles/${encodeURIComponent(S)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:w,avatarColor:E})});await P(e),C(null)}catch(e){N(e instanceof Error?e.message:`Profile could not be updated.`)}finally{j(!1)}}},L=async()=>{if(O){j(!0),N(``);try{let e=await fetch(`/api/netflix/profiles/${encodeURIComponent(O.id)}`,{method:`DELETE`});await P(e),k(null),S===O.id&&C(null)}catch(e){N(e instanceof Error?e.message:`Profile could not be deleted.`)}finally{j(!1)}}},R=e=>{C(e.id),T(e.name),D(e.avatarColor),k(null),N(``)};return t(`div`,{className:g.backdrop,onMouseDown:i,children:n(`article`,{ref:c,className:g.modal,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`manage-profiles-title`,onMouseDown:e=>e.stopPropagation(),children:[t(`button`,{className:g.close,"aria-label":`Close`,onClick:i,children:t(u,{})}),n(`header`,{className:g.header,children:[t(`span`,{className:g.icon,children:t(f,{})}),n(`div`,{children:[t(`h2`,{id:`manage-profiles-title`,children:`Manage Profiles`}),t(`p`,{children:`Each profile keeps its own list and exact watch position.`})]})]}),t(`div`,{className:g.list,children:e.map(i=>S===i.id?n(`form`,{className:g.editor,onSubmit:I,children:[t(`span`,{className:g.avatar,style:{backgroundColor:E},"aria-hidden":`true`,children:w.slice(0,1).toUpperCase()||`?`}),n(`div`,{className:g.editorFields,children:[t(`label`,{htmlFor:`profile-name-${i.id}`,children:`Profile name`}),t(`input`,{id:`profile-name-${i.id}`,required:!0,maxLength:30,value:w,onChange:e=>T(e.currentTarget.value)}),t(b,{name:`edit-color-${i.id}`,value:E,onChange:D})]}),n(`div`,{className:g.editorActions,children:[t(`button`,{type:`button`,className:`${g.button} ${g.buttonQuiet}`,onClick:()=>C(null),children:`Cancel`}),n(`button`,{type:`submit`,className:`${g.button} ${g.buttonPrimary}`,disabled:A,children:[t(o,{}),` Save`]})]})]},i.id):n(`article`,{className:g.row,children:[t(`span`,{className:g.avatar,style:{backgroundColor:i.avatarColor},"aria-hidden":`true`,children:i.name.slice(0,1).toUpperCase()}),n(`span`,{className:g.name,children:[t(`b`,{children:i.name}),t(`small`,{children:i.id===r.id?`Currently watching`:`Separate viewing data`})]}),t(`button`,{type:`button`,className:g.iconButton,"aria-label":`Edit ${i.name}`,onClick:()=>R(i),children:t(f,{})}),t(`button`,{type:`button`,className:`${g.iconButton} ${g.iconButtonDanger}`,"aria-label":`Delete ${i.name}`,disabled:e.length===1,onClick:()=>{k(i),C(null)},children:t(h,{})})]},i.id))}),O&&n(`div`,{className:g.deleteConfirm,role:`alert`,children:[n(`span`,{children:[n(`b`,{children:[`Delete `,O.name,`?`]}),t(`small`,{children:`Their list and watch history will also be deleted.`})]}),t(`button`,{type:`button`,className:`${g.button} ${g.buttonQuiet}`,onClick:()=>k(null),children:`Keep profile`}),t(`button`,{type:`button`,className:`${g.button} ${g.buttonDanger}`,disabled:A,onClick:()=>void L(),children:`Delete`})]}),n(`form`,{className:g.addForm,onSubmit:F,children:[n(`div`,{children:[t(`label`,{htmlFor:`new-profile-name`,children:`Add a profile`}),t(`input`,{id:`new-profile-name`,required:!0,maxLength:30,placeholder:`Profile name`,value:l,onChange:e=>d(e.currentTarget.value)})]}),t(b,{name:`new-profile-color`,value:y,onChange:x}),n(`button`,{type:`submit`,className:`${g.button} ${g.buttonPrimary}`,disabled:A,children:[A?t(p,{className:g.spin}):t(m,{}),`Add profile`]})]}),M&&t(`p`,{className:g.error,role:`alert`,children:M})]})})}function b({name:e,value:r,onChange:i}){return n(`fieldset`,{className:g.colorPicker,children:[t(`legend`,{children:`Avatar color`}),t(`div`,{children:_.map((a,o)=>n(`label`,{title:`Color ${o+1}`,children:[t(`input`,{type:`radio`,name:e,value:a,checked:r===a,onChange:()=>i(a)}),t(`span`,{style:{backgroundColor:a}})]},a))})]})}var x=e(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),S=e(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),C=e(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),w=e(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),T=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{x as a,p as c,u as d,l as f,o as h,S as i,f as l,s as m,w as n,y as o,c as p,C as r,m as s,T as t,d as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=e(import.meta.url);export{u as i,c as n,d as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DSjMdhoD.js";import{n as t,t as n}from"./app-elements-Psr6bSdJ.js";import{a as r,o as i}from"./navigation-context-state-BnWorqxb.js";import{r as a}from"./navigation-errors-BRIEcp79.js";import"./navigation-server-CCLiCOcy.js";import{Fragment as o,jsx as s}from"react/jsx-runtime";import*as c from"react";var l=e({BfcacheStateKeyMapContext:()=>y,Children:()=>B,ChildrenContext:()=>f,ElementsContext:()=>d,ParallelSlot:()=>V,ParallelSlotsContext:()=>p,Slot:()=>z,UNMATCHED_SLOT:()=>t,getNonCacheComponentsSegmentKey:()=>L,updateBfcacheSlotEntryOrder:()=>C}),u=Object.freeze({}),d=c.createContext(u),f=c.createContext(null),p=c.createContext(null),m=r(),h=i(),g=Object.freeze({}),_=3,v=1,y=c.createContext(g);function b(){return!1}function x(){return b()?_:v}function S(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):1}function C(e,t,n=x()){let r=S(n),i=[t];for(let n of e){if(i.length>=r)break;n!==t&&i.push(n)}return i}function w(e,t){let n=new Set(t);for(let t of e.keys())n.has(t)||e.delete(t)}function T(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function E(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.values(e);return t.length>0&&t.every(e=>e===`s`||e===`d`)}function D(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`schemaVersion`in e&&`appElementsSchemaVersion`in e&&`rscPayloadSchemaVersion`in e&&`graphVersion`in e&&`deploymentVersion`in e&&`rootBoundaryId`in e&&`renderEpoch`in e}function O(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`ownerLayoutId`in e&&`slotId`in e&&`state`in e}function k(e){return Array.isArray(e)&&e.length>0&&e.every(O)}function A(e,t){return e===`__skippedLayoutIds`&&Array.isArray(t)&&t.every(e=>typeof e==`string`)}function j(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`sourceMatchedUrl`in e&&typeof e.sourceMatchedUrl==`string`&&`sourceRouteId`in e&&typeof e.sourceRouteId==`string`&&`slotId`in e&&typeof e.slotId==`string`&&`targetMatchedUrl`in e&&typeof e.targetMatchedUrl==`string`&&`targetRouteId`in e&&typeof e.targetRouteId==`string`}function M(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:`kind`in e&&e.kind===`runtime-cache-entry`&&`decision`in e}function N(e,t){return E(t)||D(t)||M(t)||j(t)||A(e,t)||k(t)}function P({entry:e,fallbackElements:t,fallbackSegmentId:n,fallbackStateKeyMap:r,SegmentContext:i}){return s(y.Provider,{value:e.stateKeyMap??r,children:s(d.Provider,{value:e.elements??t,children:s(i.Provider,{value:e.segmentId??n,children:e.content})})})}function F(e){let t=c.useRef(new Map),[n,r]=c.useState(()=>[e.stateKey]);t.current.set(e.stateKey,e);let i=C(n,e.stateKey),a=!T(n,i),o=a?i:n;return w(t.current,o),a&&r(i),o.map(e=>t.current.get(e)).filter(e=>e!==void 0)}function I({activeStateKey:e,content:t,elements:n,id:r,SegmentContext:i,stateKeyMap:a}){return s(o,{children:F({content:t,elements:n,segmentId:r,stateKey:e,stateKeyMap:a}).map(t=>s(c.Activity,{mode:t.stateKey===e?`visible`:`hidden`,children:s(P,{entry:t,fallbackElements:n,fallbackSegmentId:r,fallbackStateKeyMap:a,SegmentContext:i})},t.stateKey))})}function L(e,t){let r=n.parseElementKey(e);return r?.kind===`page`||r?.kind===`slot`&&r.name===`children`?t:void 0}function R({content:e,id:t}){let n=h,r=c.useContext(d),i=c.useContext(y),a=i[t];return n?a===void 0?s(n.Provider,{value:t,children:e}):b()?s(I,{activeStateKey:a,content:e,elements:r,id:t,SegmentContext:n,stateKeyMap:i}):s(n.Provider,{value:t,children:e},L(t,a)):s(o,{children:e})}function z({id:e,children:n,parallelSlots:r}){let i=c.useContext(d);if(!Object.hasOwn(i,e))return null;let o=i[e];if(N(e,o)||(o===t&&a(),o===null))return null;let l=s(p.Provider,{value:r??null,children:s(f.Provider,{value:n??null,children:o})});return m&&h?s(R,{id:e,content:l}):l}function B(){return c.useContext(f)}function V({name:e}){return c.useContext(p)?.[e]??null}export{l as i,d as n,z as r,y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./chevron-left-CkBJG8E2.js";import{t as n}from"./house-l1u9dUbj.js";import{_ as r,a as i,c as a,d as o,i as s,l as c,n as l,o as u,p as d,r as f,s as ee,t as p,u as te,v as ne}from"./pin-BQre-tQY.js";import{a as m,c as h,d as g,f as _,h as re,i as v,m as ie,n as y,p as b,r as ae,s as oe,t as x}from"./refresh-cw-CWdWHjqY.js";import{a as S,c as se,i as ce,l as le,n as ue,o as de,r as fe,s as pe,t as me,u as he}from"./playback-activity-D5TYX2Ae.js";import{Fragment as ge,jsx as C,jsxs as w}from"react/jsx-runtime";import{useCallback as T,useEffect as E,useMemo as D,useRef as O,useState as k}from"react";var A=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),_e=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),ve=e(`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`}]]),ye=e(`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=e(`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=e(`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=e(`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`}]]),j=e(`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`}]]),Ce=e(`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`}]]),we=e(`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`}]]);function M({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 w(`div`,{"aria-label":`${t} cover`,className:`coverArt ${r?`coverArtHasImage`:``} ${i?`coverArtRound`:``} ${n}`,role:`img`,style:a,children:[C(`span`,{className:`coverOrb coverOrbOne`}),C(`span`,{className:`coverOrb coverOrbTwo`}),C(`span`,{className:`coverLine`}),C(`span`,{className:`coverGlyph`,"aria-hidden":`true`,children:e.glyph}),C(`span`,{className:`coverNoise`})]})}function Te(e){return e.replace(/[<>&"']/g,e=>{switch(e){case`<`:return`<`;case`>`:return`>`;case`&`:return`&`;case`"`:return`"`;default:return`'`}})}function Ee(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="${Te(e.palette.from)}"/>`,`<stop offset="1" stop-color="${Te(e.palette.to)}"/>`,`</linearGradient>`,`</defs>`,`<rect width="960" height="540" fill="url(#g)"/>`,`<circle cx="760" cy="95" r="250" fill="${Te(e.palette.accent)}" opacity=".18"/>`,`<circle cx="190" cy="485" r="225" fill="#000" opacity=".2"/>`,`<text x="480" y="315" fill="${Te(e.palette.accent)}" font-family="Arial,sans-serif" font-size="150" font-weight="700" text-anchor="middle">${Te(e.palette.glyph)}</text>`,`</svg>`].join(``);return`data:image/svg+xml,${encodeURIComponent(t)}`}function N(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:Ee(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:fe(),deviceType:ce(),updatedAt:Date.now()}}function De(e){let t=O(e),n=O(null),r=D(()=>e.active&&e.profileId?{id:ue(),profileId:e.profileId}:null,[e.active,e.profileId]);E(()=>{t.current=e},[e]),E(()=>{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:N(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};!S(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,me)))}},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,me);return u(),()=>{window.clearInterval(f),a!==null&&window.clearTimeout(a),window.removeEventListener(`pagehide`,d),n.current===c&&(n.current=null),d()}},[r]),E(()=>{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 P(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 F(e,t){return t?`${e}${e.includes(`?`)?`&`:`?`}profileId=${encodeURIComponent(t)}`:e}function Ae(e){let t=e.provider.toLowerCase(),n=f.chromaticWeather;return t.includes(`zing`)?n=f.neonPulse:t.includes(`tiktok`)?n=f.parallelStreets:t.includes(`youtube`)?n=f.stillFrames:t.includes(`nhac`)&&(n=f.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:f.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 w(`span`,{className:`spotifyMark`,"aria-hidden":`true`,children:[C(`span`,{}),C(`span`,{}),C(`span`,{})]})}function I({autoFocus:e=!1,buttonRef:t,label:n,children:r,className:i=``,pressed:a,expanded:o,controls:s,hasPopup:c,onClick:l}){return C(`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 ze({playing:e,label:t,size:n=`normal`,onClick:r}){return C(`button`,{"aria-label":t,className:`playButton playButton-${n}`,onClick:r,type:`button`,children:C(e?m:b,{fill:`currentColor`})})}function Be({item:e,active:t,onSelect:n}){return w(`button`,{className:`libraryRow ${t?`libraryRowActive`:``}`,onClick:n,type:`button`,children:[C(M,{className:`libraryCover`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),w(`span`,{className:`libraryRowText`,children:[C(`span`,{className:`libraryRowTitle`,children:e.title}),w(`span`,{className:`libraryRowMeta`,children:[e.pinned?C(p,{"aria-hidden":`true`,fill:`currentColor`,size:12}):null,e.subtitle]})]}),C(j,{"aria-hidden":`true`,className:`libraryRowMore`,size:19})]})}function Ve({playlist:e,active:t,playing:n,onPlay:r}){return w(`article`,{className:`playlistCard ${t?`playlistCardActive`:``}`,children:[w(`div`,{className:`playlistCardArt`,children:[C(M,{imageUrl:e.imageUrl,palette:e.palette,title:e.title}),C(ze,{label:`${n&&t?`Pause`:`Play`} ${e.title}`,onClick:e=>{e.stopPropagation(),r()},playing:n&&t}),t&&n?w(`span`,{className:`playingBadge`,children:[C(`span`,{}),C(`span`,{}),C(`span`,{})]}):null]}),w(`button`,{className:`cardCopy`,onClick:r,type:`button`,children:[C(`span`,{className:`playlistCardTitle`,children:e.title}),C(`span`,{className:`playlistCardDescription`,children:e.description})]})]})}function He({track:e,active:t,playing:n,liked:i,onSelect:a,onLike:o}){return w(`div`,{className:`trackResult ${t?`trackResultActive`:``}`,children:[w(`button`,{"aria-label":`${n&&t?`Pause`:`Play`} ${e.title}`,className:`trackResultMain`,onClick:a,type:`button`,children:[w(`span`,{className:`trackResultArtWrap`,children:[C(M,{className:`trackResultArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),C(`span`,{className:`trackResultPlay`,children:C(n&&t?m:b,{fill:`currentColor`,size:18})})]}),w(`span`,{className:`trackResultCopy`,children:[C(`span`,{className:`trackResultTitle`,children:e.title}),C(`span`,{children:e.artist})]})]}),C(`span`,{className:`trackResultAlbum`,children:e.album}),C(I,{className:`trackResultLike`,label:`${i?`Remove`:`Add`} ${e.title} ${i?`from`:`to`} Liked Songs`,onClick:o,pressed:i,children:C(r,{fill:i?`currentColor`:`none`,size:18})}),C(`span`,{className:`trackResultDuration`,children:Le(e.durationSec)}),C(I,{label:`More options for ${e.title}`,children:C(j,{size:19})})]})}function Ue({providers:e,syncingProviderIds:t,providerError:n,musicUrl:r,addMusicError:i,addingMusic:a,onClose:s,onMusicUrlChange:c,onAddMusic:l,onSync:u}){return w(`div`,{"aria-label":`Music sources`,className:`headerPopover sourcePopover`,id:`source-popover`,role:`dialog`,children:[w(`div`,{className:`popoverHeader`,children:[w(`div`,{children:[C(`span`,{className:`popoverEyebrow`,children:`YOUR MUSIC`}),C(`h2`,{children:`Sources`})]}),C(I,{label:`Close music sources`,onClick:s,children:C(g,{size:18})})]}),n?w(`div`,{className:`popoverError`,role:`alert`,children:[C(o,{size:16}),C(`span`,{children:n})]}):null,C(`div`,{className:`providerList`,children:e.map(e=>{let n=t.has(e.id)||e.syncStatus.toLowerCase()===`syncing`;return w(`article`,{className:`providerRow`,children:[C(`span`,{className:`providerMark providerMark--${e.id}`,"aria-hidden":`true`,children:e.name.slice(0,1).toUpperCase()}),w(`div`,{className:`providerCopy`,children:[w(`a`,{href:e.homeUrl,rel:`noreferrer`,target:`_blank`,children:[C(`strong`,{children:e.name}),C(pe,{size:13})]}),w(`span`,{children:[Fe(e.lastSyncedAt),` · `,e.itemCount,` `,e.itemCount===1?`item`:`items`]}),e.error?C(`span`,{className:`providerError`,children:e.error}):null]}),w(`button`,{"aria-label":`Sync ${e.name}`,className:`syncProviderButton`,disabled:n,onClick:()=>u(e),type:`button`,children:[n?C(h,{"aria-hidden":`true`,className:`spin`,size:17}):C(x,{"aria-hidden":`true`,size:17}),C(`span`,{children:n?`Syncing`:`Sync`})]})]},e.id)})}),w(`form`,{className:`addMusicForm`,onSubmit:l,children:[w(`div`,{className:`addMusicHeading`,children:[C(`span`,{className:`addMusicIcon`,children:C(de,{size:17})}),w(`div`,{children:[C(`strong`,{children:`Add music`}),C(`span`,{children:`Paste a song or YouTube playlist link.`})]})]}),C(`label`,{htmlFor:`music-source-url`,children:`Music link`}),w(`div`,{className:`musicUrlControl`,children:[C(`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}),w(`button`,{disabled:a||!r.trim(),type:`submit`,children:[a?C(h,{"aria-hidden":`true`,className:`spin`,size:17}):C(oe,{"aria-hidden":`true`,size:17}),C(`span`,{children:a?`Adding`:`Add`})]})]}),i?C(`span`,{className:`fieldError`,role:`alert`,children:i}):null]})]})}function We({downloads:e,error:t,currentTrackId:n,isPlaying:r,onClose:i,onPlay:a}){let s=e.filter(e=>e.status!==`completed`&&e.status!==`failed`).length;return w(`div`,{"aria-label":`Music downloads`,className:`headerPopover downloadsPopover`,id:`downloads-popover`,role:`dialog`,children:[w(`div`,{className:`popoverHeader`,children:[w(`div`,{children:[C(`span`,{className:`popoverEyebrow`,children:`OFFLINE MUSIC`}),C(`h2`,{children:`Downloads`})]}),w(`div`,{className:`downloadHeaderActions`,children:[s?w(`span`,{className:`activeDownloadCount`,children:[C(h,{"aria-hidden":`true`,className:`spin`,size:13}),s,` active`]}):null,C(I,{label:`Close downloads`,onClick:i,children:C(g,{size:18})})]})]}),t?w(`div`,{className:`popoverError`,role:`alert`,children:[C(o,{size:16}),C(`span`,{children:t})]}):null,C(`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 w(`article`,{className:`downloadRow ${e.status===`failed`?`downloadRowFailed`:``}`,children:[w(`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&&a(e.track),type:`button`,children:[C(M,{className:`downloadArtwork`,imageUrl:t?.imageUrl,palette:t?.palette??f.deepFocus,title:t?.title??`Preparing music`}),C(`span`,{className:`downloadPlayOverlay`,"aria-hidden":`true`,children:s&&r?C(m,{fill:`currentColor`,size:20}):i?C(b,{fill:`currentColor`,size:20}):e.status===`failed`?C(o,{size:18}):C(h,{className:`spin`,size:18})})]}),w(`div`,{className:`downloadCopy`,children:[w(`div`,{className:`downloadTitleRow`,children:[C(`strong`,{children:t?.title??Ie(e.sourceUrl)}),e.status===`completed`?C(A,{"aria-label":`Download complete`,className:`downloadCompleteIcon`,size:16}):null]}),C(`span`,{children:t?.artist??(e.status===`fetching`?`Reading song information`:Pe(e.status))}),w(`div`,{className:`downloadProgressMeta`,children:[C(`span`,{children:Pe(e.status)}),w(`span`,{children:[l,l&&u?` / ${u}`:``,!l&&e.status!==`failed`?`${c}%`:``]})]}),C(`span`,{"aria-label":`${c}% downloaded`,className:`downloadProgressTrack`,role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,children:C(`span`,{style:{width:`${c}%`}})}),e.error?C(`span`,{className:`downloadError`,children:e.error}):null]})]},e.id)}):w(`div`,{className:`emptyDownloads`,children:[C(`span`,{children:C(se,{size:23})}),C(`strong`,{children:`No downloads yet`}),C(`p`,{children:`Add a song or playlist from Sources and its progress will appear here.`})]})})]})}function Ge({initialProfiles:e=[],initialActiveProfile:i=null}){let[o,c]=k(`home`),[d,f]=k(ee[0].id),[p,h]=k(u[0].id),[v,y]=k(!1),[ae,x]=k(0),[S,ce]=k(74),[ue,de]=k(74),[fe,pe]=k(!1),[me,ge]=k(!1),[A,_e]=k(``),[ve,Se]=k(``),[j,Ce]=k(`all`),[we,Te]=k(!0),[N,Me]=k(()=>new Set([`neon-skyline`,`blue-hour`,`satellite-hearts`])),[Ne,Pe]=k([]),[Fe,Ie]=k([]),[Le,ze]=k([]),[Ve,He]=k(ke),[Ge,Je]=k([]),[Qe,$e]=k(``),[et,tt]=k(``),[L,R]=k(!1),[z,B]=k(!1),[nt,rt]=k(!1),[it,at]=k(!1),[ot,st]=k(!1),[ct,lt]=k(``),[ut,dt]=k(e),[V,ft]=k(i),[pt,mt]=k(!1),[ht,gt]=k(``),[_t,vt]=k(``),[yt,bt]=k(!1),[xt,St]=k(()=>new Set),[Ct,wt]=k(null),Tt=O(null),Et=O(null),Dt=O(null),Ot=O(null),kt=O(null),H=O(ae),At=O(null),jt=O(null),Mt=O(``),Nt=O(0),Pt=O(!1),U=O(i?.id??null),W=D(()=>{let e=new Set(Ne.map(e=>e.id));return[...Ne,...ee.filter(t=>!e.has(t.id))]},[Ne]),G=D(()=>{let e=new Set(Fe.map(e=>e.id));return[...Fe,...u.filter(t=>!e.has(t.id))]},[Fe]),K=W.find(e=>e.id===d)??ee[0],Ft=G.find(e=>e.id===p)??u[0],q=D(()=>{let e=Ft.trackIds.map(e=>W.find(t=>t.id===e)).filter(e=>!!e);return e.length?e:W},[W,Ft.trackIds]),It=D(()=>{let e=q.findIndex(e=>e.id===K.id);return e<0?q:[...q.slice(e+1),...q.slice(0,e)]},[K.id,q]),J=Ct?.trackId===K.id&&Ct.duration>0?Ct.duration:K.durationSec,Lt=Ge.filter(e=>e.status!==`completed`&&e.status!==`failed`).length,Y=T(e=>{lt(e),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>lt(``),2400)},[]),Rt=T(()=>{rt(!1),window.requestAnimationFrame(()=>Dt.current?.focus())},[]),zt=T(()=>{st(!1),at(!1),window.requestAnimationFrame(()=>Ot.current?.focus())},[]),X=T(e=>{let t=U.current;if(!t)return;let n=Date.now(),r=Oe(e);ze(t=>[{...e,playedAt:n},...t.filter(e=>Oe(e)!==r)].slice(0,10)),P(F(`/api/spotify/recently-played`,t),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({item:e,profileId:t})}).catch(()=>{})},[]),Bt=T(e=>{if(U.current===e)return;U.current=e;let t=Et.current;t&&(t.pause(),t.removeAttribute(`src`),delete t.dataset.trackId,t.load()),Mt.current=``,y(!1),mt(!1),at(!1),st(!1),x(0),H.current=0,wt(null),f(ee[0].id),h(u[0].id),Pe([]),Ie([]),ze([]),He(ke),Je([]),$e(``),tt(``),St(new Set),bt(!1),vt(``)},[]),Vt=T(async e=>{let t=Nt.current;try{let n=await P(`/api/netflix/profiles`,{signal:e});if(Pt.current||t!==Nt.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;Bt(i?.id??null),dt(r),ft(i)}catch{}},[Bt]),Ht=T(async e=>{Pt.current=!0,Nt.current+=1;try{let t=await P(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});Nt.current+=1;let n=t.activeProfile??e;Bt(n.id),ft(n)}finally{Pt.current=!1}},[Bt]),Ut=T(async(e,t)=>{Nt.current+=1,Bt(t.id),dt(e),ft(t)},[Bt]),Wt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/providers`,e));if(U.current!==t)return;He(n.providers.length?n.providers:ke),$e(``)}catch(e){if(U.current!==t)return;$e(e instanceof Error?e.message:`Could not load music sources.`)}},[]),Gt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/downloads`,e));if(U.current!==t)return;Je([...n.downloads].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())),tt(``)}catch(e){if(U.current!==t)return;tt(e instanceof Error?e.message:`Could not load downloads.`)}},[]),Kt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/tracks`,e));if(U.current!==t)return;Pe(n.tracks.map(Ae))}catch{}},[]),qt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/playlists`,e));if(U.current!==t)return;Ie(n.playlists.map(je))}catch{}},[]),Jt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/recently-played`,e));if(U.current!==t)return;ze(Array.isArray(n.items)?n.items.slice(0,10):[])}catch{}},[]);E(()=>{let e=V?.id,t=window.setTimeout(()=>{Wt(e),Gt(e),Kt(e),qt(e),Jt(e)},0),n=window.setInterval(()=>{Gt(e)},1600),r=window.setInterval(()=>{Kt(e),qt(e),Jt(e)},3e3),i=window.setInterval(()=>{Wt(e)},6e3);return()=>{window.clearTimeout(t),window.clearInterval(n),window.clearInterval(r),window.clearInterval(i)}},[V?.id,Gt,Wt,Jt,qt,Kt]),E(()=>{let t=new AbortController,n=()=>void Vt(t.signal),r=()=>{document.visibilityState===`visible`&&n()},a=window.setInterval(n,3e3);if(window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,r),!e.length||!i){let e=window.requestAnimationFrame(n);return()=>{t.abort(),window.cancelAnimationFrame(e),window.clearInterval(a),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}}return()=>{t.abort(),window.clearInterval(a),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}},[i,e.length,Vt]);let Z=T((e,t)=>{let n=Et.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,Mt.current=``,n.load()),!t){n.pause();return}n.play().catch(()=>{y(!1),Y(`This downloaded track could not be played.`)})}},[Y]),Yt=T((e,t=!0)=>{if(e.id===d&&t){let t=!v;y(t),t&&(mt(!0),X({kind:`track`,track:e})),Z(e,t);return}f(e.id),H.current=0,x(0),y(t),t&&(mt(!0),X({kind:`track`,track:e})),Z(e,t)},[d,v,X,Z]),Xt=T(e=>{let t=W.find(t=>t.id===e.trackIds[0]);if(!t){Y(`${e.title} has no playable songs yet`);return}let n=e.id===p,r=e.trackIds.includes(d),i=!(n&&r&&v);mt(!0),h(e.id),i&&X({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?y(e=>!e):(f(t.id),H.current=0,x(0),y(!0))},[W,p,d,v,X,Y]),Q=T(()=>{q.length&&(f(e=>{let t=q.findIndex(t=>t.id===e),n=t>=0?(t+1)%q.length:0;if(fe&&q.length>1)do n=Math.floor(Math.random()*q.length);while(n===t);return q[n]?.id??e}),H.current=0,x(0))},[q,fe]),Zt=T(e=>{let t=Math.max(0,Math.min(e,J||e));H.current=t,x(t);let n=Et.current;K.audioUrl&&n?.dataset.trackId===K.id&&(n.currentTime=t)},[K.audioUrl,K.id,J]),Qt=T(()=>{if(H.current>4){Zt(0);return}q.length&&(f(e=>{let t=q.findIndex(t=>t.id===e),n=(Math.max(0,t)-1+q.length)%q.length;return q[n]?.id??e}),H.current=0,x(0))},[Zt,q]);E(()=>{if(!v||K.audioUrl)return;let e=window.setInterval(()=>{x(e=>{if(e+1>=K.durationSec)return H.current=K.durationSec,window.setTimeout(()=>{me?(H.current=0,x(0)):Q()},0),K.durationSec;let t=e+1;return H.current=t,t})},1e3);return()=>window.clearInterval(e)},[K.audioUrl,K.durationSec,Q,v,me]),E(()=>{let e=Et.current;e&&(e.volume=S/100)},[S]),E(()=>{let e=Et.current;if(e){if(!K.audioUrl){e.dataset.trackId&&(e.pause(),e.removeAttribute(`src`),delete e.dataset.trackId,e.load());return}(e.dataset.trackId!==K.id||e.getAttribute(`src`)!==K.audioUrl)&&(e.src=K.audioUrl,e.dataset.trackId=K.id,Mt.current=``,e.load()),v&&e.paused?e.play().catch(()=>{y(!1),Y(`This downloaded track could not be played.`)}):!v&&!e.paused&&e.pause()}},[K.audioUrl,K.id,v,Y]);let $t=T(()=>{let e=!v;y(e),e&&mt(!0),Z(K,e)},[K,v,Z]),en=T(e=>{y(!e),Z(K,!e)},[K,Z]),tn=T(e=>{ce(t=>e?(t>0&&de(t),0):t>0?t:ue||74)},[ue]),nn=T(e=>{let t=Math.max(0,Math.min(100,Math.round(e*100)));ce(t),t>0&&de(t)},[]),rn=T(e=>{let t=W.find(t=>t.id===e);t&&(f(t.id),H.current=0,x(0),y(!0),mt(!0),X({kind:`track`,track:t}),Z(t,!0))},[W,X,Z]),an=T(e=>{let t=G.find(t=>t.id===e);t&&Xt(t)},[G,Xt]);De({active:pt,profileId:V?.id??``,track:K,currentTime:ae,duration:J,isPlaying:v,volume:S,onSetPaused:en,onSeek:Zt,onSetMuted:tn,onSetVolume:nn,onPrevious:Qt,onNext:Q,onSelectTrack:rn,onSelectPlaylist:an});let on=T(e=>{switch(e.type){case`set-paused`:en(e.paused);break;case`seek-relative`:Zt(H.current+e.seconds);break;case`seek-to`:Zt(e.seconds);break;case`set-muted`:tn(e.muted);break;case`set-volume`:nn(e.volume);break;case`previous-track`:Qt();break;case`next-track`:Q();break;case`switch-track`:rn(e.trackId);break;case`switch-playlist`:an(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}},[Q,Qt,Zt,an,rn,tn,en,nn]);E(()=>{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(),c(`search`),window.requestAnimationFrame(()=>Tt.current?.focus());else if(e.key===`Escape`){if(it){zt();return}let e=L||z||nt;R(!1),B(!1),nt?Rt():rt(!1),!e&&A&&_e(``)}else e.code===`Space`&&!n&&(e.preventDefault(),$t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Rt,zt,z,it,A,nt,L,$t]),E(()=>{if(!it)return;let e=window.requestAnimationFrame(()=>kt.current?.focus());return()=>window.cancelAnimationFrame(e)},[it]),E(()=>{if(!L&&!z)return;let e=e=>{e.target instanceof Node&&!At.current?.contains(e.target)&&(R(!1),B(!1))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[z,L]),E(()=>()=>{jt.current&&clearTimeout(jt.current)},[]);let sn=D(()=>{let e=Fe.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[s[0],...e,...s.slice(1)]},[Fe]),cn=D(()=>{let e=ve.trim().toLowerCase(),t=sn.filter(t=>{let n=j===`all`||t.kind===j||j===`playlist`&&t.kind===`collection`,r=!e||`${t.title} ${t.subtitle}`.toLowerCase().includes(e);return n&&r});return we?t:[...t].reverse()},[sn,j,we,ve]),ln=A.trim().toLowerCase(),un=D(()=>ln?W.filter(e=>`${e.title} ${e.artist} ${e.album}`.toLowerCase().includes(ln)):[],[W,ln]),dn=D(()=>ln?G.filter(e=>`${e.title} ${e.description}`.toLowerCase().includes(ln)):[],[G,ln]),fn=D(()=>Le.map(e=>{if(e.kind===`track`){let t=W.find(t=>t.id===e.track.id);return t?{kind:`track`,track:t}:null}let t=G.find(t=>t.id===e.playlist.id);return t?{kind:`playlist`,playlist:t}:null}).filter(e=>e!==null).slice(0,10),[G,W,Le]),pn=e=>{Me(t=>{let n=new Set(t),r=W.find(t=>t.id===e);return n.has(e)?(n.delete(e),Y(`Removed ${r?.title??`track`} from Liked Songs`)):(n.add(e),Y(`Added ${r?.title??`track`} to Liked Songs`)),n})},mn=e=>{if(e.playlistId){let t=G.find(t=>t.id===e.playlistId);if(t){Xt(t),Y(`Playing ${t.title}`);return}}if(e.id===`liked-songs`){Yt(W.find(e=>N.has(e.id))??ee[0]),Y(`Playing Liked Songs`);return}let t=W.find(t=>`${t.artist} ${t.album}`.includes(e.title));t&&(Yt(t),Y(`Playing ${e.title}`))},hn=async e=>{let t=V?.id??null;St(t=>new Set(t).add(e.id)),He(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`syncing`,error:null}:t));try{let n=await P(F(`/api/spotify/providers/${encodeURIComponent(e.id)}/sync`,t),{method:`POST`});if(U.current!==t)return;He(t=>t.map(t=>t.id===e.id?n.provider:t)),$e(``),Y(`${e.name} is synced`),Kt(t)}catch(n){if(U.current!==t)return;let r=n instanceof Error?n.message:`Could not sync ${e.name}.`;He(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`failed`,error:r}:t)),Y(`Could not sync ${e.name}`)}finally{U.current===t&&St(t=>{let n=new Set(t);return n.delete(e.id),n})}},gn=async e=>{e.preventDefault();let t=V?.id??null,n=ht.trim();vt(``);try{let e=new URL(n);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw Error(`Enter a valid http or https music link.`)}catch{vt(`Enter a valid music link.`);return}bt(!0);try{let e=await P(`/api/spotify/music`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:n,profileId:t})});if(U.current!==t)return;if(e.download){let t=e.download;Je(e=>[t,...e.filter(e=>e.id!==t.id)])}if(e.playlist){let t=je(e.playlist);Ie(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.`);gt(``),R(!1),B(!0),Y(e.playlist?`${e.playlist.title} added to Your Library`:`Music added to downloads`),Gt(t),qt(t),Kt(t)}catch(e){if(U.current!==t)return;vt(e instanceof Error?e.message:`Could not add this music link.`)}finally{U.current===t&&bt(!1)}},_n=e=>{let t=Ae(e);Pe(e=>[t,...e.filter(e=>e.id!==t.id)]),Yt(t)},$=e=>{c(e),R(!1),B(!1),e===`search`&&window.requestAnimationFrame(()=>Tt.current?.focus())},vn=J>0?Math.min(100,ae/J*100):0,yn={"--range-progress":`${vn}%`},bn={"--range-progress":`${S}%`},xn={service:`spotify`,sessionId:`mobile-now-playing`,profileId:V?.id??`local-profile`,titleId:K.id,title:K.title,artist:K.artist,album:K.album,provider:K.provider??`Spotify Atom`,artwork:Ee(K),currentTime:ae,duration:J,paused:!v,muted:S<=0,volume:S/100,deviceType:`phone`,updatedAt:0};return w(`div`,{className:`spotifyApp`,children:[w(`aside`,{className:`sidebar`,children:[w(`div`,{className:`sidebarTop`,children:[w(`button`,{className:`brand`,onClick:()=>$(`home`),type:`button`,children:[C(Re,{}),C(`span`,{children:`Spotify`})]}),w(`div`,{className:`sidebarPrimaryNav`,children:[w(`button`,{className:o===`home`?`sidebarNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[C(n,{fill:o===`home`?`currentColor`:`none`,size:24}),`Home`]}),w(`button`,{className:o===`search`?`sidebarNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[C(_,{size:24}),`Search`]})]})]}),w(`section`,{className:`libraryPanel`,children:[w(`div`,{className:`libraryHeader`,children:[w(`button`,{onClick:()=>$(`library`),type:`button`,children:[C(ye,{size:23}),C(`span`,{children:`Your Library`})]}),w(`div`,{children:[C(I,{label:`Create playlist or folder`,onClick:()=>Y(`Your new playlist is ready to name`),children:C(oe,{size:20})}),C(I,{label:`Expand your library`,onClick:()=>$(`library`),children:C(ne,{size:20})})]})]}),C(`div`,{className:`filterChips`,"aria-label":`Library filters`,children:[`all`,`playlist`,`artist`,`album`].map(e=>C(`button`,{className:j===e?`chipActive`:``,onClick:()=>Ce(e),type:`button`,children:e===`all`?`All`:e===`playlist`?`Playlists`:`${e[0].toUpperCase()}${e.slice(1)}s`},e))}),w(`div`,{className:`libraryTools`,children:[w(`label`,{children:[C(_,{"aria-hidden":`true`,size:17}),C(`input`,{"aria-label":`Search in Your Library`,onChange:e=>Se(e.target.value),placeholder:`Search in Your Library`,value:ve}),ve?C(`button`,{"aria-label":`Clear library search`,onClick:()=>Se(``),type:`button`,children:C(g,{size:15})}):null]}),w(`button`,{className:`recentsButton`,onClick:()=>Te(e=>!e),type:`button`,children:[we?`Recents`:`Oldest`,C(be,{size:17})]})]}),w(`div`,{className:`libraryList`,children:[cn.map(e=>C(Be,{active:!!(e.playlistId&&e.playlistId===p),item:e,onSelect:()=>mn(e)},e.id)),cn.length?null:w(`div`,{className:`emptyLibrary`,children:[C(_,{size:24}),C(`strong`,{children:`No matches found`}),C(`span`,{children:`Try another search or filter.`})]})]})]})]}),w(`main`,{className:`mainPanel`,children:[w(`header`,{className:`topBar`,children:[w(`div`,{className:`historyButtons`,children:[C(I,{label:`Go back`,onClick:()=>$(`home`),children:C(t,{size:25})}),C(I,{label:`Go forward`,children:C(ie,{size:25})})]}),w(`div`,{className:`globalSearch ${o===`search`?`searchEmphasis`:``}`,children:[C(_,{"aria-hidden":`true`,size:21}),C(`input`,{onChange:e=>{_e(e.target.value),e.target.value&&c(`search`)},onFocus:()=>c(`search`),placeholder:`What do you want to play?`,ref:Tt,value:A}),A?C(`button`,{"aria-label":`Clear search`,className:`clearSearch`,onClick:()=>_e(``),type:`button`,children:C(g,{size:18})}):C(`kbd`,{children:`⌘ K`})]}),w(`div`,{className:`topActions`,ref:At,children:[C(`button`,{className:`explorePremium`,onClick:()=>Y(`Premium looks good on you`),type:`button`,children:`Explore Premium`}),w(`button`,{className:`installButton`,onClick:()=>Y(`Spotify is ready in your browser`),type:`button`,children:[C(se,{size:16}),`Install App`]}),w(`div`,{className:`headerPopoverWrap`,children:[C(I,{className:`sourceActionButton`,controls:`source-popover`,expanded:L,hasPopup:`dialog`,label:`Music sources`,onClick:()=>{let e=!L;R(e),B(!1),rt(!1),e&&Wt(V?.id)},children:C(le,{size:19})}),L?C(Ue,{addMusicError:_t,addingMusic:yt,musicUrl:ht,onAddMusic:gn,onClose:()=>R(!1),onMusicUrlChange:e=>{gt(e),_t&&vt(``)},onSync:e=>{hn(e)},providerError:Qe,providers:Ve,syncingProviderIds:xt}):null]}),w(`div`,{className:`headerPopoverWrap`,children:[w(I,{className:`downloadsActionButton`,controls:`downloads-popover`,expanded:z,hasPopup:`dialog`,label:Lt?`Downloads, ${Lt} active`:`Downloads`,onClick:()=>{let e=!z;B(e),R(!1),rt(!1),e&&(Gt(V?.id),Kt(V?.id))},children:[C(se,{size:19}),Lt?C(`span`,{className:`downloadActionBadge`,"aria-hidden":`true`,children:Lt>9?`9+`:Lt}):null]}),z?C(We,{currentTrackId:d,downloads:Ge,error:et,isPlaying:v,onClose:()=>B(!1),onPlay:_n}):null]}),C(I,{label:`What’s New`,onClick:()=>{R(!1),B(!1)},children:C(he,{size:19})}),V?C(`div`,{className:`sharedProfileAction`,onFocus:()=>{R(!1),B(!1)},onPointerDown:()=>{R(!1),B(!1)},children:C(te,{profiles:ut,activeProfile:V,onSelectProfile:Ht,onProfilesChanged:Ut})}):null]})]}),w(`div`,{className:`mainScroll`,children:[o===`home`?C(Ke,{currentPlaylistId:p,isPlaying:v,onPlayPlaylist:Xt,onShowSearch:()=>$(`search`)}):null,o===`search`?C(qe,{currentPlaylistId:p,currentTrackId:d,isPlaying:v,likedTracks:N,matchingPlaylists:dn,matchingTracks:un,normalizedQuery:ln,onLike:pn,onPlayPlaylist:Xt,onSelectTrack:Yt,query:A,recentItems:fn,setQuery:_e}):null,o===`library`?C(Ye,{availableTracks:W,currentPlaylistId:p,currentTrackId:d,filteredLibrary:cn,isPlaying:v,likedTracks:N,onOpenItem:mn,onSelectTrack:Yt}):null,w(`footer`,{className:`contentFooter`,children:[w(`div`,{children:[C(`strong`,{children:`Spotify Atom`}),C(`span`,{children:`A Next.js listening experience.`})]}),C(`span`,{children:`Fictional artists and demo content`})]})]}),nt?C(Xe,{currentTrack:K,onClose:Rt,onSelectTrack:Yt,playlistTitle:Ft.title,tracks:It}):null]}),C(`audio`,{"aria-hidden":`true`,className:`audioEngine`,onEnded:e=>{me?(e.currentTarget.currentTime=0,e.currentTarget.play().catch(()=>{y(!1),Y(`This downloaded track could not be replayed.`)})):Q()},onError:e=>{let t=e.currentTarget.dataset.trackId;t&&t===K.id&&Mt.current!==t&&(Mt.current=t,y(!1),Y(`The downloaded audio file is unavailable.`))},onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&wt({trackId:e.currentTarget.dataset.trackId??K.id,duration:t})},onTimeUpdate:e=>{if(e.currentTarget.dataset.trackId===K.id){let t=e.currentTarget.currentTime;H.current=t,x(t)}},preload:`metadata`,ref:Et}),C(Ze,{currentTrack:K,duration:J,elapsed:ae,isPlaying:v,liked:N.has(K.id),onLike:()=>pn(K.id),onNext:Q,onPrevious:Qt,onSeek:Zt,onTogglePlay:$t,onToggleQueue:()=>{rt(e=>!e),R(!1),B(!1)},onVolumeChange:e=>{ce(e),e>0&&de(e)},progressStyle:yn,queueButtonRef:Dt,queueOpen:nt,repeat:me,setRepeat:ge,setShuffle:pe,shuffle:fe,showToast:Y,volume:S,volumeStyle:bn,toggleMute:()=>{S>0?(de(S),ce(0)):ce(ue||74)}}),w(`div`,{className:`mobilePlayer`,children:[C(`span`,{className:`mobilePlayerProgress`,style:{width:`${vn}%`}}),C(M,{className:`mobilePlayerArt`,imageUrl:K.imageUrl,palette:K.palette,title:K.title}),w(`button`,{className:`mobilePlayerCopy`,onClick:()=>Y(`${K.title} · ${K.artist}`),type:`button`,children:[C(`strong`,{children:K.title}),C(`span`,{children:K.artist})]}),C(I,{label:`${N.has(K.id)?`Remove from`:`Add to`} Liked Songs`,onClick:()=>pn(K.id),pressed:N.has(K.id),children:C(r,{fill:N.has(K.id)?`currentColor`:`none`,size:21})}),C(I,{className:`mobilePlayToggle`,label:v?`Pause`:`Play`,onClick:$t,children:C(v?m:b,{fill:`currentColor`,size:25})}),C(I,{buttonRef:Ot,className:`mobileExpandToggle`,controls:`mobile-expanded-player`,expanded:it,hasPopup:`dialog`,label:`Expand player`,onClick:()=>{at(!0),R(!1),B(!1)},children:C(xe,{size:21})})]}),it?C(`div`,{className:`mobileExpandedPlayerBackdrop`,onClick:zt,children:w(`section`,{"aria-label":`Now playing ${K.title}`,"aria-modal":`true`,className:`mobileExpandedPlayer`,id:`mobile-expanded-player`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[w(`header`,{className:`mobileExpandedPlayerHeader`,children:[w(`div`,{children:[C(`span`,{children:`Spotify activity`}),C(`h2`,{children:`Now playing`})]}),C(I,{autoFocus:!0,buttonRef:kt,label:`Close expanded player`,onClick:zt,children:C(g,{size:20})})]}),C(a,{activity:xn,onCommand:on,onSearchToggle:()=>st(e=>!e),searchOpen:ot,tabLabel:`This device`})]})}):null,ot?C(l,{activity:xn,onClose:()=>st(!1),onSelectPlaylist:async e=>{an(e.id)},onSelectTrack:async e=>{rn(e.id)}}):null,w(`nav`,{className:`mobileNav`,"aria-label":`Main navigation`,children:[w(`button`,{className:o===`home`?`mobileNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[C(n,{fill:o===`home`?`currentColor`:`none`,size:24}),C(`span`,{children:`Home`})]}),w(`button`,{className:o===`search`?`mobileNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[C(_,{size:24}),C(`span`,{children:`Search`})]}),w(`button`,{className:o===`library`?`mobileNavActive`:``,onClick:()=>$(`library`),type:`button`,children:[C(ye,{size:24}),C(`span`,{children:`Your Library`})]})]}),w(`div`,{"aria-atomic":`true`,"aria-live":`polite`,className:`toast ${ct?`toastVisible`:``}`,children:[C(re,{size:18}),ct]})]})}function Ke({currentPlaylistId:e,isPlaying:t,onPlayPlaylist:n,onShowSearch:r}){let a=u.find(e=>e.id===`discover-weekly`)??u[0],o=u.slice(4,10);return w(`div`,{className:`homeView`,children:[w(`section`,{className:`hero`,children:[C(`div`,{className:`heroGlow`}),w(`div`,{className:`heroCopy`,children:[w(`span`,{className:`heroEyebrow`,children:[C(d,{size:15}),`MADE FOR YOU`]}),C(`h1`,{children:`Soundtrack your every move.`}),C(`p`,{children:`New discoveries, old favorites, and the right music for right now.`}),w(`div`,{className:`heroActions`,children:[w(`button`,{className:`primaryButton`,onClick:()=>n(a),type:`button`,children:[e===a.id&&t?C(m,{fill:`currentColor`,size:19}):C(b,{fill:`currentColor`,size:19}),e===a.id&&t?`Pause your mix`:`Play your mix`]}),w(`button`,{className:`secondaryButton`,onClick:r,type:`button`,children:[C(ve,{size:19}),`Explore music`]})]})]}),w(`div`,{className:`heroArt`,"aria-hidden":`true`,children:[C(M,{className:`heroCover heroCoverBack`,palette:u[1].palette,title:u[1].title}),C(M,{className:`heroCover heroCoverMiddle`,palette:u[3].palette,title:u[3].title}),C(M,{className:`heroCover heroCoverFront`,palette:u[0].palette,title:u[0].title})]})]}),w(`section`,{className:`quickSection`,children:[C(`div`,{className:`sectionTitleRow compactTitleRow`,children:w(`div`,{children:[C(`span`,{className:`sectionEyebrow`,children:`PICK UP WHERE YOU LEFT OFF`}),C(`h2`,{children:`Good evening`})]})}),C(`div`,{className:`quickGrid`,children:o.map(r=>{let i=r.id===e;return w(`button`,{className:`quickTile ${i?`quickTileActive`:``}`,onClick:()=>n(r),type:`button`,children:[C(M,{className:`quickTileArt`,palette:r.palette,title:r.title}),C(`strong`,{children:r.title}),C(`span`,{className:`quickTilePlay`,"aria-hidden":`true`,children:C(i&&t?m:b,{fill:`currentColor`,size:19})})]},r.id)})})]}),i.map(r=>{let i=r.playlistIds.map(e=>u.find(t=>t.id===e)).filter(e=>!!e);return w(`section`,{className:`shelfSection`,children:[w(`div`,{className:`sectionTitleRow`,children:[w(`div`,{children:[C(`h2`,{children:r.title}),r.description?C(`p`,{children:r.description}):null]}),C(`button`,{type:`button`,children:`Show all`})]}),C(`div`,{className:`playlistGrid`,children:i.map(r=>C(Ve,{active:r.id===e,onPlay:()=>n(r),playing:t,playlist:r},r.id))})]},r.id)})]})}function qe({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 w(`div`,{className:`searchView`,children:[w(`div`,{className:`pageHeading`,children:[C(`span`,{className:`sectionEyebrow`,children:`FIND YOUR NEXT FAVORITE`}),C(`h1`,{children:`Search`}),C(`p`,{children:`Artists, songs, albums, playlists, and everything in between.`})]}),w(`label`,{className:`mobileSearchInput`,children:[C(_,{size:21}),C(`input`,{onChange:e=>f(e.target.value),placeholder:`What do you want to play?`,value:u}),u?C(`button`,{"aria-label":`Clear search`,onClick:()=>f(``),type:`button`,children:C(g,{size:19})}):null]}),o?C(`div`,{className:`searchResults`,children:a.length||i.length?w(ge,{children:[w(`section`,{className:`topResultSection`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Top result`})}),w(`div`,{className:`topResultLayout`,children:[a[0]?w(`button`,{className:`topResultCard`,onClick:()=>l(a[0]),type:`button`,children:[C(M,{className:`topResultArt`,imageUrl:a[0].imageUrl,palette:a[0].palette,title:a[0].title}),C(`strong`,{children:a[0].title}),w(`span`,{children:[`Song · `,C(`b`,{children:a[0].artist})]}),C(`span`,{className:`topResultPlay`,children:t===a[0].id&&n?C(m,{fill:`currentColor`,size:26}):C(b,{fill:`currentColor`,size:26})})]}):i[0]?w(`button`,{className:`topResultCard`,onClick:()=>c(i[0]),type:`button`,children:[C(M,{className:`topResultArt`,imageUrl:i[0].imageUrl,palette:i[0].palette,title:i[0].title}),C(`strong`,{children:i[0].title}),w(`span`,{children:[`Playlist · `,i[0].curator]}),C(`span`,{className:`topResultPlay`,children:C(b,{fill:`currentColor`,size:26})})]}):null,w(`div`,{className:`songResults`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Songs`})}),a.slice(0,4).map(e=>C(He,{active:e.id===t,liked:r.has(e.id),onLike:()=>s(e.id),onSelect:()=>l(e),playing:n,track:e},e.id))]})]})]}),i.length?w(`section`,{className:`shelfSection searchPlaylistSection`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Playlists`})}),C(`div`,{className:`playlistGrid`,children:i.slice(0,5).map(e=>C(Ve,{active:!1,onPlay:()=>c(e),playing:n,playlist:e},e.id))})]}):null]}):w(`div`,{className:`noResults`,children:[C(`span`,{children:C(_,{size:28})}),w(`h2`,{children:[`No results found for “`,u,`”`]}),C(`p`,{children:`Check the spelling or try fewer words.`})]})}):w(`section`,{"aria-labelledby":`search-recent-heading`,className:`searchRecentSection`,children:[C(`div`,{className:`sectionTitleRow`,children:w(`div`,{children:[C(`h2`,{id:`search-recent-heading`,children:`Recently played`}),C(`p`,{children:`Your latest songs and playlists.`})]})}),d.length?C(`div`,{className:`recentSearchGrid`,children:d.map(r=>C(Je,{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}`))}):w(`div`,{className:`searchRecentEmpty`,role:`status`,children:[C(_e,{"aria-hidden":`true`,size:27}),w(`div`,{children:[C(`strong`,{children:`Nothing played yet`}),C(`p`,{children:`Play a song or playlist and it will appear here.`})]})]})]})]})}function Je({active:e,item:t,onPlay:n,playing:r}){let i=t.kind===`track`?t.track:t.playlist,a=e&&r;return w(`button`,{"aria-label":`${a?`Pause`:`Play`} ${i.title}`,className:`recentSearchCard ${e?`recentSearchCardActive`:``}`,onClick:n,type:`button`,children:[w(`span`,{className:`recentSearchArt`,children:[C(M,{imageUrl:i.imageUrl,palette:i.palette,title:i.title}),C(`span`,{className:`recentSearchPlay`,"aria-hidden":`true`,children:C(a?m:b,{fill:`currentColor`,size:20})})]}),w(`span`,{className:`recentSearchCopy`,children:[C(`strong`,{children:i.title}),C(`span`,{children:t.kind===`track`?`Song · ${t.track.artist}`:`Playlist · ${t.playlist.curator}`})]})]})}function Ye({availableTracks:e,currentPlaylistId:t,currentTrackId:n,filteredLibrary:i,isPlaying:a,likedTracks:o,onOpenItem:s,onSelectTrack:c}){let l=e.filter(e=>o.has(e.id));return w(`div`,{className:`fullLibraryView`,children:[w(`div`,{className:`pageHeading libraryPageHeading`,children:[C(`span`,{className:`sectionEyebrow`,children:`SAVED FOR LATER`}),C(`h1`,{children:`Your Library`}),C(`p`,{children:`Playlists, artists, albums, and the songs you never skip.`})]}),w(`section`,{className:`libraryCollectionGrid`,children:[w(`button`,{className:`likedCollection`,onClick:()=>l[0]&&c(l[0]),type:`button`,children:[C(`span`,{className:`likedTrackNames`,children:l.slice(0,3).map(e=>w(`span`,{children:[C(`b`,{children:e.title}),` `,w(`span`,{children:[`· `,e.artist]})]},e.id))}),C(`strong`,{children:`Liked Songs`}),w(`span`,{children:[l.length,` songs`]}),C(`span`,{className:`likedCollectionPlay`,children:l.some(e=>e.id===n)&&a?C(m,{fill:`currentColor`,size:24}):C(b,{fill:`currentColor`,size:24})})]}),i.filter(e=>e.id!==`liked-songs`).slice(0,5).map(e=>w(`button`,{className:`libraryCollectionCard ${e.playlistId===t?`libraryCollectionActive`:``}`,onClick:()=>s(e),type:`button`,children:[C(M,{className:`libraryCollectionArt`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),C(`strong`,{children:e.title}),C(`span`,{children:e.subtitle})]},e.id))]}),w(`section`,{className:`shelfSection likedTracksSection`,children:[w(`div`,{className:`sectionTitleRow`,children:[w(`div`,{children:[C(`h2`,{children:`Your liked songs`}),C(`p`,{children:`The tracks at the heart of your library.`})]}),C(_e,{size:20})]}),C(`div`,{className:`likedTracksTable`,children:l.map((e,t)=>w(`button`,{className:e.id===n?`likedTrackActive`:``,onClick:()=>c(e),type:`button`,children:[C(`span`,{className:`likedTrackNumber`,children:e.id===n&&a?w(`span`,{className:`miniEqualizer`,children:[C(`i`,{}),C(`i`,{}),C(`i`,{})]}):t+1}),C(M,{className:`likedTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`likedTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]}),C(`span`,{className:`likedTrackAlbum`,children:e.album}),C(r,{"aria-hidden":`true`,fill:`currentColor`,size:17}),C(`span`,{children:Le(e.durationSec)})]},e.id))})]})]})}function Xe({currentTrack:e,onClose:t,onSelectTrack:n,playlistTitle:r,tracks:i}){return w(`aside`,{"aria-labelledby":`queue-heading`,className:`queuePanel`,id:`queue-panel`,role:`dialog`,children:[w(`header`,{className:`queueHeader`,children:[C(`h2`,{id:`queue-heading`,children:`Queue`}),C(I,{autoFocus:!0,label:`Close queue`,onClick:t,children:C(g,{size:20})})]}),w(`div`,{className:`queueScroll`,children:[w(`section`,{"aria-labelledby":`queue-now-playing`,children:[C(`h3`,{id:`queue-now-playing`,children:`Now playing`}),w(`div`,{className:`queueTrack queueTrackCurrent`,children:[C(M,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`queueTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]})]})]}),w(`section`,{className:`queueNext`,"aria-labelledby":`queue-next-heading`,children:[w(`h3`,{id:`queue-next-heading`,children:[`Next from: `,r]}),i.length?C(`div`,{className:`queueTrackList`,children:i.map(e=>w(`button`,{className:`queueTrack`,onClick:()=>n(e),type:`button`,children:[C(M,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`queueTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]})]},e.id))}):C(`p`,{className:`queueEmpty`,children:`There are no more songs in this queue.`})]})]})]})}function Ze({currentTrack:e,duration:t,elapsed:n,isPlaying:i,liked:a,onLike:o,onNext:s,onPrevious:l,onSeek:u,onTogglePlay:d,onToggleQueue:f,onVolumeChange:ee,progressStyle:p,queueButtonRef:te,queueOpen:ne,repeat:m,setRepeat:h,setShuffle:g,shuffle:_,showToast:re,toggleMute:ie,volume:b,volumeStyle:oe}){return w(`footer`,{className:`desktopPlayer`,children:[w(`div`,{className:`playerTrack`,children:[C(M,{className:`playerCover`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`div`,{className:`playerTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]}),C(I,{label:`${a?`Remove from`:`Add to`} Liked Songs`,onClick:o,pressed:a,children:C(r,{fill:a?`currentColor`:`none`,size:19})}),C(I,{label:`Open Now Playing view`,onClick:()=>re(`Now Playing view is already in focus`),children:C(xe,{size:17})})]}),w(`div`,{className:`playerCenter`,children:[w(`div`,{className:`transportControls`,children:[C(I,{label:`Turn shuffle ${_?`off`:`on`}`,onClick:()=>g(!_),pressed:_,children:C(we,{size:18})}),C(I,{label:`Previous`,onClick:l,children:C(c,{fill:`currentColor`,size:19})}),C(ze,{label:i?`Pause`:`Play`,onClick:d,playing:i,size:`small`}),C(I,{label:`Next`,onClick:s,children:C(v,{fill:`currentColor`,size:19})}),C(I,{label:`Turn repeat ${m?`off`:`on`}`,onClick:()=>h(!m),pressed:m,children:C(Ce,{size:18})})]}),w(`div`,{className:`progressRow`,children:[C(`span`,{children:Le(n)}),C(`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:p,type:`range`,value:Math.min(n,t)}),C(`span`,{children:Le(t)})]})]}),w(`div`,{className:`playerTools`,children:[C(I,{label:`Now Playing view`,children:C(be,{size:18})}),C(I,{className:`playerQueueButton`,controls:`queue-panel`,expanded:ne,hasPopup:`dialog`,label:`Queue`,onClick:f,pressed:ne,buttonRef:te,children:C(be,{size:18})}),C(I,{label:`Connect to a device`,onClick:()=>re(`Listening on this web browser`),children:C(Se,{size:18})}),C(I,{label:b===0?`Unmute`:`Mute`,onClick:ie,children:C(b===0?y:ae,{size:20})}),C(`input`,{"aria-label":`Volume`,className:`range volumeRange`,max:100,min:0,onChange:e=>ee(Number(e.target.value)),style:oe,type:`range`,value:b}),C(I,{label:`Full screen`,children:C(xe,{size:17})})]})]})}export{Ge as SpotifyApp};
|