@serifpersia/dango 3.6.0 → 3.6.2
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 +45 -13
- package/client/dist/assets/{AnimeCard-CEDL_2lC.js → AnimeCard-KCdQSFYo.js} +1 -1
- package/client/dist/assets/AnimeInfo-BivVqWcB.css +1 -0
- package/client/dist/assets/AnimeInfo-CWppMyrH.js +1 -0
- package/client/dist/assets/{AnimeInfoPage-a1-1F_la.js → AnimeInfoPage-CfYONEFT.js} +2 -2
- package/client/dist/assets/{Asmr-CCMuiaoR.js → Asmr-CbkxcXne.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-CiwgOhH2.js → AsmrResetProgressModal-CjPrSioI.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-XNJmMFmH.js +10 -0
- package/client/dist/assets/AvSyncCalibrator-ZSpMgUid.css +1 -0
- package/client/dist/assets/{Home-BmTp0Dx7.js → Home-BTkitKD6.js} +1 -1
- package/client/dist/assets/Home-DeY8zvfI.css +1 -0
- package/client/dist/assets/{Insights-C89oz_3z.js → Insights-_LB6kp3M.js} +1 -1
- package/client/dist/assets/{LibraryListPage-DOSPLTiR.js → LibraryListPage-4BBrV2Ne.js} +1 -1
- package/client/dist/assets/{ListeningList-IHSyufXX.js → ListeningList-BlAwt-LT.js} +1 -1
- package/client/dist/assets/{Manga-H4hG-3K8.js → Manga-BtLdEUi5.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-Bjz2NwLc.js → MangaInfoPage-CQr6_pSH.js} +1 -1
- package/client/dist/assets/{MangaReadPage-DZakUml0.js → MangaReadPage-DUHUub1H.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-kbpad7Vl.js → MangaResetProgressModal-CnP9RIzg.js} +1 -1
- package/client/dist/assets/{Mature-DfODnRR8.js → Mature-Dv8i7W02.js} +1 -1
- package/client/dist/assets/{MediaCard-fN3GQyTJ.js → MediaCard-tBWyjKaV.js} +1 -1
- package/client/dist/assets/{Music-CFVwJyIo.js → Music-kBqpbxdz.js} +1 -1
- package/client/dist/assets/{OptionListMenu-BjoortST.js → OptionListMenu-BiiWXfEL.js} +1 -1
- package/client/dist/assets/{Player-DMeWl-5s.js → Player-CXReluOl.js} +6 -6
- package/client/dist/assets/Player-DCB994_8.css +1 -0
- package/client/dist/assets/PlayerSettings-BXGe3F5k.css +1 -0
- package/client/dist/assets/{PlayerSettings-DaG98x1K.js → PlayerSettings-uFwbD3Z7.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-MpSKva6y.js → QueueOptionsButton-BN-6sbNV.js} +1 -1
- package/client/dist/assets/{QueueRail-CtLxXvR_.js → QueueRail-BYyC_xPZ.js} +1 -1
- package/client/dist/assets/{Radio-D1zoU38z.js → Radio-DN66fPmx.js} +1 -1
- package/client/dist/assets/{ReadingList-C_oRyOHJ.js → ReadingList-6z-6l85T.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CpbOV9Sk.js → ResetProgressModal-CZieLUpX.js} +1 -1
- package/client/dist/assets/{Search-Cs8U1ZGO.js → Search-aO0P-vef.js} +1 -1
- package/client/dist/assets/Settings-CYeDIeBU.js +21 -0
- package/client/dist/assets/{SkeletonGrid-gCly-9x7.js → SkeletonGrid-DJKwfPjg.js} +1 -1
- package/client/dist/assets/Trackers-CLJvFNWX.js +2 -0
- package/client/dist/assets/Tv-B-TnGO82.js +4 -0
- package/client/dist/assets/Tv-Bdruknna.css +1 -0
- package/client/dist/assets/{TvInfo-CfYJPE-C.js → TvInfo-Y7k3LY78.js} +1 -1
- package/client/dist/assets/{TvPopup-BBIe0fHF.js → TvPopup-CM8RMOwX.js} +1 -1
- package/client/dist/assets/{TvSearch-Bfp_r265.js → TvSearch-Bn-OsC1u.js} +1 -1
- package/client/dist/assets/{TvWatchlist-DNcVUBXZ.js → TvWatchlist-PyOWvixK.js} +1 -1
- package/client/dist/assets/{Watchlist-DnC7uDc4.js → Watchlist-CCmzjnDR.js} +1 -1
- package/client/dist/assets/{hls-B9wsDt6U.js → hls-Dn7_lAv2.js} +1 -1
- package/client/dist/assets/index-D0Haw_Zl.css +1 -0
- package/client/dist/assets/index-VzVAYX5A.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-Dpkjj68s.js → useAnimeInfoData-BpD2dXLB.js} +1 -1
- package/client/dist/assets/{useAsmr-QqLyjBbR.js → useAsmr-Dm1-a4VV.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-CnYAAhDj.js → useAsmrPopup-2SWfvbnM.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-CxRsa2lr.js → useMangaLibrary-RpiA2f_k.js} +1 -1
- package/client/dist/assets/{useMangaPopup-CXnu2h4Y.js → useMangaPopup-Dcfgv2CZ.js} +1 -1
- package/client/dist/assets/{useProviders-DDPMV3HX.js → useProviders-vzvT6VhD.js} +1 -1
- package/client/dist/assets/{useTv-BkZAFGaD.js → useTv-DrhnOiw6.js} +1 -1
- package/client/dist/assets/{useTvLibrary-CL3kMD_c.js → useTvLibrary-DDReryyQ.js} +1 -1
- package/client/dist/index.html +2 -2
- package/client/dist/repo_logo.svg +19 -39
- package/orchestrator.js +107 -8
- package/package.json +2 -2
- package/server/dist/app-hono.js +13 -8
- package/server/dist/config.js +3 -2
- package/server/dist/hono/auth.js +0 -7
- package/server/dist/trpc/routers/auth.js +16 -0
- package/server/package.json +1 -1
- package/client/dist/assets/AnimeInfo-BFWtHlPC.css +0 -1
- package/client/dist/assets/AnimeInfo-mVGUoF9q.js +0 -1
- package/client/dist/assets/AvSyncCalibrator-PqA6B5Ey.js +0 -10
- package/client/dist/assets/AvSyncCalibrator-ieaRTs3u.css +0 -1
- package/client/dist/assets/Home-B_q2l74h.css +0 -1
- package/client/dist/assets/Player-DBLl-bj_.css +0 -1
- package/client/dist/assets/PlayerSettings-Bj6SsmQ2.css +0 -1
- package/client/dist/assets/Settings-BgcOeTlE.js +0 -21
- package/client/dist/assets/Trackers-DoHHWI2D.js +0 -2
- package/client/dist/assets/Tv-BlVIanQL.css +0 -1
- package/client/dist/assets/Tv-DhLdh3WF.js +0 -4
- package/client/dist/assets/index-C6HMOCqo.css +0 -1
- package/client/dist/assets/index-CfgPGaUO.js +0 -178
package/client/dist/index.html
CHANGED
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
background-color: #0c0d12;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
|
-
<script type="module" crossorigin src="/assets/index-
|
|
36
|
+
<script type="module" crossorigin src="/assets/index-VzVAYX5A.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-core-DfaOB3Rn.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-BBT5_sHx.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-DrybRNxP.js">
|
|
40
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
40
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D0Haw_Zl.css">
|
|
41
41
|
</head>
|
|
42
42
|
|
|
43
43
|
<body>
|
|
@@ -1,53 +1,33 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="38.4" height="13.3" viewBox="-11.85 -0.8 38.4 13.3">
|
|
2
2
|
<path
|
|
3
|
-
fill="
|
|
4
|
-
stroke="#
|
|
5
|
-
stroke-width="
|
|
6
|
-
stroke-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
fill="#e1afef"
|
|
4
|
+
stroke="#a978a9"
|
|
5
|
+
stroke-width="0.9"
|
|
6
|
+
stroke-linejoin="round"
|
|
7
|
+
paint-order="stroke fill"
|
|
8
|
+
d="M 7.0022839,0 C 3.0649855,0 -0.09802047,2.4883888 0.0022839,6 c 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.5304511,0.392468 6.5849461,-4.168088 C 13.62431,2.8853946 10.939582,0 7.0022839,0 Z" />
|
|
9
|
+
<path fill="#140f15" d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
10
|
+
<path fill="#140f15" d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
11
|
+
<g transform="translate(12.231148 1.5056648)">
|
|
9
12
|
<path
|
|
10
|
-
fill="#
|
|
11
|
-
stroke="#
|
|
12
|
-
stroke-width="0.9"
|
|
13
|
-
stroke-linejoin="round"
|
|
14
|
-
paint-order="stroke fill"
|
|
15
|
-
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
16
|
-
<path
|
|
17
|
-
fill="#140f15"
|
|
18
|
-
d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
19
|
-
<path
|
|
20
|
-
fill="#140f15"
|
|
21
|
-
d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
22
|
-
</g>
|
|
23
|
-
<g transform="translate(15 -0.9)">
|
|
24
|
-
<path
|
|
25
|
-
fill="#e1afef"
|
|
26
|
-
stroke="#a978a9"
|
|
13
|
+
fill="#e3e1ee"
|
|
14
|
+
stroke="#b3b1c6"
|
|
27
15
|
stroke-width="0.9"
|
|
28
16
|
stroke-linejoin="round"
|
|
29
17
|
paint-order="stroke fill"
|
|
30
18
|
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
31
|
-
<path
|
|
32
|
-
|
|
33
|
-
d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
34
|
-
<path
|
|
35
|
-
fill="#140f15"
|
|
36
|
-
d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
19
|
+
<path fill="#140f15" d="m 3.3556746,2.945744 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
20
|
+
<path fill="#140f15" d="m 6.9812931,2.945744 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
37
21
|
</g>
|
|
38
|
-
<g transform="translate(
|
|
22
|
+
<g transform="translate(-11.063909 1.423053)">
|
|
39
23
|
<path
|
|
40
|
-
fill="#
|
|
41
|
-
stroke="#
|
|
24
|
+
fill="#897cff"
|
|
25
|
+
stroke="#5646db"
|
|
42
26
|
stroke-width="0.9"
|
|
43
27
|
stroke-linejoin="round"
|
|
44
28
|
paint-order="stroke fill"
|
|
45
29
|
d="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z" />
|
|
46
|
-
<path
|
|
47
|
-
|
|
48
|
-
d="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
49
|
-
<path
|
|
50
|
-
fill="#140f15"
|
|
51
|
-
d="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z" />
|
|
30
|
+
<path fill="#140f15" d="m 7.3136624,3.376812 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z" />
|
|
31
|
+
<path fill="#140f15" d="m 10.939281,3.376812 c -0.585889,0 -0.652029,2.3368563 -0.02476,2.3368563 0.660496,0 0.670465,-2.3368563 0.02476,-2.3368563 z" />
|
|
52
32
|
</g>
|
|
53
33
|
</svg>
|
package/orchestrator.js
CHANGED
|
@@ -5,6 +5,7 @@ const http = require('http')
|
|
|
5
5
|
const os = require('os')
|
|
6
6
|
const path = require('path')
|
|
7
7
|
const crypto = require('crypto')
|
|
8
|
+
const { parseArgs } = require('util')
|
|
8
9
|
|
|
9
10
|
async function fetchJson(url, timeoutMs) {
|
|
10
11
|
const controller = new AbortController()
|
|
@@ -36,7 +37,38 @@ function detectGlobalInstall() {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const shutdownToken = crypto.randomBytes(32).toString('hex')
|
|
39
|
-
|
|
40
|
+
let options, mode
|
|
41
|
+
try {
|
|
42
|
+
const { values, positionals } = parseArgs({
|
|
43
|
+
allowPositionals: true,
|
|
44
|
+
options: {
|
|
45
|
+
port: { type: 'string' },
|
|
46
|
+
'dev-port': { type: 'string' },
|
|
47
|
+
'no-update': { type: 'boolean' },
|
|
48
|
+
version: { type: 'boolean', short: 'v' },
|
|
49
|
+
help: { type: 'boolean', short: 'h' },
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
options = values
|
|
53
|
+
mode = positionals[0] || 'prod'
|
|
54
|
+
if (positionals.length > 1 || !['dev', 'prod'].includes(mode)) {
|
|
55
|
+
throw new Error('Expected at most one mode: dev or prod')
|
|
56
|
+
}
|
|
57
|
+
for (const [flag, variable] of [
|
|
58
|
+
['port', 'PORT'],
|
|
59
|
+
['dev-port', 'DEV_PORT'],
|
|
60
|
+
]) {
|
|
61
|
+
const value = options[flag]
|
|
62
|
+
if (value === undefined) continue
|
|
63
|
+
if (!/^\d+$/.test(value) || Number(value) < 1 || Number(value) > 65535) {
|
|
64
|
+
throw new Error(`--${flag} must be an integer between 1 and 65535`)
|
|
65
|
+
}
|
|
66
|
+
process.env[variable] = String(Number(value))
|
|
67
|
+
}
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(`dango: ${err.message}`)
|
|
70
|
+
process.exit(1)
|
|
71
|
+
}
|
|
40
72
|
const isWin = os.platform() === 'win32'
|
|
41
73
|
const npmCmd = isWin ? 'npm.cmd' : 'npm'
|
|
42
74
|
|
|
@@ -47,16 +79,20 @@ const colors = {
|
|
|
47
79
|
system: '\x1b[33m',
|
|
48
80
|
}
|
|
49
81
|
|
|
50
|
-
if (
|
|
82
|
+
if (options.version) {
|
|
51
83
|
const pkg = require('./package.json')
|
|
52
84
|
console.log(`dango version ${pkg.version}`)
|
|
53
85
|
process.exit(0)
|
|
54
86
|
}
|
|
55
87
|
|
|
56
|
-
if (
|
|
57
|
-
console.log(
|
|
88
|
+
if (options.help) {
|
|
89
|
+
console.log(
|
|
90
|
+
'Usage: dango [dev|prod] [--port PORT] [--dev-port PORT] [--no-update] [--version] [--help]'
|
|
91
|
+
)
|
|
58
92
|
console.log(' dev Run with hot-reload (server + client)')
|
|
59
93
|
console.log(' prod Run pre-built version (default)')
|
|
94
|
+
console.log(' --port PORT Backend port (overrides PORT; default: 3000)')
|
|
95
|
+
console.log(' --dev-port PORT Development frontend port (overrides DEV_PORT; default: 5173)')
|
|
60
96
|
console.log(' --no-update Skip update checks')
|
|
61
97
|
console.log(' --version, -v Print version and exit')
|
|
62
98
|
console.log(' --help, -h Show this help and exit')
|
|
@@ -104,7 +140,7 @@ const isNewerVersion = (remote, current) => {
|
|
|
104
140
|
}
|
|
105
141
|
|
|
106
142
|
async function checkForUpdates() {
|
|
107
|
-
if (
|
|
143
|
+
if (options['no-update'] || mode === 'dev') return
|
|
108
144
|
|
|
109
145
|
try {
|
|
110
146
|
const isGlobalInstall = detectGlobalInstall()
|
|
@@ -224,6 +260,37 @@ const CLIENT_DIR = path.join(__dirname, 'client')
|
|
|
224
260
|
let syncSpinner = null
|
|
225
261
|
let syncMessage = ''
|
|
226
262
|
let syncDots = 0
|
|
263
|
+
let providerLineActive = false
|
|
264
|
+
let providerPhase = false
|
|
265
|
+
let providerFields = {}
|
|
266
|
+
let pendingProviderSummary = false
|
|
267
|
+
|
|
268
|
+
const ansiPattern = /\x1b\[[0-9;]*m/g
|
|
269
|
+
const readPrettyField = (line) => {
|
|
270
|
+
const match = /^\s+([\w-]+):\s*(.*)$/.exec(line.replace(ansiPattern, ''))
|
|
271
|
+
return match ? [match[1], match[2].trim().replace(/^"|"$/g, '')] : null
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const showProvider = (color, prefix, fields) => {
|
|
275
|
+
process.stdout.write(
|
|
276
|
+
`\r\x1b[K${color}[${prefix}]${colors.reset} ${colors.system}Loading providers${colors.reset} ` +
|
|
277
|
+
`${colors.client}${fields.provider || ''}${fields.version ? ` v${fields.version}` : ''}${colors.reset}`
|
|
278
|
+
)
|
|
279
|
+
providerLineActive = true
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const flushProviderSummary = (color, prefix) => {
|
|
283
|
+
if (providerLineActive) {
|
|
284
|
+
process.stdout.write('\n')
|
|
285
|
+
providerLineActive = false
|
|
286
|
+
}
|
|
287
|
+
if (!pendingProviderSummary) return
|
|
288
|
+
pendingProviderSummary = false
|
|
289
|
+
console.log(
|
|
290
|
+
`${color}[${prefix}]${colors.reset} ${colors.system}Providers ready${colors.reset} ` +
|
|
291
|
+
`${colors.client}${providerFields.count} anime, ${providerFields.mangaCount} manga, ${providerFields.tvCount} tv${colors.reset}`
|
|
292
|
+
)
|
|
293
|
+
}
|
|
227
294
|
|
|
228
295
|
const startSpinner = (msg) => {
|
|
229
296
|
stopSpinner()
|
|
@@ -281,7 +348,7 @@ const formatChildLine = (line) => {
|
|
|
281
348
|
const text =
|
|
282
349
|
`${time ? `[${time}] ` : ''}${levelColor}${levelName}${colors.reset} ${messageColor}${obj.msg}${colors.reset}` +
|
|
283
350
|
(extras.length ? ` (${propertyColor}${extras.join(' ')}${colors.reset})` : '')
|
|
284
|
-
return { text, msg: obj.msg }
|
|
351
|
+
return { text, msg: obj.msg, obj }
|
|
285
352
|
}
|
|
286
353
|
|
|
287
354
|
const log = (prefix, color, data) => {
|
|
@@ -293,9 +360,23 @@ const log = (prefix, color, data) => {
|
|
|
293
360
|
|
|
294
361
|
const display = []
|
|
295
362
|
for (const line of lines) {
|
|
296
|
-
|
|
363
|
+
if (providerPhase) {
|
|
364
|
+
const field = readPrettyField(line)
|
|
365
|
+
if (field) {
|
|
366
|
+
providerFields[field[0]] = field[1]
|
|
367
|
+
if (providerLineActive && field[0] !== 'module') {
|
|
368
|
+
showProvider(color, prefix, providerFields)
|
|
369
|
+
}
|
|
370
|
+
continue
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const { text, msg, obj } = formatChildLine(line)
|
|
297
375
|
const content = msg !== undefined ? msg : text
|
|
298
376
|
|
|
377
|
+
const boundMatch = content.match(/Server running on http:\/\/localhost:(\d+)/)
|
|
378
|
+
if (boundMatch) boundServerPort = Number(boundMatch[1])
|
|
379
|
+
|
|
299
380
|
if (content.includes('[SERVER_EXIT]')) {
|
|
300
381
|
isShuttingDown = true
|
|
301
382
|
stopSpinner()
|
|
@@ -308,6 +389,23 @@ const log = (prefix, color, data) => {
|
|
|
308
389
|
return
|
|
309
390
|
}
|
|
310
391
|
|
|
392
|
+
if (content.includes('remote provider loaded')) {
|
|
393
|
+
if (pendingProviderSummary) flushProviderSummary(color, prefix)
|
|
394
|
+
providerPhase = true
|
|
395
|
+
providerFields = { ...(obj || {}) }
|
|
396
|
+
showProvider(color, prefix, providerFields)
|
|
397
|
+
continue
|
|
398
|
+
}
|
|
399
|
+
if (content.includes('remote providers refreshed')) {
|
|
400
|
+
providerPhase = true
|
|
401
|
+
Object.assign(providerFields, obj)
|
|
402
|
+
pendingProviderSummary = true
|
|
403
|
+
continue
|
|
404
|
+
}
|
|
405
|
+
flushProviderSummary(color, prefix)
|
|
406
|
+
providerPhase = false
|
|
407
|
+
providerFields = {}
|
|
408
|
+
|
|
311
409
|
if (content.includes('[SYNC_START]')) {
|
|
312
410
|
startSpinner(content.split('[SYNC_START]')[1].trim())
|
|
313
411
|
continue
|
|
@@ -392,6 +490,7 @@ const terminateProcess = (proc, signal = 'SIGTERM') => {
|
|
|
392
490
|
}
|
|
393
491
|
let serverProcess, clientProcess
|
|
394
492
|
let isShuttingDown = false
|
|
493
|
+
let boundServerPort = Number(process.env.PORT) || 3000
|
|
395
494
|
|
|
396
495
|
async function main() {
|
|
397
496
|
console.log(
|
|
@@ -465,7 +564,7 @@ const shutdown = () => {
|
|
|
465
564
|
}, 5000)
|
|
466
565
|
}
|
|
467
566
|
|
|
468
|
-
const serverPort =
|
|
567
|
+
const serverPort = boundServerPort
|
|
469
568
|
const req = http.request(
|
|
470
569
|
{
|
|
471
570
|
hostname: '127.0.0.1',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "A web application for watching anime.",
|
|
5
5
|
"main": "orchestrator.js",
|
|
6
6
|
"repository": {
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"allowScripts": {
|
|
84
84
|
"esbuild@0.28.2": true
|
|
85
85
|
},
|
|
86
|
-
"versionDate": "2026-10-
|
|
86
|
+
"versionDate": "2026-10-17T09:49:33.429Z"
|
|
87
87
|
}
|
package/server/dist/app-hono.js
CHANGED
|
@@ -53,6 +53,11 @@ export function getHonoClientIp(c) {
|
|
|
53
53
|
return c.req.header('x-dango-client-ip') ?? undefined;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
const NOT_READY_HEADER = 'x-dango-not-ready';
|
|
57
|
+
function notReady(c, body) {
|
|
58
|
+
c.header(NOT_READY_HEADER, '1');
|
|
59
|
+
return typeof body === 'string' ? c.text(body, 503) : c.json(body, 503);
|
|
60
|
+
}
|
|
56
61
|
export async function honoRequestLogger(c, next) {
|
|
57
62
|
const start = process.hrtime.bigint();
|
|
58
63
|
const url = new URL(c.req.url);
|
|
@@ -61,7 +66,7 @@ export async function honoRequestLogger(c, next) {
|
|
|
61
66
|
const ms = Math.round((Number(process.hrtime.bigint() - start) / 1_000_000) * 10) / 10;
|
|
62
67
|
const status = c.res.status;
|
|
63
68
|
const payload = { method: c.req.method, url: loggedUrl, status, ms };
|
|
64
|
-
if (status >= 500) {
|
|
69
|
+
if (status >= 500 && !c.res.headers.get(NOT_READY_HEADER)) {
|
|
65
70
|
logger.warn(payload, 'request failed');
|
|
66
71
|
}
|
|
67
72
|
else if (!loggedUrl.startsWith('/api/proxy')) {
|
|
@@ -208,26 +213,26 @@ export function createHonoApp(getState, getGuardState, getDbs, dbAdmin, provider
|
|
|
208
213
|
app.get('/api/health', (c) => {
|
|
209
214
|
const state = getState();
|
|
210
215
|
if (state.shuttingDown) {
|
|
211
|
-
return c
|
|
216
|
+
return notReady(c, { status: 'shutting-down', ready: false });
|
|
212
217
|
}
|
|
213
218
|
if (!state.dbReady) {
|
|
214
|
-
return c
|
|
219
|
+
return notReady(c, { status: 'starting', ready: false });
|
|
215
220
|
}
|
|
216
221
|
return c.json({ status: 'ok', ready: true });
|
|
217
222
|
});
|
|
218
223
|
app.use(async (c, next) => {
|
|
219
224
|
const guard = getGuardState();
|
|
220
225
|
if (guard.shuttingDown) {
|
|
221
|
-
return c
|
|
226
|
+
return notReady(c, 'Server is shutting down...');
|
|
222
227
|
}
|
|
223
228
|
if (!guard.dbsReady) {
|
|
224
|
-
return c
|
|
229
|
+
return notReady(c, 'Database initializing...');
|
|
225
230
|
}
|
|
226
231
|
if (guard.bootSyncing &&
|
|
227
232
|
c.req.method !== 'GET' &&
|
|
228
233
|
c.req.method !== 'HEAD' &&
|
|
229
234
|
c.req.method !== 'OPTIONS') {
|
|
230
|
-
return c
|
|
235
|
+
return notReady(c, 'Sync in progress...');
|
|
231
236
|
}
|
|
232
237
|
await next();
|
|
233
238
|
});
|
|
@@ -288,7 +293,7 @@ export function createHonoApp(getState, getGuardState, getDbs, dbAdmin, provider
|
|
|
288
293
|
app.get('/api/auth/app-status', (c) => {
|
|
289
294
|
const authed = !hasAppPassword() ||
|
|
290
295
|
validateLanSession(getTokenFromHeaders(c.req.header('authorization'), c.req.header('cookie')));
|
|
291
|
-
return c.json({ hasPassword: hasAppPassword(), isAuthenticated: authed });
|
|
296
|
+
return c.json({ hasPassword: hasAppPassword(), isAuthenticated: authed, port: CONFIG.PORT });
|
|
292
297
|
});
|
|
293
298
|
app.post('/api/auth/app-login', async (c) => {
|
|
294
299
|
const body = (await c.req.json().catch(() => undefined));
|
|
@@ -470,7 +475,7 @@ export function createHonoApp(getState, getGuardState, getDbs, dbAdmin, provider
|
|
|
470
475
|
try {
|
|
471
476
|
const dbs = getDbs();
|
|
472
477
|
if (!dbs.mangaDb || dbs.mangaDb.isClosedCheck()) {
|
|
473
|
-
return c
|
|
478
|
+
return notReady(c, { error: 'Manga database is not ready' });
|
|
474
479
|
}
|
|
475
480
|
let result;
|
|
476
481
|
try {
|
package/server/dist/config.js
CHANGED
|
@@ -117,10 +117,11 @@ migrateFromAniWeb(DATA_ROOT);
|
|
|
117
117
|
dotenv.config({ path: path.join(SERVER_ROOT, '.env') });
|
|
118
118
|
dotenv.config({ path: ENV_PATH, override: true });
|
|
119
119
|
const IS_DEV = process.argv.includes('--dev');
|
|
120
|
-
const PORT = 3000;
|
|
120
|
+
const PORT = Number(process.env.PORT) || 3000;
|
|
121
|
+
const DEV_PORT = Number(process.env.DEV_PORT) || 5173;
|
|
121
122
|
const HOST = process.env.HOST || '0.0.0.0';
|
|
122
123
|
const GOOGLE_REDIRECT_URI = IS_DEV
|
|
123
|
-
?
|
|
124
|
+
? `http://localhost:${DEV_PORT}/api/auth/google/callback`
|
|
124
125
|
: `http://localhost:${PORT}/api/auth/google/callback`;
|
|
125
126
|
export const CONFIG = {
|
|
126
127
|
ROOT: DATA_ROOT,
|
package/server/dist/hono/auth.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logger from '../logger.js';
|
|
2
2
|
import { googleDriveService } from '../google.js';
|
|
3
|
-
import { CONFIG } from '../config.js';
|
|
4
3
|
import { updateEnvFile } from '../utils/env.utils.js';
|
|
5
4
|
export function registerAuth(app, getDbs, runSync) {
|
|
6
5
|
app.get('/api/auth/google/callback', async (c) => {
|
|
@@ -32,12 +31,6 @@ export function registerAuth(app, getDbs, runSync) {
|
|
|
32
31
|
try {
|
|
33
32
|
if (window.opener && !window.opener.closed) {
|
|
34
33
|
window.opener.postMessage(payload, window.location.origin);
|
|
35
|
-
try {
|
|
36
|
-
window.opener.postMessage(payload, 'http://localhost:${CONFIG.PORT}');
|
|
37
|
-
} catch (e) {}
|
|
38
|
-
try {
|
|
39
|
-
window.opener.postMessage(payload, 'http://127.0.0.1:${CONFIG.PORT}');
|
|
40
|
-
} catch (e) {}
|
|
41
34
|
setTimeout(function () { window.close(); }, 300);
|
|
42
35
|
setTimeout(function () { window.location.href = '/?google_auth=success'; }, 1500);
|
|
43
36
|
} else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logger from '../../logger.js';
|
|
2
|
+
import { TRPCError } from '@trpc/server';
|
|
2
3
|
import { googleDriveService } from '../../google.js';
|
|
3
4
|
import { githubSyncService } from '../../github-sync.js';
|
|
4
5
|
import { initSyncProvider, getActiveProvider, runFullSyncSequence } from '../../sync.js';
|
|
@@ -27,6 +28,9 @@ const syncProviderInput = () => defineSchema((value) => ({
|
|
|
27
28
|
const rcloneSaveInput = () => defineSchema((value) => ({
|
|
28
29
|
remote: reqObj(value).remote,
|
|
29
30
|
}));
|
|
31
|
+
const serverPortInput = () => defineSchema((value) => ({
|
|
32
|
+
port: reqObj(value).port,
|
|
33
|
+
}));
|
|
30
34
|
export const authRouter = router({
|
|
31
35
|
configStatus: protectedProcedure.query(async () => {
|
|
32
36
|
const useWorker = !!CONFIG.GOOGLE_AUTH_WORKER_URL;
|
|
@@ -145,6 +149,18 @@ export const authRouter = router({
|
|
|
145
149
|
await runSyncFromCtx(ctx, ctx.db, 'rclone');
|
|
146
150
|
return { success: true };
|
|
147
151
|
}),
|
|
152
|
+
setServerPort: protectedProcedure.input(serverPortInput()).mutation(async ({ input }) => {
|
|
153
|
+
const port = Number(input.port);
|
|
154
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
155
|
+
throw new TRPCError({
|
|
156
|
+
code: 'BAD_REQUEST',
|
|
157
|
+
message: 'Port must be an integer between 1 and 65535',
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
await updateEnvFile({ PORT: String(port) });
|
|
161
|
+
logger.info({ port }, 'Server port saved. Restart required to apply.');
|
|
162
|
+
return { success: true, port };
|
|
163
|
+
}),
|
|
148
164
|
googleAuthUrl: protectedProcedure.query(async () => {
|
|
149
165
|
const url = await googleDriveService.getAuthUrl();
|
|
150
166
|
return { url };
|
package/server/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._container_1287q_1{max-width:var(--max-width);margin:0 auto;padding:0;min-height:100vh;background:var(--bg-main);overflow-x:hidden}._heroSection_1287q_11{position:relative;width:100%;padding-bottom:var(--space-12)}._bannerContainer_1287q_17{position:absolute;top:0;left:0;right:0;height:500px;overflow:hidden;z-index:0}._banner_1287q_17{width:100%;height:100%;background-size:cover;background-position:center 20%;filter:brightness(.3) saturate(1.1);transform:scale(1.05);transition:transform var(--transition-slow)}._bannerOverlay_1287q_37{position:absolute;inset:0;background:linear-gradient(to bottom,rgba(5,5,5,.4) 0%,rgba(5,5,5,.7) 40%,var(--bg-main) 100%);box-shadow:inset 0 -100px 100px -20px var(--bg-main)}._heroContent_1287q_49{position:relative;z-index:1;display:grid;grid-template-columns:320px 1fr;gap:var(--space-10);max-width:1200px;margin:0 auto;padding:var(--space-16) var(--space-6) 0;align-items:flex-start}._posterContainer_1287q_62{position:sticky;top:120px;border-radius:var(--radius-lg);overflow:hidden;box-shadow:0 20px 50px #00000080;transform:translateY(0);animation:_floatIn_1287q_1 .8s var(--ease-spring);border:1px solid var(--border-secondary)}._poster_1287q_62{width:100%;display:block;object-fit:cover;aspect-ratio:2 / 3;transition:transform var(--transition-base)}._posterContainer_1287q_62:hover ._poster_1287q_62{transform:scale(1.05)}._infoGlass_1287q_86{background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-8);box-shadow:var(--glass-shadow);animation:_slideUpIn_1287q_1 .8s var(--ease-smooth);display:flex;flex-direction:column;gap:var(--space-8)}._title_1287q_100{font-size:clamp(1.5rem,4vw,2.5rem);font-weight:800;color:var(--text-primary);line-height:1.1;margin:0 0 var(--space-4);letter-spacing:-.02em}._quickMeta_1287q_109{display:flex;flex-wrap:wrap;gap:var(--space-6);align-items:center;margin-bottom:var(--space-2)}._metaItem_1287q_117{display:flex;align-items:center;gap:var(--space-2);color:var(--text-secondary);font-size:var(--font-size-sm);font-weight:500}._iconStar_1287q_126{color:var(--accent-lighter)}._iconTv_1287q_129{color:var(--accent)}._iconType_1287q_132{color:var(--color-success)}._iconClock_1287q_135{color:#60a5fa}._genres_1287q_139{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-4)}._genre_1287q_139{background:#ffffff0d;padding:.4rem 1rem;border-radius:var(--radius-full);font-size:var(--font-size-sm);color:var(--text-secondary);border:1px solid var(--border-primary);transition:all var(--transition-fast);font-weight:500}._genre_1287q_139:hover{background:var(--accent);border-color:var(--accent);color:var(--accent-text);transform:translateY(-2px)}._synopsisSection_1287q_165{border-top:1px solid var(--border-primary);padding-top:var(--space-6)}._sectionTitleSmall_1287q_170{font-size:var(--font-size-sm);text-transform:uppercase;letter-spacing:.1em;color:var(--text-tertiary);margin-bottom:var(--space-3)}._description_1287q_178{font-size:var(--font-size-base);color:var(--text-secondary);line-height:1.7;max-width:800px}._actions_1287q_186{display:flex;gap:var(--space-4);margin-top:auto}._watchBtn_1287q_192{display:inline-flex;align-items:center;gap:var(--space-3);background:linear-gradient(135deg,var(--accent) 0%,var(--accent-dark) 100%);color:var(--accent-text);padding:.8rem 1.8rem;border-radius:var(--radius-md);font-weight:600;font-size:var(--font-size-sm);border:none;cursor:pointer;transition:all var(--transition-base);box-shadow:0 4px 15px var(--accent-glow)}._watchBtn_1287q_192:hover{transform:translateY(-2px);box-shadow:0 8px 25px var(--accent-glow);opacity:.95}._watchlistBtn_1287q_214{display:inline-flex;align-items:center;gap:var(--space-3);background:#ffffff0d;color:var(--text-primary);border:1px solid var(--border-secondary);padding:.8rem 1.8rem;border-radius:var(--radius-md);font-weight:600;font-size:var(--font-size-sm);cursor:pointer;transition:all var(--transition-base)}._watchlistBtn_1287q_214:hover{background:#ffffff1a;border-color:var(--text-secondary)}._watchlistBtn_1287q_214._active_1287q_234{background:color-mix(in srgb,var(--color-success) 10%,transparent);border-color:var(--color-success);color:var(--color-success)}._detailsSection_1287q_241{max-width:1200px;margin:0 auto var(--space-16);padding:0 var(--space-6)}._detailsToggleBtn_1287q_247{display:flex;align-items:center;justify-content:center;gap:var(--space-3);width:100%;padding:var(--space-4);background:var(--bg-secondary);color:var(--text-secondary);border:1px solid var(--border-primary);border-radius:var(--radius-lg);font-weight:600;cursor:pointer;transition:all var(--transition-base);margin-bottom:var(--space-6)}._detailsToggleBtn_1287q_247:hover{background:var(--bg-tertiary);color:var(--text-primary);border-color:var(--border-secondary)}._expandedContent_1287q_270{animation:_fadeIn_1287q_1 .5s var(--ease-smooth)}._detailsGridContainer_1287q_274{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:var(--space-6);padding:var(--space-8);background:var(--bg-secondary);border-radius:var(--radius-xl);border:1px solid var(--border-primary)}._detailItem_1287q_284{display:flex;flex-direction:column;gap:var(--space-1)}._detailItem_1287q_284 strong{font-size:.7rem;color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.1em}._detailItem_1287q_284 span{font-size:var(--font-size-sm);color:var(--text-primary);font-weight:500}._airingValue_1287q_303{color:var(--accent-light)!important}._loadingDetails_1287q_308{display:flex;flex-direction:column;align-items:center;gap:var(--space-4);padding:var(--space-12);color:var(--text-tertiary)}._spinner_1287q_317{width:30px;height:30px;border:3px solid rgba(255,255,255,.1);border-top-color:var(--accent);border-radius:50%;animation:_spin_1287q_317 .8s linear infinite}@keyframes _spin_1287q_317{to{transform:rotate(360deg)}}._heroSkeleton_1287q_332{width:100%}._skeletonBanner_1287q_336,._skeletonPoster_1287q_337,._skeletonTitle_1287q_338,._skeletonMeta_1287q_339,._skeletonDesc_1287q_340,._skeletonActions_1287q_341{position:relative;overflow:hidden;background:var(--bg-tertiary)}._skeletonBanner_1287q_336:after,._skeletonPoster_1287q_337:after,._skeletonTitle_1287q_338:after,._skeletonMeta_1287q_339:after,._skeletonDesc_1287q_340:after,._skeletonActions_1287q_341:after{content:"";position:absolute;inset:0;transform:translate(-100%);background-image:linear-gradient(90deg,#fff0 0,#ffffff0d 20%,#ffffff1f 60%,#fff0);animation:_skeleton-wave_1287q_1 1.8s infinite ease-in-out}._skeletonBanner_1287q_336{height:400px}._skeletonContent_1287q_374{max-width:1200px;margin:-100px auto 0;padding:0 var(--space-6);display:grid;grid-template-columns:320px 1fr;gap:var(--space-10)}._skeletonPoster_1287q_337{height:480px;border-radius:var(--radius-lg)}._skeletonInfo_1287q_388{background:var(--bg-secondary);border-radius:var(--radius-xl);padding:var(--space-8);display:flex;flex-direction:column;gap:var(--space-6)}._skeletonTitle_1287q_338{height:40px;width:60%;border-radius:var(--radius-sm)}._skeletonMeta_1287q_339{height:24px;width:40%;border-radius:var(--radius-sm)}._skeletonDesc_1287q_340{height:160px;width:100%;border-radius:var(--radius-sm)}._skeletonActions_1287q_341{height:50px;width:50%;border-radius:var(--radius-sm)}@keyframes _floatIn_1287q_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes _slideUpIn_1287q_1{0%{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes _fadeIn_1287q_1{0%{opacity:0}to{opacity:1}}@media(max-width:1024px){._heroContent_1287q_49{grid-template-columns:1fr;padding-top:var(--space-12)}._posterContainer_1287q_62{width:220px;margin:0 auto;position:relative;top:0}._infoGlass_1287q_86{margin-top:-40px;padding-top:var(--space-12);text-align:center}._quickMeta_1287q_109,._genres_1287q_139{justify-content:center}._actions_1287q_186{flex-direction:column}._watchBtn_1287q_192,._watchlistBtn_1287q_214{width:100%;justify-content:center}._skeletonContent_1287q_374{grid-template-columns:1fr}._skeletonPoster_1287q_337{width:220px;height:330px;margin:0 auto}}@media(max-width:768px){._heroSection_1287q_11{padding-bottom:var(--space-8)}._heroContent_1287q_49{grid-template-columns:1fr;gap:var(--space-6);padding:var(--space-12) var(--space-4) 0}._posterContainer_1287q_62{position:relative;top:0;max-width:240px;margin:0 auto;margin-bottom:var(--space-4);animation:none}._infoGlass_1287q_86{padding:var(--space-6);animation:none}}@media(max-width:480px){._infoGlass_1287q_86{padding:var(--space-6);animation:none}._title_1287q_100{font-size:1.5rem}._quickMeta_1287q_109{gap:var(--space-3)}._metaItem_1287q_117 span{font-size:.75rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as C,a as I,d as S,h as p,T,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as s}from"./vendor-icons-DrybRNxP.js";import{u as b}from"./useAnimeInfoData-Dpkjj68s.js";import{d as B,e as w,f as d,s as M,M as x,B as u}from"./index-CfgPGaUO.js";import{A}from"./AnimeMetaDetails-BogOi_bM.js";import{S as D}from"./SynopsisText-B3Sa5pRv.js";import{Q as G}from"./QueueOptionsButton-MpSKva6y.js";import"./vendor-query-BBT5_sHx.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-ui-3qrARCPr.js";const P="_container_1287q_1",W="_heroSection_1287q_11",O="_bannerContainer_1287q_17",$="_banner_1287q_17",U="_bannerOverlay_1287q_37",j="_heroContent_1287q_49",z="_posterContainer_1287q_62",V="_floatIn_1287q_1",Q="_poster_1287q_62",E="_infoGlass_1287q_86",H="_slideUpIn_1287q_1",F="_title_1287q_100",J="_quickMeta_1287q_109",K="_metaItem_1287q_117",L="_iconStar_1287q_126",R="_iconTv_1287q_129",X="_iconType_1287q_132",Y="_iconClock_1287q_135",Z="_genres_1287q_139",ee="_genre_1287q_139",ne="_synopsisSection_1287q_165",te="_sectionTitleSmall_1287q_170",se="_description_1287q_178",ae="_actions_1287q_186",ie="_watchBtn_1287q_192",oe="_watchlistBtn_1287q_214",le="_active_1287q_234",ce="_detailsSection_1287q_241",re="_detailsToggleBtn_1287q_247",de="_expandedContent_1287q_270",_e="_fadeIn_1287q_1",me="_detailsGridContainer_1287q_274",he="_detailItem_1287q_284",pe="_airingValue_1287q_303",ue="_loadingDetails_1287q_308",ve="_spinner_1287q_317",ge="_spin_1287q_317",ke="_heroSkeleton_1287q_332",qe="_skeletonBanner_1287q_336",fe="_skeletonPoster_1287q_337",Ne="_skeletonTitle_1287q_338",ye="_skeletonMeta_1287q_339",Ce="_skeletonDesc_1287q_340",Ie="_skeletonActions_1287q_341",Se="_skeletonContent_1287q_374",Te="_skeletonInfo_1287q_388",n={container:P,heroSection:W,bannerContainer:O,banner:$,bannerOverlay:U,heroContent:j,posterContainer:z,floatIn:V,poster:Q,infoGlass:E,slideUpIn:H,title:F,quickMeta:J,metaItem:K,iconStar:L,iconTv:R,iconType:X,iconClock:Y,genres:Z,genre:ee,synopsisSection:ne,sectionTitleSmall:te,description:se,actions:ae,watchBtn:ie,watchlistBtn:oe,active:le,detailsSection:ce,detailsToggleBtn:re,expandedContent:de,fadeIn:_e,detailsGridContainer:me,detailItem:he,airingValue:pe,loadingDetails:ue,spinner:ve,spin:ge,heroSkeleton:ke,skeletonBanner:qe,skeletonPoster:fe,skeletonTitle:Ne,skeletonMeta:ye,skeletonDesc:Ce,skeletonActions:Ie,"skeleton-wave":"_skeleton-wave_1287q_1",skeletonContent:Se,skeletonInfo:Te};function Oe(){const{id:a}=C(),i=I(),{titlePreference:l}=B(),[o,v]=S(!1),{showMeta:t,loadingMeta:g,toggleWatchlist:k,inWatchlist:c}=b(a),{hasConsent:q,grant:f}=w();p(()=>{a&&t?.id&&t.id!==a&&i(`/anime/${t.id}`,{replace:!0})},[a,t,i]),p(()=>{document.title=t?.name?`${t.name} - dango`:"Anime - dango"},[t?.name]);const N=()=>t?.name?l==="name"?t.name:l==="nativeName"?t.names?.native||t.name:l==="englishName"&&t.names?.english||t.name:"",y=()=>{a&&i(`/watch/${a}`)},_=T(()=>t?.bannerImage?d(t.bannerImage):t?.thumbnail?d(t.thumbnail,1200,450):"",[t?.bannerImage,t?.thumbnail]);if(g||!t?.name)return e("div",{className:n.container,children:e("div",{className:n.heroSkeleton,children:[e("div",{className:n.skeletonBanner}),e("div",{className:n.skeletonContent,children:[e("div",{className:n.skeletonPoster}),e("div",{className:n.skeletonInfo,children:[e("div",{className:n.skeletonTitle}),e("div",{className:n.skeletonMeta}),e("div",{className:n.skeletonDesc}),e("div",{className:n.skeletonActions})]})]})]})});const m=t.isAdult===!0&&!q;return e("div",{className:n.container,style:m?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:n.heroSection,children:[e("div",{className:n.bannerContainer,children:[e("div",{className:n.banner,style:_?{backgroundImage:`url(${_})`}:void 0}),e("div",{className:n.bannerOverlay})]}),e("div",{className:n.heroContent,children:[e("div",{className:n.posterContainer,children:e("img",{src:d(t.thumbnail||"",320,480),alt:t.name,className:n.poster,decoding:"async"})}),e("div",{className:n.infoGlass,children:[e("div",{className:n.topInfo,children:[e("h1",{className:n.title,children:N()}),e("div",{className:n.quickMeta,children:[t.score&&e("div",{className:n.metaItem,children:[e(s,{name:"star",className:n.iconStar}),e("span",{children:t.score})]}),t.status&&e("div",{className:n.metaItem,children:[e(s,{name:"tv",className:n.iconTv}),e("span",{children:t.status})]}),t.type&&e("div",{className:n.metaItem,children:[e(s,{name:"layer-group",className:n.iconType}),e("span",{children:t.type})]})]}),Array.isArray(t.genres)&&t.genres.length>0&&e("div",{className:n.genres,children:t.genres.filter(Boolean).slice(0,5).map(r=>{const h=typeof r=="string"?r:r?.name;return e("span",{className:n.genre,children:h},h)})})]}),e("div",{className:n.synopsisSection,children:[e("h2",{className:n.sectionTitleSmall,children:"Synopsis"}),e(D,{text:M(t.description),emptyText:"No description available."})]}),e("div",{className:n.actions,children:[e("button",{className:n.watchBtn,onClick:y,children:[e(s,{name:"play",size:14}),"Start Watching"]}),e("button",{className:`${n.watchlistBtn} ${c?n.active:""}`,onClick:k,children:[c?e(s,{name:"check",size:14}):e(s,{name:"plus",size:14}),c?"In Watchlist":"Add to Watchlist"]}),e(G,{showId:a,showName:t.name||t.names?.romaji,showThumbnail:t.thumbnail,nativeName:t.names?.native,englishName:t.names?.english,showType:t.type,className:n.watchlistBtn,activeClassName:n.active})]})]})]})]}),e("div",{className:n.detailsSection,children:[e("button",{className:n.detailsToggleBtn,onClick:()=>{v(!o)},children:[o?e(s,{name:"chevron-up"}):e(s,{name:"chevron-down"}),o?"Hide Details":"Show Details"]}),o&&e("div",{className:n.expandedContent,children:e(A,{showMeta:t,styles:n})})]}),m&&e(x,{isOpen:!0,title:"Content Warning",onClose:()=>i("/"),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(u,{variant:"secondary",onClick:()=>i("/"),children:"Go Back"}),e(u,{onClick:f,children:"I'm 18+, Continue"})]})]})})]})}export{Oe as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{u as r,A as b,d as C,h as A,q as x,T as pe,$ as At}from"./vendor-core-DfaOB3Rn.js";import{B as re,M as $t,S as ye,h as Ft,R as Rt,t as Je,O as Dt,g as Ot}from"./index-CfgPGaUO.js";import{I as Q}from"./vendor-icons-DrybRNxP.js";import{u as qt}from"./vendor-query-BBT5_sHx.js";const Ht="_controls_ov6ol_1",Vt="_titleContainer_ov6ol_9",Wt="_scheduleInfo_ov6ol_15",Ut="_status_ov6ol_23",zt="_nextEpisode_ov6ol_35",Kt="_watchlistBtn_ov6ol_45",Gt="_inList_ov6ol_72",Xt="_queueBtn_ov6ol_83",Jt="_queueActive_ov6ol_95",Qt="_modeToggleBtn_ov6ol_101",jt="_modeToggleActive_ov6ol_108",Yt="_nativeToggleBtn_ov6ol_119",Zt="_nativeToggleActive_ov6ol_132",en="_markWatchedBtn_ov6ol_153",tn="_markWatchedDone_ov6ol_167",nn="_completeSeriesBtn_ov6ol_178",rn="_providerAndEpisodeRow_ov6ol_192",on="_episodeActions_ov6ol_199",sn="_desktopEpisodeActions_ov6ol_206",cn="_mobileEpisodeActions_ov6ol_213",an="_episodeNavBtn_ov6ol_217",ln="_primary_ov6ol_247",un="_secondary_ov6ol_257",dn="_episodePickerBtn_ov6ol_261",pn="_queueCountdown_ov6ol_265",fn="_speedBoostBadge_ov6ol_280",mn="_videoContainer_ov6ol_311",hn="_loadingOverlay_ov6ol_324",vn="_loadingDots_ov6ol_338",_n="_dot_ov6ol_343",gn="_bounce_ov6ol_1",yn="_bufferingOverlay_ov6ol_372",bn="_bufferingSpinner_ov6ol_381",wn="_spin_ov6ol_921",Sn="_videoIframe_ov6ol_396",Cn="_videoElementHidden_ov6ol_419",kn="_upscalerCanvas_ov6ol_424",En="_upscalerActive_ov6ol_437",Ln="_upscalerStatusBadge_ov6ol_441",Tn="_subtitleOverlay_ov6ol_456",Bn="_controlsOverlay_ov6ol_468",xn="_hidden_ov6ol_498",Nn="_centerPlayPause_ov6ol_504",In="_bottomControls_ov6ol_536",Pn="_progressBarContainer_ov6ol_553",Mn="_progressBar_ov6ol_553",An="_scrubbing_ov6ol_576",$n="_watchedBar_ov6ol_581",Fn="_bufferedBar_ov6ol_582",Rn="_thumb_ov6ol_604",Dn="_timeBubble_ov6ol_625",On="_skipSegment_ov6ol_648",qn="_op_ov6ol_662",Hn="_ed_ov6ol_666",Vn="_recap_ov6ol_670",Wn="_bottomControlsRow_ov6ol_674",Un="_controlBtn_ov6ol_682",zn="_timeDisplay_ov6ol_706",Kn="_leftControls_ov6ol_715",Gn="_rightControls_ov6ol_716",Xn="_middleControls_ov6ol_717",Jn="_skipControls_ov6ol_723",Qn="_skipBtn_ov6ol_729",jn="_volumeContainer_ov6ol_753",Yn="_volumeSlider_ov6ol_760",Zn="_settingsMenu_ov6ol_838",er="_slideUp_ov6ol_1",tr="_qualityListInMenu_ov6ol_877",nr="_ccOptionsContainer_ov6ol_878",rr="_qualityItemInMenu_ov6ol_886",or="_ccItem_ov6ol_887",sr="_active_ov6ol_908",cr="_sourceLoader_ov6ol_915",ar="_spinner_ov6ol_921",ir="_watchBtn_ov6ol_980",lr="_errorOverlay_ov6ol_1026",ur="_retryButton_ov6ol_1036",dr="_sourceSelectionContainer_ov6ol_1064",pr="_slideUpIn_ov6ol_1",fr="_providerSelectContainer_ov6ol_1079",mr="_providerSelect_ov6ol_1079",hr="_sourceSelect_ov6ol_1064",vr="_sourceButtons_ov6ol_1135",_r="_sourceButton_ov6ol_1135",gr="_detailsBox_ov6ol_1167",yr="_detailsToggleBtn_ov6ol_1180",br="_detailsGridContainer_ov6ol_1204",wr="_fadeIn_ov6ol_1",Sr="_detailItem_ov6ol_1216",Cr="_animeStatus_ov6ol_1236",kr="_genresList_ov6ol_1249",Er="_genreTag_ov6ol_1256",Lr="_loadingDetails_ov6ol_1274",Tr="_descriptionSection_ov6ol_1281",Br="_description_ov6ol_1281",xr="_epJumpControls_ov6ol_1317",Nr="_epRangeButtons_ov6ol_1328",Ir="_metaTags_ov6ol_1334",Pr="_epRangeBtn_ov6ol_1341",Mr="_epJumpInputGroup_ov6ol_1356",Ar="_fullscreenActive_ov6ol_1388",$r="_errorSubtext_ov6ol_1432",Ts={controls:Ht,titleContainer:Vt,scheduleInfo:Wt,status:Ut,nextEpisode:zt,watchlistBtn:Kt,inList:Gt,queueBtn:Xt,queueActive:Jt,modeToggleBtn:Qt,modeToggleActive:jt,nativeToggleBtn:Yt,nativeToggleActive:Zt,markWatchedBtn:en,markWatchedDone:tn,completeSeriesBtn:nn,providerAndEpisodeRow:rn,episodeActions:on,desktopEpisodeActions:sn,mobileEpisodeActions:cn,episodeNavBtn:an,primary:ln,secondary:un,episodePickerBtn:dn,queueCountdown:pn,speedBoostBadge:fn,videoContainer:mn,loadingOverlay:hn,loadingDots:vn,dot:_n,bounce:gn,bufferingOverlay:yn,bufferingSpinner:bn,spin:wn,videoIframe:Sn,videoElementHidden:Cn,upscalerCanvas:kn,upscalerActive:En,upscalerStatusBadge:Ln,subtitleOverlay:Tn,controlsOverlay:Bn,hidden:xn,centerPlayPause:Nn,bottomControls:In,progressBarContainer:Pn,progressBar:Mn,scrubbing:An,watchedBar:$n,bufferedBar:Fn,thumb:Rn,timeBubble:Dn,skipSegment:On,op:qn,ed:Hn,recap:Vn,bottomControlsRow:Wn,controlBtn:Un,timeDisplay:zn,leftControls:Kn,rightControls:Gn,middleControls:Xn,skipControls:Jn,skipBtn:Qn,volumeContainer:jn,volumeSlider:Yn,settingsMenu:Zn,slideUp:er,qualityListInMenu:tr,ccOptionsContainer:nr,qualityItemInMenu:rr,ccItem:or,active:sr,sourceLoader:cr,spinner:ar,watchBtn:ir,errorOverlay:lr,retryButton:ur,sourceSelectionContainer:dr,slideUpIn:pr,providerSelectContainer:fr,providerSelect:mr,sourceSelect:hr,sourceButtons:vr,sourceButton:_r,detailsBox:gr,detailsToggleBtn:yr,detailsGridContainer:br,fadeIn:wr,detailItem:Sr,animeStatus:Cr,genresList:kr,genreTag:Er,loadingDetails:Lr,descriptionSection:Tr,description:Br,epJumpControls:xr,epRangeButtons:Nr,metaTags:Ir,epRangeBtn:Pr,epJumpInputGroup:Mr,fullscreenActive:Ar,errorSubtext:$r},Fr="_playerPageLayout_6lomc_1",Rr="_episodeSidebar_6lomc_15",Dr="_playerMain_6lomc_28",Or="_videoPlayerWrapper_6lomc_36",qr="_playerInfoHeader_6lomc_52",Hr="_playerAnimeCard_6lomc_58",Vr="_playerInfoContainer_6lomc_70",Wr="_videoTitleSection_6lomc_94",Ur="_theaterMode_6lomc_276",zr="_theaterAmbient_6lomc_310",Kr={playerPageLayout:Fr,episodeSidebar:Rr,playerMain:Dr,videoPlayerWrapper:Or,playerInfoHeader:qr,playerAnimeCard:Hr,playerInfoContainer:Vr,videoTitleSection:Wr,theaterMode:Ur,theaterAmbient:zr},Gr="_shell_41rxp_1",Xr="_stage_41rxp_37",Jr="_shellFill_41rxp_85",Qr="_shellFullscreen_41rxp_93",jr="_uiLayer_41rxp_107",Yr="_volumeWrap_41rxp_118",Zr="_volumeSlider_41rxp_124",ce={shell:Gr,stage:Xr,shellFill:Jr,shellFullscreen:Qr,uiLayer:jr,volumeWrap:Yr,volumeSlider:Zr},eo=.8,to=5,Bs=2e3,Ze="autoplayEnabled",no=(e,n)=>n>0&&e>=n*eo,xs=(e,n)=>e>to&&!no(e,n),Ns=()=>{try{return localStorage.getItem(Ze)==="true"}catch{return!1}},Is=e=>{try{localStorage.setItem(Ze,String(e))}catch{}},ro=["finished","completed","complete","ended"],Ps=(e,n,t)=>e.length>0&&!!n&&e[e.length-1]===n&&ro.some(s=>String(t||"").trim().toLowerCase().includes(s)),Ms=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",oo=e=>(e.language??e.lang??"").toLowerCase(),so=e=>(e.label??"").toLowerCase(),co=e=>`${e.language??e.lang??""}|||${e.label??""}`,ao=e=>oo(e).startsWith("en")||so(e).includes("english");function As(e,n){if(e.length===0||n?.enabled===!1)return-1;const t=n?.lastKey??null;if(t){const o=e.findIndex(i=>co(i)===t);if(o>=0)return o}const s=e.findIndex(ao);return s>=0?s:0}const Z={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},xe=(e,n,t)=>Math.max(n,Math.min(t,e)),Ne=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),ke=(e,n,t,s)=>{try{const o=localStorage.getItem(e);if(o===null)return n;const i=parseFloat(o);return Number.isFinite(i)?xe(i,t,s):n}catch{return n}};function io(){let e=Z.edge,n=Z.bgColor,t=Z.textColor,s=Z.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const i=localStorage.getItem("subtitleBgColor");Ne(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ne(p)&&(t=p);const _=localStorage.getItem("subtitleBold");_!==null&&(s=_==="true")}catch{}return{fontSize:ke("subtitleFontSize",Z.fontSize,.5,10),position:ke("subtitlePosition",Z.position,0,100),bgOpacity:ke("subtitleBgOpacity",Z.bgOpacity,0,1),bgColor:n,textColor:t,edge:e,bold:s}}function et(e,n){const t=`rgba(0, 0, 0, ${xe(n,0,1)})`;if(!Ne(e))return t;const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${i}, ${xe(n,0,1)})`}function tt(e,n){return e==="none"?n<=0?"0 1px 3px rgba(0, 0, 0, 0.9)":"none":e==="outline"?["-1px 0 0 black","1px 0 0 black","0 -1px 0 black","0 1px 0 black","-1px -1px 0 black","1px -1px 0 black","-1px 1px 0 black","1px 1px 0 black","0 0 6px rgba(0, 0, 0, 0.9)"].join(", "):"0 0 4px black, 0 1px 2px rgba(0, 0, 0, 0.8)"}function $s(e){return`
|
|
2
|
-
video::cue {
|
|
3
|
-
font-size: ${e.fontSize}rem !important;
|
|
4
|
-
color: ${e.textColor} !important;
|
|
5
|
-
background-color: ${et(e.bgColor,e.bgOpacity)} !important;
|
|
6
|
-
font-weight: ${e.bold?"bold":"normal"} !important;
|
|
7
|
-
text-shadow: ${tt(e.edge,e.bgOpacity)} !important;
|
|
8
|
-
}
|
|
9
|
-
`}function Fs(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${et(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${tt(e.edge,e.bgOpacity)}`,"padding: 0.2em 0.5em","border-radius: 0.25em","text-align: center","position: absolute","left: 50%","transform: translateX(-50%)","max-width: 92%","white-space: pre-wrap","overflow-wrap: break-word","line-height: 1.4"].join(`;
|
|
10
|
-
`)+";"}const lo=new Set(["b","i","u","strong","em"]);function Rs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(t,s,o)=>lo.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:t)}function Ds(e){return e.replace(/<[^>]*>/g,"")}const Os=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],qs=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function Hs(e,n){const t=Number.isFinite(e)?e*16:Z.fontSize*16;return!Number.isFinite(n)||n<=0?t/16:Math.min(t,Math.max(13,n*.07))/16}function Vs(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Ws(e,n){const t=e.clientWidth||0,s=e.clientHeight||0,o=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let i=s;o>0&&t>0&&s>0&&(i=t/s>o?s:t/o);const p=Math.max(0,(s-i)/2),_=Math.max(0,Math.min(100,Number(n)||0))/100*i;return p+_}const Us=({isOpen:e,onClose:n,title:t,message:s,resumeLabel:o="Resume",restartLabel:i="Start Over",onResume:p,onRestart:_})=>r($t,{isOpen:e,onClose:n,title:t,width:"sm",children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:s}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(re,{variant:"secondary",onClick:_,children:i}),r(re,{onClick:p,children:o})]})]})}),uo="_centerControls_61n7k_1",po="_centerSkipBtn_61n7k_15",fo="_centerPlayPause_61n7k_40",mo="_playIconOffset_61n7k_71",de={centerControls:uo,centerSkipBtn:po,centerPlayPause:fo,playIconOffset:mo},zs=({isPlaying:e,onTogglePlay:n,onSkipBack:t,onSkipForward:s,skipSeconds:o=10})=>r("div",{className:de.centerControls,onClick:i=>i.stopPropagation(),children:[r("button",{className:de.centerSkipBtn,onClick:t,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:r(Q,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(Q,{name:"pause"}):r(Q,{name:"play",className:de.playIconOffset})}),r("button",{className:de.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:r(Q,{name:"forward-10"})})]}),Ks=({visible:e,title:n,episode:t,onBack:s,classes:o})=>r("div",{className:`${o.overlay} ${e?"":o.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:o.top,onClick:i=>i.stopPropagation(),children:[r("button",{className:o.backBtn,onClick:i=>{i.stopPropagation(),s()},title:"Back","aria-label":"Back",children:r(Q,{name:"chevron-left"})}),r("div",{className:o.titleInfo,children:[r("span",{className:o.title,children:n}),t&&r("span",{className:o.episode,children:t})]})]})}),Gs=({classes:e,videoRef:n,duration:t,formatTime:s,isScrubbing:o,buffered:i="auto",onSeek:p,onScrubStart:_,onScrubMove:a,onScrubEnd:h,timeLabelRef:l,children:E})=>{const v=b(null),L=b(null),f=b(null),g=b(null),S=b(null),u=b(!1),y=b(o);y.current=o;const d=b({onScrubMove:a,onScrubEnd:h});d.current={onScrubMove:a,onScrubEnd:h};const[N,$]=C({time:0,position:null});A(()=>{const m=n.current;if(!m)return;const w=j=>{const D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`)},R=()=>{o||w(m.currentTime)},U=()=>{if(i==="auto"&&m.buffered.length>0){const D=m.buffered.end(m.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${D}%`)}};return w(m.currentTime),U(),m.addEventListener("timeupdate",R),m.addEventListener("progress",U),()=>{m.removeEventListener("timeupdate",R),m.removeEventListener("progress",U)}},[n,t,o,i,s,l]);const W=m=>{if(!v.current)return 0;const w=v.current.getBoundingClientRect();return Math.min(1,Math.max(0,(m-w.left)/w.width))},G=m=>{const w=m*t,R=w/t*100||0;L.current&&(L.current.style.width=`${R}%`),f.current&&(f.current.style.left=`${R}%`),l?.current&&(l.current.innerText=`${s(w)} / ${s(t)}`);const U=v.current?.getBoundingClientRect();$({time:w,position:U?m*U.width:null})};A(()=>{if(!o){S.current=null;return}const m=R=>{if(S.current!==null&&R.pointerId!==S.current||!t)return;const U=W(R.clientX);d.current.onScrubMove(U);const j=U*t,D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`);const ee=v.current?.getBoundingClientRect();$({time:j,position:ee?U*ee.width:null})},w=R=>{S.current!==null&&R.pointerId!==S.current||(S.current=null,u.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),d.current.onScrubEnd())};return document.addEventListener("pointermove",m),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w),()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)}},[o,t,s,l]);const B=m=>{if(m.pointerType==="mouse"&&m.button!==0||!n.current||!t)return;m.preventDefault(),S.current=m.pointerId;try{v.current?.setPointerCapture(m.pointerId)}catch{}y.current||_();const w=W(m.clientX);a(w),G(w)},q=m=>{if(!t||y.current||m.pointerType!=="mouse")return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},z=m=>{if(!(S.current!==null&&m.pointerId!==S.current)&&y.current){S.current=null,u.current=!0,m.pointerType!=="mouse"&&$({time:0,position:null});try{v.current?.hasPointerCapture(m.pointerId)&&v.current.releasePointerCapture(m.pointerId)}catch{}h()}};return r("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:v,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round((Number(L.current?.style.width?.replace("%",""))||0)*(t||0)/100),tabIndex:0,onClick:m=>{if(u.current){u.current=!1;return}!n.current||isNaN(t)||t===0||p(W(m.clientX))},onPointerDown:B,onPointerMove:q,onPointerUp:z,onPointerCancel:z,onMouseMove:m=>{if(o||!t)return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||$({time:0,position:null})},onKeyDown:m=>{if(!(!n.current||!t)&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();const w=(m.key==="ArrowRight"?5:-5)/t,R=n.current.currentTime/t||0;p(Math.min(1,Math.max(0,R+w)))}},children:[N.position!==null&&r("div",{className:e.timeBubble,style:{left:N.position},children:s(N.time)}),r("div",{className:e.bar,children:[r("div",{className:e.buffered,ref:g,style:i==="full"?{width:"100%"}:void 0}),r("div",{className:e.watched,ref:L}),r("div",{className:e.thumb,ref:f,onMouseDown:m=>{m.preventDefault(),n.current&&(y.current||_())}}),E]})]})};function Ee(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||t}catch{return!1}}function nt(){const[e,n]=C(Ee);return A(()=>{n(Ee());let t=null;const s=()=>n(Ee());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",s):t.addListener(s)}catch{}return window.addEventListener("touchstart",s,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",s):t.removeListener(s))}catch{}window.removeEventListener("touchstart",s)}},[]),e}const ho=450,Xs=({muted:e,volume:n,volumeIcon:t,buttonClassName:s,sliderClassName:o,onToggleMute:i,onVolumeChange:p,onExpandedChange:_})=>{const a=nt(),[h,l]=C(!1),E=b(null),v=b(!1),L=b(null),f=x(d=>{l(d),_?.(d)},[_]);A(()=>()=>{E.current&&window.clearTimeout(E.current)},[]),A(()=>{if(!h)return;const d=N=>{L.current&&!L.current.contains(N.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[h,f]);const g=e?0:n,S=()=>{v.current=!1,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{v.current=!0,f(!0)},ho)},u=()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},y=d=>{if(d.stopPropagation(),v.current){v.current=!1;return}if(a){h?i():f(!0);return}i()};return r("div",{ref:L,className:ce.volumeWrap,"data-expanded":h?"true":"false",onContextMenu:d=>d.preventDefault(),children:[r("button",{type:"button",className:s,onClick:y,onPointerDown:S,onPointerUp:u,onPointerLeave:u,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":h,children:t}),r("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:d=>p(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${ce.volumeSlider} ${o??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})},Qe=280;function vo(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Js=({player:e,topBar:n,centerControls:t,bottomBar:s,settingsPanel:o,overlays:i,isInteracting:p=!1,className:_,chromeDisabled:a=!1,children:h})=>{const{state:l,refs:E,actions:v}=e,L=E.playerContainerRef,g=nt()?5e3:3e3,S=b(0),u=b(null),y=b(p);y.current=p;const d=x(()=>{const B=v.inactivityTimer.current;B&&(window.clearTimeout(B),v.inactivityTimer.current=null)},[v]),N=x(()=>{d(),l.isPlaying&&(y.current||l.useNativeControls||(v.inactivityTimer.current=window.setTimeout(()=>{if(y.current)return;v.setShowControls(!1);const B=L.current;B&&l.isFullscreen&&(B.style.cursor="none")},g)))},[v,d,L,g,l.isFullscreen,l.isPlaying,l.useNativeControls]),$=x(()=>{const B=L.current;B&&(B.style.cursor="default"),!l.showControls&&!l.useNativeControls&&v.setShowControls(!0),N()},[v,L,N,l.showControls,l.useNativeControls]);A(()=>{if(l.showControls){if(!l.isPlaying){d();return}if(p||l.isScrubbing||l.showSettings||l.showVolumeSlider){v.setShowControls(!0),d();return}N()}},[v,d,p,N,l.isPlaying,l.isScrubbing,l.showControls,l.showSettings,l.showVolumeSlider]),A(()=>()=>d(),[d]);const W=x(B=>{const q=B.target;if(vo(q))return;const z=Date.now(),m=z-S.current<Qe;if(S.current=z,m){u.current&&(window.clearTimeout(u.current),u.current=null),v.toggleFullscreen();return}u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,v.setShowControls(!l.showControls),l.showControls?N():$()},Qe)},[v,N,l.showControls,$]);A(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const G=l.showControls||l.isScrubbing||l.showSettings||l.showVolumeSlider;return r("div",{ref:L,className:`${ce.shell} ${l.isFullscreen?ce.shellFullscreen:""} ${_??""}`,onContextMenu:B=>B.preventDefault(),onPointerMove:B=>{B.pointerType==="mouse"&&$()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&l.isPlaying&&!y.current&&v.setShowControls(!1)},children:[r("div",{className:ce.stage,onClick:W,onContextMenu:B=>B.preventDefault(),children:h}),i,!a&&!l.useNativeControls&&r("div",{className:ce.uiLayer,onContextMenu:B=>B.preventDefault(),children:[r("div",{"data-player-ui":"true",children:n}),G&&t&&r("div",{"data-player-ui":"true",children:t}),r("div",{"data-player-ui":"true",children:s}),o&&r("div",{"data-player-ui":"true",children:o})]})]})},_o="_statusArea_1xccu_1",go="_toggleBtn_1xccu_20",yo="_shortcuts_1xccu_46",bo="_shortcutGroup_1xccu_56",wo="_shortcut_1xccu_46",So="_key_1xccu_70",Co="_label_1xccu_91",P={statusArea:_o,toggleBtn:go,shortcuts:yo,shortcutGroup:bo,shortcut:wo,key:So,label:Co},Qs=({showTheater:e=!0})=>{const[n,t]=C(!1);return r("div",{className:P.statusArea,children:[r("button",{type:"button",className:P.toggleBtn,onClick:()=>t(s=>!s),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[r(Q,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(Q,{name:"chevron-up",size:12}):r(Q,{name:"chevron-down",size:12})]}),n&&r("div",{id:"player-shortcuts",className:P.shortcuts,children:[r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"↑"}),r("span",{className:P.key,children:"↓"}),r("span",{className:P.label,children:"Volume"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"←"}),r("span",{className:P.key,children:"→"}),r("span",{className:P.label,children:"Seek"})]})]}),r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"Space"}),r("span",{className:P.label,children:"Play/Pause"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"F"}),r("span",{className:P.label,children:"Fullscreen"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"M"}),r("span",{className:P.label,children:"Mute"})]}),e&&r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"T"}),r("span",{className:P.label,children:"Theater"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"N"}),r("span",{className:P.label,children:"Next"})]})]})]})]})},ko="_episodeListContainer_9tyin_1",Eo="_drawerContainer_9tyin_9",Lo="_episodeListHeader_9tyin_14",To="_drawerHeader_9tyin_20",Bo="_episodeListTitle_9tyin_29",xo="_rangeSelector_9tyin_41",No="_rangeButton_9tyin_47",Io="_active_9tyin_70",Po="_episodeList_9tyin_1",Mo="_drawerList_9tyin_89",Ao="_episodeItem_9tyin_118",$o="_watched_9tyin_145",Fo="_episodeThumb_9tyin_167",Ro="_episodeText_9tyin_176",Do="_episodeLabel_9tyin_184",Oo="_episodeSub_9tyin_189",M={episodeListContainer:ko,drawerContainer:Eo,episodeListHeader:Lo,drawerHeader:To,episodeListTitle:Bo,rangeSelector:xo,rangeButton:No,active:Io,episodeList:Po,drawerList:Mo,episodeItem:Ao,watched:$o,episodeThumb:Fo,episodeText:Ro,episodeLabel:Do,episodeSub:Oo},qo=({episodes:e,currentEpisode:n,watchedEpisodes:t=[],onEpisodeClick:s,variant:o="sidebar",title:i="Episodes",header:p})=>{const[_,a]=C(0),h=b(null),l=pe(()=>e.map(f=>typeof f=="string"?{id:f,label:`Episode ${f}`}:f),[e]),E=pe(()=>new Set(t),[t]);A(()=>{const f=h.current;if(!f)return;let g=f.parentElement;for(;g;){const y=window.getComputedStyle(g);if((y.overflowY==="auto"||y.overflowY==="scroll")&&g.scrollHeight>g.clientHeight)break;g=g.parentElement}if(!g)return;const S=g.getBoundingClientRect(),u=f.getBoundingClientRect();g.scrollTop+=u.top+u.height/2-(S.top+g.clientHeight/2)},[n,_]);const v=pe(()=>{if(l.length<=100)return[];const f=[];for(let g=0;g<l.length;g+=100){const S=g+1,u=Math.min(g+100,l.length);f.push(`${S}-${u}`)}return f},[l]),L=pe(()=>{if(v.length===0)return l;const f=v[_];if(!f)return l;const[g,S]=f.split("-"),u=parseInt(g,10),y=parseInt(S,10);return l.slice(u-1,y)},[l,v,_]);return r("div",{className:`${M.episodeListContainer} ${o==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${o==="drawer"?M.drawerHeader:""}`,children:[p,r("h3",{className:M.episodeListTitle,children:i}),v.length>0&&r("div",{className:M.rangeSelector,children:v.map((f,g)=>r("button",{className:`${M.rangeButton} ${_===g?M.active:""}`,onClick:()=>a(g),children:f},f))})]}),r("div",{className:`${M.episodeList} ${o==="drawer"?M.drawerList:""}`,children:L.map(f=>{const g=f.id===n,S=E.has(f.id)||f.watched===!0;return r("div",{ref:g?h:void 0,className:`${M.episodeItem} ${S?M.watched:""} ${g?M.active:""}`,onClick:()=>s(f.id),children:[f.thumbnail&&r("img",{src:f.thumbnail,alt:"",loading:"lazy",decoding:"async",className:M.episodeThumb}),r("span",{className:M.episodeText,children:[r("span",{className:M.episodeLabel,children:f.label??`Episode ${f.id}`}),f.sublabel&&r("span",{className:M.episodeSub,children:f.sublabel})]})]},f.id)})})]})},js=({variant:e="sidebar",count:n=12})=>r("div",{className:`${M.episodeListContainer} ${e==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${e==="drawer"?M.drawerHeader:""}`,children:[r("h3",{className:M.episodeListTitle,children:"Episodes"}),r("div",{className:M.rangeSelector,children:[r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"})]})]}),r("div",{className:`${M.episodeList} ${e==="drawer"?M.drawerList:""}`,children:Array.from({length:n}).map((t,s)=>r("div",{className:M.episodeItem,style:{border:"none",background:"transparent"},children:r(ye,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),Ho="_shell_cys6s_1",Vo="_overlay_cys6s_10",Wo="_drawer_cys6s_21",Uo="_handle_cys6s_56",zo="_header_cys6s_64",Ko="_headerCopy_cys6s_73",Go="_kicker_cys6s_79",Xo="_title_cys6s_87",Jo="_closeBtn_cys6s_94",Qo="_body_cys6s_116",J={shell:Ho,overlay:Vo,drawer:Wo,handle:Uo,header:zo,headerCopy:Ko,kicker:Go,title:Xo,closeBtn:Jo,body:Qo};function Ys({isOpen:e,onClose:n,episodes:t,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:i,title:p,header:_}){return A(()=>{if(!e)return;const a=l=>{l.key==="Escape"&&n()},h=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",a),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",a)}},[e,n]),e?At(r("div",{className:J.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[r("button",{className:J.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),r("aside",{className:J.drawer,children:[r("div",{className:J.handle}),r("div",{className:J.header,children:[r("div",{className:J.headerCopy,children:[r("span",{className:J.kicker,children:"Episode picker"}),r("h3",{className:J.title,children:"Choose an episode"})]}),r("button",{className:J.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:r(Q,{name:"times"})})]}),r("div",{className:J.body,children:r(qo,{episodes:t,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:i,variant:"drawer",title:p,header:_})})]})]}),document.body):null}const jo="_sourceSelectionContainer_c5tub_76",Yo="_providerSelectContainer_c5tub_89",Zo="_providerSelect_c5tub_89",es="_sourceSelect_c5tub_76",ts="_sourceButtons_c5tub_145",ns="_sourceButton_c5tub_145",rs="_active_c5tub_170",Zs={sourceSelectionContainer:jo,providerSelectContainer:Yo,providerSelect:Zo,sourceSelect:es,sourceButtons:ts,sourceButton:ns,active:rs};function Pe(){return document}function rt(e){const n=Pe();if(document.fullscreenElement)return document.fullscreenElement;if(n.webkitFullscreenElement)return n.webkitFullscreenElement;const t=e;return t?.webkitDisplayingFullscreen?t:null}function ae(e){return rt(e)!==null}async function os(e,n){if(rt(n))return;const t=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const s=n;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function ss(e){const n=Pe();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(n.webkitFullscreenElement&&typeof n.webkitExitFullscreen=="function"){await n.webkitExitFullscreen();return}}catch{}const t=e;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof n.webkitCancelFullScreen=="function"?n.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??n.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function cs(e,n){!e&&!n||(ae(n)?await ss(n):e&&await os(e,n))}function as(e,n){const t=()=>{try{n(ae(e()))}catch{}},s=Pe(),o=t;s.addEventListener("fullscreenchange",t),s.addEventListener("webkitfullscreenchange",o),s.addEventListener("webkitbeginfullscreen",o,!0),s.addEventListener("webkitendfullscreen",o,!0);const i=e();return i?.addEventListener("webkitbeginfullscreen",o),i?.addEventListener("webkitendfullscreen",o),()=>{s.removeEventListener("fullscreenchange",t),s.removeEventListener("webkitfullscreenchange",o),s.removeEventListener("webkitbeginfullscreen",o,!0),s.removeEventListener("webkitendfullscreen",o,!0),i?.removeEventListener("webkitbeginfullscreen",o),i?.removeEventListener("webkitendfullscreen",o)}}const ec=({skipIntervals:e,showId:n,episodeNumber:t,episodeCount:s,sourceType:o,showMeta:i})=>{const p=qt(),_=Ft(),a=b(null),h=b(null),l=b(null),E=b(null),v=b(!1),L=b(null),f=b(0),g=b(1),S=b({mouse:!1,keyboard:!1}),u=b(null),y=b(null),d=b(!1),N=b(Math.random().toString(36).substring(2)),[$,W]=C(!1),[G,B]=C(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[q,z]=C(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[m,w]=C(!1),[R,U]=C(0),[j,D]=C(!0),[ee,Me]=C(!1),[ot,Ae]=C({time:0,position:null}),[we,st]=C(localStorage.getItem("autoSkipEnabled")==="true"),[ct,Se]=C(null),[at,it]=C(!1),[te]=C(io),[lt,ut]=C(te.fontSize),[dt,pt]=C(te.position),[ft,mt]=C(te.bgOpacity),[ht,vt]=C(te.bgColor),[_t,gt]=C(te.textColor),[yt,bt]=C(te.edge),[wt,St]=C(te.bold),[Ct,kt]=C([]),[Et,Lt]=C(null),[Tt,Bt]=C(!1),[xt,Nt]=C(!1),[fe,X]=C(!1),[It,me]=C(!1),[Pt,$e]=C(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ie=b(!1),Ce=b(-1),he=x(()=>{const c=a.current;return!n||!t||!i?.name?null:{showId:n,episodeNumber:t,episodeCount:s,currentTime:c?c.currentTime:0,duration:c?c.duration:0,showName:i.name,showThumbnail:i.thumbnail,nativeName:i.names?.native,englishName:i.names?.english,genres:Array.isArray(i.genres)?i.genres.map(T=>typeof T=="string"?T:T?.name).filter(Boolean):void 0,popularityScore:i.score,type:i.type,isPlaying:c?!c.paused:!0,sessionId:N.current,isAdult:i.isAdult}},[n,t,s,i]),O=x((c=!1,T=!1)=>{if(ie.current)return!1;const I=he();if(!I)return!1;const k=a.current;if(!k&&o!=="iframe")return!1;const F=k?k.currentTime>=k.duration*.8:!1;let H=k?k.currentTime:0;if(c&&F&&(H=k?k.duration:0),!T){if(H===0&&!F)return!1;const K=k?Math.abs(H-Ce.current):0;if(!c&&k&&H!==k.duration&&K<5)return!1}return I.currentTime=H,Ce.current=H,c?(async()=>{try{await Je.progress.updateProgress.mutate(I),p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]}),p.invalidateQueries({queryKey:["thisWeekSchedule"]}),p.invalidateQueries(_.continueWatching.pathFilter())}catch(K){console.error("Failed to update progress:",K)}})():Rt("progress.updateProgress",I).catch(K=>console.error("Failed to update progress:",K)),!0},[he,o,p,n,t,_.continueWatching]);A(()=>{const c=a.current;c&&(c.volume=q,c.muted=G)},[a,q,G]),A(()=>{const c=()=>{ie.current||O(!0)};window.addEventListener("beforeunload",c);const T=L,I=E;return()=>{window.removeEventListener("beforeunload",c),ie.current||O(!0),T.current&&clearTimeout(T.current),I.current&&clearTimeout(I.current)}},[O]);const ve=x(()=>{const c=h.current;c&&cs(c,a.current).catch(T=>{console.error(`Error attempting to toggle full-screen mode: ${T?.message} (${T?.name})`)})},[]),_e=x(()=>{a.current&&(a.current.paused?a.current.play().catch(()=>console.warn("Autoplay was prevented.")):(a.current.pause(),D(!0)))},[D]),oe=x(()=>{const c=a.current;if(!c)return;const T=S.current.mouse||S.current.keyboard;c.playbackRate=T?2:g.current},[]),le=x(c=>{S.current.mouse!==c&&(S.current.mouse=c,me(c||S.current.keyboard),oe())},[oe]),se=x(c=>{S.current.keyboard!==c&&(S.current.keyboard=c,me(S.current.mouse||c),oe())},[oe]),ue=x(c=>{a.current&&(a.current.currentTime+=c,L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{O(!1,!0)},1500),D(!0))},[O,D]),ge=x(()=>{if(!a.current)return;const c=!a.current.muted;a.current.muted=c,B(c),localStorage.setItem("playerMuted",String(c)),!c&&a.current.volume===0&&(a.current.volume=.5,z(.5),localStorage.setItem("playerVolume",String(.5))),D(!0)},[D]);A(()=>{const c=()=>a.current,T=as(c,I=>{w(I),I&&D(!0)});return w(ae(c())),T},[D]),A(()=>{const c=I=>{if(!I.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(I.code==="Space"){if(I.preventDefault(),d.current)return;d.current=!0,y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{y.current=null,d.current&&se(!0)},180);return}switch(I.key.toLowerCase()){case"f":ve();break;case"m":ge();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(I.preventDefault(),a.current){const F=Math.min(1,a.current.volume+.1);a.current.volume=F,z(F)}break;case"arrowdown":if(I.preventDefault(),a.current){const F=Math.max(0,a.current.volume-.1);a.current.volume=F,z(F)}break}}},T=I=>{if(I.code==="Space"){if(I.preventDefault(),d.current=!1,S.current.keyboard){se(!1);return}y.current&&(clearTimeout(y.current),y.current=null,_e())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",T),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",T),y.current&&(clearTimeout(y.current),y.current=null),d.current=!1,se(!1),me(!1)}},[se,_e,ve,ge,ue]),A(()=>{const c=H=>H?!!H.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,T=H=>{if(H.button!==0)return;const Y=H.target;if(!Y||c(Y))return;const K=h.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},I=H=>{const Y=H.target;if(!Y||c(Y))return;const K=h.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},k=()=>{u.current&&(clearTimeout(u.current),u.current=null),le(!1)},F=()=>{u.current&&(clearTimeout(u.current),u.current=null),d.current=!1,y.current&&(clearTimeout(y.current),y.current=null),se(!1),le(!1),me(!1)};return document.addEventListener("mousedown",T),document.addEventListener("mouseup",k),document.addEventListener("touchstart",I,{passive:!0}),document.addEventListener("touchend",k),document.addEventListener("touchcancel",k),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),window.addEventListener("blur",F),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("mouseup",k),document.removeEventListener("touchstart",I),document.removeEventListener("touchend",k),document.removeEventListener("touchcancel",k),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),window.removeEventListener("blur",F),u.current&&(clearTimeout(u.current),u.current=null)}},[se,le]);const Fe=x(()=>{W(!0),X(!1),setTimeout(()=>O(!1,!0),50)},[O]),Re=x(()=>{W(!0),X(!1)},[]),De=x(()=>{const c=a.current;c&&!c.paused&&c.readyState>=3&&!c.seeking||X(!0)},[]),Oe=x(()=>{X(!1)},[]),qe=x(()=>{W(!1),X(!1),D(!0),setTimeout(()=>O(!1,!0),50)},[O]),He=b(!1);He.current=fe,A(()=>{if(!fe)return;let c=a.current?.currentTime??0,T=0;const I=window.setInterval(()=>{const k=a.current;if(!k)return;T+=1;const F=k.currentTime,H=F!==c;if(c=F,!(k.paused||k.seeking)){if(H||k.readyState>=3){X(!1);return}T>=24&&k.readyState>=2&&!k.ended&&X(!1)}},500);return()=>window.clearInterval(I)},[fe]),A(()=>{ie.current=!1,Ce.current=-1,f.current=0,N.current=Math.random().toString(36).substring(2),U(0),X(!1)},[n,t]);const Ve=x(()=>{U(0),X(!1)},[]);A(()=>{const c=N.current;return()=>{Dt(c)}},[n,t]),A(()=>{if(o!=="iframe")return;O(!1,!0);const c=setInterval(()=>{O(!1,!0)},6e4);return()=>clearInterval(c)},[o,O]);const We=x(()=>{U(a.current?.duration||0),oe()},[oe]),Ue=x(()=>{if(a.current){const c=a.current.muted,T=a.current.volume;B(c),z(T),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(T))}},[]),ze=x(()=>{},[]),Ke=x(()=>{const c=a.current;if(!c)return;He.current&&!c.paused&&!c.seeking&&X(!1);const T=c.currentTime||0,I=Date.now();I-f.current>6e4&&O()&&(f.current=I);const k=e.find(F=>T>=F.start_time&&T<F.end_time)||null;Se(F=>F?.skip_id!==k?.skip_id?k:F),we&&k&&!c.paused&&(c.currentTime=k.end_time,Se(null))},[e,we,O]),Ge=x(()=>{const c=he();c&&(c.currentTime=c.duration,Je.progress.updateProgress.mutate(c).then(()=>{p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(T=>console.error("Failed to send final progress:",T)))},[he,p,n,t]),Xe=x(()=>{ie.current=!0,Ge()},[Ge]);A(()=>{const c=()=>{ee&&(Me(!1),Ae({time:0,position:null}),v.current&&a.current?.play(),O(!1,!0))};return ee&&(document.addEventListener("mouseup",c),document.addEventListener("pointerup",c),document.addEventListener("touchend",c),document.addEventListener("pointercancel",c),document.addEventListener("touchcancel",c)),()=>{document.removeEventListener("mouseup",c),document.removeEventListener("pointerup",c),document.removeEventListener("touchend",c),document.removeEventListener("pointercancel",c),document.removeEventListener("touchcancel",c)}},[ee,O]);const Mt=pe(()=>({togglePlay:_e,seek:ue,toggleMute:ge,toggleFullscreen:ve,onPlay:Fe,onPause:qe,onLoadedMetadata:We,formatTime:Ot,onVolumeChange:Ue,onProgress:ze,onTimeUpdate:Ke,onEnded:Xe,setShowControls:D,setIsScrubbing:Me,setHoverTime:Ae,setIsAutoSkipEnabled:st,setCurrentSkipInterval:Se,setShowCCMenu:it,setSubtitleFontSize:ut,setSubtitlePosition:pt,setSubtitleBgOpacity:mt,setSubtitleBgColor:vt,setSubtitleTextColor:gt,setSubtitleEdge:bt,setSubtitleBold:St,setAvailableSubtitles:kt,setActiveSubtitleTrack:Lt,setShowSettings:Bt,setShowVolumeSlider:Nt,wasPlayingBeforeScrub:v,inactivityTimer:E,setIsFullscreen:w,onWaiting:De,onPlaying:Re,onCanPlay:Oe,sendProgressUpdate:O,setUseNativeControls:$e,resetMediaState:Ve}),[_e,ue,ge,ve,Fe,qe,We,Ue,ze,Ke,Xe,w,De,Re,Oe,O,$e,Ve]);return{refs:{videoRef:a,playerContainerRef:h,progressBarRef:l},state:{isPlaying:$,isMuted:G,volume:q,isFullscreen:m,duration:R,showControls:j,isScrubbing:ee,hoverTime:ot,isAutoSkipEnabled:we,currentSkipInterval:ct,showCCMenu:at,subtitleFontSize:lt,subtitlePosition:dt,subtitleBgOpacity:ft,subtitleBgColor:ht,subtitleTextColor:_t,subtitleEdge:yt,subtitleBold:wt,availableSubtitles:Ct,activeSubtitleTrack:Et,showSettings:Tt,showVolumeSlider:xt,isBuffering:fe,isSpeedBoostActive:It,useNativeControls:Pt},actions:Mt}};function is(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function tc(e,n){const{refs:t,actions:s}=e,o=b(n);o.current=n;const i=b(!1),p=b(!1),_=a=>{try{if(a)return a.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};A(()=>{if(!is())return;let a=null;const h=()=>{const l=t.playerContainerRef.current;if(_(a)){if(!o.current||!l||ae(t.videoRef.current)||p.current)return;i.current=!0,s.toggleFullscreen()}else p.current=!1,i.current&&(i.current=!1,ae(t.videoRef.current)&&s.toggleFullscreen())};try{a=window.matchMedia("(orientation: landscape)"),a.addEventListener?a.addEventListener("change",h):a.addListener(h)}catch{}return h(),()=>{try{a&&(a.removeEventListener?a.removeEventListener("change",h):a.removeListener(h))}catch{}}},[s,t.playerContainerRef,t.videoRef,n]),A(()=>{const a=()=>{if(!ae(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(p.current=!0)}catch{p.current=!0}}};return document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[t.videoRef])}const ls=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function nc({videoRef:e,canvasRef:n,delayMs:t,enabled:s}){const o=b(t);o.current=t;const i=b([]),p=b(-1),_=b(-1),a=b(!1),h=b(0),l=b(null);A(()=>{const E=u=>{if(u)try{u.close()}catch{}},v=()=>{for(const u of i.current)E(u.bitmap);i.current=[]};if(!s){v(),p.current=-1,_.current=-1,a.current=!1,h.current=0;return}let L=!1;const f=()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)},g=()=>{L||(f(),l.current=requestAnimationFrame(()=>{S()}))};async function S(){if(L)return;const u=e.current,y=n.current;if(!u||!y||u.videoWidth===0){g();return}if(u.paused||u.ended||document.hidden||u.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){g();return}const d=u.getVideoPlaybackQuality().totalVideoFrames;if(d===p.current){g();return}(u.seeking||_.current>=0&&Math.abs(u.currentTime-_.current)>.5)&&(v(),a.current=!1,h.current=0,p.current=-1),_.current=u.currentTime,(y.width!==u.videoWidth||y.height!==u.videoHeight)&&(y.width=u.videoWidth,y.height=u.videoHeight);const N=Math.max(0,o.current||0);N>h.current&&(a.current=!1);try{const $=await createImageBitmap(u);if(L){E($);return}p.current=d;const W=performance.now(),G=y.getContext("2d"),B=w=>{G&&G.drawImage(w,0,0,y.width,y.height)};if(N<=0){v(),a.current=!1,h.current=0,B($),E($),g();return}const q=i.current;q.push({bitmap:$,capture:W});const z=ls(N);for(;q.length>z;)E(q.shift()?.bitmap);let m=-1;for(let w=q.length-1;w>=0;w--)if(W-q[w].capture>=N){m=w;break}if(m!==-1){for(let R=0;R<m;R++)E(q.shift()?.bitmap);const w=q.shift();w?(B(w.bitmap),E(w.bitmap),a.current=!0,h.current=N):B($)}else if(!a.current)B($);else{const w=q.shift();w?(B(w.bitmap),E(w.bitmap)):B($)}}catch{}g()}return g(),()=>{L=!0,f();for(const u of i.current)try{u.bitmap.close()}catch{}i.current=[]}},[s,e,n])}const je=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},Ye=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function rc(e,n){const[t,s]=C(()=>{try{const d=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(d)&&d>=0&&d<=500)return Math.round(d)}catch{}return 180}),[o,i]=C(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[p,_]=C(!1),[a,h]=C(!1),l=b(null),E=b(null),v=d=>{const N=Math.max(0,Math.min(500,Math.round(d)));s(N);try{localStorage.setItem("playerVideoDelayMs",String(N))}catch{}},L=d=>{i(d),Ye(d)},f=x(()=>{h(!1),_(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:o,setDelayEnabled:L,handleVideoDelayChange:v,isCalibrating:p,testClipActive:a,stopCalibration:f,openAvSyncCalibrator:()=>{l.current={enabled:o,ms:t},i(!0),Ye(!0),n?.(),_(!0)},cancelAvSyncCalibrator:()=>{const d=l.current;l.current=null,d&&(s(d.ms),i(d.enabled),je(d.ms,d.enabled)),h(!1),_(!1)},applyAvSyncCalibrator:()=>{l.current=null,i(!0),je(t,!0),h(!1),_(!1)},toggleTestClip:()=>{if(a){h(!1);return}const d=e.current;d&&!isNaN(d.currentTime)&&(E.current=d.currentTime),h(!0)},calibReturnRef:E,effectiveVideoDelayMs:o?t:0}}function oc(){const[e,n]=C(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});A(()=>{try{e?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(o){console.error(o)}return()=>{try{document.body.classList.remove("theater-mode")}catch(o){console.error(o)}}},[e]);const t=x(()=>{n(o=>{const i=!o;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),s=x(o=>{if(e&&o.target===o.currentTarget){n(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:s}}const ne={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function us(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ne;const n=JSON.parse(e),t=(s,o,i,p)=>{const _=Number(s);return Number.isFinite(_)?Math.max(i,Math.min(p,_)):o};return{enabled:n.enabled??ne.enabled,blur:t(n.blur,ne.blur,0,120),saturation:t(n.saturation,ne.saturation,0,200),brightness:t(n.brightness,ne.brightness,20,120),opacity:t(n.opacity,ne.opacity,10,100)}}catch{return ne}}function sc(){const[e,n]=C(us),t=x(s=>{n(o=>{const i={...o,...s};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const Le=160,Te=90,ds=120,cc=({videoRef:e,active:n,settings:t,className:s})=>{const o=b(null);return A(()=>{if(!n)return;const i=o.current,p=e.current;if(!i||!p)return;const _=i.getContext("2d",{alpha:!1});if(!_)return;let a=0,h=0,l=!1;const E=()=>{if(!(p.readyState<2||!p.videoWidth))try{const f=p.videoWidth,g=p.videoHeight,S=Le/Te,u=f/g;let y=f,d=g,N=0,$=0;u>S?(y=g*S,N=(f-y)/2):(d=f/S,$=(g-d)/2),_.drawImage(p,N,$,y,d,0,0,Le,Te)}catch{}},v=f=>{l||p.paused||(a=requestAnimationFrame(v),!(f-h<ds)&&(h=f,E()))},L=()=>{l||(cancelAnimationFrame(a),h=0,a=requestAnimationFrame(v))};return p.addEventListener("play",L),p.addEventListener("seeked",E),p.addEventListener("loadeddata",E),a=requestAnimationFrame(v),()=>{l=!0,cancelAnimationFrame(a),p.removeEventListener("play",L),p.removeEventListener("seeked",E),p.removeEventListener("loadeddata",E)}},[n,e]),n?r("canvas",{ref:o,width:Le,height:Te,"aria-hidden":"true",className:s??Kr.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},ps="_row_1fq55_1",fs="_rowHeader_1fq55_9",ms="_rowLabel_1fq55_17",hs="_rowValue_1fq55_28",vs="_slider_1fq55_36",_s="_swatches_1fq55_99",gs="_swatch_1fq55_99",ys="_swatchPicked_1fq55_114",bs="_colorInput_1fq55_120",ws="_segmented_1fq55_131",V={row:ps,rowHeader:fs,rowLabel:ms,rowValue:hs,slider:vs,swatches:_s,swatch:gs,swatchPicked:ys,colorInput:bs,segmented:ws},Ss=({label:e,display:n,min:t,max:s,step:o,value:i,percent:p,onChange:_,onCommit:a})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:[r("span",{className:V.rowLabel,children:e}),r("span",{className:V.rowValue,children:n})]}),r("input",{type:"range",className:V.slider,min:t,max:s,step:o,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:h=>_(Number(h.target.value)),onMouseDown:h=>h.stopPropagation(),onPointerDown:h=>h.stopPropagation(),onTouchStart:h=>h.stopPropagation(),onPointerUp:a,onPointerCancel:a,onTouchEnd:a,onKeyUp:a,onBlur:a,style:{"--slider-percent":`${p}%`}})]}),ac=({label:e,colors:n,value:t,onChange:s})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.swatches,children:[n.map(o=>r("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":t.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${V.swatch} ${t.toLowerCase()===o.toLowerCase()?V.swatchPicked:""}`,style:{backgroundColor:o}},o)),r("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:V.colorInput,value:t,"data-speed-boost-ignore":"true",onInput:o=>s(o.target.value),onMouseDown:o=>o.stopPropagation(),onPointerDown:o=>o.stopPropagation(),onTouchStart:o=>o.stopPropagation()})]})]});function ic({label:e,options:n,value:t,onChange:s}){return r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.segmented,role:"group","aria-label":e,children:n.map(o=>r("button",{type:"button","aria-pressed":t===o,onClick:()=>s(o),children:[r("span",{children:o}),t===o&&r(Q,{name:"check",size:10})]},o))})]})}const be=10,Ie=500,Be=e=>Math.max(0,Math.min(Ie,Math.round(e))),lc=({isOpen:e,ms:n,onChange:t,onApply:s,onClose:o,testClipActive:i,onTestClip:p})=>e?r("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:_=>_.stopPropagation(),style:{position:"absolute",right:8,bottom:112,width:"min(260px, calc(100% - 16px))",maxHeight:"calc(100% - 124px)",overflowY:"auto",overflowX:"hidden",zIndex:60,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:12,borderRadius:"var(--radius-lg)",border:"1px solid var(--glass-border)",background:"rgba(18, 18, 22, 0.95)",boxShadow:"var(--glass-shadow)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxSizing:"border-box"},children:[r("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),r("div",{children:r(re,{size:"sm",variant:"secondary",onClick:p,children:i?"Back to video":"Preview test clip"})}),r("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[r(re,{size:"sm",onClick:()=>t(Be(n-be)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",be,"ms"]}),r("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[n,"ms"]}),r(re,{size:"sm",onClick:()=>t(Be(n+be)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",be,"ms"]})]}),r(Ss,{label:"Video delay",display:`${n}ms`,min:0,max:Ie,step:5,value:n,percent:n/Ie*100,onChange:_=>t(Be(_))}),r("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[r(re,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),r(re,{size:"sm",onClick:s,children:["Apply ",n,"ms"]})]})]}):null;export{cc as A,Is as B,zs as C,Vs as D,js as E,Ms as F,Bs as G,xs as H,ac as I,qs as J,ic as K,Z as L,Ss as M,ne as N,Qs as P,Us as R,Gs as S,Os as T,Xs as U,Js as a,Ks as b,Zs as c,rc as d,nc as e,oc as f,Ps as g,tc as h,no as i,sc as j,$s as k,Ns as l,Hs as m,Fs as n,Ws as o,As as p,Ds as q,Rs as r,co as s,Kr as t,ec as u,qo as v,Ts as w,ce as x,lc as y,Ys as z};
|