diff --git a/backend/chaturbate_online.go b/backend/chaturbate_online.go index ee588a1..ab626a1 100644 --- a/backend/chaturbate_online.go +++ b/backend/chaturbate_online.go @@ -1,5 +1,4 @@ // backend\chaturbate_online.go - package main import ( @@ -22,7 +21,6 @@ import ( const chaturbateOnlineRoomsURL = "https://chaturbate.com/affiliates/api/onlinerooms/?format=json&wm=827SM" // ChaturbateRoom bildet die Felder ab, die die Online-Rooms API liefert. -// (Du kannst das später problemlos erweitern, wenn du weitere Felder brauchst.) type ChaturbateRoom struct { Gender string `json:"gender"` Location string `json:"location"` @@ -75,7 +73,7 @@ type chaturbateCache struct { LiteByUser map[string]ChaturbateOnlineRoomLite FetchedAt time.Time - LastAttempt time.Time // ✅ wichtig für Bootstrap-Cooldown (siehe Punkt 2) + LastAttempt time.Time LastErr string } @@ -84,7 +82,7 @@ var ( cbMu sync.RWMutex cb chaturbateCache - // ✅ Optional: ModelStore, um Tags aus der Online-API zu übernehmen + // ✅ Optional: ModelStore, um Tags/Bilder/Status aus der Online-API zu übernehmen cbModelStore *ModelStore ) @@ -232,11 +230,16 @@ func indexLiteByUser(rooms []ChaturbateRoom) map[string]ChaturbateOnlineRoomLite if u == "" { continue } + img := strings.TrimSpace(rm.ImageURL360) + if img == "" { + img = strings.TrimSpace(rm.ImageURL) + } + m[u] = ChaturbateOnlineRoomLite{ Username: rm.Username, CurrentShow: rm.CurrentShow, ChatRoomURL: rm.ChatRoomURL, - ImageURL: rm.ImageURL, + ImageURL: img, Gender: rm.Gender, Country: rm.Country, @@ -248,26 +251,145 @@ func indexLiteByUser(rooms []ChaturbateRoom) map[string]ChaturbateOnlineRoomLite return m } -// startChaturbateOnlinePoller pollt die API alle paar Sekunden, -// aber nur, wenn der Settings-Switch "useChaturbateApi" aktiviert ist. +// --- Profilbild Download + Persist (online -> offline) --- + +func selectBestRoomImageURL(rm ChaturbateRoom) string { + if v := strings.TrimSpace(rm.ImageURL360); v != "" { + return v + } + if v := strings.TrimSpace(rm.ImageURL); v != "" { + return v + } + return "" +} + +func fetchProfileImageBytes(ctx context.Context, rawURL string) (mime string, data []byte, err error) { + u := strings.TrimSpace(rawURL) + if u == "" { + return "", nil, fmt.Errorf("empty image url") + } + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil) + if err != nil { + return "", nil, err + } + req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)") + req.Header.Set("Accept", "image/*,*/*;q=0.8") + + resp, err := cbHTTP.Do(req) + if err != nil { + return "", nil, err + } + defer resp.Body.Close() + + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + b, _ := io.ReadAll(io.LimitReader(resp.Body, 2048)) + return "", nil, fmt.Errorf("image fetch HTTP %d: %s", resp.StatusCode, strings.TrimSpace(string(b))) + } + + // Sicherheitslimit (Profilbilder sind klein) + const maxImageBytes = 4 << 20 // 4 MiB + b, err := io.ReadAll(io.LimitReader(resp.Body, maxImageBytes+1)) + if err != nil { + return "", nil, err + } + if len(b) == 0 { + return "", nil, fmt.Errorf("empty image body") + } + if len(b) > maxImageBytes { + return "", nil, fmt.Errorf("image too large") + } + + ct := strings.TrimSpace(strings.ToLower(resp.Header.Get("Content-Type"))) + if i := strings.Index(ct, ";"); i >= 0 { + ct = strings.TrimSpace(ct[:i]) + } + + return ct, b, nil +} + +func persistOfflineTransitions(prevRoomsByUser, newRoomsByUser map[string]ChaturbateRoom, fetchedAt time.Time) { + if cbModelStore == nil || prevRoomsByUser == nil { + return + } + seenAt := fetchedAt.UTC().Format(time.RFC3339Nano) + + for userLower, prevRm := range prevRoomsByUser { + // war vorher online und ist jetzt noch online => kein Offline-Transition + if _, stillOnline := newRoomsByUser[userLower]; stillOnline { + continue + } + + username := strings.TrimSpace(prevRm.Username) + if username == "" { + username = strings.TrimSpace(userLower) + } + if username == "" { + continue + } + + // 1) Offline Status persistieren + _ = cbModelStore.SetLastSeenOnline("chaturbate.com", username, false, seenAt) + + // 2) Letztes bekanntes Profilbild persistieren + imgURL := selectBestRoomImageURL(prevRm) + if imgURL == "" { + continue + } + + // URL immer merken (Fallback / Diagnose) + _ = cbModelStore.SetProfileImageURLOnly("chaturbate.com", username, imgURL, seenAt) + + // Blob speichern (best effort) + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + mime, data, err := fetchProfileImageBytes(ctx, imgURL) + cancel() + if err != nil || len(data) == 0 { + continue + } + _ = cbModelStore.SetProfileImage("chaturbate.com", username, imgURL, mime, data, seenAt) + } +} + +// cbApplySnapshot ersetzt atomar den Cache-Snapshot und triggert anschließend +// offline-transition persist (best effort, außerhalb des Locks). +func cbApplySnapshot(rooms []ChaturbateRoom) time.Time { + var prevRoomsByUser map[string]ChaturbateRoom + newRoomsByUser := indexRoomsByUser(rooms) + newLiteByUser := indexLiteByUser(rooms) + fetchedAtNow := time.Now() + + cbMu.Lock() + if cb.RoomsByUser != nil { + prevRoomsByUser = cb.RoomsByUser + } + cb.LastErr = "" + cb.Rooms = rooms + cb.RoomsByUser = newRoomsByUser + cb.LiteByUser = newLiteByUser + cb.FetchedAt = fetchedAtNow + cbMu.Unlock() + + // Offline-Transitions bewusst außerhalb des Locks + if cbModelStore != nil && prevRoomsByUser != nil { + go persistOfflineTransitions(prevRoomsByUser, newRoomsByUser, fetchedAtNow) + } + + return fetchedAtNow +} + // startChaturbateOnlinePoller pollt die API alle paar Sekunden, // aber nur, wenn der Settings-Switch "useChaturbateApi" aktiviert ist. func startChaturbateOnlinePoller(store *ModelStore) { - // ✅ etwas langsamer pollen (weniger Last) const interval = 10 * time.Second - - // ✅ Tags-Fill ist teuer -> max alle 10 Minuten const tagsFillEvery = 10 * time.Minute - // nur loggen, wenn sich etwas ändert (sonst spammt es) lastLoggedCount := -1 lastLoggedErr := "" - // Tags-Fill Throttle (lokal in der Funktion) var tagsMu sync.Mutex var tagsLast time.Time - // sofort ein initialer Tick first := time.NewTimer(0) defer first.Stop() @@ -284,7 +406,7 @@ func startChaturbateOnlinePoller(store *ModelStore) { continue } - // ✅ immer merken: wir haben es versucht (hilft dem Handler beim Bootstrap-Cooldown) + // immer merken: wir haben es versucht cbMu.Lock() cb.LastAttempt = time.Now() cbMu.Unlock() @@ -293,17 +415,14 @@ func startChaturbateOnlinePoller(store *ModelStore) { rooms, err := fetchChaturbateOnlineRooms(ctx) cancel() - cbMu.Lock() if err != nil { - // ❗️bei Fehler NICHT fetchedAt aktualisieren, - // sonst wirkt der Cache "frisch", obwohl rooms alt sind. + cbMu.Lock() cb.LastErr = err.Error() - // ❗️damit offline Models nicht hängen bleiben: Cache leeren + // Fehler => Cache leeren (damit offline nicht hängen bleibt) cb.Rooms = nil cb.RoomsByUser = nil cb.LiteByUser = nil - cbMu.Unlock() if cb.LastErr != lastLoggedErr { @@ -313,16 +432,9 @@ func startChaturbateOnlinePoller(store *ModelStore) { continue } - // ✅ Erfolg: komplette Liste ersetzen + indices + fetchedAt setzen - cb.LastErr = "" - cb.Rooms = rooms - cb.RoomsByUser = indexRoomsByUser(rooms) - cb.LiteByUser = indexLiteByUser(rooms) - cb.FetchedAt = time.Now() + _ = cbApplySnapshot(rooms) - cbMu.Unlock() - - // ✅ Tags übernehmen ist teuer -> nur selten + im Hintergrund + // Tags übernehmen ist teuer -> nur selten + im Hintergrund if cbModelStore != nil && len(rooms) > 0 { shouldFill := false @@ -418,7 +530,7 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { var shows []string // --------------------------- - // Filter state (muss vor GET/POST da sein) + // Filter state // --------------------------- var ( allowedShow map[string]bool @@ -449,7 +561,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { wantRefresh = req.Refresh - // ✅ neue Filter übernehmen (POST) genders := normalizeList(req.Gender) countries := normalizeList(req.Country) tagsAny := normalizeList(req.TagsAny) @@ -461,7 +572,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { allowedCountry = toSet(countries) allowedTagsAny = toSet(tagsAny) - // normalize users seenU := map[string]bool{} for _, u := range req.Q { u = strings.ToLower(strings.TrimSpace(u)) @@ -473,7 +583,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { } sort.Strings(users) - // normalize shows seenS := map[string]bool{} for _, s := range req.Show { s = strings.ToLower(strings.TrimSpace(s)) @@ -518,28 +627,24 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { sort.Strings(shows) } - // ✅ gender=... qGender := strings.TrimSpace(r.URL.Query().Get("gender")) if qGender != "" { genders := normalizeList(strings.Split(qGender, ",")) allowedGender = toSet(genders) } - // ✅ country=... qCountry := strings.TrimSpace(r.URL.Query().Get("country")) if qCountry != "" { countries := normalizeList(strings.Split(qCountry, ",")) allowedCountry = toSet(countries) } - // ✅ tagsAny=... qTagsAny := strings.TrimSpace(r.URL.Query().Get("tagsAny")) if qTagsAny != "" { tagsAny := normalizeList(strings.Split(qTagsAny, ",")) allowedTagsAny = toSet(tagsAny) } - // ✅ minUsers=123 qMinUsers := strings.TrimSpace(r.URL.Query().Get("minUsers")) if qMinUsers != "" { if n, err := strconv.Atoi(qMinUsers); err == nil { @@ -547,7 +652,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { } } - // ✅ isHD=1/true/yes qIsHD := strings.ToLower(strings.TrimSpace(r.URL.Query().Get("isHD"))) if qIsHD != "" { b := (qIsHD == "1" || qIsHD == "true" || qIsHD == "yes") @@ -556,10 +660,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { allowedShow = toSet(shows) } - // --------------------------- - // Ultra-wichtig: niemals die komplette Affiliate-Liste ausliefern. - // Wenn keine Users angegeben sind -> leere Antwort (spart massiv CPU + JSON) - // --------------------------- onlySpecificUsers := len(users) > 0 // --------------------------- @@ -570,7 +670,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { "users="+strings.Join(users, ","), "show="+strings.Join(keysOfSet(allowedShow), ","), - // ✅ neue Filter in den Key! "gender="+strings.Join(keysOfSet(allowedGender), ","), "country="+strings.Join(keysOfSet(allowedCountry), ","), "tagsAny="+strings.Join(keysOfSet(allowedTagsAny), ","), @@ -609,23 +708,20 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { } // --------------------------- - // Snapshot Cache (nur Lite-Index nutzen) + // Snapshot Cache lesen (nur Lite) // --------------------------- cbMu.RLock() fetchedAt := cb.FetchedAt lastErr := cb.LastErr lastAttempt := cb.LastAttempt - liteByUser := cb.LiteByUser // map[usernameLower]ChaturbateRoomLite + liteByUser := cb.LiteByUser cbMu.RUnlock() // --------------------------- // Persist "last seen online/offline" für explizit angefragte User - // (nur wenn wir einen gültigen Snapshot haben) // --------------------------- if cbModelStore != nil && onlySpecificUsers && liteByUser != nil && !fetchedAt.IsZero() { seenAt := fetchedAt.UTC().Format(time.RFC3339Nano) - - // Persistiert den tatsächlichen Snapshot-Status (unabhängig von Filtern) for _, u := range users { _, isOnline := liteByUser[u] _ = cbModelStore.SetLastSeenOnline("chaturbate.com", u, isOnline, seenAt) @@ -633,17 +729,12 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { } // --------------------------- - // Refresh/Bootstrap-Strategie: - // - Handler blockiert NICHT auf Remote-Fetch (Performance!) - // - wenn refresh=true: triggert einen Fetch (best effort), aber liefert sofort Cache/leer zurück - // - wenn Cache noch nie erfolgreich war: "warming up" + best-effort Bootstrap, mit Cooldown + // Refresh/Bootstrap-Strategie // --------------------------- const bootstrapCooldown = 8 * time.Second needBootstrap := fetchedAt.IsZero() - shouldTriggerFetch := - wantRefresh || - (needBootstrap && time.Since(lastAttempt) >= bootstrapCooldown) + shouldTriggerFetch := wantRefresh || (needBootstrap && time.Since(lastAttempt) >= bootstrapCooldown) if shouldTriggerFetch { cbRefreshMu.Lock() @@ -653,12 +744,10 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { cbRefreshInFlight = true cbRefreshMu.Unlock() - // attempt timestamp sofort setzen (damit 100 Requests nicht alle triggern) cbMu.Lock() cb.LastAttempt = time.Now() cbMu.Unlock() - // ✅ background fetch (nicht blockieren) go func() { defer func() { cbRefreshMu.Lock() @@ -670,24 +759,20 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { rooms, err := fetchChaturbateOnlineRooms(ctx) cancel() - cbMu.Lock() if err != nil { + cbMu.Lock() cb.LastErr = err.Error() cb.Rooms = nil cb.RoomsByUser = nil cb.LiteByUser = nil // fetchedAt NICHT ändern (bleibt letzte erfolgreiche Zeit) - } else { - cb.LastErr = "" - cb.Rooms = rooms - cb.RoomsByUser = indexRoomsByUser(rooms) - cb.LiteByUser = indexLiteByUser(rooms) // ✅ kleiner Index für Handler - cb.FetchedAt = time.Now() + cbMu.Unlock() + return } - cbMu.Unlock() - // Tags optional übernehmen (nur bei Erfolg) - if cbModelStore != nil && err == nil && len(rooms) > 0 { + _ = cbApplySnapshot(rooms) + + if cbModelStore != nil && len(rooms) > 0 { cbModelStore.FillMissingTagsFromChaturbateOnline(rooms) } }() @@ -741,7 +826,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { return true } - // ✅ total = Anzahl online rooms (gefiltert), ohne sie auszuliefern total := 0 if liteByUser != nil { noExtraFilters := @@ -783,7 +867,6 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { } } - // wenn noch nie erfolgreich gefetched: nicer error if needBootstrap && lastErr == "" { lastErr = "warming up" } @@ -797,7 +880,7 @@ func chaturbateOnlineHandler(w http.ResponseWriter, r *http.Request) { "count": len(outRooms), "total": total, "lastError": lastErr, - "rooms": outRooms, // ✅ klein & schnell + "rooms": outRooms, } body, _ := json.Marshal(out) diff --git a/backend/data/models_store.db b/backend/data/models_store.db index f303744..276769a 100644 Binary files a/backend/data/models_store.db and b/backend/data/models_store.db differ diff --git a/backend/data/models_store.db-shm b/backend/data/models_store.db-shm index b326c33..8afc0c0 100644 Binary files a/backend/data/models_store.db-shm and b/backend/data/models_store.db-shm differ diff --git a/backend/data/models_store.db-wal b/backend/data/models_store.db-wal index 3543c76..bd5b44b 100644 Binary files a/backend/data/models_store.db-wal and b/backend/data/models_store.db-wal differ diff --git a/backend/generate.go b/backend/generate.go index 0dbb270..0e13f68 100644 --- a/backend/generate.go +++ b/backend/generate.go @@ -327,6 +327,11 @@ func ensureAssetsForVideoDetailed(ctx context.Context, videoPath string, sourceU // ---------------- // Preview (MP4 teaser clips) // ---------------- + const ( + previewClipLenSec = 0.75 + previewMaxClips = 12 + ) + var computedPreviewClips []previewClip if previewBefore { @@ -346,7 +351,7 @@ func ensureAssetsForVideoDetailed(ctx context.Context, videoPath string, sourceU progress(thumbsW + 0.05) - if err := generateTeaserClipsMP4WithProgress(genCtx, videoPath, previewPath, 0.75, 12, func(r float64) { + if err := generateTeaserClipsMP4WithProgress(genCtx, videoPath, previewPath, previewClipLenSec, previewMaxClips, func(r float64) { if r < 0 { r = 0 } @@ -372,16 +377,10 @@ func ensureAssetsForVideoDetailed(ctx context.Context, videoPath string, sourceU return } - // muss identisch zu generateTeaserClipsMP4WithProgress Defaults sein + // exakt dieselben Werte wie beim tatsächlichen Preview-Rendern opts := TeaserPreviewOptions{ - Segments: 18, - SegmentDuration: 1.0, - Width: 640, - Preset: "veryfast", - CRF: 21, - Audio: true, - AudioBitrate: "128k", - UseVsync2: false, + Segments: previewMaxClips, + SegmentDuration: previewClipLenSec, } starts, segDur, _ := computeTeaserStarts(meta.durSec, opts) diff --git a/backend/main.go b/backend/main.go index 0e01638..0eaaae3 100644 --- a/backend/main.go +++ b/backend/main.go @@ -170,207 +170,6 @@ func probeVideoProps(ctx context.Context, filePath string) (w int, h int, fps fl return w, h, fps, nil } -func metaJSONPathForAssetID(assetID string) (string, error) { - root, err := generatedMetaRoot() - if err != nil { - return "", err - } - if strings.TrimSpace(root) == "" { - return "", fmt.Errorf("generated/meta root leer") - } - return filepath.Join(root, assetID, "meta.json"), nil -} - -func readVideoMetaIfValid(metaPath string, fi os.FileInfo) (*videoMeta, bool) { - b, err := os.ReadFile(metaPath) - if err != nil || len(b) == 0 { - return nil, false - } - var m videoMeta - if err := json.Unmarshal(b, &m); err != nil { - return nil, false - } - - // nur akzeptieren wenn Datei identisch (damit wir nicht stale Werte zeigen) - if m.FileSize != fi.Size() || m.FileModUnix != fi.ModTime().Unix() { - return nil, false - } - - // Mindestvalidierung - if m.DurationSeconds <= 0 { - return nil, false - } - - return &m, true -} - -func ensureVideoMetaForFile(ctx context.Context, fullPath string, fi os.FileInfo, sourceURL string) (*videoMeta, bool) { - // assetID aus Dateiname - stem := strings.TrimSuffix(filepath.Base(fullPath), filepath.Ext(fullPath)) - assetID := stripHotPrefix(strings.TrimSpace(stem)) - if assetID == "" { - return nil, false - } - - // sanitize wie bei deinen generated Ordnern - var err error - assetID, err = sanitizeID(assetID) - if err != nil || assetID == "" { - return nil, false - } - - metaPath, err := metaJSONPathForAssetID(assetID) - if err != nil { - return nil, false - } - - // 1) valid meta vorhanden? - if m, ok := readVideoMetaIfValid(metaPath, fi); ok { - return m, true - } - - // 2) sonst neu erzeugen (mit Concurrency-Limit) - if ctx == nil { - ctx = context.Background() - } - cctx, cancel := context.WithTimeout(ctx, 8*time.Second) - defer cancel() - - if durSem != nil { - if err := durSem.Acquire(cctx); err != nil { - return nil, false - } - defer durSem.Release() - } - - // Dauer - dur, derr := durationSecondsCached(cctx, fullPath) - if derr != nil || dur <= 0 { - return nil, false - } - - // Video props - w, h, fps, perr := probeVideoProps(cctx, fullPath) - if perr != nil { - // width/height/fps dürfen 0 bleiben, duration ist aber trotzdem nützlich - w, h, fps = 0, 0, 0 - } - - // meta dir anlegen - _ = os.MkdirAll(filepath.Dir(metaPath), 0o755) - - m := &videoMeta{ - Version: 2, - DurationSeconds: dur, - FileSize: fi.Size(), - FileModUnix: fi.ModTime().Unix(), - VideoWidth: w, - VideoHeight: h, - FPS: fps, - Resolution: formatResolution(w, h), - SourceURL: strings.TrimSpace(sourceURL), - UpdatedAtUnix: time.Now().Unix(), - } - - b, _ := json.MarshalIndent(m, "", " ") - b = append(b, '\n') - _ = atomicWriteFile(metaPath, b) // best effort - - return m, true -} - -func attachMetaToJobBestEffort(ctx context.Context, job *RecordJob, fullPath string) { - if job == nil { - return - } - fullPath = strings.TrimSpace(fullPath) - if fullPath == "" { - return - } - - // Stat - fi, err := os.Stat(fullPath) - if err != nil || fi == nil || fi.IsDir() { - return - } - - // Größe immer mitgeben (macht Sort/Anzeige einfacher) - if job.SizeBytes <= 0 { - job.SizeBytes = fi.Size() - } - - // Meta.json lesen/erzeugen (best effort) - m, ok := ensureVideoMetaForFileBestEffort(ctx, fullPath, job.SourceURL) - if !ok || m == nil { - return - } - - // Optional: komplettes Meta mitsenden - job.Meta = m - - // Und zusätzlich die "Top-Level" Felder befüllen (für Frontend bequem) - if job.DurationSeconds <= 0 && m.DurationSeconds > 0 { - job.DurationSeconds = m.DurationSeconds - } - if job.VideoWidth <= 0 && m.VideoWidth > 0 { - job.VideoWidth = m.VideoWidth - } - if job.VideoHeight <= 0 && m.VideoHeight > 0 { - job.VideoHeight = m.VideoHeight - } - if job.FPS <= 0 && m.FPS > 0 { - job.FPS = m.FPS - } -} - -// ensureVideoMetaForFileBestEffort: -// - versucht zuerst echtes Generieren (ffprobe/ffmpeg) via ensureVideoMetaForFile -// - wenn das fehlschlägt, aber durationSecondsCacheOnly schon was weiß: -// schreibt eine Duration-only meta.json, damit wir künftig "aus meta.json" lesen können. -func ensureVideoMetaForFileBestEffort(ctx context.Context, fullPath string, sourceURL string) (*videoMeta, bool) { - fullPath = strings.TrimSpace(fullPath) - if fullPath == "" { - return nil, false - } - - fi, err := os.Stat(fullPath) - if err != nil || fi == nil || fi.IsDir() || fi.Size() <= 0 { - return nil, false - } - - // 1) Normaler Weg: meta erzeugen/lesen (ffprobe/ffmpeg) - if m, ok := ensureVideoMetaForFile(ctx, fullPath, fi, sourceURL); ok && m != nil { - return m, true - } - - // 2) Fallback: wenn wir Duration schon im RAM-Cache haben -> meta.json (Duration-only) persistieren - dur := durationSecondsCacheOnly(fullPath, fi) - if dur <= 0 { - return nil, false - } - - stem := strings.TrimSuffix(filepath.Base(fullPath), filepath.Ext(fullPath)) - assetID := stripHotPrefix(strings.TrimSpace(stem)) - if assetID == "" { - return nil, false - } - - metaPath, err := metaJSONPathForAssetID(assetID) - if err != nil || strings.TrimSpace(metaPath) == "" { - return nil, false - } - - _ = os.MkdirAll(filepath.Dir(metaPath), 0o755) - _ = writeVideoMetaDuration(metaPath, fi, dur, sourceURL) - - // nochmal lesen/validieren - if m, ok := readVideoMetaIfValid(metaPath, fi); ok && m != nil { - return m, true - } - - return nil, false -} - func (d *dummyResponseWriter) Header() http.Header { if d.h == nil { d.h = make(http.Header) diff --git a/backend/meta.go b/backend/meta.go index 765e88f..308e5d4 100644 --- a/backend/meta.go +++ b/backend/meta.go @@ -2,6 +2,7 @@ package main import ( + "context" "encoding/json" "fmt" "os" @@ -97,6 +98,207 @@ func readVideoMetaDuration(metaPath string, fi os.FileInfo) (float64, bool) { return m.DurationSeconds, true } +func metaJSONPathForAssetID(assetID string) (string, error) { + root, err := generatedMetaRoot() + if err != nil { + return "", err + } + if strings.TrimSpace(root) == "" { + return "", fmt.Errorf("generated/meta root leer") + } + return filepath.Join(root, assetID, "meta.json"), nil +} + +func ensureVideoMetaForFile(ctx context.Context, fullPath string, fi os.FileInfo, sourceURL string) (*videoMeta, bool) { + // assetID aus Dateiname + stem := strings.TrimSuffix(filepath.Base(fullPath), filepath.Ext(fullPath)) + assetID := stripHotPrefix(strings.TrimSpace(stem)) + if assetID == "" { + return nil, false + } + + // sanitize wie bei deinen generated Ordnern + var err error + assetID, err = sanitizeID(assetID) + if err != nil || assetID == "" { + return nil, false + } + + metaPath, err := metaJSONPathForAssetID(assetID) + if err != nil { + return nil, false + } + + // 1) valid meta vorhanden? + if m, ok := readVideoMetaIfValid(metaPath, fi); ok { + return m, true + } + + // 2) sonst neu erzeugen (mit Concurrency-Limit) + if ctx == nil { + ctx = context.Background() + } + cctx, cancel := context.WithTimeout(ctx, 8*time.Second) + defer cancel() + + if durSem != nil { + if err := durSem.Acquire(cctx); err != nil { + return nil, false + } + defer durSem.Release() + } + + // Dauer + dur, derr := durationSecondsCached(cctx, fullPath) + if derr != nil || dur <= 0 { + return nil, false + } + + // Video props + w, h, fps, perr := probeVideoProps(cctx, fullPath) + if perr != nil { + // width/height/fps dürfen 0 bleiben, duration ist aber trotzdem nützlich + w, h, fps = 0, 0, 0 + } + + // meta dir anlegen + _ = os.MkdirAll(filepath.Dir(metaPath), 0o755) + + m := &videoMeta{ + Version: 2, + DurationSeconds: dur, + FileSize: fi.Size(), + FileModUnix: fi.ModTime().Unix(), + VideoWidth: w, + VideoHeight: h, + FPS: fps, + Resolution: formatResolution(w, h), + SourceURL: strings.TrimSpace(sourceURL), + UpdatedAtUnix: time.Now().Unix(), + } + + b, _ := json.MarshalIndent(m, "", " ") + b = append(b, '\n') + _ = atomicWriteFile(metaPath, b) // best effort + + return m, true +} + +func attachMetaToJobBestEffort(ctx context.Context, job *RecordJob, fullPath string) { + if job == nil { + return + } + fullPath = strings.TrimSpace(fullPath) + if fullPath == "" { + return + } + + // Stat + fi, err := os.Stat(fullPath) + if err != nil || fi == nil || fi.IsDir() { + return + } + + // Größe immer mitgeben (macht Sort/Anzeige einfacher) + if job.SizeBytes <= 0 { + job.SizeBytes = fi.Size() + } + + // Meta.json lesen/erzeugen (best effort) + m, ok := ensureVideoMetaForFileBestEffort(ctx, fullPath, job.SourceURL) + if !ok || m == nil { + return + } + + // Optional: komplettes Meta mitsenden + job.Meta = m + + // Und zusätzlich die "Top-Level" Felder befüllen (für Frontend bequem) + if job.DurationSeconds <= 0 && m.DurationSeconds > 0 { + job.DurationSeconds = m.DurationSeconds + } + if job.VideoWidth <= 0 && m.VideoWidth > 0 { + job.VideoWidth = m.VideoWidth + } + if job.VideoHeight <= 0 && m.VideoHeight > 0 { + job.VideoHeight = m.VideoHeight + } + if job.FPS <= 0 && m.FPS > 0 { + job.FPS = m.FPS + } +} + +// ensureVideoMetaForFileBestEffort: +// - versucht zuerst echtes Generieren (ffprobe/ffmpeg) via ensureVideoMetaForFile +// - wenn das fehlschlägt, aber durationSecondsCacheOnly schon was weiß: +// schreibt eine Duration-only meta.json, damit wir künftig "aus meta.json" lesen können. +func ensureVideoMetaForFileBestEffort(ctx context.Context, fullPath string, sourceURL string) (*videoMeta, bool) { + fullPath = strings.TrimSpace(fullPath) + if fullPath == "" { + return nil, false + } + + fi, err := os.Stat(fullPath) + if err != nil || fi == nil || fi.IsDir() || fi.Size() <= 0 { + return nil, false + } + + // 1) Normaler Weg: meta erzeugen/lesen (ffprobe/ffmpeg) + if m, ok := ensureVideoMetaForFile(ctx, fullPath, fi, sourceURL); ok && m != nil { + return m, true + } + + // 2) Fallback: wenn wir Duration schon im RAM-Cache haben -> meta.json (Duration-only) persistieren + dur := durationSecondsCacheOnly(fullPath, fi) + if dur <= 0 { + return nil, false + } + + stem := strings.TrimSuffix(filepath.Base(fullPath), filepath.Ext(fullPath)) + assetID := stripHotPrefix(strings.TrimSpace(stem)) + if assetID == "" { + return nil, false + } + + metaPath, err := metaJSONPathForAssetID(assetID) + if err != nil || strings.TrimSpace(metaPath) == "" { + return nil, false + } + + _ = os.MkdirAll(filepath.Dir(metaPath), 0o755) + _ = writeVideoMetaDuration(metaPath, fi, dur, sourceURL) + + // nochmal lesen/validieren + if m, ok := readVideoMetaIfValid(metaPath, fi); ok && m != nil { + return m, true + } + + return nil, false +} + +func readVideoMetaIfValid(metaPath string, fi os.FileInfo) (*videoMeta, bool) { + b, err := os.ReadFile(metaPath) + if err != nil || len(b) == 0 { + return nil, false + } + + var m videoMeta + if err := json.Unmarshal(b, &m); err != nil { + return nil, false + } + if m.Version != 1 && m.Version != 2 { + return nil, false + } + if m.FileSize != fi.Size() || m.FileModUnix != fi.ModTime().Unix() { + return nil, false + } + if m.DurationSeconds <= 0 { + return nil, false + } + + return &m, true +} + func readVideoMetaSourceURL(metaPath string, fi os.FileInfo) (string, bool) { m, ok := readVideoMetaIfValid(metaPath, fi) if !ok || m == nil { @@ -114,6 +316,11 @@ func writeVideoMeta(metaPath string, fi os.FileInfo, dur float64, w int, h int, if strings.TrimSpace(metaPath) == "" || dur <= 0 { return nil } + var existing *videoMeta + if old, ok := readVideoMetaIfValid(metaPath, fi); ok && old != nil { + existing = old + } + m := videoMeta{ Version: 2, DurationSeconds: dur, @@ -125,6 +332,15 @@ func writeVideoMeta(metaPath string, fi os.FileInfo, dur float64, w int, h int, Resolution: formatResolution(w, h), SourceURL: strings.TrimSpace(sourceURL), UpdatedAtUnix: time.Now().Unix(), + + // ✅ bestehende Preview-Daten behalten + PreviewClips: nil, + PreviewSprite: nil, + } + + if existing != nil { + m.PreviewClips = existing.PreviewClips + m.PreviewSprite = existing.PreviewSprite } buf, err := json.Marshal(m) if err != nil { @@ -138,6 +354,11 @@ func writeVideoMetaWithPreviewClips(metaPath string, fi os.FileInfo, dur float64 if strings.TrimSpace(metaPath) == "" || dur <= 0 { return nil } + var existing *videoMeta + if old, ok := readVideoMetaIfValid(metaPath, fi); ok && old != nil { + existing = old + } + m := videoMeta{ Version: 2, DurationSeconds: dur, @@ -151,6 +372,11 @@ func writeVideoMetaWithPreviewClips(metaPath string, fi os.FileInfo, dur float64 PreviewClips: clips, UpdatedAtUnix: time.Now().Unix(), } + + // ✅ vorhandenes Sprite (inkl. stepSeconds) nicht wegwerfen + if existing != nil && existing.PreviewSprite != nil { + m.PreviewSprite = existing.PreviewSprite + } buf, err := json.Marshal(m) if err != nil { return err @@ -189,6 +415,17 @@ func writeVideoMetaWithPreviewClipsAndSprite( UpdatedAtUnix: time.Now().Unix(), } + if sprite == nil { + if old, ok := readVideoMetaIfValid(metaPath, fi); ok && old != nil && old.PreviewSprite != nil { + m.PreviewSprite = old.PreviewSprite + } + } + if len(clips) == 0 { + if old, ok := readVideoMetaIfValid(metaPath, fi); ok && old != nil && len(old.PreviewClips) > 0 { + m.PreviewClips = old.PreviewClips + } + } + buf, err := json.Marshal(m) if err != nil { return err diff --git a/backend/models_api.go b/backend/models_api.go index 066b5c2..197a79d 100644 --- a/backend/models_api.go +++ b/backend/models_api.go @@ -11,6 +11,7 @@ import ( "net/url" "strconv" "strings" + "time" ) // ✅ umbenannt, damit es nicht mit models.go kollidiert @@ -157,8 +158,8 @@ func importModelsCSV(store *ModelStore, r io.Reader, kind string) (importResult, } get := func(key string) string { - i := idx[key] - if i < 0 || i >= len(rec) { + i, ok := idx[key] + if !ok || i < 0 || i >= len(rec) { return "" } return strings.TrimSpace(rec[i]) @@ -240,18 +241,111 @@ func RegisterModelAPI(mux *http.ServeMux, store *ModelStore) { }) mux.HandleFunc("/api/models/meta", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) + return + } modelsWriteJSON(w, http.StatusOK, store.Meta()) }) mux.HandleFunc("/api/models/watched", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) + return + } host := strings.TrimSpace(r.URL.Query().Get("host")) modelsWriteJSON(w, http.StatusOK, store.ListWatchedLite(host)) }) - mux.HandleFunc("/api/models/list", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/api/models", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) + return + } modelsWriteJSON(w, http.StatusOK, store.List()) }) + // ✅ Profilbild-Blob aus DB ausliefern + mux.HandleFunc("/api/models/image", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) + return + } + + id := strings.TrimSpace(r.URL.Query().Get("id")) + if id == "" { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "id fehlt"}) + return + } + + mime, data, ok, err := store.GetProfileImageByID(id) + if err != nil { + modelsWriteJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return + } + if !ok || len(data) == 0 { + http.NotFound(w, r) + return + } + + w.Header().Set("Content-Type", mime) + w.Header().Set("Cache-Control", "public, max-age=86400") + _, _ = w.Write(data) + }) + + // ✅ Profilbild hochladen/ersetzen (Blob + URL speichern) + mux.HandleFunc("/api/models/profile-image", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) + return + } + + if err := r.ParseMultipartForm(10 << 20); err != nil { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid multipart form"}) + return + } + + host := strings.TrimSpace(r.FormValue("host")) + modelKey := strings.TrimSpace(r.FormValue("modelKey")) + sourceURL := strings.TrimSpace(r.FormValue("sourceUrl")) + + if modelKey == "" { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "modelKey fehlt"}) + return + } + + f, _, err := r.FormFile("file") + if err != nil { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "missing file"}) + return + } + defer f.Close() + + data, err := io.ReadAll(io.LimitReader(f, 8<<20)) + if err != nil || len(data) == 0 { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid image"}) + return + } + + mime := http.DetectContentType(data) + if !strings.HasPrefix(mime, "image/") { + modelsWriteJSON(w, http.StatusBadRequest, map[string]string{"error": "file is not an image"}) + return + } + + if err := store.SetProfileImage(host, modelKey, sourceURL, mime, data, time.Now().UTC().Format(time.RFC3339Nano)); err != nil { + modelsWriteJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) + return + } + + m, err := store.EnsureByHostModelKey(host, modelKey) + if err != nil { + modelsWriteJSON(w, http.StatusOK, map[string]any{"ok": true}) + return + } + modelsWriteJSON(w, http.StatusOK, m) + }) + mux.HandleFunc("/api/models/upsert", func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) @@ -278,7 +372,6 @@ func RegisterModelAPI(mux *http.ServeMux, store *ModelStore) { }) // ✅ NEU: Ensure-Endpoint (für QuickActions aus FinishedDownloads) - // Erst versucht er ein bestehendes Model via modelKey zu finden, sonst legt er ein "manual" Model an. mux.HandleFunc("/api/models/ensure", func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { modelsWriteJSON(w, http.StatusMethodNotAllowed, map[string]string{"error": "method not allowed"}) @@ -379,11 +472,10 @@ func RegisterModelAPI(mux *http.ServeMux, store *ModelStore) { return } - // ✅ Wenn ein Model weder beobachtet noch favorisiert/geliked ist, fliegt es aus dem Store. - // (Damit bleibt der Store „sauber“ und ModelsTab listet nur relevante Einträge.) + // ✅ Cleanup wenn kein relevanter Flag mehr gesetzt ist likedOn := (m.Liked != nil && *m.Liked) if !m.Watching && !m.Favorite && !likedOn { - _ = store.Delete(m.ID) // best-effort: Patch war erfolgreich, Delete darf hier nicht „fatal“ sein + _ = store.Delete(m.ID) w.WriteHeader(http.StatusNoContent) return } diff --git a/backend/models_store.go b/backend/models_store.go index 27078cc..536d93a 100644 --- a/backend/models_store.go +++ b/backend/models_store.go @@ -5,6 +5,7 @@ import ( "database/sql" "encoding/json" "errors" + "net/http" "net/url" "os" "path/filepath" @@ -27,6 +28,10 @@ type StoredModel struct { LastSeenOnline *bool `json:"lastSeenOnline,omitempty"` // nil = unbekannt LastSeenOnlineAt string `json:"lastSeenOnlineAt,omitempty"` // RFC3339Nano + ProfileImageURL string `json:"profileImageUrl,omitempty"` + ProfileImageCached string `json:"profileImageCached,omitempty"` // z.B. /api/models/image?id=... + ProfileImageUpdatedAt string `json:"profileImageUpdatedAt,omitempty"` // RFC3339Nano + Watching bool `json:"watching"` Favorite bool `json:"favorite"` Hot bool `json:"hot"` @@ -60,9 +65,9 @@ type ParsedModelDTO struct { } type ModelFlagsPatch struct { - Host string `json:"host,omitempty"` // ✅ neu - ModelKey string `json:"modelKey,omitempty"` // ✅ wenn id fehlt - ID string `json:"id,omitempty"` // ✅ optional + Host string `json:"host,omitempty"` + ModelKey string `json:"modelKey,omitempty"` + ID string `json:"id,omitempty"` Watched *bool `json:"watched,omitempty"` Favorite *bool `json:"favorite,omitempty"` @@ -149,8 +154,6 @@ ON CONFLICT(id) DO UPDATE SET // EnsureByModelKey: // - liefert ein bestehendes Model (best match) wenn vorhanden // - sonst legt es ein "manual" Model ohne URL an (Input=modelKey, IsURL=false) -// Dadurch funktionieren QuickActions (Like/Favorite) auch bei fertigen Videos, -// bei denen keine SourceURL mehr vorhanden ist. func (s *ModelStore) EnsureByModelKey(modelKey string) (StoredModel, error) { if err := s.ensureInit(); err != nil { return StoredModel{}, err @@ -161,8 +164,6 @@ func (s *ModelStore) EnsureByModelKey(modelKey string) (StoredModel, error) { return StoredModel{}, errors.New("modelKey fehlt") } - // Erst schauen ob es das Model schon gibt (egal welcher Host) - // Erst schauen ob es das Model schon gibt (egal welcher Host) var existingID string err := s.db.QueryRow(` SELECT id @@ -183,7 +184,6 @@ func (s *ModelStore) EnsureByModelKey(modelKey string) (StoredModel, error) { return StoredModel{}, err } - // Neu anlegen als "manual" (is_url = 0), input = modelKey (NOT NULL) now := time.Now().UTC().Format(time.RFC3339Nano) id := canonicalID("", key) @@ -260,8 +260,7 @@ WHERE lower(trim(host)) = 'chaturbate.com' } // Backwards compatible: -// - wenn du ".json" übergibst (wie aktuell in main.go), wird daraus automatisch ".db" -// und die JSON-Datei wird als Legacy-Quelle für die 1x Migration genutzt. +// - wenn du ".json" übergibst, wird daraus automatisch ".db" func NewModelStore(path string) *ModelStore { path = strings.TrimSpace(path) @@ -271,7 +270,7 @@ func NewModelStore(path string) *ModelStore { if strings.HasSuffix(lower, ".json") { legacy = path - dbPath = strings.TrimSuffix(path, filepath.Ext(path)) + ".db" // z.B. models_store.db + dbPath = strings.TrimSuffix(path, filepath.Ext(path)) + ".db" } else if strings.HasSuffix(lower, ".db") || strings.HasSuffix(lower, ".sqlite") || strings.HasSuffix(lower, ".sqlite3") { legacy = filepath.Join(filepath.Dir(path), "models_store.json") } @@ -282,8 +281,6 @@ func NewModelStore(path string) *ModelStore { } } -// main.go ruft aktuell store.Load() auf :contentReference[oaicite:4]{index=4} -// -> wir lassen Load() als Alias für Init() drin. func (s *ModelStore) Load() error { return s.ensureInit() } func (s *ModelStore) ensureInit() error { @@ -305,17 +302,14 @@ func (s *ModelStore) init() error { if err != nil { return err } - // SQLite am besten single-conn im Server-Prozess + db.SetMaxOpenConns(5) db.SetMaxIdleConns(5) _, _ = db.Exec(`PRAGMA busy_timeout = 2500;`) - - // Pragmas (einzeln ausführen) _, _ = db.Exec(`PRAGMA foreign_keys = ON;`) _, _ = db.Exec(`PRAGMA journal_mode = WAL;`) _, _ = db.Exec(`PRAGMA synchronous = NORMAL;`) - // ✅ zuerst Schema/Columns auf "db" erstellen if err := createModelsSchema(db); err != nil { _ = db.Close() return err @@ -325,17 +319,14 @@ func (s *ModelStore) init() error { return err } - // ✅ erst danach in den Store übernehmen s.db = db - // 1x Migration: wenn DB leer ist und Legacy JSON existiert if s.legacyJSONPath != "" { if err := s.migrateFromJSONIfEmpty(); err != nil { return err } } - // ✅ beim Einlesen normalisieren if err := s.normalizeNameOnlyChaturbate(); err != nil { return err } @@ -358,6 +349,11 @@ CREATE TABLE IF NOT EXISTS models ( biocontext_json TEXT, biocontext_fetched_at TEXT, + profile_image_url TEXT, + profile_image_mime TEXT, + profile_image_blob BLOB, + profile_image_updated_at TEXT, + last_seen_online INTEGER NULL, -- NULL/0/1 last_seen_online_at TEXT, @@ -411,7 +407,7 @@ func ensureModelsColumns(db *sql.DB) error { } } - // ✅ Biocontext (persistente Bio-Infos) + // ✅ Biocontext if !cols["biocontext_json"] { if _, err := db.Exec(`ALTER TABLE models ADD COLUMN biocontext_json TEXT;`); err != nil { return err @@ -423,7 +419,29 @@ func ensureModelsColumns(db *sql.DB) error { } } - // ✅ Last seen online/offline (persistente Presence-Infos) + // ✅ Profile image columns + if !cols["profile_image_url"] { + if _, err := db.Exec(`ALTER TABLE models ADD COLUMN profile_image_url TEXT;`); err != nil { + return err + } + } + if !cols["profile_image_mime"] { + if _, err := db.Exec(`ALTER TABLE models ADD COLUMN profile_image_mime TEXT;`); err != nil { + return err + } + } + if !cols["profile_image_blob"] { + if _, err := db.Exec(`ALTER TABLE models ADD COLUMN profile_image_blob BLOB;`); err != nil { + return err + } + } + if !cols["profile_image_updated_at"] { + if _, err := db.Exec(`ALTER TABLE models ADD COLUMN profile_image_updated_at TEXT;`); err != nil { + return err + } + } + + // ✅ Last seen online/offline if !cols["last_seen_online"] { if _, err := db.Exec(`ALTER TABLE models ADD COLUMN last_seen_online INTEGER NULL;`); err != nil { return err @@ -475,16 +493,6 @@ func ptrLikedFromNull(n sql.NullInt64) *bool { return &v } -func nullBoolToNullInt64(p *bool) sql.NullInt64 { - if p == nil { - return sql.NullInt64{Valid: false} - } - if *p { - return sql.NullInt64{Valid: true, Int64: 1} - } - return sql.NullInt64{Valid: true, Int64: 0} -} - func ptrBoolFromNullInt64(n sql.NullInt64) *bool { if !n.Valid { return nil @@ -493,10 +501,150 @@ func ptrBoolFromNullInt64(n sql.NullInt64) *bool { return &v } -// --- Biocontext Cache (persistente Bio-Infos aus Chaturbate) --- +// --- Profile image cache --- + +// SetProfileImage speichert Bild-URL + MIME + Blob. +// Legt den Datensatz bei Bedarf minimal an. +func (s *ModelStore) SetProfileImage(host, modelKey, sourceURL, mime string, data []byte, updatedAt string) error { + if err := s.ensureInit(); err != nil { + return err + } + + host = canonicalHost(host) + key := strings.TrimSpace(modelKey) + if host == "" || key == "" { + return errors.New("host/modelKey fehlt") + } + if len(data) == 0 { + return errors.New("image data fehlt") + } + + src := strings.TrimSpace(sourceURL) + mime = strings.TrimSpace(strings.ToLower(mime)) + if mime == "" || mime == "application/octet-stream" { + detected := http.DetectContentType(data) + if strings.TrimSpace(detected) != "" { + mime = detected + } + } + if mime == "" { + mime = "image/jpeg" + } + + ts := strings.TrimSpace(updatedAt) + if ts == "" { + ts = time.Now().UTC().Format(time.RFC3339Nano) + } + now := time.Now().UTC().Format(time.RFC3339Nano) + + s.mu.Lock() + defer s.mu.Unlock() + + // Erst Update versuchen + res, err := s.db.Exec(` +UPDATE models +SET profile_image_url=?, profile_image_mime=?, profile_image_blob=?, profile_image_updated_at=?, updated_at=? +WHERE lower(trim(host)) = lower(trim(?)) + AND lower(trim(model_key)) = lower(trim(?)); +`, src, mime, data, ts, now, host, key) + if err != nil { + return err + } + + aff, _ := res.RowsAffected() + if aff > 0 { + return nil + } + + // Kein Auto-Insert: Profilbild nur für bereits bestehende Models speichern. + return nil +} + +// SetProfileImageURLOnly speichert nur die letzte bekannte Bild-URL (+Zeit), ohne Blob. +// Praktisch als Fallback, wenn Download fehlschlägt. +func (s *ModelStore) SetProfileImageURLOnly(host, modelKey, sourceURL, updatedAt string) error { + if err := s.ensureInit(); err != nil { + return err + } + + host = canonicalHost(host) + key := strings.TrimSpace(modelKey) + src := strings.TrimSpace(sourceURL) + if host == "" || key == "" { + return errors.New("host/modelKey fehlt") + } + if src == "" { + return nil + } + + ts := strings.TrimSpace(updatedAt) + if ts == "" { + ts = time.Now().UTC().Format(time.RFC3339Nano) + } + now := time.Now().UTC().Format(time.RFC3339Nano) + + s.mu.Lock() + defer s.mu.Unlock() + + res, err := s.db.Exec(` +UPDATE models +SET profile_image_url=?, profile_image_updated_at=?, updated_at=? +WHERE lower(trim(host)) = lower(trim(?)) + AND lower(trim(model_key)) = lower(trim(?)); +`, src, ts, now, host, key) + if err != nil { + return err + } + aff, _ := res.RowsAffected() + if aff > 0 { + return nil + } + + // Kein Auto-Insert: Bild-URL nur für bereits bestehende Models speichern. + return nil +} + +func (s *ModelStore) GetProfileImageByID(id string) (mime string, data []byte, ok bool, err error) { + if err := s.ensureInit(); err != nil { + return "", nil, false, err + } + id = strings.TrimSpace(id) + if id == "" { + return "", nil, false, errors.New("id fehlt") + } + + var mimeNS sql.NullString + var blob []byte + err = s.db.QueryRow(` +SELECT profile_image_mime, profile_image_blob +FROM models +WHERE id = ? +LIMIT 1; +`, id).Scan(&mimeNS, &blob) + + if errors.Is(err, sql.ErrNoRows) { + return "", nil, false, nil + } + if err != nil { + return "", nil, false, err + } + if len(blob) == 0 { + return "", nil, false, nil + } + + m := strings.TrimSpace(mimeNS.String) + if m == "" { + m = http.DetectContentType(blob) + if m == "" { + m = "application/octet-stream" + } + } + + return m, blob, true, nil +} + +// --- Biocontext Cache --- -// GetBioContext liefert das zuletzt gespeicherte Biocontext-JSON (+ Zeitstempel). -// ok=false wenn nichts gespeichert ist. func (s *ModelStore) GetBioContext(host, modelKey string) (jsonStr string, fetchedAt string, ok bool, err error) { if err := s.ensureInit(); err != nil { return "", "", false, err @@ -531,8 +679,6 @@ func (s *ModelStore) GetBioContext(host, modelKey string) (jsonStr string, fetch return val, strings.TrimSpace(ts.String), true, nil } -// SetBioContext speichert/aktualisiert das Biocontext-JSON dauerhaft in der DB. -// Es legt das Model (host+modelKey) bei Bedarf minimal an. func (s *ModelStore) SetBioContext(host, modelKey, jsonStr, fetchedAt string) error { if err := s.ensureInit(); err != nil { return err @@ -551,11 +697,11 @@ func (s *ModelStore) SetBioContext(host, modelKey, jsonStr, fetchedAt string) er defer s.mu.Unlock() res, err := s.db.Exec(` - UPDATE models - SET biocontext_json=?, biocontext_fetched_at=?, updated_at=? - WHERE lower(trim(host)) = lower(trim(?)) - AND lower(trim(model_key)) = lower(trim(?)); - `, js, ts, now, host, key) +UPDATE models +SET biocontext_json=?, biocontext_fetched_at=?, updated_at=? +WHERE lower(trim(host)) = lower(trim(?)) + AND lower(trim(model_key)) = lower(trim(?)); +`, js, ts, now, host, key) if err != nil { return err } @@ -565,34 +711,11 @@ func (s *ModelStore) SetBioContext(host, modelKey, jsonStr, fetchedAt string) er return nil } - // Model existiert noch nicht -> minimal anlegen (als URL) - id := canonicalID(host, key) - input := "https://" + host + "/" + key + "/" - path := "/" + key + "/" - - _, err = s.db.Exec(` - INSERT INTO models ( - id,input,is_url,host,path,model_key, - tags,last_stream, - biocontext_json,biocontext_fetched_at, - watching,favorite,hot,keep,liked, - created_at,updated_at - ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - ON CONFLICT(id) DO UPDATE SET - biocontext_json=excluded.biocontext_json, - biocontext_fetched_at=excluded.biocontext_fetched_at, - updated_at=excluded.updated_at; - `, id, input, int64(1), host, path, key, - "", "", - js, ts, - int64(0), int64(0), int64(0), int64(0), nil, - now, now, - ) - return err + // Kein Auto-Insert: Biocontext nur für vorhandene Models. + return nil } -// SetLastSeenOnline speichert den zuletzt bekannten Online/Offline-Status (+ Zeit) -// dauerhaft in der DB. Legt das Model (host+modelKey) bei Bedarf minimal an. +// SetLastSeenOnline speichert Online/Offline Status func (s *ModelStore) SetLastSeenOnline(host, modelKey string, online bool, seenAt string) error { if err := s.ensureInit(); err != nil { return err @@ -617,13 +740,12 @@ func (s *ModelStore) SetLastSeenOnline(host, modelKey string, online bool, seenA s.mu.Lock() defer s.mu.Unlock() - // Erst versuchen, vorhandenes Model zu aktualisieren res, err := s.db.Exec(` - UPDATE models - SET last_seen_online=?, last_seen_online_at=?, updated_at=? - WHERE lower(trim(host)) = lower(trim(?)) - AND lower(trim(model_key)) = lower(trim(?)); - `, onlineArg, ts, now, host, key) +UPDATE models +SET last_seen_online=?, last_seen_online_at=?, updated_at=? +WHERE lower(trim(host)) = lower(trim(?)) + AND lower(trim(model_key)) = lower(trim(?)); +`, onlineArg, ts, now, host, key) if err != nil { return err } @@ -633,37 +755,12 @@ func (s *ModelStore) SetLastSeenOnline(host, modelKey string, online bool, seenA return nil } - // Falls noch kein Model existiert: minimal anlegen - id := canonicalID(host, key) - input := "https://" + host + "/" + key + "/" - path := "/" + key + "/" - - _, err = s.db.Exec(` - INSERT INTO models ( - id,input,is_url,host,path,model_key, - tags,last_stream, - biocontext_json,biocontext_fetched_at, - last_seen_online,last_seen_online_at, - watching,favorite,hot,keep,liked, - created_at,updated_at - ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - ON CONFLICT(id) DO UPDATE SET - last_seen_online=excluded.last_seen_online, - last_seen_online_at=excluded.last_seen_online_at, - updated_at=excluded.updated_at; - `, - id, input, int64(1), host, path, key, - "", "", - nil, nil, - onlineArg, ts, - int64(0), int64(0), int64(0), int64(0), nil, - now, now, - ) - return err + // Wichtig: Keine Auto-Erzeugung durch Online-Poller. + // Nur bereits manuell/importiert vorhandene Models werden aktualisiert. + return nil } func (s *ModelStore) migrateFromJSONIfEmpty() error { - // DB leer? var cnt int if err := s.db.QueryRow(`SELECT COUNT(1) FROM models;`).Scan(&cnt); err != nil { return err @@ -672,7 +769,6 @@ func (s *ModelStore) migrateFromJSONIfEmpty() error { return nil } - // Legacy JSON vorhanden? b, err := os.ReadFile(s.legacyJSONPath) if err != nil { if errors.Is(err, os.ErrNotExist) { @@ -698,19 +794,22 @@ func (s *ModelStore) migrateFromJSONIfEmpty() error { } defer func() { _ = tx.Rollback() }() + // ✅ FIX: 15 Spalten => 15 Platzhalter stmt, err := tx.Prepare(` INSERT INTO models ( id,input,is_url,host,path,model_key, tags,last_stream, watching,favorite,hot,keep,liked, created_at,updated_at -) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET input=excluded.input, is_url=excluded.is_url, host=excluded.host, path=excluded.path, model_key=excluded.model_key, + tags=excluded.tags, + last_stream=excluded.last_stream, updated_at=excluded.updated_at; `) if err != nil { @@ -727,7 +826,6 @@ ON CONFLICT(id) DO UPDATE SET continue } - // alte IDs (oft nur modelKey) werden auf host:modelKey normalisiert id := canonicalID(host, modelKey) created := strings.TrimSpace(m.CreatedAt) @@ -754,6 +852,8 @@ ON CONFLICT(id) DO UPDATE SET host, m.Path, modelKey, + m.Tags, + m.LastStream, boolToInt(m.Watching), boolToInt(m.Favorite), boolToInt(m.Hot), @@ -775,7 +875,6 @@ func bytesTrimSpace(b []byte) []byte { } func (s *ModelStore) normalizeNameOnlyChaturbate() error { - // Kandidaten: is_url=0 UND input==model_key UND host leer oder schon chaturbate rows, err := s.db.Query(` SELECT id, model_key, @@ -835,7 +934,6 @@ WHERE is_url = 0 newInput := "https://" + host + "/" + it.key + "/" newPath := "/" + it.key + "/" - // Ziel-Datensatz: wenn bereits chaturbate.com: existiert, dorthin mergen var targetID string err := tx.QueryRow(` SELECT id @@ -859,7 +957,6 @@ LIMIT 1; likedArg = nil } - // Wenn es keinen Ziel-Datensatz gibt: neu anlegen mit canonical ID if targetID == "" { targetID = canonicalID(host, it.key) @@ -880,7 +977,6 @@ INSERT INTO models ( return err } } else { - // Ziel existiert: Flags mergen + fehlende Felder auffüllen _, err = tx.Exec(` UPDATE models SET input = CASE @@ -915,7 +1011,6 @@ WHERE id = ?; } } - // alten "manual" Datensatz löschen (nur wenn anderer Ziel-Datensatz) if it.oldID != targetID { if _, err := tx.Exec(`DELETE FROM models WHERE id=?;`, it.oldID); err != nil { return err @@ -932,15 +1027,18 @@ func (s *ModelStore) List() []StoredModel { } rows, err := s.db.Query(` - SELECT - id,input,is_url,host,path,model_key, - tags, COALESCE(last_stream,''), - last_seen_online, COALESCE(last_seen_online_at,''), - watching,favorite,hot,keep,liked, - created_at,updated_at - FROM models - ORDER BY updated_at DESC; - `) +SELECT + id,input,is_url,host,path,model_key, + tags, COALESCE(last_stream,''), + last_seen_online, COALESCE(last_seen_online_at,''), + COALESCE(profile_image_url,''), + COALESCE(profile_image_updated_at,''), + CASE WHEN profile_image_blob IS NOT NULL AND length(profile_image_blob) > 0 THEN 1 ELSE 0 END as has_profile_image, + watching,favorite,hot,keep,liked, + created_at,updated_at +FROM models +ORDER BY updated_at DESC; +`) if err != nil { return []StoredModel{} } @@ -950,23 +1048,31 @@ func (s *ModelStore) List() []StoredModel { for rows.Next() { var ( - id, input, host, path, modelKey, tags, lastStream, createdAt, updatedAt string - isURL, watching, favorite, hot, keep int64 - liked sql.NullInt64 - lastSeenOnline sql.NullInt64 - lastSeenOnlineAt string + id, input, host, path, modelKey, tags, lastStream string + createdAt, updatedAt string + + isURL, watching, favorite, hot, keep int64 + liked sql.NullInt64 + lastSeenOnline sql.NullInt64 + lastSeenOnlineAt string + + profileImageURL string + profileImageUpdatedAt string + hasProfileImage int64 ) + if err := rows.Scan( &id, &input, &isURL, &host, &path, &modelKey, &tags, &lastStream, &lastSeenOnline, &lastSeenOnlineAt, + &profileImageURL, &profileImageUpdatedAt, &hasProfileImage, &watching, &favorite, &hot, &keep, &liked, &createdAt, &updatedAt, ); err != nil { continue } - out = append(out, StoredModel{ + m := StoredModel{ ID: id, Input: input, IsURL: isURL != 0, @@ -984,7 +1090,16 @@ func (s *ModelStore) List() []StoredModel { Liked: ptrLikedFromNull(liked), CreatedAt: createdAt, UpdatedAt: updatedAt, - }) + + ProfileImageURL: profileImageURL, + ProfileImageUpdatedAt: profileImageUpdatedAt, + } + + if hasProfileImage != 0 { + m.ProfileImageCached = "/api/models/image?id=" + url.QueryEscape(id) + } + + out = append(out, m) } return out @@ -1085,27 +1200,27 @@ func (s *ModelStore) UpsertFromParsed(p ParsedModelDTO) (StoredModel, error) { defer s.mu.Unlock() _, err = s.db.Exec(` - INSERT INTO models ( - id,input,is_url,host,path,model_key, - tags,last_stream, - watching,favorite,hot,keep,liked, - created_at,updated_at - ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - ON CONFLICT(id) DO UPDATE SET - input=excluded.input, - is_url=excluded.is_url, - host=excluded.host, - path=excluded.path, - model_key=excluded.model_key, - updated_at=excluded.updated_at; - `, +INSERT INTO models ( + id,input,is_url,host,path,model_key, + tags,last_stream, + watching,favorite,hot,keep,liked, + created_at,updated_at +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +ON CONFLICT(id) DO UPDATE SET + input=excluded.input, + is_url=excluded.is_url, + host=excluded.host, + path=excluded.path, + model_key=excluded.model_key, + updated_at=excluded.updated_at; +`, id, u.String(), int64(1), host, p.Path, modelKey, - "", "", // ✅ tags, last_stream + "", "", int64(0), int64(0), int64(0), int64(0), nil, now, now, @@ -1128,7 +1243,6 @@ func (s *ModelStore) PatchFlags(patch ModelFlagsPatch) (StoredModel, error) { s.mu.Lock() defer s.mu.Unlock() - // aktuelle Flags lesen var ( watching, favorite, hot, keep int64 liked sql.NullInt64 @@ -1142,28 +1256,21 @@ func (s *ModelStore) PatchFlags(patch ModelFlagsPatch) (StoredModel, error) { return StoredModel{}, err } - // ✅ watched -> watching (DB) if patch.Watched != nil { watching = boolToInt(*patch.Watched) } - if patch.Favorite != nil { favorite = boolToInt(*patch.Favorite) } - - // ✅ liked ist true/false (kein ClearLiked mehr) if patch.Liked != nil { liked = sql.NullInt64{Valid: true, Int64: boolToInt(*patch.Liked)} } - // ✅ Exklusivität serverseitig (robust): - // - liked=true => favorite=false - // - favorite=true => liked=false (nicht NULL) + // Exklusivität if patch.Liked != nil && *patch.Liked { favorite = int64(0) } if patch.Favorite != nil && *patch.Favorite { - // Wenn Frontend nicht explizit liked=true sendet, force liked=false if patch.Liked == nil || !*patch.Liked { liked = sql.NullInt64{Valid: true, Int64: 0} } @@ -1225,7 +1332,6 @@ func (s *ModelStore) UpsertFromImport(p ParsedModelDTO, tags, lastStream string, now := time.Now().UTC().Format(time.RFC3339Nano) - // kind: "favorite" | "liked" fav := int64(0) var likedArg any = nil if kind == "favorite" { @@ -1238,7 +1344,6 @@ func (s *ModelStore) UpsertFromImport(p ParsedModelDTO, tags, lastStream string, s.mu.Lock() defer s.mu.Unlock() - // exists? inserted := false var dummy int err = s.db.QueryRow(`SELECT 1 FROM models WHERE id=? LIMIT 1;`, id).Scan(&dummy) @@ -1283,11 +1388,17 @@ ON CONFLICT(id) DO UPDATE SET func (s *ModelStore) getByID(id string) (StoredModel, error) { var ( - input, host, path, modelKey, tags, lastStream, createdAt, updatedAt string - isURL, watching, favorite, hot, keep int64 - liked sql.NullInt64 - lastSeenOnlineAt string - lastSeenOnline sql.NullInt64 + input, host, path, modelKey, tags, lastStream string + createdAt, updatedAt string + + isURL, watching, favorite, hot, keep int64 + liked sql.NullInt64 + lastSeenOnline sql.NullInt64 + lastSeenOnlineAt string + + profileImageURL string + profileImageUpdatedAt string + hasProfileImage int64 ) err := s.db.QueryRow(` @@ -1295,6 +1406,9 @@ SELECT input,is_url,host,path,model_key, tags, COALESCE(last_stream,''), last_seen_online, COALESCE(last_seen_online_at,''), + COALESCE(profile_image_url,''), + COALESCE(profile_image_updated_at,''), + CASE WHEN profile_image_blob IS NOT NULL AND length(profile_image_blob) > 0 THEN 1 ELSE 0 END as has_profile_image, watching,favorite,hot,keep,liked, created_at,updated_at FROM models @@ -1303,6 +1417,7 @@ WHERE id=?; &input, &isURL, &host, &path, &modelKey, &tags, &lastStream, &lastSeenOnline, &lastSeenOnlineAt, + &profileImageURL, &profileImageUpdatedAt, &hasProfileImage, &watching, &favorite, &hot, &keep, &liked, &createdAt, &updatedAt, ) @@ -1313,7 +1428,7 @@ WHERE id=?; return StoredModel{}, err } - return StoredModel{ + m := StoredModel{ ID: id, Input: input, IsURL: isURL != 0, @@ -1331,5 +1446,14 @@ WHERE id=?; Liked: ptrLikedFromNull(liked), CreatedAt: createdAt, UpdatedAt: updatedAt, - }, nil + + ProfileImageURL: profileImageURL, + ProfileImageUpdatedAt: profileImageUpdatedAt, + } + + if hasProfileImage != 0 { + m.ProfileImageCached = "/api/models/image?id=" + url.QueryEscape(id) + } + + return m, nil } diff --git a/backend/nsfwapp.exe b/backend/nsfwapp.exe index f5b5f7d..a438fa3 100644 Binary files a/backend/nsfwapp.exe and b/backend/nsfwapp.exe differ diff --git a/backend/record_handlers.go b/backend/record_handlers.go index 7f8bbd4..48aabb1 100644 --- a/backend/record_handlers.go +++ b/backend/record_handlers.go @@ -12,6 +12,7 @@ import ( "os" "path" "path/filepath" + "reflect" "runtime" "sort" "strconv" @@ -35,15 +36,25 @@ type doneListResponse struct { PageSize int `json:"pageSize,omitempty"` } +type previewSpriteMetaResp struct { + Exists bool `json:"exists"` + Path string `json:"path,omitempty"` + Count int `json:"count,omitempty"` + Cols int `json:"cols,omitempty"` + Rows int `json:"rows,omitempty"` + StepSeconds float64 `json:"stepSeconds,omitempty"` +} + type doneMetaFileResp struct { - File string `json:"file"` - MetaExists bool `json:"metaExists"` - DurationSeconds float64 `json:"durationSeconds,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - FPS float64 `json:"fps,omitempty"` - SourceURL string `json:"sourceUrl,omitempty"` - Error string `json:"error,omitempty"` + File string `json:"file"` + MetaExists bool `json:"metaExists"` + DurationSeconds float64 `json:"durationSeconds,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + FPS float64 `json:"fps,omitempty"` + SourceURL string `json:"sourceUrl,omitempty"` + PreviewSprite previewSpriteMetaResp `json:"previewSprite"` + Error string `json:"error,omitempty"` } type doneMetaResp struct { @@ -121,6 +132,383 @@ func isSafeBasename(name string) bool { return filepath.Base(name) == name } +func intFromAny(v any) (int, bool) { + switch x := v.(type) { + case int: + return x, true + case int8: + return int(x), true + case int16: + return int(x), true + case int32: + return int(x), true + case int64: + return int(x), true + case uint: + return int(x), true + case uint8: + return int(x), true + case uint16: + return int(x), true + case uint32: + return int(x), true + case uint64: + return int(x), true + case float32: + return int(x), true + case float64: + return int(x), true + case json.Number: + if i, err := x.Int64(); err == nil { + return int(i), true + } + if f, err := x.Float64(); err == nil { + return int(f), true + } + case string: + s := strings.TrimSpace(x) + if s == "" { + return 0, false + } + if i, err := strconv.Atoi(s); err == nil { + return i, true + } + } + return 0, false +} + +func floatFromAny(v any) (float64, bool) { + switch x := v.(type) { + case float32: + return float64(x), true + case float64: + return x, true + case int: + return float64(x), true + case int8: + return float64(x), true + case int16: + return float64(x), true + case int32: + return float64(x), true + case int64: + return float64(x), true + case uint: + return float64(x), true + case uint8: + return float64(x), true + case uint16: + return float64(x), true + case uint32: + return float64(x), true + case uint64: + return float64(x), true + case json.Number: + if f, err := x.Float64(); err == nil { + return f, true + } + case string: + s := strings.TrimSpace(x) + if s == "" { + return 0, false + } + if f, err := strconv.ParseFloat(s, 64); err == nil { + return f, true + } + } + return 0, false +} + +type previewSpriteMetaFileInfo struct { + Count int + Cols int + Rows int + StepSeconds float64 +} + +func readPreviewSpriteMetaFromMetaFile(metaPath string) (previewSpriteMetaFileInfo, bool) { + var out previewSpriteMetaFileInfo + + b, err := os.ReadFile(metaPath) + if err != nil || len(b) == 0 { + return out, false + } + + var m map[string]any + dec := json.NewDecoder(strings.NewReader(string(b))) + dec.UseNumber() + if err := dec.Decode(&m); err != nil { + return out, false + } + + ps, ok := m["previewSprite"].(map[string]any) + if !ok || ps == nil { + return out, false + } + + if n, ok := intFromAny(ps["count"]); ok && n > 0 { + out.Count = n + } else if n, ok := intFromAny(ps["frames"]); ok && n > 0 { + out.Count = n + } else if n, ok := intFromAny(ps["imageCount"]); ok && n > 0 { + out.Count = n + } + + if n, ok := intFromAny(ps["cols"]); ok && n > 0 { + out.Cols = n + } + if n, ok := intFromAny(ps["rows"]); ok && n > 0 { + out.Rows = n + } + + if f, ok := floatFromAny(ps["stepSeconds"]); ok && f > 0 { + out.StepSeconds = f + } else if f, ok := floatFromAny(ps["step"]); ok && f > 0 { + out.StepSeconds = f + } else if f, ok := floatFromAny(ps["intervalSeconds"]); ok && f > 0 { + out.StepSeconds = f + } + + // gültig, wenn mindestens count oder grid vorhanden ist + if out.Count > 0 || (out.Cols > 0 && out.Rows > 0) { + return out, true + } + return out, false +} + +func previewSpriteTruthForID(id string) previewSpriteMetaResp { + out := previewSpriteMetaResp{Exists: false} + + id = strings.TrimSpace(id) + if id == "" || strings.Contains(id, "/") || strings.Contains(id, "\\") { + return out + } + + metaPath, err := generatedMetaFile(id) + if err != nil || strings.TrimSpace(metaPath) == "" { + return out + } + + genDir := filepath.Dir(metaPath) + spriteFile := filepath.Join(genDir, "preview-sprite.webp") + + fi, err := os.Stat(spriteFile) + if err != nil || fi == nil || fi.IsDir() || fi.Size() <= 0 { + return out + } + + // ✅ echte Datei existiert + out.Exists = true + out.Path = "/api/preview-sprite/" + url.PathEscape(id) + + // Meta-Felder best-effort aus meta.json lesen + if ps, ok := readPreviewSpriteMetaFromMetaFile(metaPath); ok { + if ps.Count > 0 { + out.Count = ps.Count + } + if ps.Cols > 0 { + out.Cols = ps.Cols + } + if ps.Rows > 0 { + out.Rows = ps.Rows + } + if ps.StepSeconds > 0 { + out.StepSeconds = ps.StepSeconds + } + } + + return out +} + +func applyPreviewSpriteTruthToDoneMetaResp(id string, resp *doneMetaFileResp) { + if resp == nil { + return + } + resp.PreviewSprite = previewSpriteTruthForID(id) +} + +func metaMapFromAny(v any) map[string]any { + out := map[string]any{} + + switch x := v.(type) { + case nil: + return out + + case map[string]any: + for k, val := range x { + out[k] = val + } + return out + + case string: + s := strings.TrimSpace(x) + if s == "" { + return out + } + var m map[string]any + dec := json.NewDecoder(strings.NewReader(s)) + dec.UseNumber() + if err := dec.Decode(&m); err == nil && m != nil { + return m + } + return out + + case []byte: + if len(x) == 0 { + return out + } + var m map[string]any + dec := json.NewDecoder(strings.NewReader(string(x))) + dec.UseNumber() + if err := dec.Decode(&m); err == nil && m != nil { + return m + } + return out + + case json.RawMessage: + if len(x) == 0 { + return out + } + var m map[string]any + dec := json.NewDecoder(strings.NewReader(string(x))) + dec.UseNumber() + if err := dec.Decode(&m); err == nil && m != nil { + return m + } + return out + + default: + // best effort: unbekannten Typ in map re-hydraten + b, err := json.Marshal(x) + if err != nil || len(b) == 0 { + return out + } + var m map[string]any + dec := json.NewDecoder(strings.NewReader(string(b))) + dec.UseNumber() + if err := dec.Decode(&m); err == nil && m != nil { + return m + } + return out + } +} + +func setStructFieldJSONMap(fv reflect.Value, m map[string]any) { + if !fv.IsValid() || !fv.CanSet() { + return + } + + // JSON serialisieren (für string / []byte / typed map / struct) + b, err := json.Marshal(m) + if err != nil { + return + } + + switch fv.Kind() { + case reflect.Interface: + // interface{} / any -> direkt map setzen + fv.Set(reflect.ValueOf(m)) + return + + case reflect.String: + fv.SetString(string(b)) + return + + case reflect.Slice: + // []byte / json.RawMessage + if fv.Type().Elem().Kind() == reflect.Uint8 { + fv.SetBytes(b) + return + } + } + + // Fallback: in den echten Feldtyp unmarshaln + ptr := reflect.New(fv.Type()) + if err := json.Unmarshal(b, ptr.Interface()); err == nil { + fv.Set(ptr.Elem()) + } +} + +func applyPreviewSpriteTruthToRecordJobMeta(j *RecordJob) { + if j == nil { + return + } + + // ID aus Output ableiten (canonical: ohne HOT, ohne Ext) + outPath := strings.TrimSpace(j.Output) + if outPath == "" { + return + } + base := filepath.Base(outPath) + id := stripHotPrefix(strings.TrimSuffix(base, filepath.Ext(base))) + id = strings.TrimSpace(id) + + ps := previewSpriteTruthForID(id) + + // per Reflection auf Feld "Meta" zugreifen (robust gegen Meta-Typ) + rv := reflect.ValueOf(j) + if rv.Kind() != reflect.Pointer || rv.IsNil() { + return + } + sv := rv.Elem() + if !sv.IsValid() || sv.Kind() != reflect.Struct { + return + } + + fv := sv.FieldByName("Meta") + if !fv.IsValid() || !fv.CanSet() { + // Falls RecordJob kein Meta-Feld hat -> nichts zu tun + return + } + + var raw any + switch fv.Kind() { + case reflect.Interface: + if fv.IsNil() { + raw = nil + } else { + raw = fv.Interface() + } + default: + raw = fv.Interface() + } + + meta := metaMapFromAny(raw) + if meta == nil { + meta = map[string]any{} + } + + // ✅ Legacy/Fallback Felder killen (falls vorhanden) + delete(meta, "previewScrubberPath") + delete(meta, "previewScrubberCount") + + // ✅ previewSprite hart mit echter Dateiwahrheit überschreiben + psMap := map[string]any{ + "exists": ps.Exists, + } + + if ps.Exists { + psMap["path"] = ps.Path + + if ps.Count > 0 { + psMap["count"] = ps.Count + } + if ps.Cols > 0 { + psMap["cols"] = ps.Cols + } + if ps.Rows > 0 { + psMap["rows"] = ps.Rows + } + if ps.StepSeconds > 0 { + psMap["stepSeconds"] = ps.StepSeconds + } + } + + meta["previewSprite"] = psMap + + setStructFieldJSONMap(fv, meta) +} + func recordList(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { http.Error(w, "Nur GET erlaubt", http.StatusMethodNotAllowed) @@ -551,6 +939,8 @@ func recordStatus(w http.ResponseWriter, r *http.Request) { return } + applyPreviewSpriteTruthToRecordJobMeta(job) + json.NewEncoder(w).Encode(job) } @@ -949,22 +1339,14 @@ func recordDoneMeta(w http.ResponseWriter, r *http.Request) { // ✅ best-effort meta.json erzeugen ensureMetaJSONForPlayback(r.Context(), outPath) - // Response-Shape: bewusst "fertig" fürs Frontend - type doneMetaFileResp struct { - File string `json:"file"` - MetaExists bool `json:"metaExists"` - DurationSeconds float64 `json:"durationSeconds,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - FPS float64 `json:"fps,omitempty"` - SourceURL string `json:"sourceUrl,omitempty"` - Error string `json:"error,omitempty"` - } - resp := doneMetaFileResp{File: filepath.Base(outPath)} // meta lesen (wenn vorhanden) id := stripHotPrefix(strings.TrimSuffix(filepath.Base(outPath), filepath.Ext(outPath))) + + // ✅ Preview-Sprite-Truth immer setzen (explizit true/false) + applyPreviewSpriteTruthToDoneMetaResp(id, &resp) + if strings.TrimSpace(id) != "" { if mp, merr := generatedMetaFile(id); merr == nil && strings.TrimSpace(mp) != "" { if mfi, serr := os.Stat(mp); serr == nil && mfi != nil && !mfi.IsDir() && mfi.Size() > 0 { @@ -1385,6 +1767,9 @@ func recordDoneList(w http.ResponseWriter, r *http.Request) { } } + // ✅ Preview-Sprite-Truth im LIST-Payload erzwingen (wichtig für Cards/Gallery) + applyPreviewSpriteTruthToRecordJobMeta(&c) + out = append(out, &c) } diff --git a/backend/web/dist/assets/index-B-X4TsOo.css b/backend/web/dist/assets/index-B-X4TsOo.css new file mode 100644 index 0000000..5e07a8e --- /dev/null +++ b/backend/web/dist/assets/index-B-X4TsOo.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-900:oklch(37.8% .077 168.94);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-sky-700:oklch(50% .134 242.749);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-900:oklch(41% .159 10.272);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.-inset-10{inset:calc(var(--spacing)*-10)}.inset-0{inset:calc(var(--spacing)*0)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-x-2{inset-inline:calc(var(--spacing)*2)}.inset-x-3{inset-inline:calc(var(--spacing)*3)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.-top-28{top:calc(var(--spacing)*-28)}.-top-\[9999px\]{top:-9999px}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-12{top:calc(var(--spacing)*12)}.top-\[56px\]{top:56px}.top-auto{top:auto}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-1\.5{right:calc(var(--spacing)*1.5)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-\[-6rem\]{right:-6rem}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-bottom-28{bottom:calc(var(--spacing)*-28)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-1\.5{bottom:calc(var(--spacing)*1.5)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-\[6px\]{bottom:6px}.bottom-\[19px\]{bottom:19px}.bottom-auto{bottom:auto}.-left-1{left:calc(var(--spacing)*-1)}.-left-\[9999px\]{left:-9999px}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[5\]{z-index:5}.z-\[6\]{z-index:6}.z-\[15\]{z-index:15}.z-\[60\]{z-index:60}.z-\[80\]{z-index:80}.z-\[9999\]{z-index:9999}.z-\[2147483647\]{z-index:2147483647}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-start-1{grid-column-start:1}.row-start-1{grid-row-start:1}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing)*-1)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-5{margin-top:calc(var(--spacing)*5)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.-mr-0\.5{margin-right:calc(var(--spacing)*-.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-0\.5{margin-left:calc(var(--spacing)*-.5)}.-ml-px{margin-left:-1px}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-6{-webkit-line-clamp:6;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-video{aspect-ratio:var(--aspect-video)}.size-1\.5{width:calc(var(--spacing)*1.5);height:calc(var(--spacing)*1.5)}.size-2\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-3\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-28{height:calc(var(--spacing)*28)}.h-44{height:calc(var(--spacing)*44)}.h-80{height:calc(var(--spacing)*80)}.h-\[60px\]{height:60px}.h-\[64px\]{height:64px}.h-\[220px\]{height:220px}.h-full{height:100%}.max-h-0{max-height:calc(var(--spacing)*0)}.max-h-28{max-height:calc(var(--spacing)*28)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[720px\]{max-height:720px}.max-h-\[calc\(100vh-3rem\)\]{max-height:calc(100vh - 3rem)}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[24px\]{min-height:24px}.min-h-\[100dvh\]{min-height:100dvh}.min-h-\[112px\]{min-height:112px}.min-h-\[118px\]{min-height:118px}.min-h-full{min-height:100%}.w-1{width:calc(var(--spacing)*1)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-20{width:calc(var(--spacing)*20)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-52{width:calc(var(--spacing)*52)}.w-\[2px\]{width:2px}.w-\[46rem\]{width:46rem}.w-\[52rem\]{width:52rem}.w-\[64px\]{width:64px}.w-\[90px\]{width:90px}.w-\[92px\]{width:92px}.w-\[96px\]{width:96px}.w-\[110px\]{width:110px}.w-\[112px\]{width:112px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[170px\]{width:170px}.w-\[260px\]{width:260px}.w-\[320px\]{width:320px}.w-\[360px\]{width:360px}.w-\[420px\]{width:420px}.w-auto{width:auto}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[11rem\]{max-width:11rem}.max-w-\[170px\]{max-width:170px}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[260px\]{max-width:260px}.max-w-\[420px\]{max-width:420px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[calc\(100\%-24px\)\]{max-width:calc(100% - 24px)}.max-w-\[calc\(100vw-1\.5rem\)\]{max-width:calc(100vw - 1.5rem)}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[2\.25rem\]{min-width:2.25rem}.min-w-\[220px\]{min-width:220px}.min-w-\[240px\]{min-width:240px}.min-w-\[300px\]{min-width:300px}.min-w-\[980px\]{min-width:980px}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-left{transform-origin:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-4{--tw-translate-y:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-75{--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-\[0\.98\]{scale:.98}.scale-\[1\.03\]{scale:1.03}.-rotate-12{rotate:-12deg}.rotate-0{rotate:none}.rotate-12{rotate:12deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-ew-resize{cursor:ew-resize}.cursor-grab{cursor:grab}.cursor-nesw-resize{cursor:nesw-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-ns-resize{cursor:ns-resize}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.cursor-zoom-in{cursor:zoom-in}.touch-none{touch-action:none}.resize{resize:both}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1fr\)_auto_auto\]{grid-template-columns:minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-1\.5{column-gap:calc(var(--spacing)*1.5)}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-3{column-gap:calc(var(--spacing)*3)}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.-space-x-px>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(-1px*var(--tw-space-x-reverse));margin-inline-end:calc(-1px*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*4)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-8>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*8)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-2{row-gap:calc(var(--spacing)*2)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}.self-center{align-self:center}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-200\/60{border-color:#fee68599}@supports (color:color-mix(in lab,red,red)){.border-amber-200\/60{border-color:color-mix(in oklab,var(--color-amber-200)60%,transparent)}}.border-amber-200\/70{border-color:#fee685b3}@supports (color:color-mix(in lab,red,red)){.border-amber-200\/70{border-color:color-mix(in oklab,var(--color-amber-200)70%,transparent)}}.border-black\/5{border-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.border-black\/5{border-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.border-emerald-200\/70{border-color:#a4f4cfb3}@supports (color:color-mix(in lab,red,red)){.border-emerald-200\/70{border-color:color-mix(in oklab,var(--color-emerald-200)70%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-200\/60{border-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/60{border-color:color-mix(in oklab,var(--color-gray-200)60%,transparent)}}.border-gray-200\/70{border-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/70{border-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.border-gray-300{border-color:var(--color-gray-300)}.border-green-200{border-color:var(--color-green-200)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-indigo-500{border-color:var(--color-indigo-500)}.border-red-200{border-color:var(--color-red-200)}.border-rose-200\/60{border-color:#ffccd399}@supports (color:color-mix(in lab,red,red)){.border-rose-200\/60{border-color:color-mix(in oklab,var(--color-rose-200)60%,transparent)}}.border-rose-200\/70{border-color:#ffccd3b3}@supports (color:color-mix(in lab,red,red)){.border-rose-200\/70{border-color:color-mix(in oklab,var(--color-rose-200)70%,transparent)}}.border-sky-200\/70{border-color:#b8e6feb3}@supports (color:color-mix(in lab,red,red)){.border-sky-200\/70{border-color:color-mix(in oklab,var(--color-sky-200)70%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.border-white\/40{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.border-white\/40{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.border-white\/70{border-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.border-white\/70{border-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-amber-500{background-color:var(--color-amber-500)!important}.\!bg-blue-600{background-color:var(--color-blue-600)!important}.\!bg-emerald-600{background-color:var(--color-emerald-600)!important}.\!bg-indigo-600{background-color:var(--color-indigo-600)!important}.\!bg-red-600{background-color:var(--color-red-600)!important}.bg-\[\#12202c\]{background-color:#12202c}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/70{background-color:#fffbebb3}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/70{background-color:color-mix(in oklab,var(--color-amber-50)70%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-amber-500\/25{background-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/25{background-color:color-mix(in oklab,var(--color-amber-500)25%,transparent)}}.bg-amber-500\/30{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/30{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.bg-amber-500\/90{background-color:#f99c00e6}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/90{background-color:color-mix(in oklab,var(--color-amber-500)90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\/5{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-black\/55{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.bg-black\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-50\/60{background-color:#ecfdf599}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/60{background-color:color-mix(in oklab,var(--color-emerald-50)60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\/70{background-color:#f9fafbb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/70{background-color:color-mix(in oklab,var(--color-gray-50)70%,transparent)}}.bg-gray-50\/90{background-color:#f9fafbe6}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/90{background-color:color-mix(in oklab,var(--color-gray-50)90%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-100\/70{background-color:#f3f4f6b3}@supports (color:color-mix(in lab,red,red)){.bg-gray-100\/70{background-color:color-mix(in oklab,var(--color-gray-100)70%,transparent)}}.bg-gray-100\/80{background-color:#f3f4f6cc}@supports (color:color-mix(in lab,red,red)){.bg-gray-100\/80{background-color:color-mix(in oklab,var(--color-gray-100)80%,transparent)}}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-200\/70{background-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-200\/70{background-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/75{background-color:#6a7282bf}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/75{background-color:color-mix(in oklab,var(--color-gray-500)75%,transparent)}}.bg-gray-900\/5{background-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\/5{background-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.bg-indigo-500\/90{background-color:#625fffe6}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/90{background-color:color-mix(in oklab,var(--color-indigo-500)90%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-indigo-600\/70{background-color:#4f39f6b3}@supports (color:color-mix(in lab,red,red)){.bg-indigo-600\/70{background-color:color-mix(in oklab,var(--color-indigo-600)70%,transparent)}}.bg-red-50{background-color:var(--color-red-50)}.bg-red-50\/60{background-color:#fef2f299}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/60{background-color:color-mix(in oklab,var(--color-red-50)60%,transparent)}}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-600\/90{background-color:#e40014e6}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/90{background-color:color-mix(in oklab,var(--color-red-600)90%,transparent)}}.bg-rose-50\/70{background-color:#fff1f2b3}@supports (color:color-mix(in lab,red,red)){.bg-rose-50\/70{background-color:color-mix(in oklab,var(--color-rose-50)70%,transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/15{background-color:color-mix(in oklab,var(--color-rose-500)15%,transparent)}}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/20{background-color:color-mix(in oklab,var(--color-rose-500)20%,transparent)}}.bg-rose-500\/25{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/25{background-color:color-mix(in oklab,var(--color-rose-500)25%,transparent)}}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500)15%,transparent)}}.bg-sky-500\/25{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/25{background-color:color-mix(in oklab,var(--color-sky-500)25%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500)15%,transparent)}}.bg-slate-800\/70{background-color:#1d293db3}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/70{background-color:color-mix(in oklab,var(--color-slate-800)70%,transparent)}}.bg-slate-900\/80{background-color:#0f172bcc}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/80{background-color:color-mix(in oklab,var(--color-slate-900)80%,transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/8{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.bg-white\/8{background-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/12{background-color:#ffffff1f}@supports (color:color-mix(in lab,red,red)){.bg-white\/12{background-color:color-mix(in oklab,var(--color-white)12%,transparent)}}.bg-white\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\/15{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.bg-white\/35{background-color:#ffffff59}@supports (color:color-mix(in lab,red,red)){.bg-white\/35{background-color:color-mix(in oklab,var(--color-white)35%,transparent)}}.bg-white\/40{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.bg-white\/40{background-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.bg-white\/60{background-color:color-mix(in oklab,var(--color-white)60%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-white\/75{background-color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.bg-white\/75{background-color:color-mix(in oklab,var(--color-white)75%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.bg-white\/95{background-color:color-mix(in oklab,var(--color-white)95%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\/20{--tw-gradient-from:#0003}@supports (color:color-mix(in lab,red,red)){.from-black\/20{--tw-gradient-from:color-mix(in oklab,var(--color-black)20%,transparent)}}.from-black\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/35{--tw-gradient-from:#00000059}@supports (color:color-mix(in lab,red,red)){.from-black\/35{--tw-gradient-from:color-mix(in oklab,var(--color-black)35%,transparent)}}.from-black\/35{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/40{--tw-gradient-from:#0006}@supports (color:color-mix(in lab,red,red)){.from-black\/40{--tw-gradient-from:color-mix(in oklab,var(--color-black)40%,transparent)}}.from-black\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/55{--tw-gradient-from:#0000008c}@supports (color:color-mix(in lab,red,red)){.from-black\/55{--tw-gradient-from:color-mix(in oklab,var(--color-black)55%,transparent)}}.from-black\/55{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/65{--tw-gradient-from:#000000a6}@supports (color:color-mix(in lab,red,red)){.from-black\/65{--tw-gradient-from:color-mix(in oklab,var(--color-black)65%,transparent)}}.from-black\/65{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/70{--tw-gradient-from:#000000b3}@supports (color:color-mix(in lab,red,red)){.from-black\/70{--tw-gradient-from:color-mix(in oklab,var(--color-black)70%,transparent)}}.from-black\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-indigo-500\/10{--tw-gradient-from:#625fff1a}@supports (color:color-mix(in lab,red,red)){.from-indigo-500\/10{--tw-gradient-from:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.from-indigo-500\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/8{--tw-gradient-from:#ffffff14}@supports (color:color-mix(in lab,red,red)){.from-white\/8{--tw-gradient-from:color-mix(in oklab,var(--color-white)8%,transparent)}}.from-white\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/70{--tw-gradient-from:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.from-white\/70{--tw-gradient-from:color-mix(in oklab,var(--color-white)70%,transparent)}}.from-white\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-black\/0{--tw-gradient-via:#0000}@supports (color:color-mix(in lab,red,red)){.via-black\/0{--tw-gradient-via:color-mix(in oklab,var(--color-black)0%,transparent)}}.via-black\/0{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\/20{--tw-gradient-via:#0003}@supports (color:color-mix(in lab,red,red)){.via-black\/20{--tw-gradient-via:color-mix(in oklab,var(--color-black)20%,transparent)}}.via-black\/20{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\/20{--tw-gradient-via:#fff3}@supports (color:color-mix(in lab,red,red)){.via-white\/20{--tw-gradient-via:color-mix(in oklab,var(--color-white)20%,transparent)}}.via-white\/20{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-black\/0{--tw-gradient-to:#0000}@supports (color:color-mix(in lab,red,red)){.to-black\/0{--tw-gradient-to:color-mix(in oklab,var(--color-black)0%,transparent)}}.to-black\/0{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-sky-500\/10{--tw-gradient-to:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.to-sky-500\/10{--tw-gradient-to:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.to-sky-500\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-white\/60{--tw-gradient-to:#fff9}@supports (color:color-mix(in lab,red,red)){.to-white\/60{--tw-gradient-to:color-mix(in oklab,var(--color-white)60%,transparent)}}.to-white\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.fill-gray-500{fill:var(--color-gray-500)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-bottom{object-position:bottom}.object-center{object-position:center}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-3\.5{padding-block:calc(var(--spacing)*3.5)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\/6{font-size:var(--text-sm);line-height:calc(var(--spacing)*6)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[18px\]{font-size:18px}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-white{color:var(--color-white)!important}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-900{color:var(--color-emerald-900)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-800\/90{color:#1e2939e6}@supports (color:color-mix(in lab,red,red)){.text-gray-800\/90{color:color-mix(in oklab,var(--color-gray-800)90%,transparent)}}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-200\/80{color:#c7d2ffcc}@supports (color:color-mix(in lab,red,red)){.text-indigo-200\/80{color:color-mix(in oklab,var(--color-indigo-200)80%,transparent)}}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-indigo-900{color:var(--color-indigo-900)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-rose-200{color:var(--color-rose-200)}.text-rose-200\/80{color:#ffccd3cc}@supports (color:color-mix(in lab,red,red)){.text-rose-200\/80{color:color-mix(in oklab,var(--color-rose-200)80%,transparent)}}.text-rose-300{color:var(--color-rose-300)}.text-rose-500{color:var(--color-rose-500)}.text-rose-600{color:var(--color-rose-600)}.text-rose-900{color:var(--color-rose-900)}.text-rose-900\/80{color:#8b0836cc}@supports (color:color-mix(in lab,red,red)){.text-rose-900\/80{color:color-mix(in oklab,var(--color-rose-900)80%,transparent)}}.text-sky-200{color:var(--color-sky-200)}.text-sky-500{color:var(--color-sky-500)}.text-sky-600{color:var(--color-sky-600)}.text-sky-700{color:var(--color-sky-700)}.text-sky-800{color:var(--color-sky-800)}.text-sky-900{color:var(--color-sky-900)}.text-slate-300{color:var(--color-slate-300)}.text-slate-500{color:var(--color-slate-500)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/75{color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.text-white\/75{color:color-mix(in oklab,var(--color-white)75%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\/85{color:#ffffffd9}@supports (color:color-mix(in lab,red,red)){.text-white\/85{color:color-mix(in oklab,var(--color-white)85%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white)95%,transparent)}}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_1px_rgba\(0\,0\,0\,0\.35\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#00000059);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring,.inset-ring-1{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-amber-200{--tw-ring-color:var(--color-amber-200)}.ring-amber-200\/30{--tw-ring-color:#fee6854d}@supports (color:color-mix(in lab,red,red)){.ring-amber-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-amber-200)30%,transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.ring-black\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\/5{--tw-ring-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.ring-black\/10{--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.ring-black\/10{--tw-ring-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.ring-emerald-200{--tw-ring-color:var(--color-emerald-200)}.ring-emerald-300{--tw-ring-color:var(--color-emerald-300)}.ring-emerald-500\/25{--tw-ring-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/25{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)25%,transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.ring-gray-200{--tw-ring-color:var(--color-gray-200)}.ring-gray-200\/60{--tw-ring-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.ring-gray-200\/60{--tw-ring-color:color-mix(in oklab,var(--color-gray-200)60%,transparent)}}.ring-gray-900\/5{--tw-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.ring-gray-900\/5{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.ring-gray-900\/10{--tw-ring-color:#1018281a}@supports (color:color-mix(in lab,red,red)){.ring-gray-900\/10{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)10%,transparent)}}.ring-green-200{--tw-ring-color:var(--color-green-200)}.ring-indigo-100{--tw-ring-color:var(--color-indigo-100)}.ring-indigo-200{--tw-ring-color:var(--color-indigo-200)}.ring-red-200{--tw-ring-color:var(--color-red-200)}.ring-red-300{--tw-ring-color:var(--color-red-300)}.ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.ring-rose-200\/30{--tw-ring-color:#ffccd34d}@supports (color:color-mix(in lab,red,red)){.ring-rose-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-rose-200)30%,transparent)}}.ring-sky-200{--tw-ring-color:var(--color-sky-200)}.ring-sky-200\/30{--tw-ring-color:#b8e6fe4d}@supports (color:color-mix(in lab,red,red)){.ring-sky-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-sky-200)30%,transparent)}}.ring-slate-500\/30{--tw-ring-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.ring-slate-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-slate-500)30%,transparent)}}.ring-white{--tw-ring-color:var(--color-white)}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.ring-white\/15{--tw-ring-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.ring-white\/15{--tw-ring-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.ring-white\/20{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.ring-white\/20{--tw-ring-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.ring-white\/40{--tw-ring-color:#fff6}@supports (color:color-mix(in lab,red,red)){.ring-white\/40{--tw-ring-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.ring-white\/80{--tw-ring-color:#fffc}@supports (color:color-mix(in lab,red,red)){.ring-white\/80{--tw-ring-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.inset-ring-gray-300{--tw-inset-ring-color:var(--color-gray-300)}.inset-ring-gray-900\/5{--tw-inset-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.inset-ring-gray-900\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.inset-ring-indigo-300{--tw-inset-ring-color:var(--color-indigo-300)}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.-outline-offset-1{outline-offset:-1px}.outline-offset-2{outline-offset:2px}.outline-black\/5{outline-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.outline-black\/5{outline-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.outline-gray-300{outline-color:var(--color-gray-300)}.outline-indigo-600{outline-color:var(--color-indigo-600)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-2xl{--tw-blur:blur(var(--blur-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-md{--tw-blur:blur(var(--blur-md));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-xl{--tw-blur:blur(var(--blur-xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.brightness-90{--tw-brightness:brightness(90%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-\[0_1px_2px_rgba\(0\,0\,0\,0\.7\)\]{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#000000b3));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow-\[0_1px_2px_rgba\(0\,0\,0\,0\.75\)\]{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#000000bf));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-\[1px\]{--tw-backdrop-blur:blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[height\]{transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,top\,width\,height\]{transition-property:left,top,width,height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[max-height\,opacity\]{transition-property:max-height,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-\[cubic-bezier\(\.2\,\.9\,\.2\,1\)\]{--tw-ease:cubic-bezier(.2,.9,.2,1);transition-timing-function:cubic-bezier(.2,.9,.2,1)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\[-ms-overflow-style\:none\]{-ms-overflow-style:none}.\[scrollbar-width\:none\]{scrollbar-width:none}.\[text-shadow\:_0_1px_0_rgba\(0\,0\,0\,0\.95\)\,_1px_0_0_rgba\(0\,0\,0\,0\.95\)\,_-1px_0_0_rgba\(0\,0\,0\,0\.95\)\,_0_-1px_0_rgba\(0\,0\,0\,0\.95\)\,_1px_1px_0_rgba\(0\,0\,0\,0\.8\)\,_-1px_1px_0_rgba\(0\,0\,0\,0\.8\)\,_1px_-1px_0_rgba\(0\,0\,0\,0\.8\)\,_-1px_-1px_0_rgba\(0\,0\,0\,0\.8\)\]{text-shadow:0 1px #000000f2,1px 0 #000000f2,-1px 0 #000000f2,0 -1px #000000f2,1px 1px #000c,-1px 1px #000c,1px -1px #000c,-1px -1px #000c}.\[text-shadow\:_0_1px_2px_rgba\(0\,0\,0\,0\.9\)\]{text-shadow:0 1px 2px #000000e6}.ring-inset{--tw-ring-inset:inset}.group-focus-within\:pointer-events-auto:is(:where(.group):focus-within *){pointer-events:auto}.group-focus-within\:opacity-0:is(:where(.group):focus-within *){opacity:0}.group-focus-within\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:visible:is(:where(.group):hover *){visibility:visible}.group-hover\:h-1:is(:where(.group):hover *){height:calc(var(--spacing)*1)}.group-hover\:translate-x-\[1px\]:is(:where(.group):hover *){--tw-translate-x:1px;translate:var(--tw-translate-x)var(--tw-translate-y)}.group-hover\:scale-\[1\.02\]:is(:where(.group):hover *){scale:1.02}.group-hover\:overflow-visible:is(:where(.group):hover *){overflow:visible}.group-hover\:rounded-full:is(:where(.group):hover *){border-radius:3.40282e38px}.group-hover\:text-amber-200:is(:where(.group):hover *){color:var(--color-amber-200)}.group-hover\:text-gray-500:is(:where(.group):hover *){color:var(--color-gray-500)}.group-hover\:text-indigo-200:is(:where(.group):hover *){color:var(--color-indigo-200)}.group-hover\:text-indigo-500:is(:where(.group):hover *){color:var(--color-indigo-500)}.group-hover\:text-rose-200:is(:where(.group):hover *){color:var(--color-rose-200)}.group-hover\:opacity-0:is(:where(.group):hover *){opacity:0}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-focus-visible\:visible:is(:where(.group):focus-visible *){visibility:visible}.file\:mr-4::file-selector-button{margin-right:calc(var(--spacing)*4)}.file\:rounded-md::file-selector-button{border-radius:var(--radius-md)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-gray-100::file-selector-button{background-color:var(--color-gray-100)}.file\:px-3::file-selector-button{padding-inline:calc(var(--spacing)*3)}.file\:py-2::file-selector-button{padding-block:calc(var(--spacing)*2)}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-semibold::file-selector-button{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.file\:text-gray-900::file-selector-button{color:var(--color-gray-900)}.even\:bg-gray-50:nth-child(2n){background-color:var(--color-gray-50)}@media(hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing)*-.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:-translate-y-\[1px\]:hover{--tw-translate-y: -1px ;translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:scale-\[1\.03\]:hover{scale:1.03}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:border-indigo-200:hover{border-color:var(--color-indigo-200)}.hover\:border-transparent:hover{border-color:#0000}.hover\:\!bg-amber-600:hover{background-color:var(--color-amber-600)!important}.hover\:\!bg-blue-700:hover{background-color:var(--color-blue-700)!important}.hover\:\!bg-emerald-700:hover{background-color:var(--color-emerald-700)!important}.hover\:\!bg-indigo-700:hover{background-color:var(--color-indigo-700)!important}.hover\:\!bg-red-700:hover{background-color:var(--color-red-700)!important}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-black\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/5:hover{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-50\/80:hover{background-color:#f9fafbcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-50\/80:hover{background-color:color-mix(in oklab,var(--color-gray-50)80%,transparent)}}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-100\/70:hover{background-color:#f3f4f6b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-100\/70:hover{background-color:color-mix(in oklab,var(--color-gray-100)70%,transparent)}}.hover\:bg-gray-200\/70:hover{background-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-200\/70:hover{background-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.hover\:bg-gray-200\/80:hover{background-color:#e5e7ebcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-200\/80:hover{background-color:color-mix(in oklab,var(--color-gray-200)80%,transparent)}}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-rose-500\/30:hover{background-color:#ff23574d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-rose-500\/30:hover{background-color:color-mix(in oklab,var(--color-rose-500)30%,transparent)}}.hover\:bg-sky-100:hover{background-color:var(--color-sky-100)}.hover\:bg-transparent:hover{background-color:#0000}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\:bg-white\/90:hover{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/90:hover{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-gray-500:hover{color:var(--color-gray-500)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-indigo-200:hover{color:var(--color-indigo-200)}.hover\:text-inherit:hover{color:inherit}.hover\:text-red-900:hover{color:var(--color-red-900)}.hover\:text-rose-200:hover{color:var(--color-rose-200)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:file\:bg-gray-200:hover::file-selector-button{background-color:var(--color-gray-200)}}.focus\:z-10:focus{z-index:10}.focus\:z-20:focus{z-index:20}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:-outline-offset-2:focus{outline-offset:-2px}.focus\:outline-offset-0:focus{outline-offset:0px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-indigo-600:focus{outline-color:var(--color-indigo-600)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-blue-500\/60:focus-visible{--tw-ring-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-blue-500\/60:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.focus-visible\:ring-indigo-500\/60:focus-visible{--tw-ring-color:#625fff99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/60:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)60%,transparent)}}.focus-visible\:ring-indigo-500\/70:focus-visible{--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/70:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)70%,transparent)}}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-white:focus-visible{--tw-ring-offset-color:var(--color-white)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.focus-visible\:outline-blue-600:focus-visible{outline-color:var(--color-blue-600)}.focus-visible\:outline-emerald-600:focus-visible{outline-color:var(--color-emerald-600)}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-indigo-600:focus-visible{outline-color:var(--color-indigo-600)}.focus-visible\:outline-red-600:focus-visible{outline-color:var(--color-red-600)}.focus-visible\:outline-white\/70:focus-visible{outline-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.focus-visible\:outline-white\/70:focus-visible{outline-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.active\:translate-y-0:active{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-focus-visible\:outline-2:has(:focus-visible){outline-style:var(--tw-outline-style);outline-width:2px}.data-closed\:opacity-0[data-closed]{opacity:0}.data-enter\:transform[data-enter]{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.data-enter\:duration-200[data-enter]{--tw-duration:.2s;transition-duration:.2s}.data-enter\:ease-out[data-enter]{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.data-closed\:data-enter\:translate-y-2[data-closed][data-enter]{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-white\/25{background-color:#ffffff40}@supports (color:color-mix(in lab,red,red)){.supports-\[backdrop-filter\]\:bg-white\/25{background-color:color-mix(in oklab,var(--color-white)25%,transparent)}}.supports-\[backdrop-filter\]\:bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.supports-\[backdrop-filter\]\:bg-white\/60{background-color:color-mix(in oklab,var(--color-white)60%,transparent)}}}@media(prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}@media(min-width:40rem){.sm\:sticky{position:sticky}.sm\:top-0{top:calc(var(--spacing)*0)}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-4{grid-column:span 4/span 4}.sm\:col-span-8{grid-column:span 8/span 8}.sm\:col-span-9{grid-column:span 9/span 9}.sm\:mt-0{margin-top:calc(var(--spacing)*0)}.sm\:ml-16{margin-left:calc(var(--spacing)*16)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:h-52{height:calc(var(--spacing)*52)}.sm\:max-h-\[calc\(100vh-4rem\)\]{max-height:calc(100vh - 4rem)}.sm\:w-16{width:calc(var(--spacing)*16)}.sm\:w-\[260px\]{width:260px}.sm\:w-auto{width:auto}.sm\:min-w-\[220px\]{min-width:220px}.sm\:flex-1{flex:1}.sm\:flex-auto{flex:auto}.sm\:flex-none{flex:none}.sm\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\:grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:items-end{align-items:flex-end}.sm\:items-start{align-items:flex-start}.sm\:items-stretch{align-items:stretch}.sm\:justify-between{justify-content:space-between}.sm\:justify-end{justify-content:flex-end}.sm\:justify-start{justify-content:flex-start}.sm\:gap-3{gap:calc(var(--spacing)*3)}.sm\:gap-4{gap:calc(var(--spacing)*4)}:where(.sm\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.sm\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.sm\:rounded-lg{border-radius:var(--radius-lg)}.sm\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.sm\:border-gray-200\/70{border-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.sm\:border-gray-200\/70{border-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.sm\:p-3{padding:calc(var(--spacing)*3)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-6{padding:calc(var(--spacing)*6)}.sm\:px-3{padding-inline:calc(var(--spacing)*3)}.sm\:px-4{padding-inline:calc(var(--spacing)*4)}.sm\:px-6{padding-inline:calc(var(--spacing)*6)}.sm\:py-4{padding-block:calc(var(--spacing)*4)}.sm\:pt-2{padding-top:calc(var(--spacing)*2)}.sm\:pt-4{padding-top:calc(var(--spacing)*4)}.sm\:pt-6{padding-top:calc(var(--spacing)*6)}.sm\:pb-6{padding-bottom:calc(var(--spacing)*6)}.sm\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.sm\:data-closed\:data-enter\:-translate-x-2[data-closed][data-enter]{--tw-translate-x:calc(var(--spacing)*-2);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:data-closed\:data-enter\:translate-x-2[data-closed][data-enter]{--tw-translate-x:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:data-closed\:data-enter\:translate-y-0[data-closed][data-enter]{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}}@media(min-width:48rem){.md\:inset-x-auto{inset-inline:auto}.md\:right-auto{right:auto}.md\:bottom-4{bottom:calc(var(--spacing)*4)}.md\:left-1\/2{left:50%}.md\:inline-block{display:inline-block}.md\:w-\[min\(760px\,calc\(100vw-32px\)\)\]{width:min(760px,100vw - 32px)}.md\:-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:w-\[320px\]{width:320px}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:px-8{padding-inline:calc(var(--spacing)*8)}}@media(min-width:80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(prefers-color-scheme:dark){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:border-amber-400\/20{border-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.dark\:border-amber-400\/20{border-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.dark\:border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:border-emerald-400\/20{border-color:#00d29433}@supports (color:color-mix(in lab,red,red)){.dark\:border-emerald-400\/20{border-color:color-mix(in oklab,var(--color-emerald-400)20%,transparent)}}.dark\:border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.dark\:border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.dark\:border-indigo-400{border-color:var(--color-indigo-400)}.dark\:border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.dark\:border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:border-rose-400\/20{border-color:#ff667f33}@supports (color:color-mix(in lab,red,red)){.dark\:border-rose-400\/20{border-color:color-mix(in oklab,var(--color-rose-400)20%,transparent)}}.dark\:border-sky-400\/20{border-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:border-sky-400\/20{border-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:border-white\/60{border-color:#fff9}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/60{border-color:color-mix(in oklab,var(--color-white)60%,transparent)}}.dark\:border-t-transparent{border-top-color:#0000}.dark\:\!bg-amber-500{background-color:var(--color-amber-500)!important}.dark\:\!bg-blue-500{background-color:var(--color-blue-500)!important}.dark\:\!bg-emerald-500{background-color:var(--color-emerald-500)!important}.dark\:\!bg-indigo-500{background-color:var(--color-indigo-500)!important}.dark\:\!bg-red-500{background-color:var(--color-red-500)!important}.dark\:bg-amber-400\/10{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-400\/10{background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.dark\:bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.dark\:bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.dark\:bg-black\/8{background-color:#00000014}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/8{background-color:color-mix(in oklab,var(--color-black)8%,transparent)}}.dark\:bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.dark\:bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.dark\:bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.dark\:bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:bg-emerald-400\/10{background-color:#00d2941a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-400\/10{background-color:color-mix(in oklab,var(--color-emerald-400)10%,transparent)}}.dark\:bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.dark\:bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.dark\:bg-gray-800{background-color:var(--color-gray-800)}.dark\:bg-gray-800\/50{background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/50{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:bg-gray-800\/70{background-color:#1e2939b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/70{background-color:color-mix(in oklab,var(--color-gray-800)70%,transparent)}}.dark\:bg-gray-800\/95{background-color:#1e2939f2}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/95{background-color:color-mix(in oklab,var(--color-gray-800)95%,transparent)}}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-gray-900\/40{background-color:#10182866}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/40{background-color:color-mix(in oklab,var(--color-gray-900)40%,transparent)}}.dark\:bg-gray-900\/50{background-color:#10182880}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/50{background-color:color-mix(in oklab,var(--color-gray-900)50%,transparent)}}.dark\:bg-gray-900\/60{background-color:#10182899}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/60{background-color:color-mix(in oklab,var(--color-gray-900)60%,transparent)}}.dark\:bg-gray-900\/70{background-color:#101828b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/70{background-color:color-mix(in oklab,var(--color-gray-900)70%,transparent)}}.dark\:bg-gray-900\/95{background-color:#101828f2}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/95{background-color:color-mix(in oklab,var(--color-gray-900)95%,transparent)}}.dark\:bg-gray-950{background-color:var(--color-gray-950)}.dark\:bg-gray-950\/35{background-color:#03071259}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/35{background-color:color-mix(in oklab,var(--color-gray-950)35%,transparent)}}.dark\:bg-gray-950\/40{background-color:#03071266}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/40{background-color:color-mix(in oklab,var(--color-gray-950)40%,transparent)}}.dark\:bg-gray-950\/60{background-color:#03071299}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/60{background-color:color-mix(in oklab,var(--color-gray-950)60%,transparent)}}.dark\:bg-gray-950\/70{background-color:#030712b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/70{background-color:color-mix(in oklab,var(--color-gray-950)70%,transparent)}}.dark\:bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.dark\:bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:bg-indigo-400{background-color:var(--color-indigo-400)}.dark\:bg-indigo-400\/10{background-color:#7d87ff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-400\/10{background-color:color-mix(in oklab,var(--color-indigo-400)10%,transparent)}}.dark\:bg-indigo-500{background-color:var(--color-indigo-500)}.dark\:bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.dark\:bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:bg-indigo-500\/40{background-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/40{background-color:color-mix(in oklab,var(--color-indigo-500)40%,transparent)}}.dark\:bg-indigo-500\/70{background-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/70{background-color:color-mix(in oklab,var(--color-indigo-500)70%,transparent)}}.dark\:bg-red-400\/10{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-400\/10{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.dark\:bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:bg-rose-400\/10{background-color:#ff667f1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-rose-400\/10{background-color:color-mix(in oklab,var(--color-rose-400)10%,transparent)}}.dark\:bg-sky-400\/10{background-color:#00bcfe1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-400\/10{background-color:color-mix(in oklab,var(--color-sky-400)10%,transparent)}}.dark\:bg-sky-400\/20{background-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-400\/20{background-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.dark\:bg-slate-400\/10{background-color:#90a1b91a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-slate-400\/10{background-color:color-mix(in oklab,var(--color-slate-400)10%,transparent)}}.dark\:bg-transparent{background-color:#0000}.dark\:bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:bg-white\/35{background-color:#ffffff59}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/35{background-color:color-mix(in oklab,var(--color-white)35%,transparent)}}.dark\:bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-white)6%,transparent)}}.dark\:from-white\/10{--tw-gradient-from:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:from-white\/10{--tw-gradient-from:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:from-white\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.dark\:via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.dark\:to-white\/5{--tw-gradient-to:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:to-white\/5{--tw-gradient-to:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:to-white\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.dark\:fill-gray-400{fill:var(--color-gray-400)}.dark\:text-amber-200{color:var(--color-amber-200)}.dark\:text-amber-300{color:var(--color-amber-300)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-emerald-200{color:var(--color-emerald-200)}.dark\:text-emerald-300{color:var(--color-emerald-300)}.dark\:text-emerald-400{color:var(--color-emerald-400)}.dark\:text-gray-100{color:var(--color-gray-100)}.dark\:text-gray-200{color:var(--color-gray-200)}.dark\:text-gray-300{color:var(--color-gray-300)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-gray-500{color:var(--color-gray-500)}.dark\:text-gray-600{color:var(--color-gray-600)}.dark\:text-green-200{color:var(--color-green-200)}.dark\:text-green-300{color:var(--color-green-300)}.dark\:text-indigo-100{color:var(--color-indigo-100)}.dark\:text-indigo-200{color:var(--color-indigo-200)}.dark\:text-indigo-300{color:var(--color-indigo-300)}.dark\:text-indigo-400{color:var(--color-indigo-400)}.dark\:text-indigo-500{color:var(--color-indigo-500)}.dark\:text-red-200{color:var(--color-red-200)}.dark\:text-red-300{color:var(--color-red-300)}.dark\:text-red-400{color:var(--color-red-400)}.dark\:text-rose-200{color:var(--color-rose-200)}.dark\:text-rose-200\/80{color:#ffccd3cc}@supports (color:color-mix(in lab,red,red)){.dark\:text-rose-200\/80{color:color-mix(in oklab,var(--color-rose-200)80%,transparent)}}.dark\:text-rose-300{color:var(--color-rose-300)}.dark\:text-sky-100{color:var(--color-sky-100)}.dark\:text-sky-200{color:var(--color-sky-200)}.dark\:text-sky-300{color:var(--color-sky-300)}.dark\:text-slate-200{color:var(--color-slate-200)}.dark\:text-white{color:var(--color-white)}.dark\:text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.dark\:text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.dark\:text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.dark\:text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.dark\:\[color-scheme\:dark\]{color-scheme:dark}.dark\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:ring-amber-400\/20{--tw-ring-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.dark\:ring-amber-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.dark\:ring-amber-400\/25{--tw-ring-color:#fcbb0040}@supports (color:color-mix(in lab,red,red)){.dark\:ring-amber-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-amber-400)25%,transparent)}}.dark\:ring-emerald-400\/20{--tw-ring-color:#00d29433}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-emerald-400)20%,transparent)}}.dark\:ring-emerald-400\/25{--tw-ring-color:#00d29440}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-emerald-400)25%,transparent)}}.dark\:ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:ring-gray-900\/60{--tw-ring-color:#10182899}@supports (color:color-mix(in lab,red,red)){.dark\:ring-gray-900\/60{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)60%,transparent)}}.dark\:ring-gray-950{--tw-ring-color:var(--color-gray-950)}.dark\:ring-green-400\/30{--tw-ring-color:#05df724d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-green-400\/30{--tw-ring-color:color-mix(in oklab,var(--color-green-400)30%,transparent)}}.dark\:ring-indigo-400\/20{--tw-ring-color:#7d87ff33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-indigo-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-indigo-400)20%,transparent)}}.dark\:ring-indigo-500\/20{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-indigo-500\/20{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:ring-red-400\/25{--tw-ring-color:#ff656840}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-red-400)25%,transparent)}}.dark\:ring-red-400\/30{--tw-ring-color:#ff65684d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-400\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-400)30%,transparent)}}.dark\:ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:ring-sky-400\/20{--tw-ring-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-sky-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:ring-slate-400\/25{--tw-ring-color:#90a1b940}@supports (color:color-mix(in lab,red,red)){.dark\:ring-slate-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-slate-400)25%,transparent)}}.dark\:ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:ring-white\/10{--tw-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:ring-white\/15{--tw-ring-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.dark\:ring-white\/15{--tw-ring-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.dark\:inset-ring-gray-700{--tw-inset-ring-color:var(--color-gray-700)}.dark\:inset-ring-indigo-400\/50{--tw-inset-ring-color:#7d87ff80}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-indigo-400\/50{--tw-inset-ring-color:color-mix(in oklab,var(--color-indigo-400)50%,transparent)}}.dark\:inset-ring-white\/5{--tw-inset-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:inset-ring-white\/10{--tw-inset-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/10{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:outline{outline-style:var(--tw-outline-style);outline-width:1px}.dark\:-outline-offset-1{outline-offset:-1px}.dark\:outline-indigo-500{outline-color:var(--color-indigo-500)}.dark\:outline-white\/10{outline-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:outline-white\/10{outline-color:color-mix(in oklab,var(--color-white)10%,transparent)}}:is(.dark\:\*\:bg-gray-800>*){background-color:var(--color-gray-800)}@media(hover:hover){.dark\:group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.dark\:group-hover\:text-indigo-400:is(:where(.group):hover *){color:var(--color-indigo-400)}}.dark\:file\:bg-white\/10::file-selector-button{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:file\:bg-white\/10::file-selector-button{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:file\:text-white::file-selector-button{color:var(--color-white)}.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}@media(hover:hover){.dark\:hover\:border-indigo-400\/30:hover{border-color:#7d87ff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:border-indigo-400\/30:hover{border-color:color-mix(in oklab,var(--color-indigo-400)30%,transparent)}}.dark\:hover\:border-white\/20:hover{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:border-white\/20:hover{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:\!bg-amber-400:hover{background-color:var(--color-amber-400)!important}.dark\:hover\:\!bg-blue-400:hover{background-color:var(--color-blue-400)!important}.dark\:hover\:\!bg-emerald-400:hover{background-color:var(--color-emerald-400)!important}.dark\:hover\:\!bg-indigo-400:hover{background-color:var(--color-indigo-400)!important}.dark\:hover\:\!bg-red-400:hover{background-color:var(--color-red-400)!important}.dark\:hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:hover\:bg-black\/55:hover{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-black\/55:hover{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.dark\:hover\:bg-black\/60:hover{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-black\/60:hover{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.dark\:hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:hover\:bg-emerald-500\/30:hover{background-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-emerald-500\/30:hover{background-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:hover\:bg-indigo-500\/20:hover{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/20:hover{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:hover\:bg-indigo-500\/50:hover{background-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/50:hover{background-color:color-mix(in oklab,var(--color-indigo-500)50%,transparent)}}.dark\:hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:hover\:bg-sky-400\/20:hover{background-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-sky-400\/20:hover{background-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:bg-white\/\[0\.09\]:hover{background-color:#ffffff17}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/\[0\.09\]:hover{background-color:color-mix(in oklab,var(--color-white)9%,transparent)}}.dark\:hover\:text-gray-200:hover{color:var(--color-gray-200)}.dark\:hover\:text-gray-300:hover{color:var(--color-gray-300)}.dark\:hover\:text-gray-400:hover{color:var(--color-gray-400)}.dark\:hover\:text-red-200:hover{color:var(--color-red-200)}.dark\:hover\:text-white:hover{color:var(--color-white)}.dark\:hover\:shadow-none:hover{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}}.dark\:focus\:outline-indigo-500:focus{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:ring-white\/40:focus-visible{--tw-ring-color:#fff6}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-white\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.dark\:focus-visible\:ring-offset-gray-950:focus-visible{--tw-ring-offset-color:var(--color-gray-950)}.dark\:focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.dark\:focus-visible\:outline-blue-500:focus-visible{outline-color:var(--color-blue-500)}.dark\:focus-visible\:outline-emerald-500:focus-visible{outline-color:var(--color-emerald-500)}.dark\:focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:outline-red-500:focus-visible{outline-color:var(--color-red-500)}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/25{background-color:#03071240}@supports (color:color-mix(in lab,red,red)){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/25{background-color:color-mix(in oklab,var(--color-gray-950)25%,transparent)}}.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/40{background-color:#03071266}@supports (color:color-mix(in lab,red,red)){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/40{background-color:color-mix(in oklab,var(--color-gray-950)40%,transparent)}}}}@media(min-width:40rem){@media(prefers-color-scheme:dark){.sm\:dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.sm\:dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}}}.\[\&_button\]\:h-7 button{height:calc(var(--spacing)*7)}.\[\&_button\]\:w-7 button{width:calc(var(--spacing)*7)}.\[\&_button\]\:min-w-0 button{min-width:calc(var(--spacing)*0)}.\[\&_button\]\:border-0 button{border-style:var(--tw-border-style);border-width:0}.\[\&_button\]\:bg-transparent button{background-color:#0000}.\[\&_button\]\:p-0 button{padding:calc(var(--spacing)*0)}.\[\&_button\]\:shadow-none button{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.\[\&_button\:hover\]\:bg-white\/10 button:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.\[\&_button\:hover\]\:bg-white\/10 button:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}}:root{color-scheme:light dark;color:#ffffffde;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#242424;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}.video-js{position:relative}.video-js .vjs-control-bar{z-index:60;position:relative}.video-js .vjs-menu-button-popup .vjs-menu,.video-js .vjs-volume-panel .vjs-volume-control{z-index:9999!important}.vjs-mini .video-js .vjs-current-time,.vjs-mini .video-js .vjs-time-divider,.vjs-mini .video-js .vjs-duration{opacity:1!important;visibility:visible!important;display:flex!important}.vjs-mini .video-js .vjs-current-time-display,.vjs-mini .video-js .vjs-duration-display{display:inline!important}.video-js .vjs-time-control{width:auto!important;min-width:0!important;padding-left:.35em!important;padding-right:.35em!important}.video-js .vjs-time-divider{padding-left:.15em!important;padding-right:.15em!important}.video-js .vjs-time-divider>div{padding:0!important}.video-js .vjs-current-time-display,.video-js .vjs-duration-display{font-variant-numeric:tabular-nums;font-size:.95em}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-svg-icon:hover,.vjs-control:focus .vjs-svg-icon{filter:drop-shadow(0 0 .25em #fff)}.vjs-modal-dialog .vjs-modal-dialog-content,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff");font-weight:400;font-style:normal}.vjs-icon-play,.video-js .vjs-play-control .vjs-icon-placeholder,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{content:""}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:""}.vjs-icon-pause,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pause:before,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mute,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mute:before,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-low,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-low:before,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mid,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mid:before,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-high,.video-js .vjs-mute-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-high:before,.video-js .vjs-mute-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-enter,.video-js .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-enter:before,.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-exit,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-exit:before,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:""}.vjs-icon-subtitles,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-subtitles:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before{content:""}.vjs-icon-captions,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-captions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-captions:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-captions-button .vjs-icon-placeholder:before{content:""}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:""}.vjs-icon-chapters,.video-js .vjs-chapters-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-chapters:before,.video-js .vjs-chapters-button .vjs-icon-placeholder:before{content:""}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:""}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:""}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:""}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:""}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:""}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:""}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:""}.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder,.video-js .vjs-volume-level,.video-js .vjs-play-progress{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before,.video-js .vjs-volume-level:before,.video-js .vjs-play-progress:before{content:""}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:""}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:""}.vjs-icon-cancel,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cancel:before,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before{content:""}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:""}.vjs-icon-replay,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay:before,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-5,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-5:before,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-10,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-10:before,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-30,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-30:before,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-5,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-5:before,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-10,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-10:before,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-30,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-30:before,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-audio,.video-js .vjs-audio-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio:before,.video-js .vjs-audio-button .vjs-icon-placeholder:before{content:""}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:""}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:""}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:""}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:""}.vjs-icon-picture-in-picture-enter,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-enter:before,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-picture-in-picture-exit,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-exit:before,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:""}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:""}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:""}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:""}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:""}.vjs-icon-audio-description,.video-js .vjs-descriptions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio-description:before,.video-js .vjs-descriptions-button .vjs-icon-placeholder:before{content:""}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js *:before,.video-js *:after{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-fluid,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-1-1{width:100%;max-width:100%}.video-js.vjs-fluid:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-1-1:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;inset:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:#000000b3;padding:.5em;text-align:center;width:100%}.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text,.vjs-layout-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:#2b333fb3;border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js:hover .vjs-big-play-button,.video-js .vjs-big-play-button:focus{border-color:#fff;background-color:#73859f;background-color:#73859f80;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button,.vjs-error .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{outline:.0625em solid white;box-shadow:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:#000c;background:linear-gradient(180deg,#000c,#fff0);overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover,.js-focus-visible .vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:#73859f80}.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover,.js-focus-visible .vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon,.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible),.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible){background:none}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0em;margin-bottom:1.5em;border-top-color:#2b333fb3}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:#2b333fb3;position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu,.vjs-menu-button-popup .vjs-menu.vjs-lock-showing{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline:hover,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline.vjs-slider-active{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline:hover .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline.vjs-slider-active .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:#2b333fb3}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-has-started .vjs-control-bar,.vjs-audio-only-mode .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar,.vjs-error .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before,.video-js .vjs-control:focus{text-shadow:0em 0em 1em white}.video-js *:not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-play-progress,.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:#73859f80}.video-js .vjs-load-progress div{background:#73859fbf}.video-js .vjs-time-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display,.video-js.vjs-touch-enabled:not(.vjs-scrubbing) .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:#000c}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:#73859f80}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0em 0em 1em white;box-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid white}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translate(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:#2b333fb3}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:#000c}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;inset:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js:not(.vjs-live) .vjs-live-control,.video-js.vjs-liveui .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider,.video-js .vjs-current-time,.video-js .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;inset:0 0 3em;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset: 10px){.video-js .vjs-text-track-display>div{inset:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate>.vjs-menu-button,.vjs-playback-rate .vjs-playback-rate-value{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:before,.vjs-loading-spinner:after{content:"";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:before,.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" ";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover{width:auto;width:initial}.video-js.vjs-layout-x-small .vjs-progress-control,.video-js.vjs-layout-tiny .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:#2b333fbf;color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-font,.vjs-text-track-settings .vjs-track-settings-controls{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display: grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:focus,.vjs-track-settings-controls button:active{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f)}.vjs-track-settings-controls button:hover{color:#2b333fbf}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:#000000e6;background:linear-gradient(180deg,#000000e6,#000000b3 60%,#0000);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-title,.vjs-title-bar-description{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30{cursor:pointer}.video-js .vjs-transient-button{position:absolute;height:3em;display:flex;align-items:center;justify-content:center;background-color:#32323280;cursor:pointer;opacity:1;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:#323232e6}@media print{.video-js>*:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js *:focus:not(.focus-visible){outline:none}.video-js *:focus:not(:focus-visible){outline:none} diff --git a/backend/web/dist/assets/index-BZTD4GKM.css b/backend/web/dist/assets/index-BZTD4GKM.css deleted file mode 100644 index e032568..0000000 --- a/backend/web/dist/assets/index-BZTD4GKM.css +++ /dev/null @@ -1 +0,0 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-900:oklch(37.8% .077 168.94);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-sky-700:oklch(50% .134 242.749);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-900:oklch(41% .159 10.272);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-gray-950:oklch(13% .028 261.692);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-snug:1.375;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.-inset-10{inset:calc(var(--spacing)*-10)}.inset-0{inset:calc(var(--spacing)*0)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-x-2{inset-inline:calc(var(--spacing)*2)}.inset-x-3{inset-inline:calc(var(--spacing)*3)}.-top-1{top:calc(var(--spacing)*-1)}.-top-28{top:calc(var(--spacing)*-28)}.-top-\[9999px\]{top:-9999px}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-\[56px\]{top:56px}.top-auto{top:auto}.-right-1{right:calc(var(--spacing)*-1)}.right-0{right:calc(var(--spacing)*0)}.right-1\.5{right:calc(var(--spacing)*1.5)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-\[-6rem\]{right:-6rem}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-bottom-28{bottom:calc(var(--spacing)*-28)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-1\.5{bottom:calc(var(--spacing)*1.5)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-auto{bottom:auto}.-left-1{left:calc(var(--spacing)*-1)}.-left-\[9999px\]{left:-9999px}.left-0{left:calc(var(--spacing)*0)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[60\]{z-index:60}.z-\[80\]{z-index:80}.z-\[9999\]{z-index:9999}.z-\[2147483647\]{z-index:2147483647}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-start-1{grid-column-start:1}.row-start-1{grid-row-start:1}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing)*-1)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-5{margin-top:calc(var(--spacing)*5)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.-mr-0\.5{margin-right:calc(var(--spacing)*-.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-0\.5{margin-left:calc(var(--spacing)*-.5)}.-ml-px{margin-left:-1px}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-6{-webkit-line-clamp:6;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-video{aspect-ratio:var(--aspect-video)}.size-1\.5{width:calc(var(--spacing)*1.5);height:calc(var(--spacing)*1.5)}.size-2\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-3\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1{height:calc(var(--spacing)*1)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-24{height:calc(var(--spacing)*24)}.h-28{height:calc(var(--spacing)*28)}.h-44{height:calc(var(--spacing)*44)}.h-80{height:calc(var(--spacing)*80)}.h-\[60px\]{height:60px}.h-\[64px\]{height:64px}.h-\[220px\]{height:220px}.h-full{height:100%}.max-h-0{max-height:calc(var(--spacing)*0)}.max-h-28{max-height:calc(var(--spacing)*28)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[720px\]{max-height:720px}.max-h-\[calc\(100vh-3rem\)\]{max-height:calc(100vh - 3rem)}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[100dvh\]{min-height:100dvh}.min-h-\[112px\]{min-height:112px}.min-h-full{min-height:100%}.w-1{width:calc(var(--spacing)*1)}.w-1\.5{width:calc(var(--spacing)*1.5)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-20{width:calc(var(--spacing)*20)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-52{width:calc(var(--spacing)*52)}.w-\[46rem\]{width:46rem}.w-\[52rem\]{width:52rem}.w-\[64px\]{width:64px}.w-\[90px\]{width:90px}.w-\[92px\]{width:92px}.w-\[96px\]{width:96px}.w-\[110px\]{width:110px}.w-\[112px\]{width:112px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[170px\]{width:170px}.w-\[260px\]{width:260px}.w-\[320px\]{width:320px}.w-\[360px\]{width:360px}.w-\[420px\]{width:420px}.w-auto{width:auto}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[11rem\]{max-width:11rem}.max-w-\[170px\]{max-width:170px}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[260px\]{max-width:260px}.max-w-\[420px\]{max-width:420px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[calc\(100\%-24px\)\]{max-width:calc(100% - 24px)}.max-w-\[calc\(100vw-1\.5rem\)\]{max-width:calc(100vw - 1.5rem)}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[2\.25rem\]{min-width:2.25rem}.min-w-\[220px\]{min-width:220px}.min-w-\[240px\]{min-width:240px}.min-w-\[300px\]{min-width:300px}.min-w-\[980px\]{min-width:980px}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-left{transform-origin:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-4{--tw-translate-y:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-75{--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-\[0\.98\]{scale:.98}.scale-\[1\.03\]{scale:1.03}.-rotate-12{rotate:-12deg}.rotate-0{rotate:none}.rotate-12{rotate:12deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-ew-resize{cursor:ew-resize}.cursor-grab{cursor:grab}.cursor-nesw-resize{cursor:nesw-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-ns-resize{cursor:ns-resize}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.cursor-zoom-in{cursor:zoom-in}.resize{resize:both}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1fr\)_auto_auto\]{grid-template-columns:minmax(0,1fr) auto auto}.flex-col{flex-direction:column}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-1\.5{column-gap:calc(var(--spacing)*1.5)}.gap-x-2{column-gap:calc(var(--spacing)*2)}.gap-x-3{column-gap:calc(var(--spacing)*3)}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.-space-x-px>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(-1px*var(--tw-space-x-reverse));margin-inline-end:calc(-1px*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*4)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-8>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*8)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:calc(var(--spacing)*1)}.gap-y-2{row-gap:calc(var(--spacing)*2)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}.self-center{align-self:center}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-200\/60{border-color:#fee68599}@supports (color:color-mix(in lab,red,red)){.border-amber-200\/60{border-color:color-mix(in oklab,var(--color-amber-200)60%,transparent)}}.border-amber-200\/70{border-color:#fee685b3}@supports (color:color-mix(in lab,red,red)){.border-amber-200\/70{border-color:color-mix(in oklab,var(--color-amber-200)70%,transparent)}}.border-black\/5{border-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.border-black\/5{border-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.border-emerald-200\/70{border-color:#a4f4cfb3}@supports (color:color-mix(in lab,red,red)){.border-emerald-200\/70{border-color:color-mix(in oklab,var(--color-emerald-200)70%,transparent)}}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-200\/60{border-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/60{border-color:color-mix(in oklab,var(--color-gray-200)60%,transparent)}}.border-gray-200\/70{border-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.border-gray-200\/70{border-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.border-gray-300{border-color:var(--color-gray-300)}.border-green-200{border-color:var(--color-green-200)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-indigo-500{border-color:var(--color-indigo-500)}.border-red-200{border-color:var(--color-red-200)}.border-rose-200\/60{border-color:#ffccd399}@supports (color:color-mix(in lab,red,red)){.border-rose-200\/60{border-color:color-mix(in oklab,var(--color-rose-200)60%,transparent)}}.border-rose-200\/70{border-color:#ffccd3b3}@supports (color:color-mix(in lab,red,red)){.border-rose-200\/70{border-color:color-mix(in oklab,var(--color-rose-200)70%,transparent)}}.border-sky-200\/70{border-color:#b8e6feb3}@supports (color:color-mix(in lab,red,red)){.border-sky-200\/70{border-color:color-mix(in oklab,var(--color-sky-200)70%,transparent)}}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.border-white\/40{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.border-white\/40{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.border-white\/70{border-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.border-white\/70{border-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-amber-500{background-color:var(--color-amber-500)!important}.\!bg-blue-600{background-color:var(--color-blue-600)!important}.\!bg-emerald-600{background-color:var(--color-emerald-600)!important}.\!bg-indigo-600{background-color:var(--color-indigo-600)!important}.\!bg-red-600{background-color:var(--color-red-600)!important}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/70{background-color:#fffbebb3}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/70{background-color:color-mix(in oklab,var(--color-amber-50)70%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.bg-amber-500\/25{background-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/25{background-color:color-mix(in oklab,var(--color-amber-500)25%,transparent)}}.bg-amber-500\/30{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/30{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\/5{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black)20%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/35{background-color:#00000059}@supports (color:color-mix(in lab,red,red)){.bg-black\/35{background-color:color-mix(in oklab,var(--color-black)35%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-black\/55{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.bg-black\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-50\/60{background-color:#ecfdf599}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/60{background-color:color-mix(in oklab,var(--color-emerald-50)60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\/70{background-color:#f9fafbb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/70{background-color:color-mix(in oklab,var(--color-gray-50)70%,transparent)}}.bg-gray-50\/90{background-color:#f9fafbe6}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/90{background-color:color-mix(in oklab,var(--color-gray-50)90%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-100\/70{background-color:#f3f4f6b3}@supports (color:color-mix(in lab,red,red)){.bg-gray-100\/70{background-color:color-mix(in oklab,var(--color-gray-100)70%,transparent)}}.bg-gray-100\/80{background-color:#f3f4f6cc}@supports (color:color-mix(in lab,red,red)){.bg-gray-100\/80{background-color:color-mix(in oklab,var(--color-gray-100)80%,transparent)}}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-200\/70{background-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.bg-gray-200\/70{background-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.bg-gray-400{background-color:var(--color-gray-400)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/75{background-color:#6a7282bf}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/75{background-color:color-mix(in oklab,var(--color-gray-500)75%,transparent)}}.bg-gray-900\/5{background-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\/5{background-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-indigo-600\/70{background-color:#4f39f6b3}@supports (color:color-mix(in lab,red,red)){.bg-indigo-600\/70{background-color:color-mix(in oklab,var(--color-indigo-600)70%,transparent)}}.bg-red-50{background-color:var(--color-red-50)}.bg-red-50\/60{background-color:#fef2f299}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/60{background-color:color-mix(in oklab,var(--color-red-50)60%,transparent)}}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-600\/90{background-color:#e40014e6}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/90{background-color:color-mix(in oklab,var(--color-red-600)90%,transparent)}}.bg-rose-50\/70{background-color:#fff1f2b3}@supports (color:color-mix(in lab,red,red)){.bg-rose-50\/70{background-color:color-mix(in oklab,var(--color-rose-50)70%,transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/15{background-color:color-mix(in oklab,var(--color-rose-500)15%,transparent)}}.bg-rose-500\/25{background-color:#ff235740}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/25{background-color:color-mix(in oklab,var(--color-rose-500)25%,transparent)}}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/15{background-color:color-mix(in oklab,var(--color-sky-500)15%,transparent)}}.bg-sky-500\/25{background-color:#00a5ef40}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/25{background-color:color-mix(in oklab,var(--color-sky-500)25%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500)15%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/8{background-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.bg-white\/8{background-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/12{background-color:#ffffff1f}@supports (color:color-mix(in lab,red,red)){.bg-white\/12{background-color:color-mix(in oklab,var(--color-white)12%,transparent)}}.bg-white\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\/15{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.bg-white\/35{background-color:#ffffff59}@supports (color:color-mix(in lab,red,red)){.bg-white\/35{background-color:color-mix(in oklab,var(--color-white)35%,transparent)}}.bg-white\/40{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.bg-white\/40{background-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.bg-white\/60{background-color:color-mix(in oklab,var(--color-white)60%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-white\/75{background-color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.bg-white\/75{background-color:color-mix(in oklab,var(--color-white)75%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.bg-white\/95{background-color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.bg-white\/95{background-color:color-mix(in oklab,var(--color-white)95%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\/20{--tw-gradient-from:#0003}@supports (color:color-mix(in lab,red,red)){.from-black\/20{--tw-gradient-from:color-mix(in oklab,var(--color-black)20%,transparent)}}.from-black\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/35{--tw-gradient-from:#00000059}@supports (color:color-mix(in lab,red,red)){.from-black\/35{--tw-gradient-from:color-mix(in oklab,var(--color-black)35%,transparent)}}.from-black\/35{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/40{--tw-gradient-from:#0006}@supports (color:color-mix(in lab,red,red)){.from-black\/40{--tw-gradient-from:color-mix(in oklab,var(--color-black)40%,transparent)}}.from-black\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/55{--tw-gradient-from:#0000008c}@supports (color:color-mix(in lab,red,red)){.from-black\/55{--tw-gradient-from:color-mix(in oklab,var(--color-black)55%,transparent)}}.from-black\/55{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-indigo-500\/10{--tw-gradient-from:#625fff1a}@supports (color:color-mix(in lab,red,red)){.from-indigo-500\/10{--tw-gradient-from:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.from-indigo-500\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/8{--tw-gradient-from:#ffffff14}@supports (color:color-mix(in lab,red,red)){.from-white\/8{--tw-gradient-from:color-mix(in oklab,var(--color-white)8%,transparent)}}.from-white\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-white\/70{--tw-gradient-from:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.from-white\/70{--tw-gradient-from:color-mix(in oklab,var(--color-white)70%,transparent)}}.from-white\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-black\/0{--tw-gradient-via:#0000}@supports (color:color-mix(in lab,red,red)){.via-black\/0{--tw-gradient-via:color-mix(in oklab,var(--color-black)0%,transparent)}}.via-black\/0{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-white\/20{--tw-gradient-via:#fff3}@supports (color:color-mix(in lab,red,red)){.via-white\/20{--tw-gradient-via:color-mix(in oklab,var(--color-white)20%,transparent)}}.via-white\/20{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-black\/0{--tw-gradient-to:#0000}@supports (color:color-mix(in lab,red,red)){.to-black\/0{--tw-gradient-to:color-mix(in oklab,var(--color-black)0%,transparent)}}.to-black\/0{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-sky-500\/10{--tw-gradient-to:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.to-sky-500\/10{--tw-gradient-to:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.to-sky-500\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-white\/60{--tw-gradient-to:#fff9}@supports (color:color-mix(in lab,red,red)){.to-white\/60{--tw-gradient-to:color-mix(in oklab,var(--color-white)60%,transparent)}}.to-white\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.fill-gray-500{fill:var(--color-gray-500)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.object-bottom{object-position:bottom}.object-center{object-position:center}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-3\.5{padding-block:calc(var(--spacing)*3.5)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-3{padding-left:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\/6{font-size:var(--text-sm);line-height:calc(var(--spacing)*6)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-white{color:var(--color-white)!important}.text-amber-200{color:var(--color-amber-200)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-900{color:var(--color-amber-900)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-900{color:var(--color-emerald-900)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-800\/90{color:#1e2939e6}@supports (color:color-mix(in lab,red,red)){.text-gray-800\/90{color:color-mix(in oklab,var(--color-gray-800)90%,transparent)}}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-indigo-900{color:var(--color-indigo-900)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-rose-200{color:var(--color-rose-200)}.text-rose-500{color:var(--color-rose-500)}.text-rose-600{color:var(--color-rose-600)}.text-rose-900{color:var(--color-rose-900)}.text-rose-900\/80{color:#8b0836cc}@supports (color:color-mix(in lab,red,red)){.text-rose-900\/80{color:color-mix(in oklab,var(--color-rose-900)80%,transparent)}}.text-sky-200{color:var(--color-sky-200)}.text-sky-500{color:var(--color-sky-500)}.text-sky-600{color:var(--color-sky-600)}.text-sky-700{color:var(--color-sky-700)}.text-sky-800{color:var(--color-sky-800)}.text-sky-900{color:var(--color-sky-900)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/75{color:#ffffffbf}@supports (color:color-mix(in lab,red,red)){.text-white\/75{color:color-mix(in oklab,var(--color-white)75%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\/85{color:#ffffffd9}@supports (color:color-mix(in lab,red,red)){.text-white\/85{color:color-mix(in oklab,var(--color-white)85%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white)95%,transparent)}}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_2px_rgba\(0\,0\,0\,0\.25\)\,0_0_10px_rgba\(168\,85\,247\,0\.55\)\]{--tw-shadow:0 0 0 2px var(--tw-shadow-color,#00000040),0 0 10px var(--tw-shadow-color,#a855f78c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring,.inset-ring-1{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-amber-200{--tw-ring-color:var(--color-amber-200)}.ring-amber-200\/30{--tw-ring-color:#fee6854d}@supports (color:color-mix(in lab,red,red)){.ring-amber-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-amber-200)30%,transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.ring-black\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\/5{--tw-ring-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.ring-black\/10{--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.ring-black\/10{--tw-ring-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.ring-emerald-200{--tw-ring-color:var(--color-emerald-200)}.ring-emerald-300{--tw-ring-color:var(--color-emerald-300)}.ring-emerald-500\/25{--tw-ring-color:#00bb7f40}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/25{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)25%,transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.ring-gray-200{--tw-ring-color:var(--color-gray-200)}.ring-gray-200\/60{--tw-ring-color:#e5e7eb99}@supports (color:color-mix(in lab,red,red)){.ring-gray-200\/60{--tw-ring-color:color-mix(in oklab,var(--color-gray-200)60%,transparent)}}.ring-gray-900\/5{--tw-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.ring-gray-900\/5{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.ring-gray-900\/10{--tw-ring-color:#1018281a}@supports (color:color-mix(in lab,red,red)){.ring-gray-900\/10{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)10%,transparent)}}.ring-green-200{--tw-ring-color:var(--color-green-200)}.ring-indigo-100{--tw-ring-color:var(--color-indigo-100)}.ring-indigo-200{--tw-ring-color:var(--color-indigo-200)}.ring-red-200{--tw-ring-color:var(--color-red-200)}.ring-red-300{--tw-ring-color:var(--color-red-300)}.ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.ring-red-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.ring-rose-200\/30{--tw-ring-color:#ffccd34d}@supports (color:color-mix(in lab,red,red)){.ring-rose-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-rose-200)30%,transparent)}}.ring-sky-200{--tw-ring-color:var(--color-sky-200)}.ring-sky-200\/30{--tw-ring-color:#b8e6fe4d}@supports (color:color-mix(in lab,red,red)){.ring-sky-200\/30{--tw-ring-color:color-mix(in oklab,var(--color-sky-200)30%,transparent)}}.ring-slate-500\/30{--tw-ring-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.ring-slate-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-slate-500)30%,transparent)}}.ring-white{--tw-ring-color:var(--color-white)}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.ring-white\/15{--tw-ring-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.ring-white\/15{--tw-ring-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.ring-white\/20{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.ring-white\/20{--tw-ring-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.ring-white\/80{--tw-ring-color:#fffc}@supports (color:color-mix(in lab,red,red)){.ring-white\/80{--tw-ring-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.inset-ring-gray-300{--tw-inset-ring-color:var(--color-gray-300)}.inset-ring-gray-900\/5{--tw-inset-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.inset-ring-gray-900\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.inset-ring-indigo-300{--tw-inset-ring-color:var(--color-indigo-300)}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.-outline-offset-1{outline-offset:-1px}.outline-offset-2{outline-offset:2px}.outline-black\/5{outline-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.outline-black\/5{outline-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.outline-gray-300{outline-color:var(--color-gray-300)}.outline-indigo-600{outline-color:var(--color-indigo-600)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-2xl{--tw-blur:blur(var(--blur-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-md{--tw-blur:blur(var(--blur-md));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-xl{--tw-blur:blur(var(--blur-xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.brightness-90{--tw-brightness:brightness(90%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-\[2px\]{--tw-backdrop-blur:blur(2px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[height\]{transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,top\,width\,height\]{transition-property:left,top,width,height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[max-height\,opacity\]{transition-property:max-height,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-\[cubic-bezier\(\.2\,\.9\,\.2\,1\)\]{--tw-ease:cubic-bezier(.2,.9,.2,1);transition-timing-function:cubic-bezier(.2,.9,.2,1)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\[-ms-overflow-style\:none\]{-ms-overflow-style:none}.\[scrollbar-width\:none\]{scrollbar-width:none}.\[text-shadow\:_0_1px_0_rgba\(0\,0\,0\,0\.95\)\,_1px_0_0_rgba\(0\,0\,0\,0\.95\)\,_-1px_0_0_rgba\(0\,0\,0\,0\.95\)\,_0_-1px_0_rgba\(0\,0\,0\,0\.95\)\,_1px_1px_0_rgba\(0\,0\,0\,0\.8\)\,_-1px_1px_0_rgba\(0\,0\,0\,0\.8\)\,_1px_-1px_0_rgba\(0\,0\,0\,0\.8\)\,_-1px_-1px_0_rgba\(0\,0\,0\,0\.8\)\]{text-shadow:0 1px #000000f2,1px 0 #000000f2,-1px 0 #000000f2,0 -1px #000000f2,1px 1px #000c,-1px 1px #000c,1px -1px #000c,-1px -1px #000c}.ring-inset{--tw-ring-inset:inset}.group-focus-within\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:visible:is(:where(.group):hover *){visibility:visible}.group-hover\:h-1\.5:is(:where(.group):hover *){height:calc(var(--spacing)*1.5)}.group-hover\:translate-x-\[1px\]:is(:where(.group):hover *){--tw-translate-x:1px;translate:var(--tw-translate-x)var(--tw-translate-y)}.group-hover\:overflow-visible:is(:where(.group):hover *){overflow:visible}.group-hover\:rounded-full:is(:where(.group):hover *){border-radius:3.40282e38px}.group-hover\:text-gray-500:is(:where(.group):hover *){color:var(--color-gray-500)}.group-hover\:text-indigo-500:is(:where(.group):hover *){color:var(--color-indigo-500)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-focus-visible\:visible:is(:where(.group):focus-visible *){visibility:visible}.file\:mr-4::file-selector-button{margin-right:calc(var(--spacing)*4)}.file\:rounded-md::file-selector-button{border-radius:var(--radius-md)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-gray-100::file-selector-button{background-color:var(--color-gray-100)}.file\:px-3::file-selector-button{padding-inline:calc(var(--spacing)*3)}.file\:py-2::file-selector-button{padding-block:calc(var(--spacing)*2)}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-semibold::file-selector-button{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.file\:text-gray-900::file-selector-button{color:var(--color-gray-900)}.even\:bg-gray-50:nth-child(2n){background-color:var(--color-gray-50)}@media(hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing)*-.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:-translate-y-\[1px\]:hover{--tw-translate-y: -1px ;translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:scale-\[1\.03\]:hover{scale:1.03}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:border-indigo-200:hover{border-color:var(--color-indigo-200)}.hover\:border-transparent:hover{border-color:#0000}.hover\:\!bg-amber-600:hover{background-color:var(--color-amber-600)!important}.hover\:\!bg-blue-700:hover{background-color:var(--color-blue-700)!important}.hover\:\!bg-emerald-700:hover{background-color:var(--color-emerald-700)!important}.hover\:\!bg-indigo-700:hover{background-color:var(--color-indigo-700)!important}.hover\:\!bg-red-700:hover{background-color:var(--color-red-700)!important}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-black\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/5:hover{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-50\/80:hover{background-color:#f9fafbcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-50\/80:hover{background-color:color-mix(in oklab,var(--color-gray-50)80%,transparent)}}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\:bg-gray-100\/70:hover{background-color:#f3f4f6b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-100\/70:hover{background-color:color-mix(in oklab,var(--color-gray-100)70%,transparent)}}.hover\:bg-gray-200\/70:hover{background-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-200\/70:hover{background-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.hover\:bg-gray-200\/80:hover{background-color:#e5e7ebcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-200\/80:hover{background-color:color-mix(in oklab,var(--color-gray-200)80%,transparent)}}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-sky-100:hover{background-color:var(--color-sky-100)}.hover\:bg-transparent:hover{background-color:#0000}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/90:hover{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/90:hover{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.hover\:text-gray-500:hover{color:var(--color-gray-500)}.hover\:text-gray-600:hover{color:var(--color-gray-600)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-inherit:hover{color:inherit}.hover\:text-red-900:hover{color:var(--color-red-900)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:file\:bg-gray-200:hover::file-selector-button{background-color:var(--color-gray-200)}}.focus\:z-10:focus{z-index:10}.focus\:z-20:focus{z-index:20}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:-outline-offset-2:focus{outline-offset:-2px}.focus\:outline-offset-0:focus{outline-offset:0px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-indigo-600:focus{outline-color:var(--color-indigo-600)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-blue-500\/60:focus-visible{--tw-ring-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-blue-500\/60:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.focus-visible\:ring-indigo-500\/60:focus-visible{--tw-ring-color:#625fff99}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/60:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)60%,transparent)}}.focus-visible\:ring-indigo-500\/70:focus-visible{--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/70:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)70%,transparent)}}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-white:focus-visible{--tw-ring-offset-color:var(--color-white)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.focus-visible\:outline-blue-600:focus-visible{outline-color:var(--color-blue-600)}.focus-visible\:outline-emerald-600:focus-visible{outline-color:var(--color-emerald-600)}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-indigo-600:focus-visible{outline-color:var(--color-indigo-600)}.focus-visible\:outline-red-600:focus-visible{outline-color:var(--color-red-600)}.focus-visible\:outline-white\/70:focus-visible{outline-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.focus-visible\:outline-white\/70:focus-visible{outline-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.active\:translate-y-0:active{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-focus-visible\:outline-2:has(:focus-visible){outline-style:var(--tw-outline-style);outline-width:2px}.data-closed\:opacity-0[data-closed]{opacity:0}.data-enter\:transform[data-enter]{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.data-enter\:duration-200[data-enter]{--tw-duration:.2s;transition-duration:.2s}.data-enter\:ease-out[data-enter]{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.data-closed\:data-enter\:translate-y-2[data-closed][data-enter]{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-white\/25{background-color:#ffffff40}@supports (color:color-mix(in lab,red,red)){.supports-\[backdrop-filter\]\:bg-white\/25{background-color:color-mix(in oklab,var(--color-white)25%,transparent)}}.supports-\[backdrop-filter\]\:bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.supports-\[backdrop-filter\]\:bg-white\/60{background-color:color-mix(in oklab,var(--color-white)60%,transparent)}}}@media(prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}@media(min-width:40rem){.sm\:sticky{position:sticky}.sm\:top-0{top:calc(var(--spacing)*0)}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-4{grid-column:span 4/span 4}.sm\:col-span-8{grid-column:span 8/span 8}.sm\:col-span-9{grid-column:span 9/span 9}.sm\:mt-0{margin-top:calc(var(--spacing)*0)}.sm\:ml-16{margin-left:calc(var(--spacing)*16)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:h-52{height:calc(var(--spacing)*52)}.sm\:max-h-\[calc\(100vh-4rem\)\]{max-height:calc(100vh - 4rem)}.sm\:w-16{width:calc(var(--spacing)*16)}.sm\:w-\[260px\]{width:260px}.sm\:w-auto{width:auto}.sm\:min-w-\[220px\]{min-width:220px}.sm\:flex-1{flex:1}.sm\:flex-auto{flex:auto}.sm\:flex-none{flex:none}.sm\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\:grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:items-end{align-items:flex-end}.sm\:items-start{align-items:flex-start}.sm\:items-stretch{align-items:stretch}.sm\:justify-between{justify-content:space-between}.sm\:justify-end{justify-content:flex-end}.sm\:justify-start{justify-content:flex-start}.sm\:gap-3{gap:calc(var(--spacing)*3)}.sm\:gap-4{gap:calc(var(--spacing)*4)}:where(.sm\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.sm\:space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.sm\:rounded-lg{border-radius:var(--radius-lg)}.sm\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.sm\:border-gray-200\/70{border-color:#e5e7ebb3}@supports (color:color-mix(in lab,red,red)){.sm\:border-gray-200\/70{border-color:color-mix(in oklab,var(--color-gray-200)70%,transparent)}}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-6{padding:calc(var(--spacing)*6)}.sm\:px-3{padding-inline:calc(var(--spacing)*3)}.sm\:px-4{padding-inline:calc(var(--spacing)*4)}.sm\:px-6{padding-inline:calc(var(--spacing)*6)}.sm\:py-4{padding-block:calc(var(--spacing)*4)}.sm\:pt-2{padding-top:calc(var(--spacing)*2)}.sm\:pt-4{padding-top:calc(var(--spacing)*4)}.sm\:pt-6{padding-top:calc(var(--spacing)*6)}.sm\:pb-6{padding-bottom:calc(var(--spacing)*6)}.sm\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.sm\:data-closed\:data-enter\:-translate-x-2[data-closed][data-enter]{--tw-translate-x:calc(var(--spacing)*-2);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:data-closed\:data-enter\:translate-x-2[data-closed][data-enter]{--tw-translate-x:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:data-closed\:data-enter\:translate-y-0[data-closed][data-enter]{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}}@media(min-width:48rem){.md\:inset-x-auto{inset-inline:auto}.md\:right-auto{right:auto}.md\:bottom-4{bottom:calc(var(--spacing)*4)}.md\:left-1\/2{left:50%}.md\:inline-block{display:inline-block}.md\:w-\[min\(760px\,calc\(100vw-32px\)\)\]{width:min(760px,100vw - 32px)}.md\:-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-80{width:calc(var(--spacing)*80)}.lg\:w-\[320px\]{width:320px}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-inline:calc(var(--spacing)*8)}}@media(min-width:80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(prefers-color-scheme:dark){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:border-amber-400\/20{border-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.dark\:border-amber-400\/20{border-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.dark\:border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:border-emerald-400\/20{border-color:#00d29433}@supports (color:color-mix(in lab,red,red)){.dark\:border-emerald-400\/20{border-color:color-mix(in oklab,var(--color-emerald-400)20%,transparent)}}.dark\:border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.dark\:border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.dark\:border-indigo-400{border-color:var(--color-indigo-400)}.dark\:border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.dark\:border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:border-rose-400\/20{border-color:#ff667f33}@supports (color:color-mix(in lab,red,red)){.dark\:border-rose-400\/20{border-color:color-mix(in oklab,var(--color-rose-400)20%,transparent)}}.dark\:border-sky-400\/20{border-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:border-sky-400\/20{border-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:border-white\/60{border-color:#fff9}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/60{border-color:color-mix(in oklab,var(--color-white)60%,transparent)}}.dark\:border-t-transparent{border-top-color:#0000}.dark\:\!bg-amber-500{background-color:var(--color-amber-500)!important}.dark\:\!bg-blue-500{background-color:var(--color-blue-500)!important}.dark\:\!bg-emerald-500{background-color:var(--color-emerald-500)!important}.dark\:\!bg-indigo-500{background-color:var(--color-indigo-500)!important}.dark\:\!bg-red-500{background-color:var(--color-red-500)!important}.dark\:bg-amber-400\/10{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-400\/10{background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.dark\:bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.dark\:bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.dark\:bg-black\/8{background-color:#00000014}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/8{background-color:color-mix(in oklab,var(--color-black)8%,transparent)}}.dark\:bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.dark\:bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.dark\:bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.dark\:bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.dark\:bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:bg-emerald-400\/10{background-color:#00d2941a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-400\/10{background-color:color-mix(in oklab,var(--color-emerald-400)10%,transparent)}}.dark\:bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.dark\:bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.dark\:bg-gray-800{background-color:var(--color-gray-800)}.dark\:bg-gray-800\/50{background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/50{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:bg-gray-800\/70{background-color:#1e2939b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/70{background-color:color-mix(in oklab,var(--color-gray-800)70%,transparent)}}.dark\:bg-gray-800\/95{background-color:#1e2939f2}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/95{background-color:color-mix(in oklab,var(--color-gray-800)95%,transparent)}}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-gray-900\/40{background-color:#10182866}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/40{background-color:color-mix(in oklab,var(--color-gray-900)40%,transparent)}}.dark\:bg-gray-900\/50{background-color:#10182880}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/50{background-color:color-mix(in oklab,var(--color-gray-900)50%,transparent)}}.dark\:bg-gray-900\/60{background-color:#10182899}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/60{background-color:color-mix(in oklab,var(--color-gray-900)60%,transparent)}}.dark\:bg-gray-900\/70{background-color:#101828b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/70{background-color:color-mix(in oklab,var(--color-gray-900)70%,transparent)}}.dark\:bg-gray-900\/95{background-color:#101828f2}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/95{background-color:color-mix(in oklab,var(--color-gray-900)95%,transparent)}}.dark\:bg-gray-950{background-color:var(--color-gray-950)}.dark\:bg-gray-950\/35{background-color:#03071259}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/35{background-color:color-mix(in oklab,var(--color-gray-950)35%,transparent)}}.dark\:bg-gray-950\/40{background-color:#03071266}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/40{background-color:color-mix(in oklab,var(--color-gray-950)40%,transparent)}}.dark\:bg-gray-950\/60{background-color:#03071299}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/60{background-color:color-mix(in oklab,var(--color-gray-950)60%,transparent)}}.dark\:bg-gray-950\/70{background-color:#030712b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-950\/70{background-color:color-mix(in oklab,var(--color-gray-950)70%,transparent)}}.dark\:bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.dark\:bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.dark\:bg-indigo-400{background-color:var(--color-indigo-400)}.dark\:bg-indigo-400\/10{background-color:#7d87ff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-400\/10{background-color:color-mix(in oklab,var(--color-indigo-400)10%,transparent)}}.dark\:bg-indigo-500{background-color:var(--color-indigo-500)}.dark\:bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.dark\:bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:bg-indigo-500\/40{background-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/40{background-color:color-mix(in oklab,var(--color-indigo-500)40%,transparent)}}.dark\:bg-indigo-500\/70{background-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/70{background-color:color-mix(in oklab,var(--color-indigo-500)70%,transparent)}}.dark\:bg-red-400\/10{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-400\/10{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.dark\:bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:bg-rose-400\/10{background-color:#ff667f1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-rose-400\/10{background-color:color-mix(in oklab,var(--color-rose-400)10%,transparent)}}.dark\:bg-sky-400\/10{background-color:#00bcfe1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-400\/10{background-color:color-mix(in oklab,var(--color-sky-400)10%,transparent)}}.dark\:bg-sky-400\/20{background-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-400\/20{background-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.dark\:bg-slate-400\/10{background-color:#90a1b91a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-slate-400\/10{background-color:color-mix(in oklab,var(--color-slate-400)10%,transparent)}}.dark\:bg-transparent{background-color:#0000}.dark\:bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:bg-white\/35{background-color:#ffffff59}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/35{background-color:color-mix(in oklab,var(--color-white)35%,transparent)}}.dark\:bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-white)6%,transparent)}}.dark\:from-white\/10{--tw-gradient-from:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:from-white\/10{--tw-gradient-from:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:from-white\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.dark\:via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.dark\:to-white\/5{--tw-gradient-to:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:to-white\/5{--tw-gradient-to:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:to-white\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.dark\:fill-gray-400{fill:var(--color-gray-400)}.dark\:text-amber-200{color:var(--color-amber-200)}.dark\:text-amber-300{color:var(--color-amber-300)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-emerald-200{color:var(--color-emerald-200)}.dark\:text-emerald-300{color:var(--color-emerald-300)}.dark\:text-emerald-400{color:var(--color-emerald-400)}.dark\:text-gray-100{color:var(--color-gray-100)}.dark\:text-gray-200{color:var(--color-gray-200)}.dark\:text-gray-300{color:var(--color-gray-300)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-gray-500{color:var(--color-gray-500)}.dark\:text-gray-600{color:var(--color-gray-600)}.dark\:text-green-200{color:var(--color-green-200)}.dark\:text-green-300{color:var(--color-green-300)}.dark\:text-indigo-100{color:var(--color-indigo-100)}.dark\:text-indigo-200{color:var(--color-indigo-200)}.dark\:text-indigo-300{color:var(--color-indigo-300)}.dark\:text-indigo-400{color:var(--color-indigo-400)}.dark\:text-indigo-500{color:var(--color-indigo-500)}.dark\:text-red-200{color:var(--color-red-200)}.dark\:text-red-300{color:var(--color-red-300)}.dark\:text-red-400{color:var(--color-red-400)}.dark\:text-rose-200{color:var(--color-rose-200)}.dark\:text-rose-200\/80{color:#ffccd3cc}@supports (color:color-mix(in lab,red,red)){.dark\:text-rose-200\/80{color:color-mix(in oklab,var(--color-rose-200)80%,transparent)}}.dark\:text-rose-300{color:var(--color-rose-300)}.dark\:text-sky-100{color:var(--color-sky-100)}.dark\:text-sky-200{color:var(--color-sky-200)}.dark\:text-sky-300{color:var(--color-sky-300)}.dark\:text-slate-200{color:var(--color-slate-200)}.dark\:text-white{color:var(--color-white)}.dark\:text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.dark\:text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.dark\:text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.dark\:text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.dark\:\[color-scheme\:dark\]{color-scheme:dark}.dark\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:ring-amber-400\/20{--tw-ring-color:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.dark\:ring-amber-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-amber-400)20%,transparent)}}.dark\:ring-amber-400\/25{--tw-ring-color:#fcbb0040}@supports (color:color-mix(in lab,red,red)){.dark\:ring-amber-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-amber-400)25%,transparent)}}.dark\:ring-emerald-400\/20{--tw-ring-color:#00d29433}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-emerald-400)20%,transparent)}}.dark\:ring-emerald-400\/25{--tw-ring-color:#00d29440}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-emerald-400)25%,transparent)}}.dark\:ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:ring-gray-900\/60{--tw-ring-color:#10182899}@supports (color:color-mix(in lab,red,red)){.dark\:ring-gray-900\/60{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)60%,transparent)}}.dark\:ring-gray-950{--tw-ring-color:var(--color-gray-950)}.dark\:ring-green-400\/30{--tw-ring-color:#05df724d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-green-400\/30{--tw-ring-color:color-mix(in oklab,var(--color-green-400)30%,transparent)}}.dark\:ring-indigo-400\/20{--tw-ring-color:#7d87ff33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-indigo-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-indigo-400)20%,transparent)}}.dark\:ring-indigo-500\/20{--tw-ring-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-indigo-500\/20{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:ring-red-400\/25{--tw-ring-color:#ff656840}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-red-400)25%,transparent)}}.dark\:ring-red-400\/30{--tw-ring-color:#ff65684d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-400\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-400)30%,transparent)}}.dark\:ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:ring-sky-400\/20{--tw-ring-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:ring-sky-400\/20{--tw-ring-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:ring-slate-400\/25{--tw-ring-color:#90a1b940}@supports (color:color-mix(in lab,red,red)){.dark\:ring-slate-400\/25{--tw-ring-color:color-mix(in oklab,var(--color-slate-400)25%,transparent)}}.dark\:ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:ring-white\/10{--tw-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:ring-white\/15{--tw-ring-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.dark\:ring-white\/15{--tw-ring-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.dark\:inset-ring-gray-700{--tw-inset-ring-color:var(--color-gray-700)}.dark\:inset-ring-indigo-400\/50{--tw-inset-ring-color:#7d87ff80}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-indigo-400\/50{--tw-inset-ring-color:color-mix(in oklab,var(--color-indigo-400)50%,transparent)}}.dark\:inset-ring-white\/5{--tw-inset-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:inset-ring-white\/10{--tw-inset-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/10{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:outline{outline-style:var(--tw-outline-style);outline-width:1px}.dark\:-outline-offset-1{outline-offset:-1px}.dark\:outline-indigo-500{outline-color:var(--color-indigo-500)}.dark\:outline-white\/10{outline-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:outline-white\/10{outline-color:color-mix(in oklab,var(--color-white)10%,transparent)}}:is(.dark\:\*\:bg-gray-800>*){background-color:var(--color-gray-800)}@media(hover:hover){.dark\:group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.dark\:group-hover\:text-indigo-400:is(:where(.group):hover *){color:var(--color-indigo-400)}}.dark\:file\:bg-white\/10::file-selector-button{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:file\:bg-white\/10::file-selector-button{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:file\:text-white::file-selector-button{color:var(--color-white)}.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}@media(hover:hover){.dark\:hover\:border-indigo-400\/30:hover{border-color:#7d87ff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:border-indigo-400\/30:hover{border-color:color-mix(in oklab,var(--color-indigo-400)30%,transparent)}}.dark\:hover\:border-white\/20:hover{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:border-white\/20:hover{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:\!bg-amber-400:hover{background-color:var(--color-amber-400)!important}.dark\:hover\:\!bg-blue-400:hover{background-color:var(--color-blue-400)!important}.dark\:hover\:\!bg-emerald-400:hover{background-color:var(--color-emerald-400)!important}.dark\:hover\:\!bg-indigo-400:hover{background-color:var(--color-indigo-400)!important}.dark\:hover\:\!bg-red-400:hover{background-color:var(--color-red-400)!important}.dark\:hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:hover\:bg-black\/55:hover{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-black\/55:hover{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.dark\:hover\:bg-black\/60:hover{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-black\/60:hover{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.dark\:hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:hover\:bg-emerald-500\/30:hover{background-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-emerald-500\/30:hover{background-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:hover\:bg-indigo-500\/20:hover{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/20:hover{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:hover\:bg-indigo-500\/50:hover{background-color:#625fff80}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/50:hover{background-color:color-mix(in oklab,var(--color-indigo-500)50%,transparent)}}.dark\:hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:hover\:bg-sky-400\/20:hover{background-color:#00bcfe33}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-sky-400\/20:hover{background-color:color-mix(in oklab,var(--color-sky-400)20%,transparent)}}.dark\:hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:bg-white\/\[0\.09\]:hover{background-color:#ffffff17}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/\[0\.09\]:hover{background-color:color-mix(in oklab,var(--color-white)9%,transparent)}}.dark\:hover\:text-gray-200:hover{color:var(--color-gray-200)}.dark\:hover\:text-gray-300:hover{color:var(--color-gray-300)}.dark\:hover\:text-gray-400:hover{color:var(--color-gray-400)}.dark\:hover\:text-red-200:hover{color:var(--color-red-200)}.dark\:hover\:text-white:hover{color:var(--color-white)}.dark\:hover\:shadow-none:hover{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}}.dark\:focus\:outline-indigo-500:focus{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:ring-white\/40:focus-visible{--tw-ring-color:#fff6}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-white\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.dark\:focus-visible\:ring-offset-gray-950:focus-visible{--tw-ring-offset-color:var(--color-gray-950)}.dark\:focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.dark\:focus-visible\:outline-blue-500:focus-visible{outline-color:var(--color-blue-500)}.dark\:focus-visible\:outline-emerald-500:focus-visible{outline-color:var(--color-emerald-500)}.dark\:focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:outline-red-500:focus-visible{outline-color:var(--color-red-500)}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/25{background-color:#03071240}@supports (color:color-mix(in lab,red,red)){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/25{background-color:color-mix(in oklab,var(--color-gray-950)25%,transparent)}}.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/40{background-color:#03071266}@supports (color:color-mix(in lab,red,red)){.dark\:supports-\[backdrop-filter\]\:bg-gray-950\/40{background-color:color-mix(in oklab,var(--color-gray-950)40%,transparent)}}}}@media(min-width:40rem){@media(prefers-color-scheme:dark){.sm\:dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.sm\:dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}}}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}}:root{color-scheme:light dark;color:#ffffffde;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#242424;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}.video-js{position:relative}.video-js .vjs-control-bar{z-index:60;position:relative}.video-js .vjs-menu-button-popup .vjs-menu,.video-js .vjs-volume-panel .vjs-volume-control{z-index:9999!important}.vjs-mini .video-js .vjs-current-time,.vjs-mini .video-js .vjs-time-divider,.vjs-mini .video-js .vjs-duration{opacity:1!important;visibility:visible!important;display:flex!important}.vjs-mini .video-js .vjs-current-time-display,.vjs-mini .video-js .vjs-duration-display{display:inline!important}.video-js .vjs-time-control{width:auto!important;min-width:0!important;padding-left:.35em!important;padding-right:.35em!important}.video-js .vjs-time-divider{padding-left:.15em!important;padding-right:.15em!important}.video-js .vjs-time-divider>div{padding:0!important}.video-js .vjs-current-time-display,.video-js .vjs-duration-display{font-variant-numeric:tabular-nums;font-size:.95em}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-svg-icon:hover,.vjs-control:focus .vjs-svg-icon{filter:drop-shadow(0 0 .25em #fff)}.vjs-modal-dialog .vjs-modal-dialog-content,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff");font-weight:400;font-style:normal}.vjs-icon-play,.video-js .vjs-play-control .vjs-icon-placeholder,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{content:""}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:""}.vjs-icon-pause,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pause:before,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mute,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mute:before,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-low,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-low:before,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mid,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mid:before,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-high,.video-js .vjs-mute-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-high:before,.video-js .vjs-mute-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-enter,.video-js .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-enter:before,.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-exit,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-exit:before,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:""}.vjs-icon-subtitles,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-subtitles:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before{content:""}.vjs-icon-captions,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-captions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-captions:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-captions-button .vjs-icon-placeholder:before{content:""}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:""}.vjs-icon-chapters,.video-js .vjs-chapters-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-chapters:before,.video-js .vjs-chapters-button .vjs-icon-placeholder:before{content:""}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:""}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:""}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:""}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:""}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:""}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:""}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:""}.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder,.video-js .vjs-volume-level,.video-js .vjs-play-progress{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before,.video-js .vjs-volume-level:before,.video-js .vjs-play-progress:before{content:""}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:""}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:""}.vjs-icon-cancel,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cancel:before,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before{content:""}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:""}.vjs-icon-replay,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay:before,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-5,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-5:before,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-10,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-10:before,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-30,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-30:before,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-5,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-5:before,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-10,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-10:before,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-30,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-30:before,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-audio,.video-js .vjs-audio-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio:before,.video-js .vjs-audio-button .vjs-icon-placeholder:before{content:""}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:""}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:""}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:""}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:""}.vjs-icon-picture-in-picture-enter,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-enter:before,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-picture-in-picture-exit,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-exit:before,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:""}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:""}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:""}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:""}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:""}.vjs-icon-audio-description,.video-js .vjs-descriptions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio-description:before,.video-js .vjs-descriptions-button .vjs-icon-placeholder:before{content:""}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js *:before,.video-js *:after{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-fluid,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-1-1{width:100%;max-width:100%}.video-js.vjs-fluid:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-1-1:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;inset:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:#000000b3;padding:.5em;text-align:center;width:100%}.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text,.vjs-layout-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:#2b333fb3;border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js:hover .vjs-big-play-button,.video-js .vjs-big-play-button:focus{border-color:#fff;background-color:#73859f;background-color:#73859f80;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button,.vjs-error .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{outline:.0625em solid white;box-shadow:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:#000c;background:linear-gradient(180deg,#000c,#fff0);overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover,.js-focus-visible .vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:#73859f80}.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover,.js-focus-visible .vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon,.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible),.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible){background:none}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0em;margin-bottom:1.5em;border-top-color:#2b333fb3}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:#2b333fb3;position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu,.vjs-menu-button-popup .vjs-menu.vjs-lock-showing{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline:hover,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline.vjs-slider-active{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline:hover .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline.vjs-slider-active .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:#2b333fb3}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-has-started .vjs-control-bar,.vjs-audio-only-mode .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar,.vjs-error .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before,.video-js .vjs-control:focus{text-shadow:0em 0em 1em white}.video-js *:not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-play-progress,.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:#73859f80}.video-js .vjs-load-progress div{background:#73859fbf}.video-js .vjs-time-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display,.video-js.vjs-touch-enabled:not(.vjs-scrubbing) .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:#000c}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:#73859f80}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0em 0em 1em white;box-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid white}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translate(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:#2b333fb3}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:#000c}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;inset:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js:not(.vjs-live) .vjs-live-control,.video-js.vjs-liveui .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider,.video-js .vjs-current-time,.video-js .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;inset:0 0 3em;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset: 10px){.video-js .vjs-text-track-display>div{inset:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate>.vjs-menu-button,.vjs-playback-rate .vjs-playback-rate-value{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:before,.vjs-loading-spinner:after{content:"";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:before,.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" ";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover{width:auto;width:initial}.video-js.vjs-layout-x-small .vjs-progress-control,.video-js.vjs-layout-tiny .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:#2b333fbf;color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-font,.vjs-text-track-settings .vjs-track-settings-controls{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display: grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:focus,.vjs-track-settings-controls button:active{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f)}.vjs-track-settings-controls button:hover{color:#2b333fbf}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:#000000e6;background:linear-gradient(180deg,#000000e6,#000000b3 60%,#0000);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-title,.vjs-title-bar-description{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30{cursor:pointer}.video-js .vjs-transient-button{position:absolute;height:3em;display:flex;align-items:center;justify-content:center;background-color:#32323280;cursor:pointer;opacity:1;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:#323232e6}@media print{.video-js>*:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js *:focus:not(.focus-visible){outline:none}.video-js *:focus:not(:focus-visible){outline:none} diff --git a/backend/web/dist/assets/index-CIN0UidG.css b/backend/web/dist/assets/index-CIN0UidG.css deleted file mode 100644 index c38e9e1..0000000 --- a/backend/web/dist/assets/index-CIN0UidG.css +++ /dev/null @@ -1 +0,0 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-800:oklch(47.3% .137 46.201);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-500:oklch(72.3% .219 149.579);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-700:oklch(50% .134 242.749);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-pink-300:oklch(82.3% .12 346.018);--color-rose-300:oklch(81% .117 11.638);--color-rose-500:oklch(64.5% .246 16.439);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-lg:32rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--leading-tight:1.25;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-4{inset:calc(var(--spacing)*4)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-x-2{inset-inline:calc(var(--spacing)*2)}.inset-x-3{inset-inline:calc(var(--spacing)*3)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.right-12{right:calc(var(--spacing)*12)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-2{bottom:calc(var(--spacing)*2)}.bottom-3{bottom:calc(var(--spacing)*3)}.bottom-7{bottom:calc(var(--spacing)*7)}.left-0{left:calc(var(--spacing)*0)}.left-2{left:calc(var(--spacing)*2)}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.col-span-1{grid-column:span 1/span 1}.col-start-1{grid-column-start:1}.row-start-1{grid-row-start:1}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-auto{margin-inline:auto}.-my-1{margin-block:calc(var(--spacing)*-1)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.-mr-0\.5{margin-right:calc(var(--spacing)*-.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.-mb-px{margin-bottom:-1px}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-0\.5{margin-left:calc(var(--spacing)*-.5)}.-ml-px{margin-left:-1px}.ml-1\.5{margin-left:calc(var(--spacing)*1.5)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.block{display:block}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.size-1\.5{width:calc(var(--spacing)*1.5);height:calc(var(--spacing)*1.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing)*.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-9{height:calc(var(--spacing)*9)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-20{width:calc(var(--spacing)*20)}.w-28{width:calc(var(--spacing)*28)}.w-\[140px\]{width:140px}.w-\[220px\]{width:220px}.w-\[420px\]{width:420px}.w-full{width:100%}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[11rem\]{max-width:11rem}.max-w-\[70vw\]{max-width:70vw}.max-w-\[240px\]{max-width:240px}.max-w-\[520px\]{max-width:520px}.max-w-\[calc\(100vw-1\.5rem\)\]{max-width:calc(100vw - 1.5rem)}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-lg{max-width:var(--container-lg)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[220px\]{min-width:220px}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-4{--tw-translate-y:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-\[0\.98\]{scale:.98}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-1\.5{column-gap:calc(var(--spacing)*1.5)}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.-space-x-px>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(-1px*var(--tw-space-x-reverse));margin-inline-end:calc(-1px*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*4)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-8>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*8)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-x-reverse)))}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--color-gray-200)}.self-center{align-self:center}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-500{border-color:var(--color-indigo-500)}.border-transparent{border-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.bg-amber-500\/25{background-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/25{background-color:color-mix(in oklab,var(--color-amber-500)25%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\/5{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/45{background-color:#00000073}@supports (color:color-mix(in lab,red,red)){.bg-black\/45{background-color:color-mix(in oklab,var(--color-black)45%,transparent)}}.bg-black\/55{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.bg-black\/55{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-50\/60{background-color:#ecfdf599}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/60{background-color:color-mix(in oklab,var(--color-emerald-50)60%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-50\/90{background-color:#f9fafbe6}@supports (color:color-mix(in lab,red,red)){.bg-gray-50\/90{background-color:color-mix(in oklab,var(--color-gray-50)90%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-500\/75{background-color:#6a7282bf}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/75{background-color:color-mix(in oklab,var(--color-gray-500)75%,transparent)}}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-50\/60{background-color:#fef2f299}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/60{background-color:color-mix(in oklab,var(--color-red-50)60%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/35{background-color:#e4001459}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/35{background-color:color-mix(in oklab,var(--color-red-600)35%,transparent)}}.bg-red-600\/90{background-color:#e40014e6}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/90{background-color:color-mix(in oklab,var(--color-red-600)90%,transparent)}}.bg-sky-50{background-color:var(--color-sky-50)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.bg-white\/60{background-color:color-mix(in oklab,var(--color-white)60%,transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\/65{--tw-gradient-from:#000000a6}@supports (color:color-mix(in lab,red,red)){.from-black\/65{--tw-gradient-from:color-mix(in oklab,var(--color-black)65%,transparent)}}.from-black\/65{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\/70{--tw-gradient-from:#000000b3}@supports (color:color-mix(in lab,red,red)){.from-black\/70{--tw-gradient-from:color-mix(in oklab,var(--color-black)70%,transparent)}}.from-black\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.fill-gray-500{fill:var(--color-gray-500)}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-3\.5{padding-block:calc(var(--spacing)*3.5)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-\[env\(safe-area-inset-bottom\)\]{padding-bottom:env(safe-area-inset-bottom)}.pl-3{padding-left:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\/6{font-size:var(--text-sm);line-height:calc(var(--spacing)*6)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.whitespace-nowrap{white-space:nowrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-800{color:var(--color-amber-800)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-indigo-200{color:var(--color-indigo-200)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-pink-300{color:var(--color-pink-300)}.text-red-300{color:var(--color-red-300)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-rose-300{color:var(--color-rose-300)}.text-rose-500{color:var(--color-rose-500)}.text-sky-700{color:var(--color-sky-700)}.text-white{color:var(--color-white)}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.italic{font-style:italic}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring,.inset-ring-1{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-amber-200{--tw-ring-color:var(--color-amber-200)}.ring-black\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\/5{--tw-ring-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.ring-black\/10{--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.ring-black\/10{--tw-ring-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.ring-emerald-200{--tw-ring-color:var(--color-emerald-200)}.ring-emerald-300{--tw-ring-color:var(--color-emerald-300)}.ring-gray-200{--tw-ring-color:var(--color-gray-200)}.ring-gray-900\/5{--tw-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.ring-gray-900\/5{--tw-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.ring-red-200{--tw-ring-color:var(--color-red-200)}.ring-red-300{--tw-ring-color:var(--color-red-300)}.inset-ring-gray-300{--tw-inset-ring-color:var(--color-gray-300)}.inset-ring-gray-900\/5{--tw-inset-ring-color:#1018280d}@supports (color:color-mix(in lab,red,red)){.inset-ring-gray-900\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-gray-900)5%,transparent)}}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.-outline-offset-1{outline-offset:-1px}.outline-offset-2{outline-offset:2px}.outline-black\/5{outline-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.outline-black\/5{outline-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.outline-gray-300{outline-color:var(--color-gray-300)}.outline-indigo-600{outline-color:var(--color-indigo-600)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-md{--tw-blur:blur(var(--blur-md));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-\[1px\]{--tw-backdrop-blur:blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}.group-focus-within\:opacity-0:is(:where(.group):focus-within *){opacity:0}.group-focus-within\:opacity-100:is(:where(.group):focus-within *){opacity:1}@media(hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:visible:is(:where(.group):hover *){visibility:visible}.group-hover\:text-gray-500:is(:where(.group):hover *){color:var(--color-gray-500)}.group-hover\:opacity-0:is(:where(.group):hover *){opacity:0}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-focus-visible\:visible:is(:where(.group):focus-visible *){visibility:visible}.file\:mr-4::file-selector-button{margin-right:calc(var(--spacing)*4)}.file\:rounded-md::file-selector-button{border-radius:var(--radius-md)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-gray-100::file-selector-button{background-color:var(--color-gray-100)}.file\:px-3::file-selector-button{padding-inline:calc(var(--spacing)*3)}.file\:py-2::file-selector-button{padding-block:calc(var(--spacing)*2)}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-semibold::file-selector-button{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.file\:text-gray-900::file-selector-button{color:var(--color-gray-900)}.even\:bg-gray-50:nth-child(2n){background-color:var(--color-gray-50)}@media(hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing)*-.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\:border-transparent:hover{border-color:#0000}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-black\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/5:hover{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.hover\:bg-black\/10:hover{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/10:hover{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.hover\:bg-black\/55:hover{background-color:#0000008c}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/55:hover{background-color:color-mix(in oklab,var(--color-black)55%,transparent)}}.hover\:bg-black\/60:hover{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/60:hover{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.hover\:bg-black\/65:hover{background-color:#000000a6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/65:hover{background-color:color-mix(in oklab,var(--color-black)65%,transparent)}}.hover\:bg-black\/70:hover{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-black\/70:hover{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100\/70:hover{background-color:#f3f4f6b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-100\/70:hover{background-color:color-mix(in oklab,var(--color-gray-100)70%,transparent)}}.hover\:bg-indigo-100:hover{background-color:var(--color-indigo-100)}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-600\/55:hover{background-color:#e400148c}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-600\/55:hover{background-color:color-mix(in oklab,var(--color-red-600)55%,transparent)}}.hover\:bg-transparent:hover{background-color:#0000}.hover\:text-gray-500:hover{color:var(--color-gray-500)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}.hover\:text-inherit:hover{color:inherit}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:file\:bg-gray-200:hover::file-selector-button{background-color:var(--color-gray-200)}}.focus\:z-10:focus{z-index:10}.focus\:z-20:focus{z-index:20}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:-outline-offset-2:focus{outline-offset:-2px}.focus\:outline-offset-0:focus{outline-offset:0px}.focus\:outline-indigo-600:focus{outline-color:var(--color-indigo-600)}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.focus-visible\:outline-blue-600:focus-visible{outline-color:var(--color-blue-600)}.focus-visible\:outline-emerald-600:focus-visible{outline-color:var(--color-emerald-600)}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-indigo-600:focus-visible{outline-color:var(--color-indigo-600)}.focus-visible\:outline-red-600:focus-visible{outline-color:var(--color-red-600)}.focus-visible\:outline-white\/70:focus-visible{outline-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.focus-visible\:outline-white\/70:focus-visible{outline-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-focus-visible\:outline-2:has(:focus-visible){outline-style:var(--tw-outline-style);outline-width:2px}@media(min-width:40rem){.sm\:inset-6{inset:calc(var(--spacing)*6)}.sm\:right-4{right:calc(var(--spacing)*4)}.sm\:bottom-4{bottom:calc(var(--spacing)*4)}.sm\:left-auto{left:auto}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-9{grid-column:span 9/span 9}.sm\:mt-0{margin-top:calc(var(--spacing)*0)}.sm\:ml-16{margin-left:calc(var(--spacing)*16)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:inline{display:inline}.sm\:w-\[420px\]{width:420px}.sm\:max-w-\[320px\]{max-width:320px}.sm\:flex-1{flex:1}.sm\:flex-auto{flex:auto}.sm\:flex-none{flex:none}.sm\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\:scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:calc(var(--spacing)*4)}.sm\:rounded-lg{border-radius:var(--radius-lg)}.sm\:p-0{padding:calc(var(--spacing)*0)}.sm\:p-6{padding:calc(var(--spacing)*6)}.sm\:px-6{padding-inline:calc(var(--spacing)*6)}}@media(min-width:48rem){.md\:inline-block{display:inline-block}}@media(min-width:64rem){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:px-8{padding-inline:calc(var(--spacing)*8)}}@media(prefers-color-scheme:dark){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){:where(.dark\:divide-white\/10>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:border-indigo-400{border-color:var(--color-indigo-400)}.dark\:border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:bg-amber-500{background-color:var(--color-amber-500)}.dark\:bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.dark\:bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500)15%,transparent)}}.dark\:bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.dark\:bg-blue-500{background-color:var(--color-blue-500)}.dark\:bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.dark\:bg-emerald-500{background-color:var(--color-emerald-500)}.dark\:bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.dark\:bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.dark\:bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.dark\:bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.dark\:bg-gray-800{background-color:var(--color-gray-800)}.dark\:bg-gray-800\/50{background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/50{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\:bg-gray-800\/70{background-color:#1e2939b3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-800\/70{background-color:color-mix(in oklab,var(--color-gray-800)70%,transparent)}}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-gray-900\/40{background-color:#10182866}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/40{background-color:color-mix(in oklab,var(--color-gray-900)40%,transparent)}}.dark\:bg-gray-900\/50{background-color:#10182880}@supports (color:color-mix(in lab,red,red)){.dark\:bg-gray-900\/50{background-color:color-mix(in oklab,var(--color-gray-900)50%,transparent)}}.dark\:bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.dark\:bg-indigo-400{background-color:var(--color-indigo-400)}.dark\:bg-indigo-500{background-color:var(--color-indigo-500)}.dark\:bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.dark\:bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/20{background-color:color-mix(in oklab,var(--color-indigo-500)20%,transparent)}}.dark\:bg-red-500{background-color:var(--color-red-500)}.dark\:bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\:bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.dark\:bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.dark\:bg-sky-500\/10{background-color:#00a5ef1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-sky-500\/10{background-color:color-mix(in oklab,var(--color-sky-500)10%,transparent)}}.dark\:bg-transparent{background-color:#0000}.dark\:bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:fill-gray-400{fill:var(--color-gray-400)}.dark\:text-amber-200{color:var(--color-amber-200)}.dark\:text-amber-300{color:var(--color-amber-300)}.dark\:text-amber-400{color:var(--color-amber-400)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-emerald-300{color:var(--color-emerald-300)}.dark\:text-emerald-400{color:var(--color-emerald-400)}.dark\:text-gray-100{color:var(--color-gray-100)}.dark\:text-gray-200{color:var(--color-gray-200)}.dark\:text-gray-300{color:var(--color-gray-300)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-gray-500{color:var(--color-gray-500)}.dark\:text-gray-600{color:var(--color-gray-600)}.dark\:text-green-200{color:var(--color-green-200)}.dark\:text-indigo-200{color:var(--color-indigo-200)}.dark\:text-indigo-300{color:var(--color-indigo-300)}.dark\:text-indigo-400{color:var(--color-indigo-400)}.dark\:text-indigo-500{color:var(--color-indigo-500)}.dark\:text-red-200{color:var(--color-red-200)}.dark\:text-red-300{color:var(--color-red-300)}.dark\:text-red-400{color:var(--color-red-400)}.dark\:text-sky-200{color:var(--color-sky-200)}.dark\:text-white{color:var(--color-white)}.dark\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-amber-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:ring-red-500\/30{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:ring-red-500\/30{--tw-ring-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:ring-white\/10{--tw-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:inset-ring-gray-700{--tw-inset-ring-color:var(--color-gray-700)}.dark\:inset-ring-white\/5{--tw-inset-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/5{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:inset-ring-white\/10{--tw-inset-ring-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:inset-ring-white\/10{--tw-inset-ring-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:outline{outline-style:var(--tw-outline-style);outline-width:1px}.dark\:-outline-offset-1{outline-offset:-1px}.dark\:outline-indigo-500{outline-color:var(--color-indigo-500)}.dark\:outline-white\/10{outline-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:outline-white\/10{outline-color:color-mix(in oklab,var(--color-white)10%,transparent)}}:is(.dark\:\*\:bg-gray-800>*){background-color:var(--color-gray-800)}@media(hover:hover){.dark\:group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}}.dark\:file\:bg-white\/10::file-selector-button{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:file\:bg-white\/10::file-selector-button{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:file\:text-white::file-selector-button{color:var(--color-white)}.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\:even\:bg-gray-800\/50:nth-child(2n){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}@media(hover:hover){.dark\:hover\:border-white\/20:hover{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:border-white\/20:hover{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.dark\:hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.dark\:hover\:bg-blue-400:hover{background-color:var(--color-blue-400)}.dark\:hover\:bg-blue-500\/30:hover{background-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-blue-500\/30:hover{background-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.dark\:hover\:bg-emerald-400:hover{background-color:var(--color-emerald-400)}.dark\:hover\:bg-emerald-500\/30:hover{background-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-emerald-500\/30:hover{background-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.dark\:hover\:bg-indigo-400:hover{background-color:var(--color-indigo-400)}.dark\:hover\:bg-indigo-500\/30:hover{background-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-indigo-500\/30:hover{background-color:color-mix(in oklab,var(--color-indigo-500)30%,transparent)}}.dark\:hover\:bg-red-400:hover{background-color:var(--color-red-400)}.dark\:hover\:bg-red-500\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-red-500\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.dark\:hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.dark\:hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.dark\:hover\:bg-white\/15:hover{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/15:hover{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.dark\:hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.dark\:hover\:text-gray-200:hover{color:var(--color-gray-200)}.dark\:hover\:text-gray-300:hover{color:var(--color-gray-300)}.dark\:hover\:text-gray-400:hover{color:var(--color-gray-400)}.dark\:hover\:text-white:hover{color:var(--color-white)}.dark\:hover\:shadow-none:hover{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:file\:bg-white\/20:hover::file-selector-button{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}}.dark\:focus\:outline-indigo-500:focus{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:outline-amber-500:focus-visible{outline-color:var(--color-amber-500)}.dark\:focus-visible\:outline-blue-500:focus-visible{outline-color:var(--color-blue-500)}.dark\:focus-visible\:outline-emerald-500:focus-visible{outline-color:var(--color-emerald-500)}.dark\:focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.dark\:focus-visible\:outline-red-500:focus-visible{outline-color:var(--color-red-500)}}}:root{color-scheme:light dark;color:#ffffffde;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#242424;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-svg-icon:hover,.vjs-control:focus .vjs-svg-icon{filter:drop-shadow(0 0 .25em #fff)}.vjs-modal-dialog .vjs-modal-dialog-content,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff");font-weight:400;font-style:normal}.vjs-icon-play,.video-js .vjs-play-control .vjs-icon-placeholder,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{content:""}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:""}.vjs-icon-pause,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pause:before,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mute,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mute:before,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-low,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-low:before,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-mid,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mid:before,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before{content:""}.vjs-icon-volume-high,.video-js .vjs-mute-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-high:before,.video-js .vjs-mute-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-enter,.video-js .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-enter:before,.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-fullscreen-exit,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-exit:before,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before{content:""}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:""}.vjs-icon-subtitles,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-subtitles:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before{content:""}.vjs-icon-captions,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-captions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-captions:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-captions-button .vjs-icon-placeholder:before{content:""}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:""}.vjs-icon-chapters,.video-js .vjs-chapters-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-chapters:before,.video-js .vjs-chapters-button .vjs-icon-placeholder:before{content:""}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:""}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:""}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:""}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:""}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:""}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:""}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:""}.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder,.video-js .vjs-volume-level,.video-js .vjs-play-progress{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before,.video-js .vjs-volume-level:before,.video-js .vjs-play-progress:before{content:""}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:""}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:""}.vjs-icon-cancel,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cancel:before,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before{content:""}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:""}.vjs-icon-replay,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay:before,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-5,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-5:before,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-10,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-10:before,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-replay-30,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-30:before,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-5,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-5:before,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-10,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-10:before,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before{content:""}.vjs-icon-forward-30,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-30:before,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before{content:""}.vjs-icon-audio,.video-js .vjs-audio-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio:before,.video-js .vjs-audio-button .vjs-icon-placeholder:before{content:""}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:""}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:""}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:""}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:""}.vjs-icon-picture-in-picture-enter,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-enter:before,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-picture-in-picture-exit,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-exit:before,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:""}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:""}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:""}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:""}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:""}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:""}.vjs-icon-audio-description,.video-js .vjs-descriptions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio-description:before,.video-js .vjs-descriptions-button .vjs-icon-placeholder:before{content:""}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js *:before,.video-js *:after{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-fluid,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-1-1{width:100%;max-width:100%}.video-js.vjs-fluid:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-1-1:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;inset:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:#000000b3;padding:.5em;text-align:center;width:100%}.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text,.vjs-layout-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:#2b333fb3;border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js:hover .vjs-big-play-button,.video-js .vjs-big-play-button:focus{border-color:#fff;background-color:#73859f;background-color:#73859f80;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button,.vjs-error .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{outline:.0625em solid white;box-shadow:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:#000c;background:linear-gradient(180deg,#000c,#fff0);overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover,.js-focus-visible .vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:#73859f80}.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover,.js-focus-visible .vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon,.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible),.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible){background:none}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0em;margin-bottom:1.5em;border-top-color:#2b333fb3}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:#2b333fb3;position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu,.vjs-menu-button-popup .vjs-menu.vjs-lock-showing{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline:hover,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline.vjs-slider-active{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline:hover .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline.vjs-slider-active .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:#2b333fb3}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-has-started .vjs-control-bar,.vjs-audio-only-mode .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar,.vjs-error .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before,.video-js .vjs-control:focus{text-shadow:0em 0em 1em white}.video-js *:not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-play-progress,.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:#73859f80}.video-js .vjs-load-progress div{background:#73859fbf}.video-js .vjs-time-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display,.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display,.video-js.vjs-touch-enabled:not(.vjs-scrubbing) .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:#000c}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:#73859f80}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0em 0em 1em white;box-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid white}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translate(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:#2b333fb3}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:#000c}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;inset:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js:not(.vjs-live) .vjs-live-control,.video-js.vjs-liveui .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider,.video-js .vjs-current-time,.video-js .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;inset:0 0 3em;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset: 10px){.video-js .vjs-text-track-display>div{inset:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate>.vjs-menu-button,.vjs-playback-rate .vjs-playback-rate-value{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:before,.vjs-loading-spinner:after{content:"";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:before,.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" ";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover{width:auto;width:initial}.video-js.vjs-layout-x-small .vjs-progress-control,.video-js.vjs-layout-tiny .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:#2b333fbf;color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-font,.vjs-text-track-settings .vjs-track-settings-controls{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display: grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:focus,.vjs-track-settings-controls button:active{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f)}.vjs-track-settings-controls button:hover{color:#2b333fbf}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:#000000e6;background:linear-gradient(180deg,#000000e6,#000000b3 60%,#0000);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-title,.vjs-title-bar-description{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30{cursor:pointer}.video-js .vjs-transient-button{position:absolute;height:3em;display:flex;align-items:center;justify-content:center;background-color:#32323280;cursor:pointer;opacity:1;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:#323232e6}@media print{.video-js>*:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js *:focus:not(.focus-visible){outline:none}.video-js *:focus:not(:focus-visible){outline:none} diff --git a/backend/web/dist/assets/index-BjA9ZqZd.js b/backend/web/dist/assets/index-DNoPI-qJ.js similarity index 53% rename from backend/web/dist/assets/index-BjA9ZqZd.js rename to backend/web/dist/assets/index-DNoPI-qJ.js index 8046aba..d075cda 100644 --- a/backend/web/dist/assets/index-BjA9ZqZd.js +++ b/backend/web/dist/assets/index-DNoPI-qJ.js @@ -1,77 +1,77 @@ -function $I(s,e){for(var t=0;ti[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();var o0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function HI(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var e=s.default;if(typeof e=="function"){var t=function i(){var n=!1;try{n=this instanceof i}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return s[i]}})}),t}var Ty={exports:{}},Yd={};var y_;function zI(){if(y_)return Yd;y_=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,n,r){var a=null;if(r!==void 0&&(a=""+r),n.key!==void 0&&(a=""+n.key),"key"in n){r={};for(var u in n)u!=="key"&&(r[u]=n[u])}else r=n;return n=r.ref,{$$typeof:s,type:i,key:a,ref:n!==void 0?n:null,props:r}}return Yd.Fragment=e,Yd.jsx=t,Yd.jsxs=t,Yd}var v_;function VI(){return v_||(v_=1,Ty.exports=zI()),Ty.exports}var g=VI(),Sy={exports:{}},Ti={};var x_;function GI(){if(x_)return Ti;x_=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function v(U){return U===null||typeof U!="object"?null:(U=y&&U[y]||U["@@iterator"],typeof U=="function"?U:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,E={};function D(U,ne,Z){this.props=U,this.context=ne,this.refs=E,this.updater=Z||b}D.prototype.isReactComponent={},D.prototype.setState=function(U,ne){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,ne,"setState")},D.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function O(){}O.prototype=D.prototype;function R(U,ne,Z){this.props=U,this.context=ne,this.refs=E,this.updater=Z||b}var j=R.prototype=new O;j.constructor=R,T(j,D.prototype),j.isPureReactComponent=!0;var F=Array.isArray;function z(){}var N={H:null,A:null,T:null,S:null},Y=Object.prototype.hasOwnProperty;function L(U,ne,Z){var fe=Z.ref;return{$$typeof:s,type:U,key:ne,ref:fe!==void 0?fe:null,props:Z}}function I(U,ne){return L(U.type,ne,U.props)}function X(U){return typeof U=="object"&&U!==null&&U.$$typeof===s}function G(U){var ne={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(Z){return ne[Z]})}var q=/\/+/g;function ae(U,ne){return typeof U=="object"&&U!==null&&U.key!=null?G(""+U.key):ne.toString(36)}function ie(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(z,z):(U.status="pending",U.then(function(ne){U.status==="pending"&&(U.status="fulfilled",U.value=ne)},function(ne){U.status==="pending"&&(U.status="rejected",U.reason=ne)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function W(U,ne,Z,fe,xe){var ge=typeof U;(ge==="undefined"||ge==="boolean")&&(U=null);var Ce=!1;if(U===null)Ce=!0;else switch(ge){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(U.$$typeof){case s:case e:Ce=!0;break;case f:return Ce=U._init,W(Ce(U._payload),ne,Z,fe,xe)}}if(Ce)return xe=xe(U),Ce=fe===""?"."+ae(U,0):fe,F(xe)?(Z="",Ce!=null&&(Z=Ce.replace(q,"$&/")+"/"),W(xe,ne,Z,"",function(Ae){return Ae})):xe!=null&&(X(xe)&&(xe=I(xe,Z+(xe.key==null||U&&U.key===xe.key?"":(""+xe.key).replace(q,"$&/")+"/")+Ce)),ne.push(xe)),1;Ce=0;var Me=fe===""?".":fe+":";if(F(U))for(var Re=0;Re>>1,re=W[te];if(0>>1;ten(Z,Q))fen(xe,Z)?(W[te]=xe,W[fe]=Q,te=fe):(W[te]=Z,W[ne]=Q,te=ne);else if(fen(xe,Q))W[te]=xe,W[fe]=Q,te=fe;else break e}}return K}function n(W,K){var Q=W.sortIndex-K.sortIndex;return Q!==0?Q:W.id-K.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var a=Date,u=a.now();s.unstable_now=function(){return a.now()-u}}var c=[],d=[],f=1,p=null,y=3,v=!1,b=!1,T=!1,E=!1,D=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function j(W){for(var K=t(d);K!==null;){if(K.callback===null)i(d);else if(K.startTime<=W)i(d),K.sortIndex=K.expirationTime,e(c,K);else break;K=t(d)}}function F(W){if(T=!1,j(W),!b)if(t(c)!==null)b=!0,z||(z=!0,G());else{var K=t(d);K!==null&&ie(F,K.startTime-W)}}var z=!1,N=-1,Y=5,L=-1;function I(){return E?!0:!(s.unstable_now()-LW&&I());){var te=p.callback;if(typeof te=="function"){p.callback=null,y=p.priorityLevel;var re=te(p.expirationTime<=W);if(W=s.unstable_now(),typeof re=="function"){p.callback=re,j(W),K=!0;break t}p===t(c)&&i(c),j(W)}else i(c);p=t(c)}if(p!==null)K=!0;else{var U=t(d);U!==null&&ie(F,U.startTime-W),K=!1}}break e}finally{p=null,y=Q,v=!1}K=void 0}}finally{K?G():z=!1}}}var G;if(typeof R=="function")G=function(){R(X)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,ae=q.port2;q.port1.onmessage=X,G=function(){ae.postMessage(null)}}else G=function(){D(X,0)};function ie(W,K){N=D(function(){W(s.unstable_now())},K)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(W){W.callback=null},s.unstable_forceFrameRate=function(W){0>W||125te?(W.sortIndex=Q,e(d,W),t(c)===null&&W===t(d)&&(T?(O(N),N=-1):T=!0,ie(F,Q-te))):(W.sortIndex=re,e(c,W),b||v||(b=!0,z||(z=!0,G()))),W},s.unstable_shouldYield=I,s.unstable_wrapCallback=function(W){var K=y;return function(){var Q=y;y=K;try{return W.apply(this,arguments)}finally{y=Q}}}})(wy)),wy}var __;function KI(){return __||(__=1,Ey.exports=qI()),Ey.exports}var Ay={exports:{}},Un={};var E_;function WI(){if(E_)return Un;E_=1;var s=Y0();function e(c){var d="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),Ay.exports=WI(),Ay.exports}var A_;function YI(){if(A_)return Xd;A_=1;var s=KI(),e=Y0(),t=dA();function i(o){var l="https://react.dev/errors/"+o;if(1re||(o.current=te[re],te[re]=null,re--)}function Z(o,l){re++,te[re]=o.current,o.current=l}var fe=U(null),xe=U(null),ge=U(null),Ce=U(null);function Me(o,l){switch(Z(ge,l),Z(xe,o),Z(fe,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?jS(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=jS(l),o=$S(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}ne(fe),Z(fe,o)}function Re(){ne(fe),ne(xe),ne(ge)}function Ae(o){o.memoizedState!==null&&Z(Ce,o);var l=fe.current,h=$S(l,o.type);l!==h&&(Z(xe,o),Z(fe,h))}function be(o){xe.current===o&&(ne(fe),ne(xe)),Ce.current===o&&(ne(Ce),Gd._currentValue=Q)}var Pe,gt;function Ye(o){if(Pe===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);Pe=l&&l[1]||"",gt=-1i[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();var h0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function QI(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var e=s.default;if(typeof e=="function"){var t=function i(){var n=!1;try{n=this instanceof i}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return s[i]}})}),t}var _y={exports:{}},Xd={};var b_;function ZI(){if(b_)return Xd;b_=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,n,r){var a=null;if(r!==void 0&&(a=""+r),n.key!==void 0&&(a=""+n.key),"key"in n){r={};for(var u in n)u!=="key"&&(r[u]=n[u])}else r=n;return n=r.ref,{$$typeof:s,type:i,key:a,ref:n!==void 0?n:null,props:r}}return Xd.Fragment=e,Xd.jsx=t,Xd.jsxs=t,Xd}var T_;function JI(){return T_||(T_=1,_y.exports=ZI()),_y.exports}var p=JI(),Ey={exports:{}},ki={};var S_;function eN(){if(S_)return ki;S_=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function v(z){return z===null||typeof z!="object"?null:(z=y&&z[y]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,E={};function D(z,re,Q){this.props=z,this.context=re,this.refs=E,this.updater=Q||b}D.prototype.isReactComponent={},D.prototype.setState=function(z,re){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,re,"setState")},D.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function O(){}O.prototype=D.prototype;function R(z,re,Q){this.props=z,this.context=re,this.refs=E,this.updater=Q||b}var j=R.prototype=new O;j.constructor=R,T(j,D.prototype),j.isPureReactComponent=!0;var F=Array.isArray;function G(){}var L={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function I(z,re,Q){var pe=Q.ref;return{$$typeof:s,type:z,key:re,ref:pe!==void 0?pe:null,props:Q}}function N(z,re){return I(z.type,re,z.props)}function X(z){return typeof z=="object"&&z!==null&&z.$$typeof===s}function V(z){var re={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Q){return re[Q]})}var Y=/\/+/g;function ne(z,re){return typeof z=="object"&&z!==null&&z.key!=null?V(""+z.key):re.toString(36)}function ie(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(G,G):(z.status="pending",z.then(function(re){z.status==="pending"&&(z.status="fulfilled",z.value=re)},function(re){z.status==="pending"&&(z.status="rejected",z.reason=re)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function K(z,re,Q,pe,be){var ve=typeof z;(ve==="undefined"||ve==="boolean")&&(z=null);var we=!1;if(z===null)we=!0;else switch(ve){case"bigint":case"string":case"number":we=!0;break;case"object":switch(z.$$typeof){case s:case e:we=!0;break;case f:return we=z._init,K(we(z._payload),re,Q,pe,be)}}if(we)return be=be(z),we=pe===""?"."+ne(z,0):pe,F(be)?(Q="",we!=null&&(Q=we.replace(Y,"$&/")+"/"),K(be,re,Q,"",function(Ze){return Ze})):be!=null&&(X(be)&&(be=N(be,Q+(be.key==null||z&&z.key===be.key?"":(""+be.key).replace(Y,"$&/")+"/")+we)),re.push(be)),1;we=0;var He=pe===""?".":pe+":";if(F(z))for(var Fe=0;Fe>>1,le=K[te];if(0>>1;ten(Q,Z))pen(be,Q)?(K[te]=be,K[pe]=Z,te=pe):(K[te]=Q,K[re]=Z,te=re);else if(pen(be,Z))K[te]=be,K[pe]=Z,te=pe;else break e}}return q}function n(K,q){var Z=K.sortIndex-q.sortIndex;return Z!==0?Z:K.id-q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var a=Date,u=a.now();s.unstable_now=function(){return a.now()-u}}var c=[],d=[],f=1,g=null,y=3,v=!1,b=!1,T=!1,E=!1,D=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function j(K){for(var q=t(d);q!==null;){if(q.callback===null)i(d);else if(q.startTime<=K)i(d),q.sortIndex=q.expirationTime,e(c,q);else break;q=t(d)}}function F(K){if(T=!1,j(K),!b)if(t(c)!==null)b=!0,G||(G=!0,V());else{var q=t(d);q!==null&&ie(F,q.startTime-K)}}var G=!1,L=-1,W=5,I=-1;function N(){return E?!0:!(s.unstable_now()-IK&&N());){var te=g.callback;if(typeof te=="function"){g.callback=null,y=g.priorityLevel;var le=te(g.expirationTime<=K);if(K=s.unstable_now(),typeof le=="function"){g.callback=le,j(K),q=!0;break t}g===t(c)&&i(c),j(K)}else i(c);g=t(c)}if(g!==null)q=!0;else{var z=t(d);z!==null&&ie(F,z.startTime-K),q=!1}}break e}finally{g=null,y=Z,v=!1}q=void 0}}finally{q?V():G=!1}}}var V;if(typeof R=="function")V=function(){R(X)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,ne=Y.port2;Y.port1.onmessage=X,V=function(){ne.postMessage(null)}}else V=function(){D(X,0)};function ie(K,q){L=D(function(){K(s.unstable_now())},q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(K){K.callback=null},s.unstable_forceFrameRate=function(K){0>K||125te?(K.sortIndex=Z,e(d,K),t(c)===null&&K===t(d)&&(T?(O(L),L=-1):T=!0,ie(F,Z-te))):(K.sortIndex=le,e(c,K),b||v||(b=!0,G||(G=!0,V()))),K},s.unstable_shouldYield=N,s.unstable_wrapCallback=function(K){var q=y;return function(){var Z=y;y=q;try{return K.apply(this,arguments)}finally{y=Z}}}})(ky)),ky}var A_;function iN(){return A_||(A_=1,Ay.exports=tN()),Ay.exports}var Cy={exports:{}},Vn={};var k_;function sN(){if(k_)return Vn;k_=1;var s=J0();function e(c){var d="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),Cy.exports=sN(),Cy.exports}var D_;function nN(){if(D_)return Qd;D_=1;var s=iN(),e=J0(),t=xA();function i(o){var l="https://react.dev/errors/"+o;if(1le||(o.current=te[le],te[le]=null,le--)}function Q(o,l){le++,te[le]=o.current,o.current=l}var pe=z(null),be=z(null),ve=z(null),we=z(null);function He(o,l){switch(Q(ve,l),Q(be,o),Q(pe,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?zS(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=zS(l),o=VS(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}re(pe),Q(pe,o)}function Fe(){re(pe),re(be),re(ve)}function Ze(o){o.memoizedState!==null&&Q(we,o);var l=pe.current,h=VS(l,o.type);l!==h&&(Q(be,o),Q(pe,h))}function De(o){be.current===o&&(re(pe),re(be)),we.current===o&&(re(we),qd._currentValue=Z)}var Ye,wt;function vt(o){if(Ye===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);Ye=l&&l[1]||"",wt=-1)":-1S||me[m]!==je[S]){var Ze=` -`+me[m].replace(" at new "," at ");return o.displayName&&Ze.includes("")&&(Ze=Ze.replace("",o.displayName)),Ze}while(1<=m&&0<=S);break}}}finally{lt=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?Ye(h):""}function ht(o,l){switch(o.tag){case 26:case 27:case 5:return Ye(o.type);case 16:return Ye("Lazy");case 13:return o.child!==l&&l!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return Ve(o.type,!1);case 11:return Ve(o.type.render,!1);case 1:return Ve(o.type,!0);case 31:return Ye("Activity");default:return""}}function st(o){try{var l="",h=null;do l+=ht(o,h),h=o,o=o.return;while(o);return l}catch(m){return` +`+Ye+o+wt}var Ge=!1;function ke(o,l){if(!o||Ge)return"";Ge=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var dt=function(){throw Error()};if(Object.defineProperty(dt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(dt,[])}catch(Qe){var Ve=Qe}Reflect.construct(o,[],dt)}else{try{dt.call()}catch(Qe){Ve=Qe}o.call(dt.prototype)}}else{try{throw Error()}catch(Qe){Ve=Qe}(dt=o())&&typeof dt.catch=="function"&&dt.catch(function(){})}}catch(Qe){if(Qe&&Ve&&typeof Qe.stack=="string")return[Qe.stack,Ve.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var S=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");S&&S.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=m.DetermineComponentFrameRoot(),B=w[0],J=w[1];if(B&&J){var ye=B.split(` +`),$e=J.split(` +`);for(S=m=0;mS||ye[m]!==$e[S]){var nt=` +`+ye[m].replace(" at new "," at ");return o.displayName&&nt.includes("")&&(nt=nt.replace("",o.displayName)),nt}while(1<=m&&0<=S);break}}}finally{Ge=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?vt(h):""}function ut(o,l){switch(o.tag){case 26:case 27:case 5:return vt(o.type);case 16:return vt("Lazy");case 13:return o.child!==l&&l!==null?vt("Suspense Fallback"):vt("Suspense");case 19:return vt("SuspenseList");case 0:case 15:return ke(o.type,!1);case 11:return ke(o.type.render,!1);case 1:return ke(o.type,!0);case 31:return vt("Activity");default:return""}}function rt(o){try{var l="",h=null;do l+=ut(o,h),h=o,o=o.return;while(o);return l}catch(m){return` Error generating stack: `+m.message+` -`+m.stack}}var ct=Object.prototype.hasOwnProperty,Ke=s.unstable_scheduleCallback,_t=s.unstable_cancelCallback,pe=s.unstable_shouldYield,We=s.unstable_requestPaint,Je=s.unstable_now,ot=s.unstable_getCurrentPriorityLevel,St=s.unstable_ImmediatePriority,vt=s.unstable_UserBlockingPriority,Vt=s.unstable_NormalPriority,si=s.unstable_LowPriority,$t=s.unstable_IdlePriority,Pt=s.log,Ht=s.unstable_setDisableYieldValue,ui=null,xt=null;function ni(o){if(typeof Pt=="function"&&Ht(o),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(ui,o)}catch{}}var Xt=Math.clz32?Math.clz32:Yi,Zi=Math.log,Gt=Math.LN2;function Yi(o){return o>>>=0,o===0?32:31-(Zi(o)/Gt|0)|0}var Ri=256,Si=262144,kt=4194304;function V(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function H(o,l,h){var m=o.pendingLanes;if(m===0)return 0;var S=0,w=o.suspendedLanes,B=o.pingedLanes;o=o.warmLanes;var J=m&134217727;return J!==0?(m=J&~w,m!==0?S=V(m):(B&=J,B!==0?S=V(B):h||(h=J&~o,h!==0&&(S=V(h))))):(J=m&~w,J!==0?S=V(J):B!==0?S=V(B):h||(h=m&~o,h!==0&&(S=V(h)))),S===0?0:l!==0&&l!==S&&(l&w)===0&&(w=S&-S,h=l&-l,w>=h||w===32&&(h&4194048)!==0)?l:S}function ee(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function Te(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ue(){var o=kt;return kt<<=1,(kt&62914560)===0&&(kt=4194304),o}function ft(o){for(var l=[],h=0;31>h;h++)l.push(o);return l}function Et(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function pi(o,l,h,m,S,w){var B=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var J=o.entanglements,me=o.expirationTimes,je=o.hiddenUpdates;for(h=B&~h;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var mn=/[\n"\\]/g;function ds(o){return o.replace(mn,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function bn(o,l,h,m,S,w,B,J){o.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?o.type=B:o.removeAttribute("type"),l!=null?B==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+Fi(l)):o.value!==""+Fi(l)&&(o.value=""+Fi(l)):B!=="submit"&&B!=="reset"||o.removeAttribute("value"),l!=null?Zn(o,B,Fi(l)):h!=null?Zn(o,B,Fi(h)):m!=null&&o.removeAttribute("value"),S==null&&w!=null&&(o.defaultChecked=!!w),S!=null&&(o.checked=S&&typeof S!="function"&&typeof S!="symbol"),J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?o.name=""+Fi(J):o.removeAttribute("name")}function an(o,l,h,m,S,w,B,J){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),l!=null||h!=null){if(!(w!=="submit"&&w!=="reset"||l!=null)){fn(o);return}h=h!=null?""+Fi(h):"",l=l!=null?""+Fi(l):h,J||l===o.value||(o.value=l),o.defaultValue=l}m=m??S,m=typeof m!="function"&&typeof m!="symbol"&&!!m,o.checked=J?o.checked:!!m,o.defaultChecked=!!m,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(o.name=B),fn(o)}function Zn(o,l,h){l==="number"&&xn(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function Ii(o,l,h,m){if(o=o.options,l){l={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wt=!1;if(at)try{var It={};Object.defineProperty(It,"passive",{get:function(){wt=!0}}),window.addEventListener("test",It,It),window.removeEventListener("test",It,It)}catch{wt=!1}var zt=null,mt=null,pt=null;function Bt(){if(pt)return pt;var o,l=mt,h=l.length,m,S="value"in zt?zt.value:zt.textContent,w=S.length;for(o=0;o=Nl),uf=" ",td=!1;function Cu(o,l){switch(o){case"keyup":return Up.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cf(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var No=!1;function jp(o,l){switch(o){case"compositionend":return cf(l);case"keypress":return l.which!==32?null:(td=!0,uf);case"textInput":return o=l.data,o===uf&&td?null:o;default:return null}}function id(o,l){if(No)return o==="compositionend"||!Io&&Cu(o,l)?(o=Bt(),pt=mt=zt=null,No=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:h,offset:l-o};o=m}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Mo(h)}}function Xa(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?Xa(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function Du(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=xn(o.document);l instanceof o.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)o=l.contentWindow;else break;l=xn(o.document)}return l}function ld(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var qp=at&&"documentMode"in document&&11>=document.documentMode,Po=null,ud=null,Bo=null,Lu=!1;function cd(o,l,h){var m=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Lu||Po==null||Po!==xn(m)||(m=Po,"selectionStart"in m&&ld(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Bo&&ma(Bo,m)||(Bo=m,m=sm(ud,"onSelect"),0>=B,S-=B,Tr=1<<32-Xt(l)+S|h<Li?(Wi=Ut,Ut=null):Wi=Ut.sibling;var ts=He(ke,Ut,Fe[Li],it);if(ts===null){Ut===null&&(Ut=Wi);break}o&&Ut&&ts.alternate===null&&l(ke,Ut),Se=w(ts,Se,Li),es===null?Yt=ts:es.sibling=ts,es=ts,Ut=Wi}if(Li===Fe.length)return h(ke,Ut),zi&&Ni(ke,Li),Yt;if(Ut===null){for(;LiLi?(Wi=Ut,Ut=null):Wi=Ut.sibling;var ll=He(ke,Ut,ts.value,it);if(ll===null){Ut===null&&(Ut=Wi);break}o&&Ut&&ll.alternate===null&&l(ke,Ut),Se=w(ll,Se,Li),es===null?Yt=ll:es.sibling=ll,es=ll,Ut=Wi}if(ts.done)return h(ke,Ut),zi&&Ni(ke,Li),Yt;if(Ut===null){for(;!ts.done;Li++,ts=Fe.next())ts=nt(ke,ts.value,it),ts!==null&&(Se=w(ts,Se,Li),es===null?Yt=ts:es.sibling=ts,es=ts);return zi&&Ni(ke,Li),Yt}for(Ut=m(Ut);!ts.done;Li++,ts=Fe.next())ts=qe(Ut,ke,Li,ts.value,it),ts!==null&&(o&&ts.alternate!==null&&Ut.delete(ts.key===null?Li:ts.key),Se=w(ts,Se,Li),es===null?Yt=ts:es.sibling=ts,es=ts);return o&&Ut.forEach(function(jI){return l(ke,jI)}),zi&&Ni(ke,Li),Yt}function ms(ke,Se,Fe,it){if(typeof Fe=="object"&&Fe!==null&&Fe.type===T&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case v:e:{for(var Yt=Fe.key;Se!==null;){if(Se.key===Yt){if(Yt=Fe.type,Yt===T){if(Se.tag===7){h(ke,Se.sibling),it=S(Se,Fe.props.children),it.return=ke,ke=it;break e}}else if(Se.elementType===Yt||typeof Yt=="object"&&Yt!==null&&Yt.$$typeof===Y&&Vl(Yt)===Se.type){h(ke,Se.sibling),it=S(Se,Fe.props),Sd(it,Fe),it.return=ke,ke=it;break e}h(ke,Se);break}else l(ke,Se);Se=Se.sibling}Fe.type===T?(it=ga(Fe.props.children,ke.mode,it,Fe.key),it.return=ke,ke=it):(it=yd(Fe.type,Fe.key,Fe.props,null,ke.mode,it),Sd(it,Fe),it.return=ke,ke=it)}return B(ke);case b:e:{for(Yt=Fe.key;Se!==null;){if(Se.key===Yt)if(Se.tag===4&&Se.stateNode.containerInfo===Fe.containerInfo&&Se.stateNode.implementation===Fe.implementation){h(ke,Se.sibling),it=S(Se,Fe.children||[]),it.return=ke,ke=it;break e}else{h(ke,Se);break}else l(ke,Se);Se=Se.sibling}it=Ho(Fe,ke.mode,it),it.return=ke,ke=it}return B(ke);case Y:return Fe=Vl(Fe),ms(ke,Se,Fe,it)}if(ie(Fe))return Ft(ke,Se,Fe,it);if(G(Fe)){if(Yt=G(Fe),typeof Yt!="function")throw Error(i(150));return Fe=Yt.call(Fe),ai(ke,Se,Fe,it)}if(typeof Fe.then=="function")return ms(ke,Se,kf(Fe),it);if(Fe.$$typeof===R)return ms(ke,Se,mi(ke,Fe),it);Cf(ke,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Se!==null&&Se.tag===6?(h(ke,Se.sibling),it=S(Se,Fe),it.return=ke,ke=it):(h(ke,Se),it=Ul(Fe,ke.mode,it),it.return=ke,ke=it),B(ke)):h(ke,Se)}return function(ke,Se,Fe,it){try{Td=0;var Yt=ms(ke,Se,Fe,it);return Pu=null,Yt}catch(Ut){if(Ut===Mu||Ut===wf)throw Ut;var es=Vs(29,Ut,null,ke.mode);return es.lanes=it,es.return=ke,es}}}var ql=R1(!0),I1=R1(!1),Go=!1;function Qp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zp(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function qo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ko(o,l,h){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(ss&2)!==0){var S=m.pending;return S===null?l.next=l:(l.next=S.next,S.next=l),m.pending=l,l=Nu(o),bf(o,null,h),l}return Iu(o,m,l,h),Nu(o)}function _d(o,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194048)!==0)){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,_i(o,h)}}function Jp(o,l){var h=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,h===m)){var S=null,w=null;if(h=h.firstBaseUpdate,h!==null){do{var B={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};w===null?S=w=B:w=w.next=B,h=h.next}while(h!==null);w===null?S=w=l:w=w.next=l}else S=w=l;h={baseState:m.baseState,firstBaseUpdate:S,lastBaseUpdate:w,shared:m.shared,callbacks:m.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=l:o.next=l,h.lastBaseUpdate=l}var eg=!1;function Ed(){if(eg){var o=Tn;if(o!==null)throw o}}function wd(o,l,h,m){eg=!1;var S=o.updateQueue;Go=!1;var w=S.firstBaseUpdate,B=S.lastBaseUpdate,J=S.shared.pending;if(J!==null){S.shared.pending=null;var me=J,je=me.next;me.next=null,B===null?w=je:B.next=je,B=me;var Ze=o.alternate;Ze!==null&&(Ze=Ze.updateQueue,J=Ze.lastBaseUpdate,J!==B&&(J===null?Ze.firstBaseUpdate=je:J.next=je,Ze.lastBaseUpdate=me))}if(w!==null){var nt=S.baseState;B=0,Ze=je=me=null,J=w;do{var He=J.lane&-536870913,qe=He!==J.lane;if(qe?(Ki&He)===He:(m&He)===He){He!==0&&He===Ur&&(eg=!0),Ze!==null&&(Ze=Ze.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var Ft=o,ai=J;He=l;var ms=h;switch(ai.tag){case 1:if(Ft=ai.payload,typeof Ft=="function"){nt=Ft.call(ms,nt,He);break e}nt=Ft;break e;case 3:Ft.flags=Ft.flags&-65537|128;case 0:if(Ft=ai.payload,He=typeof Ft=="function"?Ft.call(ms,nt,He):Ft,He==null)break e;nt=p({},nt,He);break e;case 2:Go=!0}}He=J.callback,He!==null&&(o.flags|=64,qe&&(o.flags|=8192),qe=S.callbacks,qe===null?S.callbacks=[He]:qe.push(He))}else qe={lane:He,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Ze===null?(je=Ze=qe,me=nt):Ze=Ze.next=qe,B|=He;if(J=J.next,J===null){if(J=S.shared.pending,J===null)break;qe=J,J=qe.next,qe.next=null,S.lastBaseUpdate=qe,S.shared.pending=null}}while(!0);Ze===null&&(me=nt),S.baseState=me,S.firstBaseUpdate=je,S.lastBaseUpdate=Ze,w===null&&(S.shared.lanes=0),Zo|=B,o.lanes=B,o.memoizedState=nt}}function N1(o,l){if(typeof o!="function")throw Error(i(191,o));o.call(l)}function O1(o,l){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;ow?w:8;var B=W.T,J={};W.T=J,xg(o,!1,l,h);try{var me=S(),je=W.S;if(je!==null&&je(J,me),me!==null&&typeof me=="object"&&typeof me.then=="function"){var Ze=DR(me,m);Cd(o,l,Ze,Ar(o))}else Cd(o,l,m,Ar(o))}catch(nt){Cd(o,l,{then:function(){},status:"rejected",reason:nt},Ar())}finally{K.p=w,B!==null&&J.types!==null&&(B.types=J.types),W.T=B}}function MR(){}function yg(o,l,h,m){if(o.tag!==5)throw Error(i(476));var S=hT(o).queue;dT(o,S,l,Q,h===null?MR:function(){return fT(o),h(m)})}function hT(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:to,lastRenderedState:Q},next:null};var h={};return l.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:to,lastRenderedState:h},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function fT(o){var l=hT(o);l.next===null&&(l=o.alternate.memoizedState),Cd(o,l.next.queue,{},Ar())}function vg(){return Lt(Gd)}function mT(){return en().memoizedState}function pT(){return en().memoizedState}function PR(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var h=Ar();o=qo(h);var m=Ko(l,o,h);m!==null&&(ur(m,l,h),_d(m,l,h)),l={cache:Ja()},o.payload=l;return}l=l.return}}function BR(o,l,h){var m=Ar();h={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Ff(o)?yT(l,h):(h=pd(o,l,h,m),h!==null&&(ur(h,o,m),vT(h,l,m)))}function gT(o,l,h){var m=Ar();Cd(o,l,h,m)}function Cd(o,l,h,m){var S={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Ff(o))yT(l,S);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var B=l.lastRenderedState,J=w(B,h);if(S.hasEagerState=!0,S.eagerState=J,Bn(J,B))return Iu(o,l,S,0),xs===null&&Ru(),!1}catch{}if(h=pd(o,l,S,m),h!==null)return ur(h,o,m),vT(h,l,m),!0}return!1}function xg(o,l,h,m){if(m={lane:2,revertLane:Qg(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},Ff(o)){if(l)throw Error(i(479))}else l=pd(o,h,m,2),l!==null&&ur(l,o,2)}function Ff(o){var l=o.alternate;return o===Ci||l!==null&&l===Ci}function yT(o,l){Fu=Rf=!0;var h=o.pending;h===null?l.next=l:(l.next=h.next,h.next=l),o.pending=l}function vT(o,l,h){if((h&4194048)!==0){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,_i(o,h)}}var Dd={readContext:Lt,use:Of,useCallback:Gs,useContext:Gs,useEffect:Gs,useImperativeHandle:Gs,useLayoutEffect:Gs,useInsertionEffect:Gs,useMemo:Gs,useReducer:Gs,useRef:Gs,useState:Gs,useDebugValue:Gs,useDeferredValue:Gs,useTransition:Gs,useSyncExternalStore:Gs,useId:Gs,useHostTransitionStatus:Gs,useFormState:Gs,useActionState:Gs,useOptimistic:Gs,useMemoCache:Gs,useCacheRefresh:Gs};Dd.useEffectEvent=Gs;var xT={readContext:Lt,use:Of,useCallback:function(o,l){return Gn().memoizedState=[o,l===void 0?null:l],o},useContext:Lt,useEffect:iT,useImperativeHandle:function(o,l,h){h=h!=null?h.concat([o]):null,Pf(4194308,4,aT.bind(null,l,o),h)},useLayoutEffect:function(o,l){return Pf(4194308,4,o,l)},useInsertionEffect:function(o,l){Pf(4,2,o,l)},useMemo:function(o,l){var h=Gn();l=l===void 0?null:l;var m=o();if(Kl){ni(!0);try{o()}finally{ni(!1)}}return h.memoizedState=[m,l],m},useReducer:function(o,l,h){var m=Gn();if(h!==void 0){var S=h(l);if(Kl){ni(!0);try{h(l)}finally{ni(!1)}}}else S=l;return m.memoizedState=m.baseState=S,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:S},m.queue=o,o=o.dispatch=BR.bind(null,Ci,o),[m.memoizedState,o]},useRef:function(o){var l=Gn();return o={current:o},l.memoizedState=o},useState:function(o){o=hg(o);var l=o.queue,h=gT.bind(null,Ci,l);return l.dispatch=h,[o.memoizedState,h]},useDebugValue:pg,useDeferredValue:function(o,l){var h=Gn();return gg(h,o,l)},useTransition:function(){var o=hg(!1);return o=dT.bind(null,Ci,o.queue,!0,!1),Gn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,h){var m=Ci,S=Gn();if(zi){if(h===void 0)throw Error(i(407));h=h()}else{if(h=l(),xs===null)throw Error(i(349));(Ki&127)!==0||j1(m,l,h)}S.memoizedState=h;var w={value:h,getSnapshot:l};return S.queue=w,iT(H1.bind(null,m,w,o),[o]),m.flags|=2048,ju(9,{destroy:void 0},$1.bind(null,m,w,h,l),null),h},useId:function(){var o=Gn(),l=xs.identifierPrefix;if(zi){var h=Cn,m=Tr;h=(m&~(1<<32-Xt(m)-1)).toString(32)+h,l="_"+l+"R_"+h,h=If++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof m.is=="string"?B.createElement("select",{is:m.is}):B.createElement("select"),m.multiple?w.multiple=!0:m.size&&(w.size=m.size);break;default:w=typeof m.is=="string"?B.createElement(S,{is:m.is}):B.createElement(S)}}w[wi]=l,w[Jt]=m;e:for(B=l.child;B!==null;){if(B.tag===5||B.tag===6)w.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===l)break e;for(;B.sibling===null;){if(B.return===null||B.return===l)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}l.stateNode=w;e:switch(Ln(w,S,m),S){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&so(l)}}return Ds(l),Ng(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,h),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==m&&so(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(i(166));if(o=ge.current,x(l)){if(o=l.stateNode,h=l.memoizedProps,m=null,S=on,S!==null)switch(S.tag){case 27:case 5:m=S.memoizedProps}o[wi]=l,o=!!(o.nodeValue===h||m!==null&&m.suppressHydrationWarning===!0||FS(o.nodeValue,h)),o||ba(l,!0)}else o=nm(o).createTextNode(m),o[wi]=l,l.stateNode=o}return Ds(l),null;case 31:if(h=l.memoizedState,o===null||o.memoizedState!==null){if(m=x(l),h!==null){if(o===null){if(!m)throw Error(i(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[wi]=l}else A(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ds(l),o=!1}else h=C(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return l.flags&256?(_r(l),l):(_r(l),null);if((l.flags&128)!==0)throw Error(i(558))}return Ds(l),null;case 13:if(m=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(S=x(l),m!==null&&m.dehydrated!==null){if(o===null){if(!S)throw Error(i(318));if(S=l.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(i(317));S[wi]=l}else A(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ds(l),S=!1}else S=C(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=S),S=!0;if(!S)return l.flags&256?(_r(l),l):(_r(l),null)}return _r(l),(l.flags&128)!==0?(l.lanes=h,l):(h=m!==null,o=o!==null&&o.memoizedState!==null,h&&(m=l.child,S=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(S=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==S&&(m.flags|=2048)),h!==o&&h&&(l.child.flags|=8192),zf(l,l.updateQueue),Ds(l),null);case 4:return Re(),o===null&&ty(l.stateNode.containerInfo),Ds(l),null;case 10:return ue(l.type),Ds(l),null;case 19:if(ne(Js),m=l.memoizedState,m===null)return Ds(l),null;if(S=(l.flags&128)!==0,w=m.rendering,w===null)if(S)Rd(m,!1);else{if(qs!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(w=Lf(o),w!==null){for(l.flags|=128,Rd(m,!1),o=w.updateQueue,l.updateQueue=o,zf(l,o),l.subtreeFlags=0,o=h,h=l.child;h!==null;)Tf(h,o),h=h.sibling;return Z(Js,Js.current&1|2),zi&&Ni(l,m.treeForkCount),l.child}o=o.sibling}m.tail!==null&&Je()>Wf&&(l.flags|=128,S=!0,Rd(m,!1),l.lanes=4194304)}else{if(!S)if(o=Lf(w),o!==null){if(l.flags|=128,S=!0,o=o.updateQueue,l.updateQueue=o,zf(l,o),Rd(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!zi)return Ds(l),null}else 2*Je()-m.renderingStartTime>Wf&&h!==536870912&&(l.flags|=128,S=!0,Rd(m,!1),l.lanes=4194304);m.isBackwards?(w.sibling=l.child,l.child=w):(o=m.last,o!==null?o.sibling=w:l.child=w,m.last=w)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=Je(),o.sibling=null,h=Js.current,Z(Js,S?h&1|2:h&1),zi&&Ni(l,m.treeForkCount),o):(Ds(l),null);case 22:case 23:return _r(l),ig(),m=l.memoizedState!==null,o!==null?o.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(h&536870912)!==0&&(l.flags&128)===0&&(Ds(l),l.subtreeFlags&6&&(l.flags|=8192)):Ds(l),h=l.updateQueue,h!==null&&zf(l,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==h&&(l.flags|=2048),o!==null&&ne(zl),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),ue(As),Ds(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function HR(o,l){switch(sr(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ue(As),Re(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return be(l),null;case 31:if(l.memoizedState!==null){if(_r(l),l.alternate===null)throw Error(i(340));A()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(_r(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(i(340));A()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return ne(Js),null;case 4:return Re(),null;case 10:return ue(l.type),null;case 22:case 23:return _r(l),ig(),o!==null&&ne(zl),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return ue(As),null;case 25:return null;default:return null}}function zT(o,l){switch(sr(l),l.tag){case 3:ue(As),Re();break;case 26:case 27:case 5:be(l);break;case 4:Re();break;case 31:l.memoizedState!==null&&_r(l);break;case 13:_r(l);break;case 19:ne(Js);break;case 10:ue(l.type);break;case 22:case 23:_r(l),ig(),o!==null&&ne(zl);break;case 24:ue(As)}}function Id(o,l){try{var h=l.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var S=m.next;h=S;do{if((h.tag&o)===o){m=void 0;var w=h.create,B=h.inst;m=w(),B.destroy=m}h=h.next}while(h!==S)}}catch(J){ls(l,l.return,J)}}function Xo(o,l,h){try{var m=l.updateQueue,S=m!==null?m.lastEffect:null;if(S!==null){var w=S.next;m=w;do{if((m.tag&o)===o){var B=m.inst,J=B.destroy;if(J!==void 0){B.destroy=void 0,S=l;var me=h,je=J;try{je()}catch(Ze){ls(S,me,Ze)}}}m=m.next}while(m!==w)}}catch(Ze){ls(l,l.return,Ze)}}function VT(o){var l=o.updateQueue;if(l!==null){var h=o.stateNode;try{O1(l,h)}catch(m){ls(o,o.return,m)}}}function GT(o,l,h){h.props=Wl(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(m){ls(o,l,m)}}function Nd(o,l){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var m=o.stateNode;break;case 30:m=o.stateNode;break;default:m=o.stateNode}typeof h=="function"?o.refCleanup=h(m):h.current=m}}catch(S){ls(o,l,S)}}function _a(o,l){var h=o.ref,m=o.refCleanup;if(h!==null)if(typeof m=="function")try{m()}catch(S){ls(o,l,S)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(S){ls(o,l,S)}else h.current=null}function qT(o){var l=o.type,h=o.memoizedProps,m=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":h.autoFocus&&m.focus();break e;case"img":h.src?m.src=h.src:h.srcSet&&(m.srcset=h.srcSet)}}catch(S){ls(o,o.return,S)}}function Og(o,l,h){try{var m=o.stateNode;cI(m,o.type,h,l),m[Jt]=l}catch(S){ls(o,o.return,S)}}function KT(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&sl(o.type)||o.tag===4}function Mg(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||KT(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&sl(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Pg(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,l):(l=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,l.appendChild(o),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=At));else if(m!==4&&(m===27&&sl(o.type)&&(h=o.stateNode,l=null),o=o.child,o!==null))for(Pg(o,l,h),o=o.sibling;o!==null;)Pg(o,l,h),o=o.sibling}function Vf(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?h.insertBefore(o,l):h.appendChild(o);else if(m!==4&&(m===27&&sl(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Vf(o,l,h),o=o.sibling;o!==null;)Vf(o,l,h),o=o.sibling}function WT(o){var l=o.stateNode,h=o.memoizedProps;try{for(var m=o.type,S=l.attributes;S.length;)l.removeAttributeNode(S[0]);Ln(l,m,h),l[wi]=o,l[Jt]=h}catch(w){ls(o,o.return,w)}}var no=!1,cn=!1,Bg=!1,YT=typeof WeakSet=="function"?WeakSet:Set,Sn=null;function zR(o,l){if(o=o.containerInfo,ny=dm,o=Du(o),ld(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var m=h.getSelection&&h.getSelection();if(m&&m.rangeCount!==0){h=m.anchorNode;var S=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{h.nodeType,w.nodeType}catch{h=null;break e}var B=0,J=-1,me=-1,je=0,Ze=0,nt=o,He=null;t:for(;;){for(var qe;nt!==h||S!==0&&nt.nodeType!==3||(J=B+S),nt!==w||m!==0&&nt.nodeType!==3||(me=B+m),nt.nodeType===3&&(B+=nt.nodeValue.length),(qe=nt.firstChild)!==null;)He=nt,nt=qe;for(;;){if(nt===o)break t;if(He===h&&++je===S&&(J=B),He===w&&++Ze===m&&(me=B),(qe=nt.nextSibling)!==null)break;nt=He,He=nt.parentNode}nt=qe}h=J===-1||me===-1?null:{start:J,end:me}}else h=null}h=h||{start:0,end:0}}else h=null;for(ry={focusedElem:o,selectionRange:h},dm=!1,Sn=l;Sn!==null;)if(l=Sn,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,Sn=o;else for(;Sn!==null;){switch(l=Sn,w=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h title"))),Ln(w,m,h),w[wi]=o,Ai(w),m=w;break e;case"link":var B=t_("link","href",S).get(m+(h.href||""));if(B){for(var J=0;Jms&&(B=ms,ms=ai,ai=B);var ke=Is(J,ai),Se=Is(J,ms);if(ke&&Se&&(qe.rangeCount!==1||qe.anchorNode!==ke.node||qe.anchorOffset!==ke.offset||qe.focusNode!==Se.node||qe.focusOffset!==Se.offset)){var Fe=nt.createRange();Fe.setStart(ke.node,ke.offset),qe.removeAllRanges(),ai>ms?(qe.addRange(Fe),qe.extend(Se.node,Se.offset)):(Fe.setEnd(Se.node,Se.offset),qe.addRange(Fe))}}}}for(nt=[],qe=J;qe=qe.parentNode;)qe.nodeType===1&&nt.push({element:qe,left:qe.scrollLeft,top:qe.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;Jh?32:h,W.T=null,h=Vg,Vg=null;var w=el,B=uo;if(gn=0,Gu=el=null,uo=0,(ss&6)!==0)throw Error(i(331));var J=ss;if(ss|=4,aS(w.current),sS(w,w.current,B,h),ss=J,Ud(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(ui,w)}catch{}return!0}finally{K.p=S,W.T=m,ES(o,l)}}function AS(o,l,h){l=tr(h,l),l=_g(o.stateNode,l,2),o=Ko(o,l,2),o!==null&&(Et(o,2),Ea(o))}function ls(o,l,h){if(o.tag===3)AS(o,o,h);else for(;l!==null;){if(l.tag===3){AS(l,o,h);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Jo===null||!Jo.has(m))){o=tr(h,o),h=kT(2),m=Ko(l,h,2),m!==null&&(CT(h,m,l,o),Et(m,2),Ea(m));break}}l=l.return}}function Wg(o,l,h){var m=o.pingCache;if(m===null){m=o.pingCache=new qR;var S=new Set;m.set(l,S)}else S=m.get(l),S===void 0&&(S=new Set,m.set(l,S));S.has(h)||(jg=!0,S.add(h),o=QR.bind(null,o,l,h),l.then(o,o))}function QR(o,l,h){var m=o.pingCache;m!==null&&m.delete(l),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,xs===o&&(Ki&h)===h&&(qs===4||qs===3&&(Ki&62914560)===Ki&&300>Je()-Kf?(ss&2)===0&&qu(o,0):$g|=h,Vu===Ki&&(Vu=0)),Ea(o)}function kS(o,l){l===0&&(l=Ue()),o=Za(o,l),o!==null&&(Et(o,l),Ea(o))}function ZR(o){var l=o.memoizedState,h=0;l!==null&&(h=l.retryLane),kS(o,h)}function JR(o,l){var h=0;switch(o.tag){case 31:case 13:var m=o.stateNode,S=o.memoizedState;S!==null&&(h=S.retryLane);break;case 19:m=o.stateNode;break;case 22:m=o.stateNode._retryCache;break;default:throw Error(i(314))}m!==null&&m.delete(l),kS(o,h)}function eI(o,l){return Ke(o,l)}var em=null,Wu=null,Yg=!1,tm=!1,Xg=!1,il=0;function Ea(o){o!==Wu&&o.next===null&&(Wu===null?em=Wu=o:Wu=Wu.next=o),tm=!0,Yg||(Yg=!0,iI())}function Ud(o,l){if(!Xg&&tm){Xg=!0;do for(var h=!1,m=em;m!==null;){if(o!==0){var S=m.pendingLanes;if(S===0)var w=0;else{var B=m.suspendedLanes,J=m.pingedLanes;w=(1<<31-Xt(42|o)+1)-1,w&=S&~(B&~J),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(h=!0,RS(m,w))}else w=Ki,w=H(m,m===xs?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||ee(m,w)||(h=!0,RS(m,w));m=m.next}while(h);Xg=!1}}function tI(){CS()}function CS(){tm=Yg=!1;var o=0;il!==0&&hI()&&(o=il);for(var l=Je(),h=null,m=em;m!==null;){var S=m.next,w=DS(m,l);w===0?(m.next=null,h===null?em=S:h.next=S,S===null&&(Wu=h)):(h=m,(o!==0||(w&3)!==0)&&(tm=!0)),m=S}gn!==0&&gn!==5||Ud(o),il!==0&&(il=0)}function DS(o,l){for(var h=o.suspendedLanes,m=o.pingedLanes,S=o.expirationTimes,w=o.pendingLanes&-62914561;0J)break;var Ze=me.transferSize,nt=me.initiatorType;Ze&&US(nt)&&(me=me.responseEnd,B+=Ze*(me"u"?null:document;function QS(o,l,h){var m=Yu;if(m&&typeof l=="string"&&l){var S=ds(l);S='link[rel="'+o+'"][href="'+S+'"]',typeof h=="string"&&(S+='[crossorigin="'+h+'"]'),XS.has(S)||(XS.add(S),o={rel:o,crossOrigin:h,href:l},m.querySelector(S)===null&&(l=m.createElement("link"),Ln(l,"link",o),Ai(l),m.head.appendChild(l)))}}function TI(o){co.D(o),QS("dns-prefetch",o,null)}function SI(o,l){co.C(o,l),QS("preconnect",o,l)}function _I(o,l,h){co.L(o,l,h);var m=Yu;if(m&&o&&l){var S='link[rel="preload"][as="'+ds(l)+'"]';l==="image"&&h&&h.imageSrcSet?(S+='[imagesrcset="'+ds(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(S+='[imagesizes="'+ds(h.imageSizes)+'"]')):S+='[href="'+ds(o)+'"]';var w=S;switch(l){case"style":w=Xu(o);break;case"script":w=Qu(o)}Hr.has(w)||(o=p({rel:"preload",href:l==="image"&&h&&h.imageSrcSet?void 0:o,as:l},h),Hr.set(w,o),m.querySelector(S)!==null||l==="style"&&m.querySelector(zd(w))||l==="script"&&m.querySelector(Vd(w))||(l=m.createElement("link"),Ln(l,"link",o),Ai(l),m.head.appendChild(l)))}}function EI(o,l){co.m(o,l);var h=Yu;if(h&&o){var m=l&&typeof l.as=="string"?l.as:"script",S='link[rel="modulepreload"][as="'+ds(m)+'"][href="'+ds(o)+'"]',w=S;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Qu(o)}if(!Hr.has(w)&&(o=p({rel:"modulepreload",href:o},l),Hr.set(w,o),h.querySelector(S)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Vd(w)))return}m=h.createElement("link"),Ln(m,"link",o),Ai(m),h.head.appendChild(m)}}}function wI(o,l,h){co.S(o,l,h);var m=Yu;if(m&&o){var S=Ji(m).hoistableStyles,w=Xu(o);l=l||"default";var B=S.get(w);if(!B){var J={loading:0,preload:null};if(B=m.querySelector(zd(w)))J.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":l},h),(h=Hr.get(w))&&hy(o,h);var me=B=m.createElement("link");Ai(me),Ln(me,"link",o),me._p=new Promise(function(je,Ze){me.onload=je,me.onerror=Ze}),me.addEventListener("load",function(){J.loading|=1}),me.addEventListener("error",function(){J.loading|=2}),J.loading|=4,am(B,l,m)}B={type:"stylesheet",instance:B,count:1,state:J},S.set(w,B)}}}function AI(o,l){co.X(o,l);var h=Yu;if(h&&o){var m=Ji(h).hoistableScripts,S=Qu(o),w=m.get(S);w||(w=h.querySelector(Vd(S)),w||(o=p({src:o,async:!0},l),(l=Hr.get(S))&&fy(o,l),w=h.createElement("script"),Ai(w),Ln(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(S,w))}}function kI(o,l){co.M(o,l);var h=Yu;if(h&&o){var m=Ji(h).hoistableScripts,S=Qu(o),w=m.get(S);w||(w=h.querySelector(Vd(S)),w||(o=p({src:o,async:!0,type:"module"},l),(l=Hr.get(S))&&fy(o,l),w=h.createElement("script"),Ai(w),Ln(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(S,w))}}function ZS(o,l,h,m){var S=(S=ge.current)?rm(S):null;if(!S)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(l=Xu(h.href),h=Ji(S).hoistableStyles,m=h.get(l),m||(m={type:"style",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=Xu(h.href);var w=Ji(S).hoistableStyles,B=w.get(o);if(B||(S=S.ownerDocument||S,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,B),(w=S.querySelector(zd(o)))&&!w._p&&(B.instance=w,B.state.loading=5),Hr.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Hr.set(o,h),w||CI(S,o,h,B.state))),l&&m===null)throw Error(i(528,""));return B}if(l&&m!==null)throw Error(i(529,""));return null;case"script":return l=h.async,h=h.src,typeof h=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Qu(h),h=Ji(S).hoistableScripts,m=h.get(l),m||(m={type:"script",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function Xu(o){return'href="'+ds(o)+'"'}function zd(o){return'link[rel="stylesheet"]['+o+"]"}function JS(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function CI(o,l,h,m){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=o.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),Ln(l,"link",h),Ai(l),o.head.appendChild(l))}function Qu(o){return'[src="'+ds(o)+'"]'}function Vd(o){return"script[async]"+o}function e_(o,l,h){if(l.count++,l.instance===null)switch(l.type){case"style":var m=o.querySelector('style[data-href~="'+ds(h.href)+'"]');if(m)return l.instance=m,Ai(m),m;var S=p({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return m=(o.ownerDocument||o).createElement("style"),Ai(m),Ln(m,"style",S),am(m,h.precedence,o),l.instance=m;case"stylesheet":S=Xu(h.href);var w=o.querySelector(zd(S));if(w)return l.state.loading|=4,l.instance=w,Ai(w),w;m=JS(h),(S=Hr.get(S))&&hy(m,S),w=(o.ownerDocument||o).createElement("link"),Ai(w);var B=w;return B._p=new Promise(function(J,me){B.onload=J,B.onerror=me}),Ln(w,"link",m),l.state.loading|=4,am(w,h.precedence,o),l.instance=w;case"script":return w=Qu(h.src),(S=o.querySelector(Vd(w)))?(l.instance=S,Ai(S),S):(m=h,(S=Hr.get(w))&&(m=p({},h),fy(m,S)),o=o.ownerDocument||o,S=o.createElement("script"),Ai(S),Ln(S,"link",m),o.head.appendChild(S),l.instance=S);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,am(m,h.precedence,o));return l.instance}function am(o,l,h){for(var m=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=m.length?m[m.length-1]:null,w=S,B=0;B title"):null)}function DI(o,l,h){if(h===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(o=l.disabled,typeof l.precedence=="string"&&o==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function s_(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function LI(o,l,h,m){if(h.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var S=Xu(m.href),w=l.querySelector(zd(S));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=lm.bind(o),l.then(o,o)),h.state.loading|=4,h.instance=w,Ai(w);return}w=l.ownerDocument||l,m=JS(m),(S=Hr.get(S))&&hy(m,S),w=w.createElement("link"),Ai(w);var B=w;B._p=new Promise(function(J,me){B.onload=J,B.onerror=me}),Ln(w,"link",m),h.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,l),(l=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=lm.bind(o),l.addEventListener("load",h),l.addEventListener("error",h))}}var my=0;function RI(o,l){return o.stylesheets&&o.count===0&&cm(o,o.stylesheets),0my?50:800)+l);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(m),clearTimeout(S)}}:null}function lm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var um=null;function cm(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,um=new Map,l.forEach(II,o),um=null,lm.call(o))}function II(o,l){if(!(l.state.loading&4)){var h=um.get(o);if(h)var m=h.get(null);else{h=new Map,um.set(o,h);for(var S=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),_y.exports=YI(),_y.exports}var hA=XI();function QI(...s){return s.filter(Boolean).join(" ")}const ZI="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",JI={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},eN={xs:"px-2 py-1 text-xs",sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3.5 py-2.5 text-sm"},tN={indigo:{primary:"!bg-indigo-600 !text-white shadow-sm hover:!bg-indigo-700 focus-visible:outline-indigo-600 dark:!bg-indigo-500 dark:hover:!bg-indigo-400 dark:focus-visible:outline-indigo-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-indigo-50 text-indigo-600 shadow-xs hover:bg-indigo-100 dark:bg-indigo-500/20 dark:text-indigo-400 dark:shadow-none dark:hover:bg-indigo-500/30"},blue:{primary:"!bg-blue-600 !text-white shadow-sm hover:!bg-blue-700 focus-visible:outline-blue-600 dark:!bg-blue-500 dark:hover:!bg-blue-400 dark:focus-visible:outline-blue-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-blue-50 text-blue-600 shadow-xs hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-400 dark:shadow-none dark:hover:bg-blue-500/30"},emerald:{primary:"!bg-emerald-600 !text-white shadow-sm hover:!bg-emerald-700 focus-visible:outline-emerald-600 dark:!bg-emerald-500 dark:hover:!bg-emerald-400 dark:focus-visible:outline-emerald-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-emerald-50 text-emerald-700 shadow-xs hover:bg-emerald-100 dark:bg-emerald-500/20 dark:text-emerald-400 dark:shadow-none dark:hover:bg-emerald-500/30"},red:{primary:"!bg-red-600 !text-white shadow-sm hover:!bg-red-700 focus-visible:outline-red-600 dark:!bg-red-500 dark:hover:!bg-red-400 dark:focus-visible:outline-red-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-red-50 text-red-700 shadow-xs hover:bg-red-100 dark:bg-red-500/20 dark:text-red-400 dark:shadow-none dark:hover:bg-red-500/30"},amber:{primary:"!bg-amber-500 !text-white shadow-sm hover:!bg-amber-600 focus-visible:outline-amber-500 dark:!bg-amber-500 dark:hover:!bg-amber-400 dark:focus-visible:outline-amber-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-amber-50 text-amber-800 shadow-xs hover:bg-amber-100 dark:bg-amber-500/20 dark:text-amber-300 dark:shadow-none dark:hover:bg-amber-500/30"}};function iN(){return g.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 animate-spin","aria-hidden":"true",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.25"}),g.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.9"})]})}function di({children:s,variant:e="primary",color:t="indigo",size:i="md",rounded:n="md",leadingIcon:r,trailingIcon:a,isLoading:u=!1,disabled:c,className:d,type:f="button",...p}){const y=r||a||u?"gap-x-1.5":"";return g.jsxs("button",{type:f,disabled:c||u,className:QI(ZI,JI[n],eN[i],tN[t][e],y,d),...p,children:[u?g.jsx("span",{className:"-ml-0.5",children:g.jsx(iN,{})}):r&&g.jsx("span",{className:"-ml-0.5",children:r}),g.jsx("span",{children:s}),a&&!u&&g.jsx("span",{className:"-mr-0.5",children:a})]})}function fA(s){var e,t,i="";if(typeof s=="string"||typeof s=="number")i+=s;else if(typeof s=="object")if(Array.isArray(s)){var n=s.length;for(e=0;ee in s?sN(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ky=(s,e,t)=>(nN(s,typeof e!="symbol"?e+"":e,t),t);let rN=class{constructor(){ky(this,"current",this.detect()),ky(this,"handoffState","pending"),ky(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Ua=new rN;function Gh(s){var e;return Ua.isServer?null:s==null?document:(e=s?.ownerDocument)!=null?e:document}function Jv(s){var e,t;return Ua.isServer?null:s==null?document:(t=(e=s?.getRootNode)==null?void 0:e.call(s))!=null?t:document}function mA(s){var e,t;return(t=(e=Jv(s))==null?void 0:e.activeElement)!=null?t:null}function aN(s){return mA(s)===s}function X0(s){typeof queueMicrotask=="function"?queueMicrotask(s):Promise.resolve().then(s).catch(e=>setTimeout(()=>{throw e}))}function Co(){let s=[],e={addEventListener(t,i,n,r){return t.addEventListener(i,n,r),e.add(()=>t.removeEventListener(i,n,r))},requestAnimationFrame(...t){let i=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let i=setTimeout(...t);return e.add(()=>clearTimeout(i))},microTask(...t){let i={current:!0};return X0(()=>{i.current&&t[0]()}),e.add(()=>{i.current=!1})},style(t,i,n){let r=t.style.getPropertyValue(i);return Object.assign(t.style,{[i]:n}),this.add(()=>{Object.assign(t.style,{[i]:r})})},group(t){let i=Co();return t(i),this.add(()=>i.dispose())},add(t){return s.includes(t)||s.push(t),()=>{let i=s.indexOf(t);if(i>=0)for(let n of s.splice(i,1))n()}},dispose(){for(let t of s.splice(0))t()}};return e}function Q0(){let[s]=_.useState(Co);return _.useEffect(()=>()=>s.dispose(),[s]),s}let gr=(s,e)=>{Ua.isServer?_.useEffect(s,e):_.useLayoutEffect(s,e)};function Eu(s){let e=_.useRef(s);return gr(()=>{e.current=s},[s]),e}let Ts=function(s){let e=Eu(s);return Zt.useCallback((...t)=>e.current(...t),[e])};function qh(s){return _.useMemo(()=>s,Object.values(s))}let oN=_.createContext(void 0);function lN(){return _.useContext(oN)}function ex(...s){return Array.from(new Set(s.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Ao(s,e,...t){if(s in e){let n=e[s];return typeof n=="function"?n(...t):n}let i=new Error(`Tried to handle "${s}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(n=>`"${n}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,Ao),i}var l0=(s=>(s[s.None=0]="None",s[s.RenderStrategy=1]="RenderStrategy",s[s.Static=2]="Static",s))(l0||{}),Tl=(s=>(s[s.Unmount=0]="Unmount",s[s.Hidden=1]="Hidden",s))(Tl||{});function Qr(){let s=cN();return _.useCallback(e=>uN({mergeRefs:s,...e}),[s])}function uN({ourProps:s,theirProps:e,slot:t,defaultTag:i,features:n,visible:r=!0,name:a,mergeRefs:u}){u=u??dN;let c=pA(e,s);if(r)return vm(c,t,i,a,u);let d=n??0;if(d&2){let{static:f=!1,...p}=c;if(f)return vm(p,t,i,a,u)}if(d&1){let{unmount:f=!0,...p}=c;return Ao(f?0:1,{0(){return null},1(){return vm({...p,hidden:!0,style:{display:"none"}},t,i,a,u)}})}return vm(c,t,i,a,u)}function vm(s,e={},t,i,n){let{as:r=t,children:a,refName:u="ref",...c}=Cy(s,["unmount","static"]),d=s.ref!==void 0?{[u]:s.ref}:{},f=typeof a=="function"?a(e):a;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(e)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let p={};if(e){let y=!1,v=[];for(let[b,T]of Object.entries(e))typeof T=="boolean"&&(y=!0),T===!0&&v.push(b.replace(/([A-Z])/g,E=>`-${E.toLowerCase()}`));if(y){p["data-headlessui-state"]=v.join(" ");for(let b of v)p[`data-${b}`]=""}}if(gh(r)&&(Object.keys(su(c)).length>0||Object.keys(su(p)).length>0))if(!_.isValidElement(f)||Array.isArray(f)&&f.length>1||fN(f)){if(Object.keys(su(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(su(c)).concat(Object.keys(su(p))).map(y=>` - ${y}`).join(` +`+m.stack}}var Je=Object.prototype.hasOwnProperty,at=s.unstable_scheduleCallback,Re=s.unstable_cancelCallback,ze=s.unstable_shouldYield,Ue=s.unstable_requestPaint,de=s.unstable_now,qe=s.unstable_getCurrentPriorityLevel,ht=s.unstable_ImmediatePriority,tt=s.unstable_UserBlockingPriority,At=s.unstable_NormalPriority,ft=s.unstable_LowPriority,Et=s.unstable_IdlePriority,Lt=s.log,Rt=s.unstable_setDisableYieldValue,qt=null,Wt=null;function yi(o){if(typeof Lt=="function"&&Rt(o),Wt&&typeof Wt.setStrictMode=="function")try{Wt.setStrictMode(qt,o)}catch{}}var Ct=Math.clz32?Math.clz32:wi,It=Math.log,oi=Math.LN2;function wi(o){return o>>>=0,o===0?32:31-(It(o)/oi|0)|0}var Di=256,Yt=262144,Nt=4194304;function H(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function U(o,l,h){var m=o.pendingLanes;if(m===0)return 0;var S=0,w=o.suspendedLanes,B=o.pingedLanes;o=o.warmLanes;var J=m&134217727;return J!==0?(m=J&~w,m!==0?S=H(m):(B&=J,B!==0?S=H(B):h||(h=J&~o,h!==0&&(S=H(h))))):(J=m&~w,J!==0?S=H(J):B!==0?S=H(B):h||(h=m&~o,h!==0&&(S=H(h)))),S===0?0:l!==0&&l!==S&&(l&w)===0&&(w=S&-S,h=l&-l,w>=h||w===32&&(h&4194048)!==0)?l:S}function ee(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function Te(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Me(){var o=Nt;return Nt<<=1,(Nt&62914560)===0&&(Nt=4194304),o}function gt(o){for(var l=[],h=0;31>h;h++)l.push(o);return l}function Tt(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function gi(o,l,h,m,S,w){var B=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var J=o.entanglements,ye=o.expirationTimes,$e=o.hiddenUpdates;for(h=B&~h;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var Ds=/[\n"\\]/g;function os(o){return o.replace(Ds,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function jn(o,l,h,m,S,w,B,J){o.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?o.type=B:o.removeAttribute("type"),l!=null?B==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+zt(l)):o.value!==""+zt(l)&&(o.value=""+zt(l)):B!=="submit"&&B!=="reset"||o.removeAttribute("value"),l!=null?Tn(o,B,zt(l)):h!=null?Tn(o,B,zt(h)):m!=null&&o.removeAttribute("value"),S==null&&w!=null&&(o.defaultChecked=!!w),S!=null&&(o.checked=S&&typeof S!="function"&&typeof S!="symbol"),J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?o.name=""+zt(J):o.removeAttribute("name")}function Dn(o,l,h,m,S,w,B,J){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),l!=null||h!=null){if(!(w!=="submit"&&w!=="reset"||l!=null)){Ii(o);return}h=h!=null?""+zt(h):"",l=l!=null?""+zt(l):h,J||l===o.value||(o.value=l),o.defaultValue=l}m=m??S,m=typeof m!="function"&&typeof m!="symbol"&&!!m,o.checked=J?o.checked:!!m,o.defaultChecked=!!m,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(o.name=B),Ii(o)}function Tn(o,l,h){l==="number"&&Wi(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function ls(o,l,h,m){if(o=o.options,l){l={};for(var S=0;S"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pt=!1;if(et)try{var mt={};Object.defineProperty(mt,"passive",{get:function(){pt=!0}}),window.addEventListener("test",mt,mt),window.removeEventListener("test",mt,mt)}catch{pt=!1}var yt=null,Dt=null,ri=null;function St(){if(ri)return ri;var o,l=Dt,h=l.length,m,S="value"in yt?yt.value:yt.textContent,w=S.length;for(o=0;o=Ol),hf=" ",id=!1;function Lu(o,l){switch(o){case"keyup":return $p.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ff(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Oo=!1;function Hp(o,l){switch(o){case"compositionend":return ff(l);case"keypress":return l.which!==32?null:(id=!0,hf);case"textInput":return o=l.data,o===hf&&id?null:o;default:return null}}function sd(o,l){if(Oo)return o==="compositionend"||!No&&Lu(o,l)?(o=St(),ri=Dt=yt=null,Oo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:h,offset:l-o};o=m}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Po(h)}}function Za(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?Za(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function Ru(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=Wi(o.document);l instanceof o.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)o=l.contentWindow;else break;l=Wi(o.document)}return l}function ud(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var Wp=et&&"documentMode"in document&&11>=document.documentMode,Fo=null,cd=null,Bo=null,Iu=!1;function dd(o,l,h){var m=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Iu||Fo==null||Fo!==Wi(m)||(m=Fo,"selectionStart"in m&&ud(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Bo&&xa(Bo,m)||(Bo=m,m=am(cd,"onSelect"),0>=B,S-=B,wr=1<<32-Ct(l)+S|h<Oi?(Xi=Zt,Zt=null):Xi=Zt.sibling;var ts=Ve(Le,Zt,je[Oi],lt);if(ts===null){Zt===null&&(Zt=Xi);break}o&&Zt&&ts.alternate===null&&l(Le,Zt),_e=w(ts,_e,Oi),es===null?ai=ts:es.sibling=ts,es=ts,Zt=Xi}if(Oi===je.length)return h(Le,Zt),zi&&Pi(Le,Oi),ai;if(Zt===null){for(;OiOi?(Xi=Zt,Zt=null):Xi=Zt.sibling;var ul=Ve(Le,Zt,ts.value,lt);if(ul===null){Zt===null&&(Zt=Xi);break}o&&Zt&&ul.alternate===null&&l(Le,Zt),_e=w(ul,_e,Oi),es===null?ai=ul:es.sibling=ul,es=ul,Zt=Xi}if(ts.done)return h(Le,Zt),zi&&Pi(Le,Oi),ai;if(Zt===null){for(;!ts.done;Oi++,ts=je.next())ts=dt(Le,ts.value,lt),ts!==null&&(_e=w(ts,_e,Oi),es===null?ai=ts:es.sibling=ts,es=ts);return zi&&Pi(Le,Oi),ai}for(Zt=m(Zt);!ts.done;Oi++,ts=je.next())ts=Qe(Zt,Le,Oi,ts.value,lt),ts!==null&&(o&&ts.alternate!==null&&Zt.delete(ts.key===null?Oi:ts.key),_e=w(ts,_e,Oi),es===null?ai=ts:es.sibling=ts,es=ts);return o&&Zt.forEach(function(YI){return l(Le,YI)}),zi&&Pi(Le,Oi),ai}function bs(Le,_e,je,lt){if(typeof je=="object"&&je!==null&&je.type===T&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case v:e:{for(var ai=je.key;_e!==null;){if(_e.key===ai){if(ai=je.type,ai===T){if(_e.tag===7){h(Le,_e.sibling),lt=S(_e,je.props.children),lt.return=Le,Le=lt;break e}}else if(_e.elementType===ai||typeof ai=="object"&&ai!==null&&ai.$$typeof===W&&Gl(ai)===_e.type){h(Le,_e.sibling),lt=S(_e,je.props),_d(lt,je),lt.return=Le,Le=lt;break e}h(Le,_e);break}else l(Le,_e);_e=_e.sibling}je.type===T?(lt=Ta(je.props.children,Le.mode,lt,je.key),lt.return=Le,Le=lt):(lt=vd(je.type,je.key,je.props,null,Le.mode,lt),_d(lt,je),lt.return=Le,Le=lt)}return B(Le);case b:e:{for(ai=je.key;_e!==null;){if(_e.key===ai)if(_e.tag===4&&_e.stateNode.containerInfo===je.containerInfo&&_e.stateNode.implementation===je.implementation){h(Le,_e.sibling),lt=S(_e,je.children||[]),lt.return=Le,Le=lt;break e}else{h(Le,_e);break}else l(Le,_e);_e=_e.sibling}lt=zo(je,Le.mode,lt),lt.return=Le,Le=lt}return B(Le);case W:return je=Gl(je),bs(Le,_e,je,lt)}if(ie(je))return Gt(Le,_e,je,lt);if(V(je)){if(ai=V(je),typeof ai!="function")throw Error(i(150));return je=ai.call(je),fi(Le,_e,je,lt)}if(typeof je.then=="function")return bs(Le,_e,Lf(je),lt);if(je.$$typeof===R)return bs(Le,_e,Ei(Le,je),lt);Rf(Le,je)}return typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint"?(je=""+je,_e!==null&&_e.tag===6?(h(Le,_e.sibling),lt=S(_e,je),lt.return=Le,Le=lt):(h(Le,_e),lt=jl(je,Le.mode,lt),lt.return=Le,Le=lt),B(Le)):h(Le,_e)}return function(Le,_e,je,lt){try{Sd=0;var ai=bs(Le,_e,je,lt);return Bu=null,ai}catch(Zt){if(Zt===Fu||Zt===Cf)throw Zt;var es=Ws(29,Zt,null,Le.mode);return es.lanes=lt,es.return=Le,es}}}var Kl=O1(!0),M1=O1(!1),qo=!1;function Jp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Ko(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Wo(o,l,h){var m=o.updateQueue;if(m===null)return null;if(m=m.shared,(ns&2)!==0){var S=m.pending;return S===null?l.next=l:(l.next=S.next,S.next=l),m.pending=l,l=Mu(o),_f(o,null,h),l}return Ou(o,m,l,h),Mu(o)}function Ed(o,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194048)!==0)){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,xi(o,h)}}function tg(o,l){var h=o.updateQueue,m=o.alternate;if(m!==null&&(m=m.updateQueue,h===m)){var S=null,w=null;if(h=h.firstBaseUpdate,h!==null){do{var B={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};w===null?S=w=B:w=w.next=B,h=h.next}while(h!==null);w===null?S=w=l:w=w.next=l}else S=w=l;h={baseState:m.baseState,firstBaseUpdate:S,lastBaseUpdate:w,shared:m.shared,callbacks:m.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=l:o.next=l,h.lastBaseUpdate=l}var ig=!1;function wd(){if(ig){var o=Sn;if(o!==null)throw o}}function Ad(o,l,h,m){ig=!1;var S=o.updateQueue;qo=!1;var w=S.firstBaseUpdate,B=S.lastBaseUpdate,J=S.shared.pending;if(J!==null){S.shared.pending=null;var ye=J,$e=ye.next;ye.next=null,B===null?w=$e:B.next=$e,B=ye;var nt=o.alternate;nt!==null&&(nt=nt.updateQueue,J=nt.lastBaseUpdate,J!==B&&(J===null?nt.firstBaseUpdate=$e:J.next=$e,nt.lastBaseUpdate=ye))}if(w!==null){var dt=S.baseState;B=0,nt=$e=ye=null,J=w;do{var Ve=J.lane&-536870913,Qe=Ve!==J.lane;if(Qe?(Yi&Ve)===Ve:(m&Ve)===Ve){Ve!==0&&Ve===zr&&(ig=!0),nt!==null&&(nt=nt.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var Gt=o,fi=J;Ve=l;var bs=h;switch(fi.tag){case 1:if(Gt=fi.payload,typeof Gt=="function"){dt=Gt.call(bs,dt,Ve);break e}dt=Gt;break e;case 3:Gt.flags=Gt.flags&-65537|128;case 0:if(Gt=fi.payload,Ve=typeof Gt=="function"?Gt.call(bs,dt,Ve):Gt,Ve==null)break e;dt=g({},dt,Ve);break e;case 2:qo=!0}}Ve=J.callback,Ve!==null&&(o.flags|=64,Qe&&(o.flags|=8192),Qe=S.callbacks,Qe===null?S.callbacks=[Ve]:Qe.push(Ve))}else Qe={lane:Ve,tag:J.tag,payload:J.payload,callback:J.callback,next:null},nt===null?($e=nt=Qe,ye=dt):nt=nt.next=Qe,B|=Ve;if(J=J.next,J===null){if(J=S.shared.pending,J===null)break;Qe=J,J=Qe.next,Qe.next=null,S.lastBaseUpdate=Qe,S.shared.pending=null}}while(!0);nt===null&&(ye=dt),S.baseState=ye,S.firstBaseUpdate=$e,S.lastBaseUpdate=nt,w===null&&(S.shared.lanes=0),Jo|=B,o.lanes=B,o.memoizedState=dt}}function P1(o,l){if(typeof o!="function")throw Error(i(191,o));o.call(l)}function F1(o,l){var h=o.callbacks;if(h!==null)for(o.callbacks=null,o=0;ow?w:8;var B=K.T,J={};K.T=J,Tg(o,!1,l,h);try{var ye=S(),$e=K.S;if($e!==null&&$e(J,ye),ye!==null&&typeof ye=="object"&&typeof ye.then=="function"){var nt=BR(ye,m);Dd(o,l,nt,Lr(o))}else Dd(o,l,m,Lr(o))}catch(dt){Dd(o,l,{then:function(){},status:"rejected",reason:dt},Lr())}finally{q.p=w,B!==null&&J.types!==null&&(B.types=J.types),K.T=B}}function VR(){}function xg(o,l,h,m){if(o.tag!==5)throw Error(i(476));var S=pT(o).queue;mT(o,S,l,Z,h===null?VR:function(){return gT(o),h(m)})}function pT(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:so,lastRenderedState:Z},next:null};var h={};return l.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:so,lastRenderedState:h},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function gT(o){var l=pT(o);l.next===null&&(l=o.alternate.memoizedState),Dd(o,l.next.queue,{},Lr())}function bg(){return Bt(qd)}function yT(){return on().memoizedState}function vT(){return on().memoizedState}function GR(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var h=Lr();o=Ko(h);var m=Wo(l,o,h);m!==null&&(dr(m,l,h),Ed(m,l,h)),l={cache:to()},o.payload=l;return}l=l.return}}function qR(o,l,h){var m=Lr();h={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},$f(o)?bT(l,h):(h=gd(o,l,h,m),h!==null&&(dr(h,o,m),TT(h,l,m)))}function xT(o,l,h){var m=Lr();Dd(o,l,h,m)}function Dd(o,l,h,m){var S={lane:m,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if($f(o))bT(l,S);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var B=l.lastRenderedState,J=w(B,h);if(S.hasEagerState=!0,S.eagerState=J,Hn(J,B))return Ou(o,l,S,0),ws===null&&Nu(),!1}catch{}if(h=gd(o,l,S,m),h!==null)return dr(h,o,m),TT(h,l,m),!0}return!1}function Tg(o,l,h,m){if(m={lane:2,revertLane:Jg(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},$f(o)){if(l)throw Error(i(479))}else l=gd(o,h,m,2),l!==null&&dr(l,o,2)}function $f(o){var l=o.alternate;return o===Li||l!==null&&l===Li}function bT(o,l){ju=Of=!0;var h=o.pending;h===null?l.next=l:(l.next=h.next,h.next=l),o.pending=l}function TT(o,l,h){if((h&4194048)!==0){var m=l.lanes;m&=o.pendingLanes,h|=m,l.lanes=h,xi(o,h)}}var Ld={readContext:Bt,use:Ff,useCallback:Ys,useContext:Ys,useEffect:Ys,useImperativeHandle:Ys,useLayoutEffect:Ys,useInsertionEffect:Ys,useMemo:Ys,useReducer:Ys,useRef:Ys,useState:Ys,useDebugValue:Ys,useDeferredValue:Ys,useTransition:Ys,useSyncExternalStore:Ys,useId:Ys,useHostTransitionStatus:Ys,useFormState:Ys,useActionState:Ys,useOptimistic:Ys,useMemoCache:Ys,useCacheRefresh:Ys};Ld.useEffectEvent=Ys;var ST={readContext:Bt,use:Ff,useCallback:function(o,l){return Yn().memoizedState=[o,l===void 0?null:l],o},useContext:Bt,useEffect:rT,useImperativeHandle:function(o,l,h){h=h!=null?h.concat([o]):null,Uf(4194308,4,uT.bind(null,l,o),h)},useLayoutEffect:function(o,l){return Uf(4194308,4,o,l)},useInsertionEffect:function(o,l){Uf(4,2,o,l)},useMemo:function(o,l){var h=Yn();l=l===void 0?null:l;var m=o();if(Wl){yi(!0);try{o()}finally{yi(!1)}}return h.memoizedState=[m,l],m},useReducer:function(o,l,h){var m=Yn();if(h!==void 0){var S=h(l);if(Wl){yi(!0);try{h(l)}finally{yi(!1)}}}else S=l;return m.memoizedState=m.baseState=S,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:S},m.queue=o,o=o.dispatch=qR.bind(null,Li,o),[m.memoizedState,o]},useRef:function(o){var l=Yn();return o={current:o},l.memoizedState=o},useState:function(o){o=mg(o);var l=o.queue,h=xT.bind(null,Li,l);return l.dispatch=h,[o.memoizedState,h]},useDebugValue:yg,useDeferredValue:function(o,l){var h=Yn();return vg(h,o,l)},useTransition:function(){var o=mg(!1);return o=mT.bind(null,Li,o.queue,!0,!1),Yn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,h){var m=Li,S=Yn();if(zi){if(h===void 0)throw Error(i(407));h=h()}else{if(h=l(),ws===null)throw Error(i(349));(Yi&127)!==0||z1(m,l,h)}S.memoizedState=h;var w={value:h,getSnapshot:l};return S.queue=w,rT(G1.bind(null,m,w,o),[o]),m.flags|=2048,Hu(9,{destroy:void 0},V1.bind(null,m,w,h,l),null),h},useId:function(){var o=Yn(),l=ws.identifierPrefix;if(zi){var h=Rn,m=wr;h=(m&~(1<<32-Ct(m)-1)).toString(32)+h,l="_"+l+"R_"+h,h=Mf++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof m.is=="string"?B.createElement("select",{is:m.is}):B.createElement("select"),m.multiple?w.multiple=!0:m.size&&(w.size=m.size);break;default:w=typeof m.is=="string"?B.createElement(S,{is:m.is}):B.createElement(S)}}w[ui]=l,w[ei]=m;e:for(B=l.child;B!==null;){if(B.tag===5||B.tag===6)w.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===l)break e;for(;B.sibling===null;){if(B.return===null||B.return===l)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}l.stateNode=w;e:switch(Nn(w,S,m),S){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&ro(l)}}return Os(l),Mg(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,h),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==m&&ro(l);else{if(typeof m!="string"&&l.stateNode===null)throw Error(i(166));if(o=ve.current,x(l)){if(o=l.stateNode,h=l.memoizedProps,m=null,S=hn,S!==null)switch(S.tag){case 27:case 5:m=S.memoizedProps}o[ui]=l,o=!!(o.nodeValue===h||m!==null&&m.suppressHydrationWarning===!0||$S(o.nodeValue,h)),o||wa(l,!0)}else o=om(o).createTextNode(m),o[ui]=l,l.stateNode=o}return Os(l),null;case 31:if(h=l.memoizedState,o===null||o.memoizedState!==null){if(m=x(l),h!==null){if(o===null){if(!m)throw Error(i(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[ui]=l}else A(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Os(l),o=!1}else h=C(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return l.flags&256?(kr(l),l):(kr(l),null);if((l.flags&128)!==0)throw Error(i(558))}return Os(l),null;case 13:if(m=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(S=x(l),m!==null&&m.dehydrated!==null){if(o===null){if(!S)throw Error(i(318));if(S=l.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(i(317));S[ui]=l}else A(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Os(l),S=!1}else S=C(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=S),S=!0;if(!S)return l.flags&256?(kr(l),l):(kr(l),null)}return kr(l),(l.flags&128)!==0?(l.lanes=h,l):(h=m!==null,o=o!==null&&o.memoizedState!==null,h&&(m=l.child,S=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(S=m.alternate.memoizedState.cachePool.pool),w=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(w=m.memoizedState.cachePool.pool),w!==S&&(m.flags|=2048)),h!==o&&h&&(l.child.flags|=8192),qf(l,l.updateQueue),Os(l),null);case 4:return Fe(),o===null&&sy(l.stateNode.containerInfo),Os(l),null;case 10:return ce(l.type),Os(l),null;case 19:if(re(an),m=l.memoizedState,m===null)return Os(l),null;if(S=(l.flags&128)!==0,w=m.rendering,w===null)if(S)Id(m,!1);else{if(Xs!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(w=Nf(o),w!==null){for(l.flags|=128,Id(m,!1),o=w.updateQueue,l.updateQueue=o,qf(l,o),l.subtreeFlags=0,o=h,h=l.child;h!==null;)Ef(h,o),h=h.sibling;return Q(an,an.current&1|2),zi&&Pi(l,m.treeForkCount),l.child}o=o.sibling}m.tail!==null&&de()>Qf&&(l.flags|=128,S=!0,Id(m,!1),l.lanes=4194304)}else{if(!S)if(o=Nf(w),o!==null){if(l.flags|=128,S=!0,o=o.updateQueue,l.updateQueue=o,qf(l,o),Id(m,!0),m.tail===null&&m.tailMode==="hidden"&&!w.alternate&&!zi)return Os(l),null}else 2*de()-m.renderingStartTime>Qf&&h!==536870912&&(l.flags|=128,S=!0,Id(m,!1),l.lanes=4194304);m.isBackwards?(w.sibling=l.child,l.child=w):(o=m.last,o!==null?o.sibling=w:l.child=w,m.last=w)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=de(),o.sibling=null,h=an.current,Q(an,S?h&1|2:h&1),zi&&Pi(l,m.treeForkCount),o):(Os(l),null);case 22:case 23:return kr(l),ng(),m=l.memoizedState!==null,o!==null?o.memoizedState!==null!==m&&(l.flags|=8192):m&&(l.flags|=8192),m?(h&536870912)!==0&&(l.flags&128)===0&&(Os(l),l.subtreeFlags&6&&(l.flags|=8192)):Os(l),h=l.updateQueue,h!==null&&qf(l,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==h&&(l.flags|=2048),o!==null&&re(Vl),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),ce(Ls),Os(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function QR(o,l){switch(rr(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ce(Ls),Fe(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return De(l),null;case 31:if(l.memoizedState!==null){if(kr(l),l.alternate===null)throw Error(i(340));A()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(kr(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(i(340));A()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return re(an),null;case 4:return Fe(),null;case 10:return ce(l.type),null;case 22:case 23:return kr(l),ng(),o!==null&&re(Vl),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return ce(Ls),null;case 25:return null;default:return null}}function qT(o,l){switch(rr(l),l.tag){case 3:ce(Ls),Fe();break;case 26:case 27:case 5:De(l);break;case 4:Fe();break;case 31:l.memoizedState!==null&&kr(l);break;case 13:kr(l);break;case 19:re(an);break;case 10:ce(l.type);break;case 22:case 23:kr(l),ng(),o!==null&&re(Vl);break;case 24:ce(Ls)}}function Nd(o,l){try{var h=l.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var S=m.next;h=S;do{if((h.tag&o)===o){m=void 0;var w=h.create,B=h.inst;m=w(),B.destroy=m}h=h.next}while(h!==S)}}catch(J){ps(l,l.return,J)}}function Qo(o,l,h){try{var m=l.updateQueue,S=m!==null?m.lastEffect:null;if(S!==null){var w=S.next;m=w;do{if((m.tag&o)===o){var B=m.inst,J=B.destroy;if(J!==void 0){B.destroy=void 0,S=l;var ye=h,$e=J;try{$e()}catch(nt){ps(S,ye,nt)}}}m=m.next}while(m!==w)}}catch(nt){ps(l,l.return,nt)}}function KT(o){var l=o.updateQueue;if(l!==null){var h=o.stateNode;try{F1(l,h)}catch(m){ps(o,o.return,m)}}}function WT(o,l,h){h.props=Yl(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(m){ps(o,l,m)}}function Od(o,l){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var m=o.stateNode;break;case 30:m=o.stateNode;break;default:m=o.stateNode}typeof h=="function"?o.refCleanup=h(m):h.current=m}}catch(S){ps(o,l,S)}}function Ca(o,l){var h=o.ref,m=o.refCleanup;if(h!==null)if(typeof m=="function")try{m()}catch(S){ps(o,l,S)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(S){ps(o,l,S)}else h.current=null}function YT(o){var l=o.type,h=o.memoizedProps,m=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":h.autoFocus&&m.focus();break e;case"img":h.src?m.src=h.src:h.srcSet&&(m.srcset=h.srcSet)}}catch(S){ps(o,o.return,S)}}function Pg(o,l,h){try{var m=o.stateNode;xI(m,o.type,h,l),m[ei]=l}catch(S){ps(o,o.return,S)}}function XT(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&nl(o.type)||o.tag===4}function Fg(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||XT(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&nl(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Bg(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,l):(l=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,l.appendChild(o),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=ii));else if(m!==4&&(m===27&&nl(o.type)&&(h=o.stateNode,l=null),o=o.child,o!==null))for(Bg(o,l,h),o=o.sibling;o!==null;)Bg(o,l,h),o=o.sibling}function Kf(o,l,h){var m=o.tag;if(m===5||m===6)o=o.stateNode,l?h.insertBefore(o,l):h.appendChild(o);else if(m!==4&&(m===27&&nl(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(Kf(o,l,h),o=o.sibling;o!==null;)Kf(o,l,h),o=o.sibling}function QT(o){var l=o.stateNode,h=o.memoizedProps;try{for(var m=o.type,S=l.attributes;S.length;)l.removeAttributeNode(S[0]);Nn(l,m,h),l[ui]=o,l[ei]=h}catch(w){ps(o,o.return,w)}}var ao=!1,pn=!1,Ug=!1,ZT=typeof WeakSet=="function"?WeakSet:Set,_n=null;function ZR(o,l){if(o=o.containerInfo,ay=mm,o=Ru(o),ud(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var m=h.getSelection&&h.getSelection();if(m&&m.rangeCount!==0){h=m.anchorNode;var S=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{h.nodeType,w.nodeType}catch{h=null;break e}var B=0,J=-1,ye=-1,$e=0,nt=0,dt=o,Ve=null;t:for(;;){for(var Qe;dt!==h||S!==0&&dt.nodeType!==3||(J=B+S),dt!==w||m!==0&&dt.nodeType!==3||(ye=B+m),dt.nodeType===3&&(B+=dt.nodeValue.length),(Qe=dt.firstChild)!==null;)Ve=dt,dt=Qe;for(;;){if(dt===o)break t;if(Ve===h&&++$e===S&&(J=B),Ve===w&&++nt===m&&(ye=B),(Qe=dt.nextSibling)!==null)break;dt=Ve,Ve=dt.parentNode}dt=Qe}h=J===-1||ye===-1?null:{start:J,end:ye}}else h=null}h=h||{start:0,end:0}}else h=null;for(oy={focusedElem:o,selectionRange:h},mm=!1,_n=l;_n!==null;)if(l=_n,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,_n=o;else for(;_n!==null;){switch(l=_n,w=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h title"))),Nn(w,m,h),w[ui]=o,ji(w),m=w;break e;case"link":var B=n_("link","href",S).get(m+(h.href||""));if(B){for(var J=0;Jbs&&(B=bs,bs=fi,fi=B);var Le=Bs(J,fi),_e=Bs(J,bs);if(Le&&_e&&(Qe.rangeCount!==1||Qe.anchorNode!==Le.node||Qe.anchorOffset!==Le.offset||Qe.focusNode!==_e.node||Qe.focusOffset!==_e.offset)){var je=dt.createRange();je.setStart(Le.node,Le.offset),Qe.removeAllRanges(),fi>bs?(Qe.addRange(je),Qe.extend(_e.node,_e.offset)):(je.setEnd(_e.node,_e.offset),Qe.addRange(je))}}}}for(dt=[],Qe=J;Qe=Qe.parentNode;)Qe.nodeType===1&&dt.push({element:Qe,left:Qe.scrollLeft,top:Qe.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;Jh?32:h,K.T=null,h=qg,qg=null;var w=tl,B=ho;if(vn=0,Ku=tl=null,ho=0,(ns&6)!==0)throw Error(i(331));var J=ns;if(ns|=4,uS(w.current),aS(w,w.current,B,h),ns=J,jd(0,!1),Wt&&typeof Wt.onPostCommitFiberRoot=="function")try{Wt.onPostCommitFiberRoot(qt,w)}catch{}return!0}finally{q.p=S,K.T=m,kS(o,l)}}function DS(o,l,h){l=sr(h,l),l=wg(o.stateNode,l,2),o=Wo(o,l,2),o!==null&&(Tt(o,2),Da(o))}function ps(o,l,h){if(o.tag===3)DS(o,o,h);else for(;l!==null;){if(l.tag===3){DS(l,o,h);break}else if(l.tag===1){var m=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(el===null||!el.has(m))){o=sr(h,o),h=LT(2),m=Wo(l,h,2),m!==null&&(RT(h,m,l,o),Tt(m,2),Da(m));break}}l=l.return}}function Xg(o,l,h){var m=o.pingCache;if(m===null){m=o.pingCache=new tI;var S=new Set;m.set(l,S)}else S=m.get(l),S===void 0&&(S=new Set,m.set(l,S));S.has(h)||(Hg=!0,S.add(h),o=aI.bind(null,o,l,h),l.then(o,o))}function aI(o,l,h){var m=o.pingCache;m!==null&&m.delete(l),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,ws===o&&(Yi&h)===h&&(Xs===4||Xs===3&&(Yi&62914560)===Yi&&300>de()-Xf?(ns&2)===0&&Wu(o,0):zg|=h,qu===Yi&&(qu=0)),Da(o)}function LS(o,l){l===0&&(l=Me()),o=eo(o,l),o!==null&&(Tt(o,l),Da(o))}function oI(o){var l=o.memoizedState,h=0;l!==null&&(h=l.retryLane),LS(o,h)}function lI(o,l){var h=0;switch(o.tag){case 31:case 13:var m=o.stateNode,S=o.memoizedState;S!==null&&(h=S.retryLane);break;case 19:m=o.stateNode;break;case 22:m=o.stateNode._retryCache;break;default:throw Error(i(314))}m!==null&&m.delete(l),LS(o,h)}function uI(o,l){return at(o,l)}var sm=null,Xu=null,Qg=!1,nm=!1,Zg=!1,sl=0;function Da(o){o!==Xu&&o.next===null&&(Xu===null?sm=Xu=o:Xu=Xu.next=o),nm=!0,Qg||(Qg=!0,dI())}function jd(o,l){if(!Zg&&nm){Zg=!0;do for(var h=!1,m=sm;m!==null;){if(o!==0){var S=m.pendingLanes;if(S===0)var w=0;else{var B=m.suspendedLanes,J=m.pingedLanes;w=(1<<31-Ct(42|o)+1)-1,w&=S&~(B&~J),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(h=!0,OS(m,w))}else w=Yi,w=U(m,m===ws?w:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(w&3)===0||ee(m,w)||(h=!0,OS(m,w));m=m.next}while(h);Zg=!1}}function cI(){RS()}function RS(){nm=Qg=!1;var o=0;sl!==0&&TI()&&(o=sl);for(var l=de(),h=null,m=sm;m!==null;){var S=m.next,w=IS(m,l);w===0?(m.next=null,h===null?sm=S:h.next=S,S===null&&(Xu=h)):(h=m,(o!==0||(w&3)!==0)&&(nm=!0)),m=S}vn!==0&&vn!==5||jd(o),sl!==0&&(sl=0)}function IS(o,l){for(var h=o.suspendedLanes,m=o.pingedLanes,S=o.expirationTimes,w=o.pendingLanes&-62914561;0J)break;var nt=ye.transferSize,dt=ye.initiatorType;nt&&HS(dt)&&(ye=ye.responseEnd,B+=nt*(ye"u"?null:document;function e_(o,l,h){var m=Qu;if(m&&typeof l=="string"&&l){var S=os(l);S='link[rel="'+o+'"][href="'+S+'"]',typeof h=="string"&&(S+='[crossorigin="'+h+'"]'),JS.has(S)||(JS.add(S),o={rel:o,crossOrigin:h,href:l},m.querySelector(S)===null&&(l=m.createElement("link"),Nn(l,"link",o),ji(l),m.head.appendChild(l)))}}function LI(o){fo.D(o),e_("dns-prefetch",o,null)}function RI(o,l){fo.C(o,l),e_("preconnect",o,l)}function II(o,l,h){fo.L(o,l,h);var m=Qu;if(m&&o&&l){var S='link[rel="preload"][as="'+os(l)+'"]';l==="image"&&h&&h.imageSrcSet?(S+='[imagesrcset="'+os(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(S+='[imagesizes="'+os(h.imageSizes)+'"]')):S+='[href="'+os(o)+'"]';var w=S;switch(l){case"style":w=Zu(o);break;case"script":w=Ju(o)}qr.has(w)||(o=g({rel:"preload",href:l==="image"&&h&&h.imageSrcSet?void 0:o,as:l},h),qr.set(w,o),m.querySelector(S)!==null||l==="style"&&m.querySelector(Vd(w))||l==="script"&&m.querySelector(Gd(w))||(l=m.createElement("link"),Nn(l,"link",o),ji(l),m.head.appendChild(l)))}}function NI(o,l){fo.m(o,l);var h=Qu;if(h&&o){var m=l&&typeof l.as=="string"?l.as:"script",S='link[rel="modulepreload"][as="'+os(m)+'"][href="'+os(o)+'"]',w=S;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Ju(o)}if(!qr.has(w)&&(o=g({rel:"modulepreload",href:o},l),qr.set(w,o),h.querySelector(S)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Gd(w)))return}m=h.createElement("link"),Nn(m,"link",o),ji(m),h.head.appendChild(m)}}}function OI(o,l,h){fo.S(o,l,h);var m=Qu;if(m&&o){var S=Ms(m).hoistableStyles,w=Zu(o);l=l||"default";var B=S.get(w);if(!B){var J={loading:0,preload:null};if(B=m.querySelector(Vd(w)))J.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":l},h),(h=qr.get(w))&&my(o,h);var ye=B=m.createElement("link");ji(ye),Nn(ye,"link",o),ye._p=new Promise(function($e,nt){ye.onload=$e,ye.onerror=nt}),ye.addEventListener("load",function(){J.loading|=1}),ye.addEventListener("error",function(){J.loading|=2}),J.loading|=4,um(B,l,m)}B={type:"stylesheet",instance:B,count:1,state:J},S.set(w,B)}}}function MI(o,l){fo.X(o,l);var h=Qu;if(h&&o){var m=Ms(h).hoistableScripts,S=Ju(o),w=m.get(S);w||(w=h.querySelector(Gd(S)),w||(o=g({src:o,async:!0},l),(l=qr.get(S))&&py(o,l),w=h.createElement("script"),ji(w),Nn(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(S,w))}}function PI(o,l){fo.M(o,l);var h=Qu;if(h&&o){var m=Ms(h).hoistableScripts,S=Ju(o),w=m.get(S);w||(w=h.querySelector(Gd(S)),w||(o=g({src:o,async:!0,type:"module"},l),(l=qr.get(S))&&py(o,l),w=h.createElement("script"),ji(w),Nn(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},m.set(S,w))}}function t_(o,l,h,m){var S=(S=ve.current)?lm(S):null;if(!S)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(l=Zu(h.href),h=Ms(S).hoistableStyles,m=h.get(l),m||(m={type:"style",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=Zu(h.href);var w=Ms(S).hoistableStyles,B=w.get(o);if(B||(S=S.ownerDocument||S,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,B),(w=S.querySelector(Vd(o)))&&!w._p&&(B.instance=w,B.state.loading=5),qr.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},qr.set(o,h),w||FI(S,o,h,B.state))),l&&m===null)throw Error(i(528,""));return B}if(l&&m!==null)throw Error(i(529,""));return null;case"script":return l=h.async,h=h.src,typeof h=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ju(h),h=Ms(S).hoistableScripts,m=h.get(l),m||(m={type:"script",instance:null,count:0,state:null},h.set(l,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function Zu(o){return'href="'+os(o)+'"'}function Vd(o){return'link[rel="stylesheet"]['+o+"]"}function i_(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function FI(o,l,h,m){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?m.loading=1:(l=o.createElement("link"),m.preload=l,l.addEventListener("load",function(){return m.loading|=1}),l.addEventListener("error",function(){return m.loading|=2}),Nn(l,"link",h),ji(l),o.head.appendChild(l))}function Ju(o){return'[src="'+os(o)+'"]'}function Gd(o){return"script[async]"+o}function s_(o,l,h){if(l.count++,l.instance===null)switch(l.type){case"style":var m=o.querySelector('style[data-href~="'+os(h.href)+'"]');if(m)return l.instance=m,ji(m),m;var S=g({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return m=(o.ownerDocument||o).createElement("style"),ji(m),Nn(m,"style",S),um(m,h.precedence,o),l.instance=m;case"stylesheet":S=Zu(h.href);var w=o.querySelector(Vd(S));if(w)return l.state.loading|=4,l.instance=w,ji(w),w;m=i_(h),(S=qr.get(S))&&my(m,S),w=(o.ownerDocument||o).createElement("link"),ji(w);var B=w;return B._p=new Promise(function(J,ye){B.onload=J,B.onerror=ye}),Nn(w,"link",m),l.state.loading|=4,um(w,h.precedence,o),l.instance=w;case"script":return w=Ju(h.src),(S=o.querySelector(Gd(w)))?(l.instance=S,ji(S),S):(m=h,(S=qr.get(w))&&(m=g({},h),py(m,S)),o=o.ownerDocument||o,S=o.createElement("script"),ji(S),Nn(S,"link",m),o.head.appendChild(S),l.instance=S);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(m=l.instance,l.state.loading|=4,um(m,h.precedence,o));return l.instance}function um(o,l,h){for(var m=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),S=m.length?m[m.length-1]:null,w=S,B=0;B title"):null)}function BI(o,l,h){if(h===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(o=l.disabled,typeof l.precedence=="string"&&o==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function a_(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function UI(o,l,h,m){if(h.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var S=Zu(m.href),w=l.querySelector(Vd(S));if(w){l=w._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=dm.bind(o),l.then(o,o)),h.state.loading|=4,h.instance=w,ji(w);return}w=l.ownerDocument||l,m=i_(m),(S=qr.get(S))&&my(m,S),w=w.createElement("link"),ji(w);var B=w;B._p=new Promise(function(J,ye){B.onload=J,B.onerror=ye}),Nn(w,"link",m),h.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,l),(l=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=dm.bind(o),l.addEventListener("load",h),l.addEventListener("error",h))}}var gy=0;function jI(o,l){return o.stylesheets&&o.count===0&&fm(o,o.stylesheets),0gy?50:800)+l);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(m),clearTimeout(S)}}:null}function dm(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fm(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var hm=null;function fm(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,hm=new Map,l.forEach($I,o),hm=null,dm.call(o))}function $I(o,l){if(!(l.state.loading&4)){var h=hm.get(o);if(h)var m=h.get(null);else{h=new Map,hm.set(o,h);for(var S=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),wy.exports=nN(),wy.exports}var bA=rN();function aN(...s){return s.filter(Boolean).join(" ")}const oN="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",lN={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},uN={xs:"px-2 py-1 text-xs",sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3.5 py-2.5 text-sm"},cN={indigo:{primary:"!bg-indigo-600 !text-white shadow-sm hover:!bg-indigo-700 focus-visible:outline-indigo-600 dark:!bg-indigo-500 dark:hover:!bg-indigo-400 dark:focus-visible:outline-indigo-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-indigo-50 text-indigo-600 shadow-xs hover:bg-indigo-100 dark:bg-indigo-500/20 dark:text-indigo-400 dark:shadow-none dark:hover:bg-indigo-500/30"},blue:{primary:"!bg-blue-600 !text-white shadow-sm hover:!bg-blue-700 focus-visible:outline-blue-600 dark:!bg-blue-500 dark:hover:!bg-blue-400 dark:focus-visible:outline-blue-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-blue-50 text-blue-600 shadow-xs hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-400 dark:shadow-none dark:hover:bg-blue-500/30"},emerald:{primary:"!bg-emerald-600 !text-white shadow-sm hover:!bg-emerald-700 focus-visible:outline-emerald-600 dark:!bg-emerald-500 dark:hover:!bg-emerald-400 dark:focus-visible:outline-emerald-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-emerald-50 text-emerald-700 shadow-xs hover:bg-emerald-100 dark:bg-emerald-500/20 dark:text-emerald-400 dark:shadow-none dark:hover:bg-emerald-500/30"},red:{primary:"!bg-red-600 !text-white shadow-sm hover:!bg-red-700 focus-visible:outline-red-600 dark:!bg-red-500 dark:hover:!bg-red-400 dark:focus-visible:outline-red-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-red-50 text-red-700 shadow-xs hover:bg-red-100 dark:bg-red-500/20 dark:text-red-400 dark:shadow-none dark:hover:bg-red-500/30"},amber:{primary:"!bg-amber-500 !text-white shadow-sm hover:!bg-amber-600 focus-visible:outline-amber-500 dark:!bg-amber-500 dark:hover:!bg-amber-400 dark:focus-visible:outline-amber-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-amber-50 text-amber-800 shadow-xs hover:bg-amber-100 dark:bg-amber-500/20 dark:text-amber-300 dark:shadow-none dark:hover:bg-amber-500/30"}};function dN(){return p.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 animate-spin","aria-hidden":"true",children:[p.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.25"}),p.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.9"})]})}function mi({children:s,variant:e="primary",color:t="indigo",size:i="md",rounded:n="md",leadingIcon:r,trailingIcon:a,isLoading:u=!1,disabled:c,className:d,type:f="button",...g}){const y=r||a||u?"gap-x-1.5":"";return p.jsxs("button",{type:f,disabled:c||u,className:aN(oN,lN[n],uN[i],cN[t][e],y,d),...g,children:[u?p.jsx("span",{className:"-ml-0.5",children:p.jsx(dN,{})}):r&&p.jsx("span",{className:"-ml-0.5",children:r}),p.jsx("span",{children:s}),a&&!u&&p.jsx("span",{className:"-mr-0.5",children:a})]})}function TA(s){var e,t,i="";if(typeof s=="string"||typeof s=="number")i+=s;else if(typeof s=="object")if(Array.isArray(s)){var n=s.length;for(e=0;ee in s?hN(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Dy=(s,e,t)=>(fN(s,typeof e!="symbol"?e+"":e,t),t);let mN=class{constructor(){Dy(this,"current",this.detect()),Dy(this,"handoffState","pending"),Dy(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Va=new mN;function Kh(s){var e;return Va.isServer?null:s==null?document:(e=s?.ownerDocument)!=null?e:document}function tx(s){var e,t;return Va.isServer?null:s==null?document:(t=(e=s?.getRootNode)==null?void 0:e.call(s))!=null?t:document}function SA(s){var e,t;return(t=(e=tx(s))==null?void 0:e.activeElement)!=null?t:null}function pN(s){return SA(s)===s}function ep(s){typeof queueMicrotask=="function"?queueMicrotask(s):Promise.resolve().then(s).catch(e=>setTimeout(()=>{throw e}))}function Do(){let s=[],e={addEventListener(t,i,n,r){return t.addEventListener(i,n,r),e.add(()=>t.removeEventListener(i,n,r))},requestAnimationFrame(...t){let i=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let i=setTimeout(...t);return e.add(()=>clearTimeout(i))},microTask(...t){let i={current:!0};return ep(()=>{i.current&&t[0]()}),e.add(()=>{i.current=!1})},style(t,i,n){let r=t.style.getPropertyValue(i);return Object.assign(t.style,{[i]:n}),this.add(()=>{Object.assign(t.style,{[i]:r})})},group(t){let i=Do();return t(i),this.add(()=>i.dispose())},add(t){return s.includes(t)||s.push(t),()=>{let i=s.indexOf(t);if(i>=0)for(let n of s.splice(i,1))n()}},dispose(){for(let t of s.splice(0))t()}};return e}function tp(){let[s]=_.useState(Do);return _.useEffect(()=>()=>s.dispose(),[s]),s}let xr=(s,e)=>{Va.isServer?_.useEffect(s,e):_.useLayoutEffect(s,e)};function wu(s){let e=_.useRef(s);return xr(()=>{e.current=s},[s]),e}let ks=function(s){let e=wu(s);return ci.useCallback((...t)=>e.current(...t),[e])};function Wh(s){return _.useMemo(()=>s,Object.values(s))}let gN=_.createContext(void 0);function yN(){return _.useContext(gN)}function ix(...s){return Array.from(new Set(s.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function ko(s,e,...t){if(s in e){let n=e[s];return typeof n=="function"?n(...t):n}let i=new Error(`Tried to handle "${s}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(n=>`"${n}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,ko),i}var f0=(s=>(s[s.None=0]="None",s[s.RenderStrategy=1]="RenderStrategy",s[s.Static=2]="Static",s))(f0||{}),Sl=(s=>(s[s.Unmount=0]="Unmount",s[s.Hidden=1]="Hidden",s))(Sl||{});function ta(){let s=xN();return _.useCallback(e=>vN({mergeRefs:s,...e}),[s])}function vN({ourProps:s,theirProps:e,slot:t,defaultTag:i,features:n,visible:r=!0,name:a,mergeRefs:u}){u=u??bN;let c=_A(e,s);if(r)return Tm(c,t,i,a,u);let d=n??0;if(d&2){let{static:f=!1,...g}=c;if(f)return Tm(g,t,i,a,u)}if(d&1){let{unmount:f=!0,...g}=c;return ko(f?0:1,{0(){return null},1(){return Tm({...g,hidden:!0,style:{display:"none"}},t,i,a,u)}})}return Tm(c,t,i,a,u)}function Tm(s,e={},t,i,n){let{as:r=t,children:a,refName:u="ref",...c}=Ly(s,["unmount","static"]),d=s.ref!==void 0?{[u]:s.ref}:{},f=typeof a=="function"?a(e):a;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(e)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let g={};if(e){let y=!1,v=[];for(let[b,T]of Object.entries(e))typeof T=="boolean"&&(y=!0),T===!0&&v.push(b.replace(/([A-Z])/g,E=>`-${E.toLowerCase()}`));if(y){g["data-headlessui-state"]=v.join(" ");for(let b of v)g[`data-${b}`]=""}}if(yh(r)&&(Object.keys(nu(c)).length>0||Object.keys(nu(g)).length>0))if(!_.isValidElement(f)||Array.isArray(f)&&f.length>1||SN(f)){if(Object.keys(nu(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(nu(c)).concat(Object.keys(nu(g))).map(y=>` - ${y}`).join(` `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(y=>` - ${y}`).join(` `)].join(` -`))}else{let y=f.props,v=y?.className,b=typeof v=="function"?(...D)=>ex(v(...D),c.className):ex(v,c.className),T=b?{className:b}:{},E=pA(f.props,su(Cy(c,["ref"])));for(let D in p)D in E&&delete p[D];return _.cloneElement(f,Object.assign({},E,p,d,{ref:n(hN(f),d.ref)},T))}return _.createElement(r,Object.assign({},Cy(c,["ref"]),!gh(r)&&d,!gh(r)&&p),f)}function cN(){let s=_.useRef([]),e=_.useCallback(t=>{for(let i of s.current)i!=null&&(typeof i=="function"?i(t):i.current=t)},[]);return(...t)=>{if(!t.every(i=>i==null))return s.current=t,e}}function dN(...s){return s.every(e=>e==null)?void 0:e=>{for(let t of s)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function pA(...s){if(s.length===0)return{};if(s.length===1)return s[0];let e={},t={};for(let i of s)for(let n in i)n.startsWith("on")&&typeof i[n]=="function"?(t[n]!=null||(t[n]=[]),t[n].push(i[n])):e[n]=i[n];if(e.disabled||e["aria-disabled"])for(let i in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(t[i]=[n=>{var r;return(r=n?.preventDefault)==null?void 0:r.call(n)}]);for(let i in t)Object.assign(e,{[i](n,...r){let a=t[i];for(let u of a){if((n instanceof Event||n?.nativeEvent instanceof Event)&&n.defaultPrevented)return;u(n,...r)}}});return e}function vr(s){var e;return Object.assign(_.forwardRef(s),{displayName:(e=s.displayName)!=null?e:s.name})}function su(s){let e=Object.assign({},s);for(let t in e)e[t]===void 0&&delete e[t];return e}function Cy(s,e=[]){let t=Object.assign({},s);for(let i of e)i in t&&delete t[i];return t}function hN(s){return Zt.version.split(".")[0]>="19"?s.props.ref:s.ref}function gh(s){return s===_.Fragment||s===Symbol.for("react.fragment")}function fN(s){return gh(s.type)}let mN="span";var u0=(s=>(s[s.None=1]="None",s[s.Focusable=2]="Focusable",s[s.Hidden=4]="Hidden",s))(u0||{});function pN(s,e){var t;let{features:i=1,...n}=s,r={ref:e,"aria-hidden":(i&2)===2?!0:(t=n["aria-hidden"])!=null?t:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return Qr()({ourProps:r,theirProps:n,slot:{},defaultTag:mN,name:"Hidden"})}let tx=vr(pN);function gN(s){return typeof s!="object"||s===null?!1:"nodeType"in s}function _l(s){return gN(s)&&"tagName"in s}function vu(s){return _l(s)&&"accessKey"in s}function Sl(s){return _l(s)&&"tabIndex"in s}function yN(s){return _l(s)&&"style"in s}function vN(s){return vu(s)&&s.nodeName==="IFRAME"}function xN(s){return vu(s)&&s.nodeName==="INPUT"}let gA=Symbol();function bN(s,e=!0){return Object.assign(s,{[gA]:e})}function Ka(...s){let e=_.useRef(s);_.useEffect(()=>{e.current=s},[s]);let t=Ts(i=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(i):n.current=i)});return s.every(i=>i==null||i?.[gA])?void 0:t}let sb=_.createContext(null);sb.displayName="DescriptionContext";function yA(){let s=_.useContext(sb);if(s===null){let e=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,yA),e}return s}function TN(){let[s,e]=_.useState([]);return[s.length>0?s.join(" "):void 0,_.useMemo(()=>function(t){let i=Ts(r=>(e(a=>[...a,r]),()=>e(a=>{let u=a.slice(),c=u.indexOf(r);return c!==-1&&u.splice(c,1),u}))),n=_.useMemo(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return Zt.createElement(sb.Provider,{value:n},t.children)},[e])]}let SN="p";function _N(s,e){let t=_.useId(),i=lN(),{id:n=`headlessui-description-${t}`,...r}=s,a=yA(),u=Ka(e);gr(()=>a.register(n),[n,a.register]);let c=qh({...a.slot,disabled:i||!1}),d={ref:u,...a.props,id:n};return Qr()({ourProps:d,theirProps:r,slot:c,defaultTag:SN,name:a.name||"Description"})}let EN=vr(_N),wN=Object.assign(EN,{});var vA=(s=>(s.Space=" ",s.Enter="Enter",s.Escape="Escape",s.Backspace="Backspace",s.Delete="Delete",s.ArrowLeft="ArrowLeft",s.ArrowUp="ArrowUp",s.ArrowRight="ArrowRight",s.ArrowDown="ArrowDown",s.Home="Home",s.End="End",s.PageUp="PageUp",s.PageDown="PageDown",s.Tab="Tab",s))(vA||{});let AN=_.createContext(()=>{});function kN({value:s,children:e}){return Zt.createElement(AN.Provider,{value:s},e)}let xA=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var CN=Object.defineProperty,DN=(s,e,t)=>e in s?CN(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,LN=(s,e,t)=>(DN(s,e+"",t),t),bA=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},zr=(s,e,t)=>(bA(s,e,"read from private field"),t?t.call(s):e.get(s)),Dy=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},C_=(s,e,t,i)=>(bA(s,e,"write to private field"),e.set(s,t),t),Ca,lh,uh;let RN=class{constructor(e){Dy(this,Ca,{}),Dy(this,lh,new xA(()=>new Set)),Dy(this,uh,new Set),LN(this,"disposables",Co()),C_(this,Ca,e),Ua.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return zr(this,Ca)}subscribe(e,t){if(Ua.isServer)return()=>{};let i={selector:e,callback:t,current:e(zr(this,Ca))};return zr(this,uh).add(i),this.disposables.add(()=>{zr(this,uh).delete(i)})}on(e,t){return Ua.isServer?()=>{}:(zr(this,lh).get(e).add(t),this.disposables.add(()=>{zr(this,lh).get(e).delete(t)}))}send(e){let t=this.reduce(zr(this,Ca),e);if(t!==zr(this,Ca)){C_(this,Ca,t);for(let i of zr(this,uh)){let n=i.selector(zr(this,Ca));TA(i.current,n)||(i.current=n,i.callback(n))}for(let i of zr(this,lh).get(e.type))i(zr(this,Ca),e)}}};Ca=new WeakMap,lh=new WeakMap,uh=new WeakMap;function TA(s,e){return Object.is(s,e)?!0:typeof s!="object"||s===null||typeof e!="object"||e===null?!1:Array.isArray(s)&&Array.isArray(e)?s.length!==e.length?!1:Ly(s[Symbol.iterator](),e[Symbol.iterator]()):s instanceof Map&&e instanceof Map||s instanceof Set&&e instanceof Set?s.size!==e.size?!1:Ly(s.entries(),e.entries()):D_(s)&&D_(e)?Ly(Object.entries(s)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Ly(s,e){do{let t=s.next(),i=e.next();if(t.done&&i.done)return!0;if(t.done||i.done||!Object.is(t.value,i.value))return!1}while(!0)}function D_(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;let e=Object.getPrototypeOf(s);return e===null||Object.getPrototypeOf(e)===null}var IN=Object.defineProperty,NN=(s,e,t)=>e in s?IN(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,L_=(s,e,t)=>(NN(s,typeof e!="symbol"?e+"":e,t),t),ON=(s=>(s[s.Push=0]="Push",s[s.Pop=1]="Pop",s))(ON||{});let MN={0(s,e){let t=e.id,i=s.stack,n=s.stack.indexOf(t);if(n!==-1){let r=s.stack.slice();return r.splice(n,1),r.push(t),i=r,{...s,stack:i}}return{...s,stack:[...s.stack,t]}},1(s,e){let t=e.id,i=s.stack.indexOf(t);if(i===-1)return s;let n=s.stack.slice();return n.splice(i,1),{...s,stack:n}}},PN=class SA extends RN{constructor(){super(...arguments),L_(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),L_(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new SA({stack:[]})}reduce(e,t){return Ao(t.type,MN,e,t)}};const _A=new xA(()=>PN.new());var Ry={exports:{}},Iy={};var R_;function BN(){if(R_)return Iy;R_=1;var s=Y0();function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var t=typeof Object.is=="function"?Object.is:e,i=s.useSyncExternalStore,n=s.useRef,r=s.useEffect,a=s.useMemo,u=s.useDebugValue;return Iy.useSyncExternalStoreWithSelector=function(c,d,f,p,y){var v=n(null);if(v.current===null){var b={hasValue:!1,value:null};v.current=b}else b=v.current;v=a(function(){function E(F){if(!D){if(D=!0,O=F,F=p(F),y!==void 0&&b.hasValue){var z=b.value;if(y(z,F))return R=z}return R=F}if(z=R,t(O,F))return z;var N=p(F);return y!==void 0&&y(z,N)?(O=F,z):(O=F,R=N)}var D=!1,O,R,j=f===void 0?null:f;return[function(){return E(d())},j===null?void 0:function(){return E(j())}]},[d,f,p,y]);var T=i(c,v[0],v[1]);return r(function(){b.hasValue=!0,b.value=T},[T]),u(T),T},Iy}var I_;function FN(){return I_||(I_=1,Ry.exports=BN()),Ry.exports}var UN=FN();function EA(s,e,t=TA){return UN.useSyncExternalStoreWithSelector(Ts(i=>s.subscribe(jN,i)),Ts(()=>s.state),Ts(()=>s.state),Ts(e),t)}function jN(s){return s}function Kh(s,e){let t=_.useId(),i=_A.get(e),[n,r]=EA(i,_.useCallback(a=>[i.selectors.isTop(a,t),i.selectors.inStack(a,t)],[i,t]));return gr(()=>{if(s)return i.actions.push(t),()=>i.actions.pop(t)},[i,s,t]),s?r?n:!0:!1}let ix=new Map,yh=new Map;function N_(s){var e;let t=(e=yh.get(s))!=null?e:0;return yh.set(s,t+1),t!==0?()=>O_(s):(ix.set(s,{"aria-hidden":s.getAttribute("aria-hidden"),inert:s.inert}),s.setAttribute("aria-hidden","true"),s.inert=!0,()=>O_(s))}function O_(s){var e;let t=(e=yh.get(s))!=null?e:1;if(t===1?yh.delete(s):yh.set(s,t-1),t!==1)return;let i=ix.get(s);i&&(i["aria-hidden"]===null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",i["aria-hidden"]),s.inert=i.inert,ix.delete(s))}function $N(s,{allowed:e,disallowed:t}={}){let i=Kh(s,"inert-others");gr(()=>{var n,r;if(!i)return;let a=Co();for(let c of(n=t?.())!=null?n:[])c&&a.add(N_(c));let u=(r=e?.())!=null?r:[];for(let c of u){if(!c)continue;let d=Gh(c);if(!d)continue;let f=c.parentElement;for(;f&&f!==d.body;){for(let p of f.children)u.some(y=>p.contains(y))||a.add(N_(p));f=f.parentElement}}return a.dispose},[i,e,t])}function HN(s,e,t){let i=Eu(n=>{let r=n.getBoundingClientRect();r.x===0&&r.y===0&&r.width===0&&r.height===0&&t()});_.useEffect(()=>{if(!s)return;let n=e===null?null:vu(e)?e:e.current;if(!n)return;let r=Co();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>i.current(n));a.observe(n),r.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>i.current(n));a.observe(n),r.add(()=>a.disconnect())}return()=>r.dispose()},[e,i,s])}let c0=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(s=>`${s}:not([tabindex='-1'])`).join(","),zN=["[data-autofocus]"].map(s=>`${s}:not([tabindex='-1'])`).join(",");var bo=(s=>(s[s.First=1]="First",s[s.Previous=2]="Previous",s[s.Next=4]="Next",s[s.Last=8]="Last",s[s.WrapAround=16]="WrapAround",s[s.NoScroll=32]="NoScroll",s[s.AutoFocus=64]="AutoFocus",s))(bo||{}),sx=(s=>(s[s.Error=0]="Error",s[s.Overflow=1]="Overflow",s[s.Success=2]="Success",s[s.Underflow=3]="Underflow",s))(sx||{}),VN=(s=>(s[s.Previous=-1]="Previous",s[s.Next=1]="Next",s))(VN||{});function GN(s=document.body){return s==null?[]:Array.from(s.querySelectorAll(c0)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function qN(s=document.body){return s==null?[]:Array.from(s.querySelectorAll(zN)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var wA=(s=>(s[s.Strict=0]="Strict",s[s.Loose=1]="Loose",s))(wA||{});function KN(s,e=0){var t;return s===((t=Gh(s))==null?void 0:t.body)?!1:Ao(e,{0(){return s.matches(c0)},1(){let i=s;for(;i!==null;){if(i.matches(c0))return!0;i=i.parentElement}return!1}})}var WN=(s=>(s[s.Keyboard=0]="Keyboard",s[s.Mouse=1]="Mouse",s))(WN||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",s=>{s.metaKey||s.altKey||s.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",s=>{s.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:s.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function _o(s){s?.focus({preventScroll:!0})}let YN=["textarea","input"].join(",");function XN(s){var e,t;return(t=(e=s?.matches)==null?void 0:e.call(s,YN))!=null?t:!1}function QN(s,e=t=>t){return s.slice().sort((t,i)=>{let n=e(t),r=e(i);if(n===null||r===null)return 0;let a=n.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function vh(s,e,{sorted:t=!0,relativeTo:i=null,skipElements:n=[]}={}){let r=Array.isArray(s)?s.length>0?Jv(s[0]):document:Jv(s),a=Array.isArray(s)?t?QN(s):s:e&64?qN(s):GN(s);n.length>0&&a.length>1&&(a=a.filter(v=>!n.some(b=>b!=null&&"current"in b?b?.current===v:b===v))),i=i??r?.activeElement;let u=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,a.indexOf(i))-1;if(e&4)return Math.max(0,a.indexOf(i))+1;if(e&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=e&32?{preventScroll:!0}:{},f=0,p=a.length,y;do{if(f>=p||f+p<=0)return 0;let v=c+f;if(e&16)v=(v+p)%p;else{if(v<0)return 3;if(v>=p)return 1}y=a[v],y?.focus(d),f+=u}while(y!==mA(y));return e&6&&XN(y)&&y.select(),2}function AA(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function ZN(){return/Android/gi.test(window.navigator.userAgent)}function M_(){return AA()||ZN()}function xm(s,e,t,i){let n=Eu(t);_.useEffect(()=>{if(!s)return;function r(a){n.current(a)}return document.addEventListener(e,r,i),()=>document.removeEventListener(e,r,i)},[s,e,i])}function kA(s,e,t,i){let n=Eu(t);_.useEffect(()=>{if(!s)return;function r(a){n.current(a)}return window.addEventListener(e,r,i),()=>window.removeEventListener(e,r,i)},[s,e,i])}const P_=30;function JN(s,e,t){let i=Eu(t),n=_.useCallback(function(u,c){if(u.defaultPrevented)return;let d=c(u);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=(function p(y){return typeof y=="function"?p(y()):Array.isArray(y)||y instanceof Set?y:[y]})(e);for(let p of f)if(p!==null&&(p.contains(d)||u.composed&&u.composedPath().includes(p)))return;return!KN(d,wA.Loose)&&d.tabIndex!==-1&&u.preventDefault(),i.current(u,d)},[i,e]),r=_.useRef(null);xm(s,"pointerdown",u=>{var c,d;M_()||(r.current=((d=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:d[0])||u.target)},!0),xm(s,"pointerup",u=>{if(M_()||!r.current)return;let c=r.current;return r.current=null,n(u,()=>c)},!0);let a=_.useRef({x:0,y:0});xm(s,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),xm(s,"touchend",u=>{let c={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=P_||Math.abs(c.y-a.current.y)>=P_))return n(u,()=>Sl(u.target)?u.target:null)},!0),kA(s,"blur",u=>n(u,()=>vN(window.document.activeElement)?window.document.activeElement:null),!0)}function nb(...s){return _.useMemo(()=>Gh(...s),[...s])}function CA(s,e,t,i){let n=Eu(t);_.useEffect(()=>{s=s??window;function r(a){n.current(a)}return s.addEventListener(e,r,i),()=>s.removeEventListener(e,r,i)},[s,e,i])}function e5(s){return _.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot)}function t5(s,e){let t=s(),i=new Set;return{getSnapshot(){return t},subscribe(n){return i.add(n),()=>i.delete(n)},dispatch(n,...r){let a=e[n].call(t,...r);a&&(t=a,i.forEach(u=>u()))}}}function i5(){let s;return{before({doc:e}){var t;let i=e.documentElement,n=(t=e.defaultView)!=null?t:window;s=Math.max(0,n.innerWidth-i.clientWidth)},after({doc:e,d:t}){let i=e.documentElement,n=Math.max(0,i.clientWidth-i.offsetWidth),r=Math.max(0,s-n);t.style(i,"paddingRight",`${r}px`)}}}function s5(){return AA()?{before({doc:s,d:e,meta:t}){function i(n){for(let r of t().containers)for(let a of r())if(a.contains(n))return!0;return!1}e.microTask(()=>{var n;if(window.getComputedStyle(s.documentElement).scrollBehavior!=="auto"){let u=Co();u.style(s.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>u.dispose()))}let r=(n=window.scrollY)!=null?n:window.pageYOffset,a=null;e.addEventListener(s,"click",u=>{if(Sl(u.target))try{let c=u.target.closest("a");if(!c)return;let{hash:d}=new URL(c.href),f=s.querySelector(d);Sl(f)&&!i(f)&&(a=f)}catch{}},!0),e.group(u=>{e.addEventListener(s,"touchstart",c=>{if(u.dispose(),Sl(c.target)&&yN(c.target))if(i(c.target)){let d=c.target;for(;d.parentElement&&i(d.parentElement);)d=d.parentElement;u.style(d,"overscrollBehavior","contain")}else u.style(c.target,"touchAction","none")})}),e.addEventListener(s,"touchmove",u=>{if(Sl(u.target)){if(xN(u.target))return;if(i(u.target)){let c=u.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),e.add(()=>{var u;let c=(u=window.scrollY)!=null?u:window.pageYOffset;r!==c&&window.scrollTo(0,r),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function n5(){return{before({doc:s,d:e}){e.style(s.documentElement,"overflow","hidden")}}}function B_(s){let e={};for(let t of s)Object.assign(e,t(e));return e}let uu=t5(()=>new Map,{PUSH(s,e){var t;let i=(t=this.get(s))!=null?t:{doc:s,count:0,d:Co(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=B_(i.meta),this.set(s,i),this},POP(s,e){let t=this.get(s);return t&&(t.count--,t.meta.delete(e),t.computedMeta=B_(t.meta)),this},SCROLL_PREVENT(s){let e={doc:s.doc,d:s.d,meta(){return s.computedMeta}},t=[s5(),i5(),n5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:s}){s.dispose()},TEARDOWN({doc:s}){this.delete(s)}});uu.subscribe(()=>{let s=uu.getSnapshot(),e=new Map;for(let[t]of s)e.set(t,t.documentElement.style.overflow);for(let t of s.values()){let i=e.get(t.doc)==="hidden",n=t.count!==0;(n&&!i||!n&&i)&&uu.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&uu.dispatch("TEARDOWN",t)}});function r5(s,e,t=()=>({containers:[]})){let i=e5(uu),n=e?i.get(e):void 0,r=n?n.count>0:!1;return gr(()=>{if(!(!e||!s))return uu.dispatch("PUSH",e,t),()=>uu.dispatch("POP",e,t)},[s,e]),r}function a5(s,e,t=()=>[document.body]){let i=Kh(s,"scroll-lock");r5(i,e,n=>{var r;return{containers:[...(r=n.containers)!=null?r:[],t]}})}function o5(s=0){let[e,t]=_.useState(s),i=_.useCallback(c=>t(c),[]),n=_.useCallback(c=>t(d=>d|c),[]),r=_.useCallback(c=>(e&c)===c,[e]),a=_.useCallback(c=>t(d=>d&~c),[]),u=_.useCallback(c=>t(d=>d^c),[]);return{flags:e,setFlag:i,addFlag:n,hasFlag:r,removeFlag:a,toggleFlag:u}}var l5={},F_,U_;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((F_=process==null?void 0:l5)==null?void 0:F_.NODE_ENV)==="test"&&typeof((U_=Element?.prototype)==null?void 0:U_.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` -`)),[]});var u5=(s=>(s[s.None=0]="None",s[s.Closed=1]="Closed",s[s.Enter=2]="Enter",s[s.Leave=4]="Leave",s))(u5||{});function c5(s){let e={};for(let t in s)s[t]===!0&&(e[`data-${t}`]="");return e}function d5(s,e,t,i){let[n,r]=_.useState(t),{hasFlag:a,addFlag:u,removeFlag:c}=o5(s&&n?3:0),d=_.useRef(!1),f=_.useRef(!1),p=Q0();return gr(()=>{var y;if(s){if(t&&r(!0),!e){t&&u(3);return}return(y=i?.start)==null||y.call(i,t),h5(e,{inFlight:d,prepare(){f.current?f.current=!1:f.current=d.current,d.current=!0,!f.current&&(t?(u(3),c(4)):(u(4),c(2)))},run(){f.current?t?(c(3),u(4)):(c(4),u(3)):t?c(1):u(1)},done(){var v;f.current&&p5(e)||(d.current=!1,c(7),t||r(!1),(v=i?.end)==null||v.call(i,t))}})}},[s,t,e,p]),s?[n,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function h5(s,{prepare:e,run:t,done:i,inFlight:n}){let r=Co();return m5(s,{prepare:e,inFlight:n}),r.nextFrame(()=>{t(),r.requestAnimationFrame(()=>{r.add(f5(s,i))})}),r.dispose}function f5(s,e){var t,i;let n=Co();if(!s)return n.dispose;let r=!1;n.add(()=>{r=!0});let a=(i=(t=s.getAnimations)==null?void 0:t.call(s).filter(u=>u instanceof CSSTransition))!=null?i:[];return a.length===0?(e(),n.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{r||e()}),n.dispose)}function m5(s,{inFlight:e,prepare:t}){if(e!=null&&e.current){t();return}let i=s.style.transition;s.style.transition="none",t(),s.offsetHeight,s.style.transition=i}function p5(s){var e,t;return((t=(e=s.getAnimations)==null?void 0:e.call(s))!=null?t:[]).some(i=>i instanceof CSSTransition&&i.playState!=="finished")}function rb(s,e){let t=_.useRef([]),i=Ts(s);_.useEffect(()=>{let n=[...t.current];for(let[r,a]of e.entries())if(t.current[r]!==a){let u=i(e,n);return t.current=e,u}},[i,...e])}let Z0=_.createContext(null);Z0.displayName="OpenClosedContext";var ua=(s=>(s[s.Open=1]="Open",s[s.Closed=2]="Closed",s[s.Closing=4]="Closing",s[s.Opening=8]="Opening",s))(ua||{});function J0(){return _.useContext(Z0)}function g5({value:s,children:e}){return Zt.createElement(Z0.Provider,{value:s},e)}function y5({children:s}){return Zt.createElement(Z0.Provider,{value:null},s)}function v5(s){function e(){document.readyState!=="loading"&&(s(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let bl=[];v5(()=>{function s(e){if(!Sl(e.target)||e.target===document.body||bl[0]===e.target)return;let t=e.target;t=t.closest(c0),bl.unshift(t??e.target),bl=bl.filter(i=>i!=null&&i.isConnected),bl.splice(10)}window.addEventListener("click",s,{capture:!0}),window.addEventListener("mousedown",s,{capture:!0}),window.addEventListener("focus",s,{capture:!0}),document.body.addEventListener("click",s,{capture:!0}),document.body.addEventListener("mousedown",s,{capture:!0}),document.body.addEventListener("focus",s,{capture:!0})});function DA(s){let e=Ts(s),t=_.useRef(!1);_.useEffect(()=>(t.current=!1,()=>{t.current=!0,X0(()=>{t.current&&e()})}),[e])}let LA=_.createContext(!1);function x5(){return _.useContext(LA)}function j_(s){return Zt.createElement(LA.Provider,{value:s.force},s.children)}function b5(s){let e=x5(),t=_.useContext(IA),[i,n]=_.useState(()=>{var r;if(!e&&t!==null)return(r=t.current)!=null?r:null;if(Ua.isServer)return null;let a=s?.getElementById("headlessui-portal-root");if(a)return a;if(s===null)return null;let u=s.createElement("div");return u.setAttribute("id","headlessui-portal-root"),s.body.appendChild(u)});return _.useEffect(()=>{i!==null&&(s!=null&&s.body.contains(i)||s==null||s.body.appendChild(i))},[i,s]),_.useEffect(()=>{e||t!==null&&n(t.current)},[t,n,e]),i}let RA=_.Fragment,T5=vr(function(s,e){let{ownerDocument:t=null,...i}=s,n=_.useRef(null),r=Ka(bN(y=>{n.current=y}),e),a=nb(n.current),u=t??a,c=b5(u),d=_.useContext(nx),f=Q0(),p=Qr();return DA(()=>{var y;c&&c.childNodes.length<=0&&((y=c.parentElement)==null||y.removeChild(c))}),c?Lc.createPortal(Zt.createElement("div",{"data-headlessui-portal":"",ref:y=>{f.dispose(),d&&y&&f.add(d.register(y))}},p({ourProps:{ref:r},theirProps:i,slot:{},defaultTag:RA,name:"Portal"})),c):null});function S5(s,e){let t=Ka(e),{enabled:i=!0,ownerDocument:n,...r}=s,a=Qr();return i?Zt.createElement(T5,{...r,ownerDocument:n,ref:t}):a({ourProps:{ref:t},theirProps:r,slot:{},defaultTag:RA,name:"Portal"})}let _5=_.Fragment,IA=_.createContext(null);function E5(s,e){let{target:t,...i}=s,n={ref:Ka(e)},r=Qr();return Zt.createElement(IA.Provider,{value:t},r({ourProps:n,theirProps:i,defaultTag:_5,name:"Popover.Group"}))}let nx=_.createContext(null);function w5(){let s=_.useContext(nx),e=_.useRef([]),t=Ts(r=>(e.current.push(r),s&&s.register(r),()=>i(r))),i=Ts(r=>{let a=e.current.indexOf(r);a!==-1&&e.current.splice(a,1),s&&s.unregister(r)}),n=_.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,_.useMemo(()=>function({children:r}){return Zt.createElement(nx.Provider,{value:n},r)},[n])]}let A5=vr(S5),NA=vr(E5),k5=Object.assign(A5,{Group:NA});function C5(s,e=typeof document<"u"?document.defaultView:null,t){let i=Kh(s,"escape");CA(e,"keydown",n=>{i&&(n.defaultPrevented||n.key===vA.Escape&&t(n))})}function D5(){var s;let[e]=_.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=_.useState((s=e?.matches)!=null?s:!1);return gr(()=>{if(!e)return;function n(r){i(r.matches)}return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[e]),t}function L5({defaultContainers:s=[],portals:e,mainTreeNode:t}={}){let i=Ts(()=>{var n,r;let a=Gh(t),u=[];for(let c of s)c!==null&&(_l(c)?u.push(c):"current"in c&&_l(c.current)&&u.push(c.current));if(e!=null&&e.current)for(let c of e.current)u.push(c);for(let c of(n=a?.querySelectorAll("html > *, body > *"))!=null?n:[])c!==document.body&&c!==document.head&&_l(c)&&c.id!=="headlessui-portal-root"&&(t&&(c.contains(t)||c.contains((r=t?.getRootNode())==null?void 0:r.host))||u.some(d=>c.contains(d))||u.push(c));return u});return{resolveContainers:i,contains:Ts(n=>i().some(r=>r.contains(n)))}}let OA=_.createContext(null);function $_({children:s,node:e}){let[t,i]=_.useState(null),n=MA(e??t);return Zt.createElement(OA.Provider,{value:n},s,n===null&&Zt.createElement(tx,{features:u0.Hidden,ref:r=>{var a,u;if(r){for(let c of(u=(a=Gh(r))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?u:[])if(c!==document.body&&c!==document.head&&_l(c)&&c!=null&&c.contains(r)){i(c);break}}}}))}function MA(s=null){var e;return(e=_.useContext(OA))!=null?e:s}function R5(){let s=typeof document>"u";return"useSyncExternalStore"in T_?(e=>e.useSyncExternalStore)(T_)(()=>()=>{},()=>!1,()=>!s):!1}function ep(){let s=R5(),[e,t]=_.useState(Ua.isHandoffComplete);return e&&Ua.isHandoffComplete===!1&&t(!1),_.useEffect(()=>{e!==!0&&t(!0)},[e]),_.useEffect(()=>Ua.handoff(),[]),s?!1:e}function ab(){let s=_.useRef(!1);return gr(()=>(s.current=!0,()=>{s.current=!1}),[]),s}var ch=(s=>(s[s.Forwards=0]="Forwards",s[s.Backwards=1]="Backwards",s))(ch||{});function I5(){let s=_.useRef(0);return kA(!0,"keydown",e=>{e.key==="Tab"&&(s.current=e.shiftKey?1:0)},!0),s}function PA(s){if(!s)return new Set;if(typeof s=="function")return new Set(s());let e=new Set;for(let t of s.current)_l(t.current)&&e.add(t.current);return e}let N5="div";var ou=(s=>(s[s.None=0]="None",s[s.InitialFocus=1]="InitialFocus",s[s.TabLock=2]="TabLock",s[s.FocusLock=4]="FocusLock",s[s.RestoreFocus=8]="RestoreFocus",s[s.AutoFocus=16]="AutoFocus",s))(ou||{});function O5(s,e){let t=_.useRef(null),i=Ka(t,e),{initialFocus:n,initialFocusFallback:r,containers:a,features:u=15,...c}=s;ep()||(u=0);let d=nb(t.current);F5(u,{ownerDocument:d});let f=U5(u,{ownerDocument:d,container:t,initialFocus:n,initialFocusFallback:r});j5(u,{ownerDocument:d,container:t,containers:a,previousActiveElement:f});let p=I5(),y=Ts(O=>{if(!vu(t.current))return;let R=t.current;(j=>j())(()=>{Ao(p.current,{[ch.Forwards]:()=>{vh(R,bo.First,{skipElements:[O.relatedTarget,r]})},[ch.Backwards]:()=>{vh(R,bo.Last,{skipElements:[O.relatedTarget,r]})}})})}),v=Kh(!!(u&2),"focus-trap#tab-lock"),b=Q0(),T=_.useRef(!1),E={ref:i,onKeyDown(O){O.key=="Tab"&&(T.current=!0,b.requestAnimationFrame(()=>{T.current=!1}))},onBlur(O){if(!(u&4))return;let R=PA(a);vu(t.current)&&R.add(t.current);let j=O.relatedTarget;Sl(j)&&j.dataset.headlessuiFocusGuard!=="true"&&(BA(R,j)||(T.current?vh(t.current,Ao(p.current,{[ch.Forwards]:()=>bo.Next,[ch.Backwards]:()=>bo.Previous})|bo.WrapAround,{relativeTo:O.target}):Sl(O.target)&&_o(O.target)))}},D=Qr();return Zt.createElement(Zt.Fragment,null,v&&Zt.createElement(tx,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:u0.Focusable}),D({ourProps:E,theirProps:c,defaultTag:N5,name:"FocusTrap"}),v&&Zt.createElement(tx,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:u0.Focusable}))}let M5=vr(O5),P5=Object.assign(M5,{features:ou});function B5(s=!0){let e=_.useRef(bl.slice());return rb(([t],[i])=>{i===!0&&t===!1&&X0(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=bl.slice())},[s,bl,e]),Ts(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function F5(s,{ownerDocument:e}){let t=!!(s&8),i=B5(t);rb(()=>{t||aN(e?.body)&&_o(i())},[t]),DA(()=>{t&&_o(i())})}function U5(s,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:n}){let r=_.useRef(null),a=Kh(!!(s&1),"focus-trap#initial-focus"),u=ab();return rb(()=>{if(s===0)return;if(!a){n!=null&&n.current&&_o(n.current);return}let c=t.current;c&&X0(()=>{if(!u.current)return;let d=e?.activeElement;if(i!=null&&i.current){if(i?.current===d){r.current=d;return}}else if(c.contains(d)){r.current=d;return}if(i!=null&&i.current)_o(i.current);else{if(s&16){if(vh(c,bo.First|bo.AutoFocus)!==sx.Error)return}else if(vh(c,bo.First)!==sx.Error)return;if(n!=null&&n.current&&(_o(n.current),e?.activeElement===n.current))return;console.warn("There are no focusable elements inside the ")}r.current=e?.activeElement})},[n,a,s]),r}function j5(s,{ownerDocument:e,container:t,containers:i,previousActiveElement:n}){let r=ab(),a=!!(s&4);CA(e?.defaultView,"focus",u=>{if(!a||!r.current)return;let c=PA(i);vu(t.current)&&c.add(t.current);let d=n.current;if(!d)return;let f=u.target;vu(f)?BA(c,f)?(n.current=f,_o(f)):(u.preventDefault(),u.stopPropagation(),_o(d)):_o(n.current)},!0)}function BA(s,e){for(let t of s)if(t.contains(e))return!0;return!1}function FA(s){var e;return!!(s.enter||s.enterFrom||s.enterTo||s.leave||s.leaveFrom||s.leaveTo)||!gh((e=s.as)!=null?e:jA)||Zt.Children.count(s.children)===1}let tp=_.createContext(null);tp.displayName="TransitionContext";var $5=(s=>(s.Visible="visible",s.Hidden="hidden",s))($5||{});function H5(){let s=_.useContext(tp);if(s===null)throw new Error("A is used but it is missing a parent or .");return s}function z5(){let s=_.useContext(ip);if(s===null)throw new Error("A is used but it is missing a parent or .");return s}let ip=_.createContext(null);ip.displayName="NestingContext";function sp(s){return"children"in s?sp(s.children):s.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function UA(s,e){let t=Eu(s),i=_.useRef([]),n=ab(),r=Q0(),a=Ts((v,b=Tl.Hidden)=>{let T=i.current.findIndex(({el:E})=>E===v);T!==-1&&(Ao(b,{[Tl.Unmount](){i.current.splice(T,1)},[Tl.Hidden](){i.current[T].state="hidden"}}),r.microTask(()=>{var E;!sp(i)&&n.current&&((E=t.current)==null||E.call(t))}))}),u=Ts(v=>{let b=i.current.find(({el:T})=>T===v);return b?b.state!=="visible"&&(b.state="visible"):i.current.push({el:v,state:"visible"}),()=>a(v,Tl.Unmount)}),c=_.useRef([]),d=_.useRef(Promise.resolve()),f=_.useRef({enter:[],leave:[]}),p=Ts((v,b,T)=>{c.current.splice(0),e&&(e.chains.current[b]=e.chains.current[b].filter(([E])=>E!==v)),e?.chains.current[b].push([v,new Promise(E=>{c.current.push(E)})]),e?.chains.current[b].push([v,new Promise(E=>{Promise.all(f.current[b].map(([D,O])=>O)).then(()=>E())})]),b==="enter"?d.current=d.current.then(()=>e?.wait.current).then(()=>T(b)):T(b)}),y=Ts((v,b,T)=>{Promise.all(f.current[b].splice(0).map(([E,D])=>D)).then(()=>{var E;(E=c.current.shift())==null||E()}).then(()=>T(b))});return _.useMemo(()=>({children:i,register:u,unregister:a,onStart:p,onStop:y,wait:d,chains:f}),[u,a,i,p,y,f,d])}let jA=_.Fragment,$A=l0.RenderStrategy;function V5(s,e){var t,i;let{transition:n=!0,beforeEnter:r,afterEnter:a,beforeLeave:u,afterLeave:c,enter:d,enterFrom:f,enterTo:p,entered:y,leave:v,leaveFrom:b,leaveTo:T,...E}=s,[D,O]=_.useState(null),R=_.useRef(null),j=FA(s),F=Ka(...j?[R,e,O]:e===null?[]:[e]),z=(t=E.unmount)==null||t?Tl.Unmount:Tl.Hidden,{show:N,appear:Y,initial:L}=H5(),[I,X]=_.useState(N?"visible":"hidden"),G=z5(),{register:q,unregister:ae}=G;gr(()=>q(R),[q,R]),gr(()=>{if(z===Tl.Hidden&&R.current){if(N&&I!=="visible"){X("visible");return}return Ao(I,{hidden:()=>ae(R),visible:()=>q(R)})}},[I,R,q,ae,N,z]);let ie=ep();gr(()=>{if(j&&ie&&I==="visible"&&R.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[R,I,ie,j]);let W=L&&!Y,K=Y&&N&&L,Q=_.useRef(!1),te=UA(()=>{Q.current||(X("hidden"),ae(R))},G),re=Ts(Ce=>{Q.current=!0;let Me=Ce?"enter":"leave";te.onStart(R,Me,Re=>{Re==="enter"?r?.():Re==="leave"&&u?.()})}),U=Ts(Ce=>{let Me=Ce?"enter":"leave";Q.current=!1,te.onStop(R,Me,Re=>{Re==="enter"?a?.():Re==="leave"&&c?.()}),Me==="leave"&&!sp(te)&&(X("hidden"),ae(R))});_.useEffect(()=>{j&&n||(re(N),U(N))},[N,j,n]);let ne=!(!n||!j||!ie||W),[,Z]=d5(ne,D,N,{start:re,end:U}),fe=su({ref:F,className:((i=ex(E.className,K&&d,K&&f,Z.enter&&d,Z.enter&&Z.closed&&f,Z.enter&&!Z.closed&&p,Z.leave&&v,Z.leave&&!Z.closed&&b,Z.leave&&Z.closed&&T,!Z.transition&&N&&y))==null?void 0:i.trim())||void 0,...c5(Z)}),xe=0;I==="visible"&&(xe|=ua.Open),I==="hidden"&&(xe|=ua.Closed),N&&I==="hidden"&&(xe|=ua.Opening),!N&&I==="visible"&&(xe|=ua.Closing);let ge=Qr();return Zt.createElement(ip.Provider,{value:te},Zt.createElement(g5,{value:xe},ge({ourProps:fe,theirProps:E,defaultTag:jA,features:$A,visible:I==="visible",name:"Transition.Child"})))}function G5(s,e){let{show:t,appear:i=!1,unmount:n=!0,...r}=s,a=_.useRef(null),u=FA(s),c=Ka(...u?[a,e]:e===null?[]:[e]);ep();let d=J0();if(t===void 0&&d!==null&&(t=(d&ua.Open)===ua.Open),t===void 0)throw new Error("A is used but it is missing a `show={true | false}` prop.");let[f,p]=_.useState(t?"visible":"hidden"),y=UA(()=>{t||p("hidden")}),[v,b]=_.useState(!0),T=_.useRef([t]);gr(()=>{v!==!1&&T.current[T.current.length-1]!==t&&(T.current.push(t),b(!1))},[T,t]);let E=_.useMemo(()=>({show:t,appear:i,initial:v}),[t,i,v]);gr(()=>{t?p("visible"):!sp(y)&&a.current!==null&&p("hidden")},[t,y]);let D={unmount:n},O=Ts(()=>{var F;v&&b(!1),(F=s.beforeEnter)==null||F.call(s)}),R=Ts(()=>{var F;v&&b(!1),(F=s.beforeLeave)==null||F.call(s)}),j=Qr();return Zt.createElement(ip.Provider,{value:y},Zt.createElement(tp.Provider,{value:E},j({ourProps:{...D,as:_.Fragment,children:Zt.createElement(HA,{ref:c,...D,...r,beforeEnter:O,beforeLeave:R})},theirProps:{},defaultTag:_.Fragment,features:$A,visible:f==="visible",name:"Transition"})))}function q5(s,e){let t=_.useContext(tp)!==null,i=J0()!==null;return Zt.createElement(Zt.Fragment,null,!t&&i?Zt.createElement(rx,{ref:e,...s}):Zt.createElement(HA,{ref:e,...s}))}let rx=vr(G5),HA=vr(V5),ob=vr(q5),xh=Object.assign(rx,{Child:ob,Root:rx});var K5=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(K5||{}),W5=(s=>(s[s.SetTitleId=0]="SetTitleId",s))(W5||{});let Y5={0(s,e){return s.titleId===e.id?s:{...s,titleId:e.id}}},lb=_.createContext(null);lb.displayName="DialogContext";function np(s){let e=_.useContext(lb);if(e===null){let t=new Error(`<${s} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,np),t}return e}function X5(s,e){return Ao(e.type,Y5,s,e)}let H_=vr(function(s,e){let t=_.useId(),{id:i=`headlessui-dialog-${t}`,open:n,onClose:r,initialFocus:a,role:u="dialog",autoFocus:c=!0,__demoMode:d=!1,unmount:f=!1,...p}=s,y=_.useRef(!1);u=(function(){return u==="dialog"||u==="alertdialog"?u:(y.current||(y.current=!0,console.warn(`Invalid role [${u}] passed to . Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let v=J0();n===void 0&&v!==null&&(n=(v&ua.Open)===ua.Open);let b=_.useRef(null),T=Ka(b,e),E=nb(b.current),D=n?0:1,[O,R]=_.useReducer(X5,{titleId:null,descriptionId:null,panelRef:_.createRef()}),j=Ts(()=>r(!1)),F=Ts(Z=>R({type:0,id:Z})),z=ep()?D===0:!1,[N,Y]=w5(),L={get current(){var Z;return(Z=O.panelRef.current)!=null?Z:b.current}},I=MA(),{resolveContainers:X}=L5({mainTreeNode:I,portals:N,defaultContainers:[L]}),G=v!==null?(v&ua.Closing)===ua.Closing:!1;$N(d||G?!1:z,{allowed:Ts(()=>{var Z,fe;return[(fe=(Z=b.current)==null?void 0:Z.closest("[data-headlessui-portal]"))!=null?fe:null]}),disallowed:Ts(()=>{var Z;return[(Z=I?.closest("body > *:not(#headlessui-portal-root)"))!=null?Z:null]})});let q=_A.get(null);gr(()=>{if(z)return q.actions.push(i),()=>q.actions.pop(i)},[q,i,z]);let ae=EA(q,_.useCallback(Z=>q.selectors.isTop(Z,i),[q,i]));JN(ae,X,Z=>{Z.preventDefault(),j()}),C5(ae,E?.defaultView,Z=>{Z.preventDefault(),Z.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),j()}),a5(d||G?!1:z,E,X),HN(z,b,j);let[ie,W]=TN(),K=_.useMemo(()=>[{dialogState:D,close:j,setTitleId:F,unmount:f},O],[D,j,F,f,O]),Q=qh({open:D===0}),te={ref:T,id:i,role:u,tabIndex:-1,"aria-modal":d?void 0:D===0?!0:void 0,"aria-labelledby":O.titleId,"aria-describedby":ie,unmount:f},re=!D5(),U=ou.None;z&&!d&&(U|=ou.RestoreFocus,U|=ou.TabLock,c&&(U|=ou.AutoFocus),re&&(U|=ou.InitialFocus));let ne=Qr();return Zt.createElement(y5,null,Zt.createElement(j_,{force:!0},Zt.createElement(k5,null,Zt.createElement(lb.Provider,{value:K},Zt.createElement(NA,{target:b},Zt.createElement(j_,{force:!1},Zt.createElement(W,{slot:Q},Zt.createElement(Y,null,Zt.createElement(P5,{initialFocus:a,initialFocusFallback:b,containers:X,features:U},Zt.createElement(kN,{value:j},ne({ourProps:te,theirProps:p,slot:Q,defaultTag:Q5,features:Z5,visible:D===0,name:"Dialog"})))))))))))}),Q5="div",Z5=l0.RenderStrategy|l0.Static;function J5(s,e){let{transition:t=!1,open:i,...n}=s,r=J0(),a=s.hasOwnProperty("open")||r!==null,u=s.hasOwnProperty("onClose");if(!a&&!u)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!a)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!u)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!r&&typeof s.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${s.open}`);if(typeof s.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${s.onClose}`);return(i!==void 0||t)&&!n.static?Zt.createElement($_,null,Zt.createElement(xh,{show:i,transition:t,unmount:n.unmount},Zt.createElement(H_,{ref:e,...n}))):Zt.createElement($_,null,Zt.createElement(H_,{ref:e,open:i,...n}))}let eO="div";function tO(s,e){let t=_.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:n=!1,...r}=s,[{dialogState:a,unmount:u},c]=np("Dialog.Panel"),d=Ka(e,c.panelRef),f=qh({open:a===0}),p=Ts(E=>{E.stopPropagation()}),y={ref:d,id:i,onClick:p},v=n?ob:_.Fragment,b=n?{unmount:u}:{},T=Qr();return Zt.createElement(v,{...b},T({ourProps:y,theirProps:r,slot:f,defaultTag:eO,name:"Dialog.Panel"}))}let iO="div";function sO(s,e){let{transition:t=!1,...i}=s,[{dialogState:n,unmount:r}]=np("Dialog.Backdrop"),a=qh({open:n===0}),u={ref:e,"aria-hidden":!0},c=t?ob:_.Fragment,d=t?{unmount:r}:{},f=Qr();return Zt.createElement(c,{...d},f({ourProps:u,theirProps:i,slot:a,defaultTag:iO,name:"Dialog.Backdrop"}))}let nO="h2";function rO(s,e){let t=_.useId(),{id:i=`headlessui-dialog-title-${t}`,...n}=s,[{dialogState:r,setTitleId:a}]=np("Dialog.Title"),u=Ka(e);_.useEffect(()=>(a(i),()=>a(null)),[i,a]);let c=qh({open:r===0}),d={ref:u,id:i};return Qr()({ourProps:d,theirProps:n,slot:c,defaultTag:nO,name:"Dialog.Title"})}let aO=vr(J5),oO=vr(tO);vr(sO);let lO=vr(rO),pc=Object.assign(aO,{Panel:oO,Title:lO,Description:wN});function uO({open:s,onClose:e,onApply:t,initialCookies:i}){const[n,r]=_.useState(""),[a,u]=_.useState(""),[c,d]=_.useState([]),f=_.useRef(!1);_.useEffect(()=>{s&&!f.current&&(r(""),u(""),d(i??[])),f.current=s},[s,i]);function p(){const b=n.trim(),T=a.trim();!b||!T||(d(E=>[...E.filter(O=>O.name!==b),{name:b,value:T}]),r(""),u(""))}function y(b){d(T=>T.filter(E=>E.name!==b))}function v(){t(c),e()}return g.jsxs(pc,{open:s,onClose:e,className:"relative z-50",children:[g.jsx("div",{className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),g.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:g.jsxs(pc.Panel,{className:"w-full max-w-lg rounded-lg bg-white dark:bg-gray-800 p-6 shadow-xl dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[g.jsx(pc.Title,{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Zusätzliche Cookies"}),g.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[g.jsx("input",{value:n,onChange:b=>r(b.target.value),placeholder:"Name (z. B. cf_clearance)",className:"col-span-1 truncate rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),g.jsx("input",{value:a,onChange:b=>u(b.target.value),placeholder:"Wert",className:"col-span-1 truncate sm:col-span-2 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"})]}),g.jsx("div",{className:"mt-2",children:g.jsx(di,{size:"sm",variant:"secondary",onClick:p,disabled:!n.trim()||!a.trim(),children:"Hinzufügen"})}),g.jsx("div",{className:"mt-4",children:c.length===0?g.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Noch keine Cookies hinzugefügt."}):g.jsxs("table",{className:"min-w-full text-sm border divide-y dark:divide-white/10",children:[g.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:g.jsxs("tr",{children:[g.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Name"}),g.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Wert"}),g.jsx("th",{className:"px-3 py-2"})]})}),g.jsx("tbody",{className:"divide-y dark:divide-white/10",children:c.map(b=>g.jsxs("tr",{children:[g.jsx("td",{className:"px-3 py-2 font-mono",children:b.name}),g.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:b.value}),g.jsx("td",{className:"px-3 py-2 text-right",children:g.jsx("button",{onClick:()=>y(b.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},b.name))})]})}),g.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[g.jsx(di,{variant:"secondary",onClick:e,children:"Abbrechen"}),g.jsx(di,{variant:"primary",onClick:v,children:"Übernehmen"})]})]})})]})}function cO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const dO=_.forwardRef(cO);function ax({tabs:s,value:e,onChange:t,className:i,ariaLabel:n="Ansicht auswählen",variant:r="underline",hideCountUntilMd:a=!1}){if(!s?.length)return null;const u=s.find(y=>y.id===e)??s[0],c=Mi("col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800 dark:focus:outline-indigo-500",r==="pillsBrand"?"dark:bg-gray-800/50":"dark:bg-white/5"),d=y=>Mi(y?"bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400":"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300",a?"ml-3 hidden rounded-full px-2.5 py-0.5 text-xs font-medium md:inline-block":"ml-3 rounded-full px-2.5 py-0.5 text-xs font-medium"),f=(y,v)=>v.count===void 0?null:g.jsx("span",{className:d(y),children:v.count}),p=()=>{switch(r){case"underline":case"underlineIcons":return g.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:g.jsx("nav",{"aria-label":n,className:"-mb-px flex space-x-8",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return g.jsxs("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:Mi(v?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-200",r==="underlineIcons"?"group inline-flex items-center border-b-2 px-1 py-4 text-sm font-medium":"flex items-center border-b-2 px-1 py-4 text-sm font-medium whitespace-nowrap",b&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[r==="underlineIcons"&&y.icon?g.jsx(y.icon,{"aria-hidden":"true",className:Mi(v?"text-indigo-500 dark:text-indigo-400":"text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-400","mr-2 -ml-0.5 size-5")}):null,g.jsx("span",{children:y.label}),f(v,y)]},y.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const y=r==="pills"?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-gray-200":r==="pillsGray"?"bg-gray-200 text-gray-800 dark:bg-white/10 dark:text-white":"bg-indigo-100 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300",v=r==="pills"?"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200":r==="pillsGray"?"text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200";return g.jsx("nav",{"aria-label":n,className:"flex space-x-4",children:s.map(b=>{const T=b.id===u.id,E=!!b.disabled;return g.jsxs("button",{type:"button",onClick:()=>!E&&t(b.id),disabled:E,"aria-current":T?"page":void 0,className:Mi(T?y:v,"inline-flex items-center rounded-md px-3 py-2 text-sm font-medium",E&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:[g.jsx("span",{children:b.label}),b.count!==void 0?g.jsx("span",{className:Mi(T?"ml-2 bg-white/70 text-gray-900 dark:bg-white/10 dark:text-white":"ml-2 bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300","rounded-full px-2 py-0.5 text-xs font-medium"),children:b.count}):null]},b.id)})})}case"fullWidthUnderline":return g.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:g.jsx("nav",{"aria-label":n,className:"-mb-px flex",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return g.jsx("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:Mi(v?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300","flex-1 border-b-2 px-1 py-4 text-center text-sm font-medium",b&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:y.label},y.id)})})});case"barUnderline":return g.jsx("nav",{"aria-label":n,className:"isolate flex divide-x divide-gray-200 rounded-lg bg-white shadow-sm dark:divide-white/10 dark:bg-gray-800/50 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",children:s.map((y,v)=>{const b=y.id===u.id,T=!!y.disabled;return g.jsxs("button",{type:"button",onClick:()=>!T&&t(y.id),disabled:T,"aria-current":b?"page":void 0,className:Mi(b?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",v===0?"rounded-l-lg":"",v===s.length-1?"rounded-r-lg":"","group relative min-w-0 flex-1 overflow-hidden px-4 py-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10 dark:hover:bg-white/5",T&&"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[g.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center justify-center",children:[g.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",title:y.label,children:y.label}),y.count!==void 0?g.jsx("span",{className:"ml-2 shrink-0 tabular-nums min-w-[2.25rem] rounded-full bg-white/70 px-2 py-0.5 text-center text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-white",children:y.count}):null]}),g.jsx("span",{"aria-hidden":"true",className:Mi(b?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},y.id)})});case"simple":return g.jsx("nav",{className:"flex border-b border-gray-200 py-4 dark:border-white/10","aria-label":n,children:g.jsx("ul",{role:"list",className:"flex min-w-full flex-none gap-x-8 px-2 text-sm/6 font-semibold text-gray-500 dark:text-gray-400",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return g.jsx("li",{children:g.jsx("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:Mi(v?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",b&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:y.label})},y.id)})})});default:return null}};return g.jsxs("div",{className:i,children:[g.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[g.jsx("select",{value:u.id,onChange:y=>t(y.target.value),"aria-label":n,className:c,children:s.map(y=>g.jsx("option",{value:y.id,children:y.label},y.id))}),g.jsx(dO,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),g.jsx("div",{className:"hidden sm:block",children:p()})]})}function ca({header:s,footer:e,grayBody:t=!1,grayFooter:i=!1,edgeToEdgeMobile:n=!1,well:r=!1,noBodyPadding:a=!1,className:u,bodyClassName:c,children:d}){const f=r;return g.jsxs("div",{className:Mi("overflow-hidden",n?"sm:rounded-lg":"rounded-lg",f?"bg-gray-50 dark:bg-gray-800 shadow-none":"bg-white shadow-sm dark:bg-gray-800 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",u),children:[s&&g.jsx("div",{className:"shrink-0 px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-white/10",children:s}),g.jsx("div",{className:Mi("min-h-0",a?"p-0":"px-4 py-5 sm:p-6",t&&"bg-gray-50 dark:bg-gray-800",c),children:d}),e&&g.jsx("div",{className:Mi("shrink-0 px-4 py-4 sm:px-6",i&&"bg-gray-50 dark:bg-gray-800/50","border-t border-gray-200 dark:border-white/10"),children:e})]})}function ox({checked:s,onChange:e,id:t,name:i,disabled:n,required:r,ariaLabel:a,ariaLabelledby:u,ariaDescribedby:c,size:d="default",variant:f="simple",className:p}){const y=b=>{n||e(b.target.checked)},v=Mi("absolute inset-0 size-full appearance-none focus:outline-hidden",n&&"cursor-not-allowed");return d==="short"?g.jsxs("div",{className:Mi("group relative inline-flex h-5 w-10 shrink-0 items-center justify-center rounded-full outline-offset-2 outline-indigo-600 has-focus-visible:outline-2 dark:outline-indigo-500",n&&"opacity-60",p),children:[g.jsx("span",{className:Mi("absolute mx-auto h-4 w-9 rounded-full bg-gray-200 inset-ring inset-ring-gray-900/5 transition-colors duration-200 ease-in-out dark:bg-gray-800/50 dark:inset-ring-white/10",s&&"bg-indigo-600 dark:bg-indigo-500")}),g.jsx("span",{className:Mi("absolute left-0 size-5 rounded-full border border-gray-300 bg-white shadow-xs transition-transform duration-200 ease-in-out dark:shadow-none",s&&"translate-x-5")}),g.jsx("input",{id:t,name:i,type:"checkbox",checked:s,onChange:y,disabled:n,required:r,"aria-label":a,"aria-labelledby":u,"aria-describedby":c,className:v})]}):g.jsxs("div",{className:Mi("group relative inline-flex w-11 shrink-0 rounded-full bg-gray-200 p-0.5 inset-ring inset-ring-gray-900/5 outline-offset-2 outline-indigo-600 transition-colors duration-200 ease-in-out has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-indigo-500",s&&"bg-indigo-600 dark:bg-indigo-500",n&&"opacity-60",p),children:[f==="icon"?g.jsxs("span",{className:Mi("relative size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",s&&"translate-x-5"),children:[g.jsx("span",{"aria-hidden":"true",className:Mi("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-in",s?"opacity-0 duration-100":"opacity-100 duration-200"),children:g.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-gray-600",children:g.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsx("span",{"aria-hidden":"true",className:Mi("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-out",s?"opacity-100 duration-200":"opacity-0 duration-100"),children:g.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-500",children:g.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})]}):g.jsx("span",{className:Mi("size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",s&&"translate-x-5")}),g.jsx("input",{id:t,name:i,type:"checkbox",checked:s,onChange:y,disabled:n,required:r,"aria-label":a,"aria-labelledby":u,"aria-describedby":c,className:v})]})}function go({label:s,description:e,labelPosition:t="left",id:i,className:n,...r}){const a=_.useId(),u=i??`sw-${a}`,c=`${u}-label`,d=`${u}-desc`;return t==="right"?g.jsxs("div",{className:Mi("flex items-center justify-between gap-3",n),children:[g.jsx(ox,{...r,id:u,ariaLabelledby:c,ariaDescribedby:e?d:void 0}),g.jsxs("div",{className:"text-sm",children:[g.jsx("label",{id:c,htmlFor:u,className:"font-medium text-gray-900 dark:text-white",children:s})," ",e?g.jsx("span",{id:d,className:"text-gray-500 dark:text-gray-400",children:e}):null]})]}):g.jsxs("div",{className:Mi("flex items-center justify-between",n),children:[g.jsxs("span",{className:"flex grow flex-col",children:[g.jsx("label",{id:c,htmlFor:u,className:"text-sm/6 font-medium text-gray-900 dark:text-white",children:s}),e?g.jsx("span",{id:d,className:"text-sm text-gray-500 dark:text-gray-400",children:e}):null]}),g.jsx(ox,{...r,id:u,ariaLabelledby:c,ariaDescribedby:e?d:void 0})]})}const Rc=new Map;let z_=!1;function hO(){z_||(z_=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const s of Rc.values())s.es&&(s.es.close(),s.es=null,s.dispatchers.clear());else for(const s of Rc.values())s.refs>0&&!s.es&&zA(s)}))}function zA(s){if(!s.es&&!document.hidden){s.es=new EventSource(s.url);for(const[e,t]of s.listeners.entries()){const i=n=>{let r=null;try{r=JSON.parse(String(n.data??"null"))}catch{return}for(const a of t)a(r)};s.dispatchers.set(e,i),s.es.addEventListener(e,i)}s.es.onerror=()=>{}}}function fO(s){s.es&&(s.es.close(),s.es=null,s.dispatchers.clear())}function mO(s){let e=Rc.get(s);return e||(e={url:s,es:null,refs:0,listeners:new Map,dispatchers:new Map},Rc.set(s,e)),e}function rp(s,e,t){hO();const i=mO(s);let n=i.listeners.get(e);if(n||(n=new Set,i.listeners.set(e,n)),n.add(t),i.refs+=1,i.es){if(!i.dispatchers.has(e)){const r=a=>{let u=null;try{u=JSON.parse(String(a.data??"null"))}catch{return}for(const c of i.listeners.get(e)??[])c(u)};i.dispatchers.set(e,r),i.es.addEventListener(e,r)}}else zA(i);return()=>{const r=Rc.get(s);if(!r)return;const a=r.listeners.get(e);a&&(a.delete(t),a.size===0&&r.listeners.delete(e)),r.refs=Math.max(0,r.refs-1),r.refs===0&&(fO(r),Rc.delete(s))}}async function pO(s,e){const t=await fetch(s,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const n=i&&(i.error||i.message)||t.statusText;throw new Error(n)}return i}function gO({onFinished:s,onStart:e,onProgress:t,onDone:i,onCancelled:n,onError:r}){const[a,u]=_.useState(null),[c,d]=_.useState(!1),[f,p]=_.useState(null),y=_.useRef(null),v=_.useRef(!1),b=_.useRef(!1),T=_.useRef(!1),E=_.useRef(!1),D=_.useRef(""),O=_.useRef(t),R=_.useRef(r);_.useEffect(()=>{O.current=t},[t]),_.useEffect(()=>{R.current=r},[r]);async function j(){if(!T.current){T.current=!0;try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}finally{T.current=!1}}}function F(){if(y.current)return y.current;const L=new AbortController;y.current=L;const I=()=>{b.current=!0,j()};return L.signal.addEventListener("abort",I,{once:!0}),L}function z(L){v.current||(v.current=!0,e?.(L))}_.useEffect(()=>{const L=E.current,I=!!a?.running;if(E.current=I,L&&!I){const X=String(a?.error??"").trim();y.current=null,v.current=!1,b.current||X==="abgebrochen"?(b.current=!1,n?.()):X||i?.(),s?.()}},[a?.running,a?.error,s,i,n]),_.useEffect(()=>{const L=rp("/api/tasks/assets/stream","state",I=>{if(u(I),I?.running){const G=F();z(G),O.current?.({done:I?.done??0,total:I?.total??0,currentFile:I?.currentFile??""})}const X=String(I?.error??"").trim();X&&X!=="abgebrochen"&&X!==D.current&&(D.current=X,R.current?.(X))});return()=>L()},[]);async function N(){if(a?.running)return;p(null),d(!0),b.current=!1,D.current="";const L=F();try{const I=await pO("/api/tasks/generate-assets",{method:"POST"});u(I),z(L),I?.running&&t?.({done:I?.done??0,total:I?.total??0,currentFile:I?.currentFile??""})}catch(I){y.current=null,v.current=!1;const X=I?.message??String(I);p(X),r?.(X)}finally{d(!1)}}const Y=!!a?.running;return g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Assets-Generator"}),g.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Erzeugt fehlende Assets (thumb/preview/meta). Fortschritt & Abbrechen oben in der Taskliste."}),f?g.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:f}):null]}),g.jsx("div",{className:"shrink-0",children:g.jsx(di,{variant:"primary",onClick:N,disabled:c||Y,children:c?"Starte…":"Start"})})]})}function yO(s,e){const t=Number(s??0),i=Number(e??0);return!i||i<=0?0:Math.max(0,Math.min(100,Math.round(t/i*100)))}function vO({tasks:s,onCancel:e}){const t=(s||[]).filter(i=>i.status!=="idle");return g.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[g.jsx("div",{className:"flex items-start justify-between gap-3",children:g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Hintergrundaufgaben"}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Laufende Hintergrundaufgaben (z.B. Assets/Previews)."})]})}),g.jsxs("div",{className:"mt-3 space-y-3",children:[t.length===0?g.jsx("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-600 dark:border-white/10 dark:bg-white/5 dark:text-gray-300",children:"Keine laufenden Aufgaben."}):null,t.map(i=>{const n=yO(i.done,i.total),r=i.status==="running",a=r&&(i.total??0)>0,u=(i.title??"").trim(),c=(i.text??"").trim();return g.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 dark:border-white/10 dark:bg-white/5 transition-opacity duration-500 "+(i.fading?"opacity-0":"opacity-100"),children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"shrink-0",children:r&&i.cancellable&&e?g.jsx("button",{type:"button",onClick:()=>e?.(i.id),className:`inline-flex h-7 w-7 items-center justify-center rounded-md\r +`))}else{let y=f.props,v=y?.className,b=typeof v=="function"?(...D)=>ix(v(...D),c.className):ix(v,c.className),T=b?{className:b}:{},E=_A(f.props,nu(Ly(c,["ref"])));for(let D in g)D in E&&delete g[D];return _.cloneElement(f,Object.assign({},E,g,d,{ref:n(TN(f),d.ref)},T))}return _.createElement(r,Object.assign({},Ly(c,["ref"]),!yh(r)&&d,!yh(r)&&g),f)}function xN(){let s=_.useRef([]),e=_.useCallback(t=>{for(let i of s.current)i!=null&&(typeof i=="function"?i(t):i.current=t)},[]);return(...t)=>{if(!t.every(i=>i==null))return s.current=t,e}}function bN(...s){return s.every(e=>e==null)?void 0:e=>{for(let t of s)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function _A(...s){if(s.length===0)return{};if(s.length===1)return s[0];let e={},t={};for(let i of s)for(let n in i)n.startsWith("on")&&typeof i[n]=="function"?(t[n]!=null||(t[n]=[]),t[n].push(i[n])):e[n]=i[n];if(e.disabled||e["aria-disabled"])for(let i in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(t[i]=[n=>{var r;return(r=n?.preventDefault)==null?void 0:r.call(n)}]);for(let i in t)Object.assign(e,{[i](n,...r){let a=t[i];for(let u of a){if((n instanceof Event||n?.nativeEvent instanceof Event)&&n.defaultPrevented)return;u(n,...r)}}});return e}function Tr(s){var e;return Object.assign(_.forwardRef(s),{displayName:(e=s.displayName)!=null?e:s.name})}function nu(s){let e=Object.assign({},s);for(let t in e)e[t]===void 0&&delete e[t];return e}function Ly(s,e=[]){let t=Object.assign({},s);for(let i of e)i in t&&delete t[i];return t}function TN(s){return ci.version.split(".")[0]>="19"?s.props.ref:s.ref}function yh(s){return s===_.Fragment||s===Symbol.for("react.fragment")}function SN(s){return yh(s.type)}let _N="span";var m0=(s=>(s[s.None=1]="None",s[s.Focusable=2]="Focusable",s[s.Hidden=4]="Hidden",s))(m0||{});function EN(s,e){var t;let{features:i=1,...n}=s,r={ref:e,"aria-hidden":(i&2)===2?!0:(t=n["aria-hidden"])!=null?t:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return ta()({ourProps:r,theirProps:n,slot:{},defaultTag:_N,name:"Hidden"})}let sx=Tr(EN);function wN(s){return typeof s!="object"||s===null?!1:"nodeType"in s}function El(s){return wN(s)&&"tagName"in s}function xu(s){return El(s)&&"accessKey"in s}function _l(s){return El(s)&&"tabIndex"in s}function AN(s){return El(s)&&"style"in s}function kN(s){return xu(s)&&s.nodeName==="IFRAME"}function CN(s){return xu(s)&&s.nodeName==="INPUT"}let EA=Symbol();function DN(s,e=!0){return Object.assign(s,{[EA]:e})}function Xa(...s){let e=_.useRef(s);_.useEffect(()=>{e.current=s},[s]);let t=ks(i=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(i):n.current=i)});return s.every(i=>i==null||i?.[EA])?void 0:t}let ab=_.createContext(null);ab.displayName="DescriptionContext";function wA(){let s=_.useContext(ab);if(s===null){let e=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,wA),e}return s}function LN(){let[s,e]=_.useState([]);return[s.length>0?s.join(" "):void 0,_.useMemo(()=>function(t){let i=ks(r=>(e(a=>[...a,r]),()=>e(a=>{let u=a.slice(),c=u.indexOf(r);return c!==-1&&u.splice(c,1),u}))),n=_.useMemo(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return ci.createElement(ab.Provider,{value:n},t.children)},[e])]}let RN="p";function IN(s,e){let t=_.useId(),i=yN(),{id:n=`headlessui-description-${t}`,...r}=s,a=wA(),u=Xa(e);xr(()=>a.register(n),[n,a.register]);let c=Wh({...a.slot,disabled:i||!1}),d={ref:u,...a.props,id:n};return ta()({ourProps:d,theirProps:r,slot:c,defaultTag:RN,name:a.name||"Description"})}let NN=Tr(IN),ON=Object.assign(NN,{});var AA=(s=>(s.Space=" ",s.Enter="Enter",s.Escape="Escape",s.Backspace="Backspace",s.Delete="Delete",s.ArrowLeft="ArrowLeft",s.ArrowUp="ArrowUp",s.ArrowRight="ArrowRight",s.ArrowDown="ArrowDown",s.Home="Home",s.End="End",s.PageUp="PageUp",s.PageDown="PageDown",s.Tab="Tab",s))(AA||{});let MN=_.createContext(()=>{});function PN({value:s,children:e}){return ci.createElement(MN.Provider,{value:s},e)}let kA=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var FN=Object.defineProperty,BN=(s,e,t)=>e in s?FN(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,UN=(s,e,t)=>(BN(s,e+"",t),t),CA=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Kr=(s,e,t)=>(CA(s,e,"read from private field"),t?t.call(s):e.get(s)),Ry=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},R_=(s,e,t,i)=>(CA(s,e,"write to private field"),e.set(s,t),t),Na,uh,ch;let jN=class{constructor(e){Ry(this,Na,{}),Ry(this,uh,new kA(()=>new Set)),Ry(this,ch,new Set),UN(this,"disposables",Do()),R_(this,Na,e),Va.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Kr(this,Na)}subscribe(e,t){if(Va.isServer)return()=>{};let i={selector:e,callback:t,current:e(Kr(this,Na))};return Kr(this,ch).add(i),this.disposables.add(()=>{Kr(this,ch).delete(i)})}on(e,t){return Va.isServer?()=>{}:(Kr(this,uh).get(e).add(t),this.disposables.add(()=>{Kr(this,uh).get(e).delete(t)}))}send(e){let t=this.reduce(Kr(this,Na),e);if(t!==Kr(this,Na)){R_(this,Na,t);for(let i of Kr(this,ch)){let n=i.selector(Kr(this,Na));DA(i.current,n)||(i.current=n,i.callback(n))}for(let i of Kr(this,uh).get(e.type))i(Kr(this,Na),e)}}};Na=new WeakMap,uh=new WeakMap,ch=new WeakMap;function DA(s,e){return Object.is(s,e)?!0:typeof s!="object"||s===null||typeof e!="object"||e===null?!1:Array.isArray(s)&&Array.isArray(e)?s.length!==e.length?!1:Iy(s[Symbol.iterator](),e[Symbol.iterator]()):s instanceof Map&&e instanceof Map||s instanceof Set&&e instanceof Set?s.size!==e.size?!1:Iy(s.entries(),e.entries()):I_(s)&&I_(e)?Iy(Object.entries(s)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Iy(s,e){do{let t=s.next(),i=e.next();if(t.done&&i.done)return!0;if(t.done||i.done||!Object.is(t.value,i.value))return!1}while(!0)}function I_(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;let e=Object.getPrototypeOf(s);return e===null||Object.getPrototypeOf(e)===null}var $N=Object.defineProperty,HN=(s,e,t)=>e in s?$N(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N_=(s,e,t)=>(HN(s,typeof e!="symbol"?e+"":e,t),t),zN=(s=>(s[s.Push=0]="Push",s[s.Pop=1]="Pop",s))(zN||{});let VN={0(s,e){let t=e.id,i=s.stack,n=s.stack.indexOf(t);if(n!==-1){let r=s.stack.slice();return r.splice(n,1),r.push(t),i=r,{...s,stack:i}}return{...s,stack:[...s.stack,t]}},1(s,e){let t=e.id,i=s.stack.indexOf(t);if(i===-1)return s;let n=s.stack.slice();return n.splice(i,1),{...s,stack:n}}},GN=class LA extends jN{constructor(){super(...arguments),N_(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),N_(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new LA({stack:[]})}reduce(e,t){return ko(t.type,VN,e,t)}};const RA=new kA(()=>GN.new());var Ny={exports:{}},Oy={};var O_;function qN(){if(O_)return Oy;O_=1;var s=J0();function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var t=typeof Object.is=="function"?Object.is:e,i=s.useSyncExternalStore,n=s.useRef,r=s.useEffect,a=s.useMemo,u=s.useDebugValue;return Oy.useSyncExternalStoreWithSelector=function(c,d,f,g,y){var v=n(null);if(v.current===null){var b={hasValue:!1,value:null};v.current=b}else b=v.current;v=a(function(){function E(F){if(!D){if(D=!0,O=F,F=g(F),y!==void 0&&b.hasValue){var G=b.value;if(y(G,F))return R=G}return R=F}if(G=R,t(O,F))return G;var L=g(F);return y!==void 0&&y(G,L)?(O=F,G):(O=F,R=L)}var D=!1,O,R,j=f===void 0?null:f;return[function(){return E(d())},j===null?void 0:function(){return E(j())}]},[d,f,g,y]);var T=i(c,v[0],v[1]);return r(function(){b.hasValue=!0,b.value=T},[T]),u(T),T},Oy}var M_;function KN(){return M_||(M_=1,Ny.exports=qN()),Ny.exports}var WN=KN();function IA(s,e,t=DA){return WN.useSyncExternalStoreWithSelector(ks(i=>s.subscribe(YN,i)),ks(()=>s.state),ks(()=>s.state),ks(e),t)}function YN(s){return s}function Yh(s,e){let t=_.useId(),i=RA.get(e),[n,r]=IA(i,_.useCallback(a=>[i.selectors.isTop(a,t),i.selectors.inStack(a,t)],[i,t]));return xr(()=>{if(s)return i.actions.push(t),()=>i.actions.pop(t)},[i,s,t]),s?r?n:!0:!1}let nx=new Map,vh=new Map;function P_(s){var e;let t=(e=vh.get(s))!=null?e:0;return vh.set(s,t+1),t!==0?()=>F_(s):(nx.set(s,{"aria-hidden":s.getAttribute("aria-hidden"),inert:s.inert}),s.setAttribute("aria-hidden","true"),s.inert=!0,()=>F_(s))}function F_(s){var e;let t=(e=vh.get(s))!=null?e:1;if(t===1?vh.delete(s):vh.set(s,t-1),t!==1)return;let i=nx.get(s);i&&(i["aria-hidden"]===null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",i["aria-hidden"]),s.inert=i.inert,nx.delete(s))}function XN(s,{allowed:e,disallowed:t}={}){let i=Yh(s,"inert-others");xr(()=>{var n,r;if(!i)return;let a=Do();for(let c of(n=t?.())!=null?n:[])c&&a.add(P_(c));let u=(r=e?.())!=null?r:[];for(let c of u){if(!c)continue;let d=Kh(c);if(!d)continue;let f=c.parentElement;for(;f&&f!==d.body;){for(let g of f.children)u.some(y=>g.contains(y))||a.add(P_(g));f=f.parentElement}}return a.dispose},[i,e,t])}function QN(s,e,t){let i=wu(n=>{let r=n.getBoundingClientRect();r.x===0&&r.y===0&&r.width===0&&r.height===0&&t()});_.useEffect(()=>{if(!s)return;let n=e===null?null:xu(e)?e:e.current;if(!n)return;let r=Do();if(typeof ResizeObserver<"u"){let a=new ResizeObserver(()=>i.current(n));a.observe(n),r.add(()=>a.disconnect())}if(typeof IntersectionObserver<"u"){let a=new IntersectionObserver(()=>i.current(n));a.observe(n),r.add(()=>a.disconnect())}return()=>r.dispose()},[e,i,s])}let p0=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(s=>`${s}:not([tabindex='-1'])`).join(","),ZN=["[data-autofocus]"].map(s=>`${s}:not([tabindex='-1'])`).join(",");var So=(s=>(s[s.First=1]="First",s[s.Previous=2]="Previous",s[s.Next=4]="Next",s[s.Last=8]="Last",s[s.WrapAround=16]="WrapAround",s[s.NoScroll=32]="NoScroll",s[s.AutoFocus=64]="AutoFocus",s))(So||{}),rx=(s=>(s[s.Error=0]="Error",s[s.Overflow=1]="Overflow",s[s.Success=2]="Success",s[s.Underflow=3]="Underflow",s))(rx||{}),JN=(s=>(s[s.Previous=-1]="Previous",s[s.Next=1]="Next",s))(JN||{});function e5(s=document.body){return s==null?[]:Array.from(s.querySelectorAll(p0)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function t5(s=document.body){return s==null?[]:Array.from(s.querySelectorAll(ZN)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var NA=(s=>(s[s.Strict=0]="Strict",s[s.Loose=1]="Loose",s))(NA||{});function i5(s,e=0){var t;return s===((t=Kh(s))==null?void 0:t.body)?!1:ko(e,{0(){return s.matches(p0)},1(){let i=s;for(;i!==null;){if(i.matches(p0))return!0;i=i.parentElement}return!1}})}var s5=(s=>(s[s.Keyboard=0]="Keyboard",s[s.Mouse=1]="Mouse",s))(s5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",s=>{s.metaKey||s.altKey||s.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",s=>{s.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:s.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function wo(s){s?.focus({preventScroll:!0})}let n5=["textarea","input"].join(",");function r5(s){var e,t;return(t=(e=s?.matches)==null?void 0:e.call(s,n5))!=null?t:!1}function a5(s,e=t=>t){return s.slice().sort((t,i)=>{let n=e(t),r=e(i);if(n===null||r===null)return 0;let a=n.compareDocumentPosition(r);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function xh(s,e,{sorted:t=!0,relativeTo:i=null,skipElements:n=[]}={}){let r=Array.isArray(s)?s.length>0?tx(s[0]):document:tx(s),a=Array.isArray(s)?t?a5(s):s:e&64?t5(s):e5(s);n.length>0&&a.length>1&&(a=a.filter(v=>!n.some(b=>b!=null&&"current"in b?b?.current===v:b===v))),i=i??r?.activeElement;let u=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,a.indexOf(i))-1;if(e&4)return Math.max(0,a.indexOf(i))+1;if(e&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),d=e&32?{preventScroll:!0}:{},f=0,g=a.length,y;do{if(f>=g||f+g<=0)return 0;let v=c+f;if(e&16)v=(v+g)%g;else{if(v<0)return 3;if(v>=g)return 1}y=a[v],y?.focus(d),f+=u}while(y!==SA(y));return e&6&&r5(y)&&y.select(),2}function OA(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function o5(){return/Android/gi.test(window.navigator.userAgent)}function B_(){return OA()||o5()}function Sm(s,e,t,i){let n=wu(t);_.useEffect(()=>{if(!s)return;function r(a){n.current(a)}return document.addEventListener(e,r,i),()=>document.removeEventListener(e,r,i)},[s,e,i])}function MA(s,e,t,i){let n=wu(t);_.useEffect(()=>{if(!s)return;function r(a){n.current(a)}return window.addEventListener(e,r,i),()=>window.removeEventListener(e,r,i)},[s,e,i])}const U_=30;function l5(s,e,t){let i=wu(t),n=_.useCallback(function(u,c){if(u.defaultPrevented)return;let d=c(u);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=(function g(y){return typeof y=="function"?g(y()):Array.isArray(y)||y instanceof Set?y:[y]})(e);for(let g of f)if(g!==null&&(g.contains(d)||u.composed&&u.composedPath().includes(g)))return;return!i5(d,NA.Loose)&&d.tabIndex!==-1&&u.preventDefault(),i.current(u,d)},[i,e]),r=_.useRef(null);Sm(s,"pointerdown",u=>{var c,d;B_()||(r.current=((d=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:d[0])||u.target)},!0),Sm(s,"pointerup",u=>{if(B_()||!r.current)return;let c=r.current;return r.current=null,n(u,()=>c)},!0);let a=_.useRef({x:0,y:0});Sm(s,"touchstart",u=>{a.current.x=u.touches[0].clientX,a.current.y=u.touches[0].clientY},!0),Sm(s,"touchend",u=>{let c={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=U_||Math.abs(c.y-a.current.y)>=U_))return n(u,()=>_l(u.target)?u.target:null)},!0),MA(s,"blur",u=>n(u,()=>kN(window.document.activeElement)?window.document.activeElement:null),!0)}function ob(...s){return _.useMemo(()=>Kh(...s),[...s])}function PA(s,e,t,i){let n=wu(t);_.useEffect(()=>{s=s??window;function r(a){n.current(a)}return s.addEventListener(e,r,i),()=>s.removeEventListener(e,r,i)},[s,e,i])}function u5(s){return _.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot)}function c5(s,e){let t=s(),i=new Set;return{getSnapshot(){return t},subscribe(n){return i.add(n),()=>i.delete(n)},dispatch(n,...r){let a=e[n].call(t,...r);a&&(t=a,i.forEach(u=>u()))}}}function d5(){let s;return{before({doc:e}){var t;let i=e.documentElement,n=(t=e.defaultView)!=null?t:window;s=Math.max(0,n.innerWidth-i.clientWidth)},after({doc:e,d:t}){let i=e.documentElement,n=Math.max(0,i.clientWidth-i.offsetWidth),r=Math.max(0,s-n);t.style(i,"paddingRight",`${r}px`)}}}function h5(){return OA()?{before({doc:s,d:e,meta:t}){function i(n){for(let r of t().containers)for(let a of r())if(a.contains(n))return!0;return!1}e.microTask(()=>{var n;if(window.getComputedStyle(s.documentElement).scrollBehavior!=="auto"){let u=Do();u.style(s.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>u.dispose()))}let r=(n=window.scrollY)!=null?n:window.pageYOffset,a=null;e.addEventListener(s,"click",u=>{if(_l(u.target))try{let c=u.target.closest("a");if(!c)return;let{hash:d}=new URL(c.href),f=s.querySelector(d);_l(f)&&!i(f)&&(a=f)}catch{}},!0),e.group(u=>{e.addEventListener(s,"touchstart",c=>{if(u.dispose(),_l(c.target)&&AN(c.target))if(i(c.target)){let d=c.target;for(;d.parentElement&&i(d.parentElement);)d=d.parentElement;u.style(d,"overscrollBehavior","contain")}else u.style(c.target,"touchAction","none")})}),e.addEventListener(s,"touchmove",u=>{if(_l(u.target)){if(CN(u.target))return;if(i(u.target)){let c=u.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),e.add(()=>{var u;let c=(u=window.scrollY)!=null?u:window.pageYOffset;r!==c&&window.scrollTo(0,r),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)})})}}:{}}function f5(){return{before({doc:s,d:e}){e.style(s.documentElement,"overflow","hidden")}}}function j_(s){let e={};for(let t of s)Object.assign(e,t(e));return e}let cu=c5(()=>new Map,{PUSH(s,e){var t;let i=(t=this.get(s))!=null?t:{doc:s,count:0,d:Do(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=j_(i.meta),this.set(s,i),this},POP(s,e){let t=this.get(s);return t&&(t.count--,t.meta.delete(e),t.computedMeta=j_(t.meta)),this},SCROLL_PREVENT(s){let e={doc:s.doc,d:s.d,meta(){return s.computedMeta}},t=[h5(),d5(),f5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:s}){s.dispose()},TEARDOWN({doc:s}){this.delete(s)}});cu.subscribe(()=>{let s=cu.getSnapshot(),e=new Map;for(let[t]of s)e.set(t,t.documentElement.style.overflow);for(let t of s.values()){let i=e.get(t.doc)==="hidden",n=t.count!==0;(n&&!i||!n&&i)&&cu.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&cu.dispatch("TEARDOWN",t)}});function m5(s,e,t=()=>({containers:[]})){let i=u5(cu),n=e?i.get(e):void 0,r=n?n.count>0:!1;return xr(()=>{if(!(!e||!s))return cu.dispatch("PUSH",e,t),()=>cu.dispatch("POP",e,t)},[s,e]),r}function p5(s,e,t=()=>[document.body]){let i=Yh(s,"scroll-lock");m5(i,e,n=>{var r;return{containers:[...(r=n.containers)!=null?r:[],t]}})}function g5(s=0){let[e,t]=_.useState(s),i=_.useCallback(c=>t(c),[]),n=_.useCallback(c=>t(d=>d|c),[]),r=_.useCallback(c=>(e&c)===c,[e]),a=_.useCallback(c=>t(d=>d&~c),[]),u=_.useCallback(c=>t(d=>d^c),[]);return{flags:e,setFlag:i,addFlag:n,hasFlag:r,removeFlag:a,toggleFlag:u}}var y5={},$_,H_;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&(($_=process==null?void 0:y5)==null?void 0:$_.NODE_ENV)==="test"&&typeof((H_=Element?.prototype)==null?void 0:H_.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` +`)),[]});var v5=(s=>(s[s.None=0]="None",s[s.Closed=1]="Closed",s[s.Enter=2]="Enter",s[s.Leave=4]="Leave",s))(v5||{});function x5(s){let e={};for(let t in s)s[t]===!0&&(e[`data-${t}`]="");return e}function b5(s,e,t,i){let[n,r]=_.useState(t),{hasFlag:a,addFlag:u,removeFlag:c}=g5(s&&n?3:0),d=_.useRef(!1),f=_.useRef(!1),g=tp();return xr(()=>{var y;if(s){if(t&&r(!0),!e){t&&u(3);return}return(y=i?.start)==null||y.call(i,t),T5(e,{inFlight:d,prepare(){f.current?f.current=!1:f.current=d.current,d.current=!0,!f.current&&(t?(u(3),c(4)):(u(4),c(2)))},run(){f.current?t?(c(3),u(4)):(c(4),u(3)):t?c(1):u(1)},done(){var v;f.current&&E5(e)||(d.current=!1,c(7),t||r(!1),(v=i?.end)==null||v.call(i,t))}})}},[s,t,e,g]),s?[n,{closed:a(1),enter:a(2),leave:a(4),transition:a(2)||a(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function T5(s,{prepare:e,run:t,done:i,inFlight:n}){let r=Do();return _5(s,{prepare:e,inFlight:n}),r.nextFrame(()=>{t(),r.requestAnimationFrame(()=>{r.add(S5(s,i))})}),r.dispose}function S5(s,e){var t,i;let n=Do();if(!s)return n.dispose;let r=!1;n.add(()=>{r=!0});let a=(i=(t=s.getAnimations)==null?void 0:t.call(s).filter(u=>u instanceof CSSTransition))!=null?i:[];return a.length===0?(e(),n.dispose):(Promise.allSettled(a.map(u=>u.finished)).then(()=>{r||e()}),n.dispose)}function _5(s,{inFlight:e,prepare:t}){if(e!=null&&e.current){t();return}let i=s.style.transition;s.style.transition="none",t(),s.offsetHeight,s.style.transition=i}function E5(s){var e,t;return((t=(e=s.getAnimations)==null?void 0:e.call(s))!=null?t:[]).some(i=>i instanceof CSSTransition&&i.playState!=="finished")}function lb(s,e){let t=_.useRef([]),i=ks(s);_.useEffect(()=>{let n=[...t.current];for(let[r,a]of e.entries())if(t.current[r]!==a){let u=i(e,n);return t.current=e,u}},[i,...e])}let ip=_.createContext(null);ip.displayName="OpenClosedContext";var ha=(s=>(s[s.Open=1]="Open",s[s.Closed=2]="Closed",s[s.Closing=4]="Closing",s[s.Opening=8]="Opening",s))(ha||{});function sp(){return _.useContext(ip)}function w5({value:s,children:e}){return ci.createElement(ip.Provider,{value:s},e)}function A5({children:s}){return ci.createElement(ip.Provider,{value:null},s)}function k5(s){function e(){document.readyState!=="loading"&&(s(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let Tl=[];k5(()=>{function s(e){if(!_l(e.target)||e.target===document.body||Tl[0]===e.target)return;let t=e.target;t=t.closest(p0),Tl.unshift(t??e.target),Tl=Tl.filter(i=>i!=null&&i.isConnected),Tl.splice(10)}window.addEventListener("click",s,{capture:!0}),window.addEventListener("mousedown",s,{capture:!0}),window.addEventListener("focus",s,{capture:!0}),document.body.addEventListener("click",s,{capture:!0}),document.body.addEventListener("mousedown",s,{capture:!0}),document.body.addEventListener("focus",s,{capture:!0})});function FA(s){let e=ks(s),t=_.useRef(!1);_.useEffect(()=>(t.current=!1,()=>{t.current=!0,ep(()=>{t.current&&e()})}),[e])}let BA=_.createContext(!1);function C5(){return _.useContext(BA)}function z_(s){return ci.createElement(BA.Provider,{value:s.force},s.children)}function D5(s){let e=C5(),t=_.useContext(jA),[i,n]=_.useState(()=>{var r;if(!e&&t!==null)return(r=t.current)!=null?r:null;if(Va.isServer)return null;let a=s?.getElementById("headlessui-portal-root");if(a)return a;if(s===null)return null;let u=s.createElement("div");return u.setAttribute("id","headlessui-portal-root"),s.body.appendChild(u)});return _.useEffect(()=>{i!==null&&(s!=null&&s.body.contains(i)||s==null||s.body.appendChild(i))},[i,s]),_.useEffect(()=>{e||t!==null&&n(t.current)},[t,n,e]),i}let UA=_.Fragment,L5=Tr(function(s,e){let{ownerDocument:t=null,...i}=s,n=_.useRef(null),r=Xa(DN(y=>{n.current=y}),e),a=ob(n.current),u=t??a,c=D5(u),d=_.useContext(ax),f=tp(),g=ta();return FA(()=>{var y;c&&c.childNodes.length<=0&&((y=c.parentElement)==null||y.removeChild(c))}),c?Ic.createPortal(ci.createElement("div",{"data-headlessui-portal":"",ref:y=>{f.dispose(),d&&y&&f.add(d.register(y))}},g({ourProps:{ref:r},theirProps:i,slot:{},defaultTag:UA,name:"Portal"})),c):null});function R5(s,e){let t=Xa(e),{enabled:i=!0,ownerDocument:n,...r}=s,a=ta();return i?ci.createElement(L5,{...r,ownerDocument:n,ref:t}):a({ourProps:{ref:t},theirProps:r,slot:{},defaultTag:UA,name:"Portal"})}let I5=_.Fragment,jA=_.createContext(null);function N5(s,e){let{target:t,...i}=s,n={ref:Xa(e)},r=ta();return ci.createElement(jA.Provider,{value:t},r({ourProps:n,theirProps:i,defaultTag:I5,name:"Popover.Group"}))}let ax=_.createContext(null);function O5(){let s=_.useContext(ax),e=_.useRef([]),t=ks(r=>(e.current.push(r),s&&s.register(r),()=>i(r))),i=ks(r=>{let a=e.current.indexOf(r);a!==-1&&e.current.splice(a,1),s&&s.unregister(r)}),n=_.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,_.useMemo(()=>function({children:r}){return ci.createElement(ax.Provider,{value:n},r)},[n])]}let M5=Tr(R5),$A=Tr(N5),P5=Object.assign(M5,{Group:$A});function F5(s,e=typeof document<"u"?document.defaultView:null,t){let i=Yh(s,"escape");PA(e,"keydown",n=>{i&&(n.defaultPrevented||n.key===AA.Escape&&t(n))})}function B5(){var s;let[e]=_.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=_.useState((s=e?.matches)!=null?s:!1);return xr(()=>{if(!e)return;function n(r){i(r.matches)}return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[e]),t}function U5({defaultContainers:s=[],portals:e,mainTreeNode:t}={}){let i=ks(()=>{var n,r;let a=Kh(t),u=[];for(let c of s)c!==null&&(El(c)?u.push(c):"current"in c&&El(c.current)&&u.push(c.current));if(e!=null&&e.current)for(let c of e.current)u.push(c);for(let c of(n=a?.querySelectorAll("html > *, body > *"))!=null?n:[])c!==document.body&&c!==document.head&&El(c)&&c.id!=="headlessui-portal-root"&&(t&&(c.contains(t)||c.contains((r=t?.getRootNode())==null?void 0:r.host))||u.some(d=>c.contains(d))||u.push(c));return u});return{resolveContainers:i,contains:ks(n=>i().some(r=>r.contains(n)))}}let HA=_.createContext(null);function V_({children:s,node:e}){let[t,i]=_.useState(null),n=zA(e??t);return ci.createElement(HA.Provider,{value:n},s,n===null&&ci.createElement(sx,{features:m0.Hidden,ref:r=>{var a,u;if(r){for(let c of(u=(a=Kh(r))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?u:[])if(c!==document.body&&c!==document.head&&El(c)&&c!=null&&c.contains(r)){i(c);break}}}}))}function zA(s=null){var e;return(e=_.useContext(HA))!=null?e:s}function j5(){let s=typeof document>"u";return"useSyncExternalStore"in E_?(e=>e.useSyncExternalStore)(E_)(()=>()=>{},()=>!1,()=>!s):!1}function np(){let s=j5(),[e,t]=_.useState(Va.isHandoffComplete);return e&&Va.isHandoffComplete===!1&&t(!1),_.useEffect(()=>{e!==!0&&t(!0)},[e]),_.useEffect(()=>Va.handoff(),[]),s?!1:e}function ub(){let s=_.useRef(!1);return xr(()=>(s.current=!0,()=>{s.current=!1}),[]),s}var dh=(s=>(s[s.Forwards=0]="Forwards",s[s.Backwards=1]="Backwards",s))(dh||{});function $5(){let s=_.useRef(0);return MA(!0,"keydown",e=>{e.key==="Tab"&&(s.current=e.shiftKey?1:0)},!0),s}function VA(s){if(!s)return new Set;if(typeof s=="function")return new Set(s());let e=new Set;for(let t of s.current)El(t.current)&&e.add(t.current);return e}let H5="div";var lu=(s=>(s[s.None=0]="None",s[s.InitialFocus=1]="InitialFocus",s[s.TabLock=2]="TabLock",s[s.FocusLock=4]="FocusLock",s[s.RestoreFocus=8]="RestoreFocus",s[s.AutoFocus=16]="AutoFocus",s))(lu||{});function z5(s,e){let t=_.useRef(null),i=Xa(t,e),{initialFocus:n,initialFocusFallback:r,containers:a,features:u=15,...c}=s;np()||(u=0);let d=ob(t.current);K5(u,{ownerDocument:d});let f=W5(u,{ownerDocument:d,container:t,initialFocus:n,initialFocusFallback:r});Y5(u,{ownerDocument:d,container:t,containers:a,previousActiveElement:f});let g=$5(),y=ks(O=>{if(!xu(t.current))return;let R=t.current;(j=>j())(()=>{ko(g.current,{[dh.Forwards]:()=>{xh(R,So.First,{skipElements:[O.relatedTarget,r]})},[dh.Backwards]:()=>{xh(R,So.Last,{skipElements:[O.relatedTarget,r]})}})})}),v=Yh(!!(u&2),"focus-trap#tab-lock"),b=tp(),T=_.useRef(!1),E={ref:i,onKeyDown(O){O.key=="Tab"&&(T.current=!0,b.requestAnimationFrame(()=>{T.current=!1}))},onBlur(O){if(!(u&4))return;let R=VA(a);xu(t.current)&&R.add(t.current);let j=O.relatedTarget;_l(j)&&j.dataset.headlessuiFocusGuard!=="true"&&(GA(R,j)||(T.current?xh(t.current,ko(g.current,{[dh.Forwards]:()=>So.Next,[dh.Backwards]:()=>So.Previous})|So.WrapAround,{relativeTo:O.target}):_l(O.target)&&wo(O.target)))}},D=ta();return ci.createElement(ci.Fragment,null,v&&ci.createElement(sx,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:m0.Focusable}),D({ourProps:E,theirProps:c,defaultTag:H5,name:"FocusTrap"}),v&&ci.createElement(sx,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:y,features:m0.Focusable}))}let V5=Tr(z5),G5=Object.assign(V5,{features:lu});function q5(s=!0){let e=_.useRef(Tl.slice());return lb(([t],[i])=>{i===!0&&t===!1&&ep(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=Tl.slice())},[s,Tl,e]),ks(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function K5(s,{ownerDocument:e}){let t=!!(s&8),i=q5(t);lb(()=>{t||pN(e?.body)&&wo(i())},[t]),FA(()=>{t&&wo(i())})}function W5(s,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:n}){let r=_.useRef(null),a=Yh(!!(s&1),"focus-trap#initial-focus"),u=ub();return lb(()=>{if(s===0)return;if(!a){n!=null&&n.current&&wo(n.current);return}let c=t.current;c&&ep(()=>{if(!u.current)return;let d=e?.activeElement;if(i!=null&&i.current){if(i?.current===d){r.current=d;return}}else if(c.contains(d)){r.current=d;return}if(i!=null&&i.current)wo(i.current);else{if(s&16){if(xh(c,So.First|So.AutoFocus)!==rx.Error)return}else if(xh(c,So.First)!==rx.Error)return;if(n!=null&&n.current&&(wo(n.current),e?.activeElement===n.current))return;console.warn("There are no focusable elements inside the ")}r.current=e?.activeElement})},[n,a,s]),r}function Y5(s,{ownerDocument:e,container:t,containers:i,previousActiveElement:n}){let r=ub(),a=!!(s&4);PA(e?.defaultView,"focus",u=>{if(!a||!r.current)return;let c=VA(i);xu(t.current)&&c.add(t.current);let d=n.current;if(!d)return;let f=u.target;xu(f)?GA(c,f)?(n.current=f,wo(f)):(u.preventDefault(),u.stopPropagation(),wo(d)):wo(n.current)},!0)}function GA(s,e){for(let t of s)if(t.contains(e))return!0;return!1}function qA(s){var e;return!!(s.enter||s.enterFrom||s.enterTo||s.leave||s.leaveFrom||s.leaveTo)||!yh((e=s.as)!=null?e:WA)||ci.Children.count(s.children)===1}let rp=_.createContext(null);rp.displayName="TransitionContext";var X5=(s=>(s.Visible="visible",s.Hidden="hidden",s))(X5||{});function Q5(){let s=_.useContext(rp);if(s===null)throw new Error("A is used but it is missing a parent or .");return s}function Z5(){let s=_.useContext(ap);if(s===null)throw new Error("A is used but it is missing a parent or .");return s}let ap=_.createContext(null);ap.displayName="NestingContext";function op(s){return"children"in s?op(s.children):s.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function KA(s,e){let t=wu(s),i=_.useRef([]),n=ub(),r=tp(),a=ks((v,b=Sl.Hidden)=>{let T=i.current.findIndex(({el:E})=>E===v);T!==-1&&(ko(b,{[Sl.Unmount](){i.current.splice(T,1)},[Sl.Hidden](){i.current[T].state="hidden"}}),r.microTask(()=>{var E;!op(i)&&n.current&&((E=t.current)==null||E.call(t))}))}),u=ks(v=>{let b=i.current.find(({el:T})=>T===v);return b?b.state!=="visible"&&(b.state="visible"):i.current.push({el:v,state:"visible"}),()=>a(v,Sl.Unmount)}),c=_.useRef([]),d=_.useRef(Promise.resolve()),f=_.useRef({enter:[],leave:[]}),g=ks((v,b,T)=>{c.current.splice(0),e&&(e.chains.current[b]=e.chains.current[b].filter(([E])=>E!==v)),e?.chains.current[b].push([v,new Promise(E=>{c.current.push(E)})]),e?.chains.current[b].push([v,new Promise(E=>{Promise.all(f.current[b].map(([D,O])=>O)).then(()=>E())})]),b==="enter"?d.current=d.current.then(()=>e?.wait.current).then(()=>T(b)):T(b)}),y=ks((v,b,T)=>{Promise.all(f.current[b].splice(0).map(([E,D])=>D)).then(()=>{var E;(E=c.current.shift())==null||E()}).then(()=>T(b))});return _.useMemo(()=>({children:i,register:u,unregister:a,onStart:g,onStop:y,wait:d,chains:f}),[u,a,i,g,y,f,d])}let WA=_.Fragment,YA=f0.RenderStrategy;function J5(s,e){var t,i;let{transition:n=!0,beforeEnter:r,afterEnter:a,beforeLeave:u,afterLeave:c,enter:d,enterFrom:f,enterTo:g,entered:y,leave:v,leaveFrom:b,leaveTo:T,...E}=s,[D,O]=_.useState(null),R=_.useRef(null),j=qA(s),F=Xa(...j?[R,e,O]:e===null?[]:[e]),G=(t=E.unmount)==null||t?Sl.Unmount:Sl.Hidden,{show:L,appear:W,initial:I}=Q5(),[N,X]=_.useState(L?"visible":"hidden"),V=Z5(),{register:Y,unregister:ne}=V;xr(()=>Y(R),[Y,R]),xr(()=>{if(G===Sl.Hidden&&R.current){if(L&&N!=="visible"){X("visible");return}return ko(N,{hidden:()=>ne(R),visible:()=>Y(R)})}},[N,R,Y,ne,L,G]);let ie=np();xr(()=>{if(j&&ie&&N==="visible"&&R.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[R,N,ie,j]);let K=I&&!W,q=W&&L&&I,Z=_.useRef(!1),te=KA(()=>{Z.current||(X("hidden"),ne(R))},V),le=ks(we=>{Z.current=!0;let He=we?"enter":"leave";te.onStart(R,He,Fe=>{Fe==="enter"?r?.():Fe==="leave"&&u?.()})}),z=ks(we=>{let He=we?"enter":"leave";Z.current=!1,te.onStop(R,He,Fe=>{Fe==="enter"?a?.():Fe==="leave"&&c?.()}),He==="leave"&&!op(te)&&(X("hidden"),ne(R))});_.useEffect(()=>{j&&n||(le(L),z(L))},[L,j,n]);let re=!(!n||!j||!ie||K),[,Q]=b5(re,D,L,{start:le,end:z}),pe=nu({ref:F,className:((i=ix(E.className,q&&d,q&&f,Q.enter&&d,Q.enter&&Q.closed&&f,Q.enter&&!Q.closed&&g,Q.leave&&v,Q.leave&&!Q.closed&&b,Q.leave&&Q.closed&&T,!Q.transition&&L&&y))==null?void 0:i.trim())||void 0,...x5(Q)}),be=0;N==="visible"&&(be|=ha.Open),N==="hidden"&&(be|=ha.Closed),L&&N==="hidden"&&(be|=ha.Opening),!L&&N==="visible"&&(be|=ha.Closing);let ve=ta();return ci.createElement(ap.Provider,{value:te},ci.createElement(w5,{value:be},ve({ourProps:pe,theirProps:E,defaultTag:WA,features:YA,visible:N==="visible",name:"Transition.Child"})))}function eO(s,e){let{show:t,appear:i=!1,unmount:n=!0,...r}=s,a=_.useRef(null),u=qA(s),c=Xa(...u?[a,e]:e===null?[]:[e]);np();let d=sp();if(t===void 0&&d!==null&&(t=(d&ha.Open)===ha.Open),t===void 0)throw new Error("A is used but it is missing a `show={true | false}` prop.");let[f,g]=_.useState(t?"visible":"hidden"),y=KA(()=>{t||g("hidden")}),[v,b]=_.useState(!0),T=_.useRef([t]);xr(()=>{v!==!1&&T.current[T.current.length-1]!==t&&(T.current.push(t),b(!1))},[T,t]);let E=_.useMemo(()=>({show:t,appear:i,initial:v}),[t,i,v]);xr(()=>{t?g("visible"):!op(y)&&a.current!==null&&g("hidden")},[t,y]);let D={unmount:n},O=ks(()=>{var F;v&&b(!1),(F=s.beforeEnter)==null||F.call(s)}),R=ks(()=>{var F;v&&b(!1),(F=s.beforeLeave)==null||F.call(s)}),j=ta();return ci.createElement(ap.Provider,{value:y},ci.createElement(rp.Provider,{value:E},j({ourProps:{...D,as:_.Fragment,children:ci.createElement(XA,{ref:c,...D,...r,beforeEnter:O,beforeLeave:R})},theirProps:{},defaultTag:_.Fragment,features:YA,visible:f==="visible",name:"Transition"})))}function tO(s,e){let t=_.useContext(rp)!==null,i=sp()!==null;return ci.createElement(ci.Fragment,null,!t&&i?ci.createElement(ox,{ref:e,...s}):ci.createElement(XA,{ref:e,...s}))}let ox=Tr(eO),XA=Tr(J5),cb=Tr(tO),bh=Object.assign(ox,{Child:cb,Root:ox});var iO=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(iO||{}),sO=(s=>(s[s.SetTitleId=0]="SetTitleId",s))(sO||{});let nO={0(s,e){return s.titleId===e.id?s:{...s,titleId:e.id}}},db=_.createContext(null);db.displayName="DialogContext";function lp(s){let e=_.useContext(db);if(e===null){let t=new Error(`<${s} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,lp),t}return e}function rO(s,e){return ko(e.type,nO,s,e)}let G_=Tr(function(s,e){let t=_.useId(),{id:i=`headlessui-dialog-${t}`,open:n,onClose:r,initialFocus:a,role:u="dialog",autoFocus:c=!0,__demoMode:d=!1,unmount:f=!1,...g}=s,y=_.useRef(!1);u=(function(){return u==="dialog"||u==="alertdialog"?u:(y.current||(y.current=!0,console.warn(`Invalid role [${u}] passed to . Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let v=sp();n===void 0&&v!==null&&(n=(v&ha.Open)===ha.Open);let b=_.useRef(null),T=Xa(b,e),E=ob(b.current),D=n?0:1,[O,R]=_.useReducer(rO,{titleId:null,descriptionId:null,panelRef:_.createRef()}),j=ks(()=>r(!1)),F=ks(Q=>R({type:0,id:Q})),G=np()?D===0:!1,[L,W]=O5(),I={get current(){var Q;return(Q=O.panelRef.current)!=null?Q:b.current}},N=zA(),{resolveContainers:X}=U5({mainTreeNode:N,portals:L,defaultContainers:[I]}),V=v!==null?(v&ha.Closing)===ha.Closing:!1;XN(d||V?!1:G,{allowed:ks(()=>{var Q,pe;return[(pe=(Q=b.current)==null?void 0:Q.closest("[data-headlessui-portal]"))!=null?pe:null]}),disallowed:ks(()=>{var Q;return[(Q=N?.closest("body > *:not(#headlessui-portal-root)"))!=null?Q:null]})});let Y=RA.get(null);xr(()=>{if(G)return Y.actions.push(i),()=>Y.actions.pop(i)},[Y,i,G]);let ne=IA(Y,_.useCallback(Q=>Y.selectors.isTop(Q,i),[Y,i]));l5(ne,X,Q=>{Q.preventDefault(),j()}),F5(ne,E?.defaultView,Q=>{Q.preventDefault(),Q.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),j()}),p5(d||V?!1:G,E,X),QN(G,b,j);let[ie,K]=LN(),q=_.useMemo(()=>[{dialogState:D,close:j,setTitleId:F,unmount:f},O],[D,j,F,f,O]),Z=Wh({open:D===0}),te={ref:T,id:i,role:u,tabIndex:-1,"aria-modal":d?void 0:D===0?!0:void 0,"aria-labelledby":O.titleId,"aria-describedby":ie,unmount:f},le=!B5(),z=lu.None;G&&!d&&(z|=lu.RestoreFocus,z|=lu.TabLock,c&&(z|=lu.AutoFocus),le&&(z|=lu.InitialFocus));let re=ta();return ci.createElement(A5,null,ci.createElement(z_,{force:!0},ci.createElement(P5,null,ci.createElement(db.Provider,{value:q},ci.createElement($A,{target:b},ci.createElement(z_,{force:!1},ci.createElement(K,{slot:Z},ci.createElement(W,null,ci.createElement(G5,{initialFocus:a,initialFocusFallback:b,containers:X,features:z},ci.createElement(PN,{value:j},re({ourProps:te,theirProps:g,slot:Z,defaultTag:aO,features:oO,visible:D===0,name:"Dialog"})))))))))))}),aO="div",oO=f0.RenderStrategy|f0.Static;function lO(s,e){let{transition:t=!1,open:i,...n}=s,r=sp(),a=s.hasOwnProperty("open")||r!==null,u=s.hasOwnProperty("onClose");if(!a&&!u)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!a)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!u)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!r&&typeof s.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${s.open}`);if(typeof s.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${s.onClose}`);return(i!==void 0||t)&&!n.static?ci.createElement(V_,null,ci.createElement(bh,{show:i,transition:t,unmount:n.unmount},ci.createElement(G_,{ref:e,...n}))):ci.createElement(V_,null,ci.createElement(G_,{ref:e,open:i,...n}))}let uO="div";function cO(s,e){let t=_.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:n=!1,...r}=s,[{dialogState:a,unmount:u},c]=lp("Dialog.Panel"),d=Xa(e,c.panelRef),f=Wh({open:a===0}),g=ks(E=>{E.stopPropagation()}),y={ref:d,id:i,onClick:g},v=n?cb:_.Fragment,b=n?{unmount:u}:{},T=ta();return ci.createElement(v,{...b},T({ourProps:y,theirProps:r,slot:f,defaultTag:uO,name:"Dialog.Panel"}))}let dO="div";function hO(s,e){let{transition:t=!1,...i}=s,[{dialogState:n,unmount:r}]=lp("Dialog.Backdrop"),a=Wh({open:n===0}),u={ref:e,"aria-hidden":!0},c=t?cb:_.Fragment,d=t?{unmount:r}:{},f=ta();return ci.createElement(c,{...d},f({ourProps:u,theirProps:i,slot:a,defaultTag:dO,name:"Dialog.Backdrop"}))}let fO="h2";function mO(s,e){let t=_.useId(),{id:i=`headlessui-dialog-title-${t}`,...n}=s,[{dialogState:r,setTitleId:a}]=lp("Dialog.Title"),u=Xa(e);_.useEffect(()=>(a(i),()=>a(null)),[i,a]);let c=Wh({open:r===0}),d={ref:u,id:i};return ta()({ourProps:d,theirProps:n,slot:c,defaultTag:fO,name:"Dialog.Title"})}let pO=Tr(lO),gO=Tr(cO);Tr(hO);let yO=Tr(mO),yc=Object.assign(pO,{Panel:gO,Title:yO,Description:ON});function vO({open:s,onClose:e,onApply:t,initialCookies:i}){const[n,r]=_.useState(""),[a,u]=_.useState(""),[c,d]=_.useState([]),f=_.useRef(!1);_.useEffect(()=>{s&&!f.current&&(r(""),u(""),d(i??[])),f.current=s},[s,i]);function g(){const b=n.trim(),T=a.trim();!b||!T||(d(E=>[...E.filter(O=>O.name!==b),{name:b,value:T}]),r(""),u(""))}function y(b){d(T=>T.filter(E=>E.name!==b))}function v(){t(c),e()}return p.jsxs(yc,{open:s,onClose:e,className:"relative z-50",children:[p.jsx("div",{className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),p.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:p.jsxs(yc.Panel,{className:"w-full max-w-lg rounded-lg bg-white dark:bg-gray-800 p-6 shadow-xl dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[p.jsx(yc.Title,{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Zusätzliche Cookies"}),p.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[p.jsx("input",{value:n,onChange:b=>r(b.target.value),placeholder:"Name (z. B. cf_clearance)",className:"col-span-1 truncate rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),p.jsx("input",{value:a,onChange:b=>u(b.target.value),placeholder:"Wert",className:"col-span-1 truncate sm:col-span-2 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"})]}),p.jsx("div",{className:"mt-2",children:p.jsx(mi,{size:"sm",variant:"secondary",onClick:g,disabled:!n.trim()||!a.trim(),children:"Hinzufügen"})}),p.jsx("div",{className:"mt-4",children:c.length===0?p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Noch keine Cookies hinzugefügt."}):p.jsxs("table",{className:"min-w-full text-sm border divide-y dark:divide-white/10",children:[p.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Name"}),p.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Wert"}),p.jsx("th",{className:"px-3 py-2"})]})}),p.jsx("tbody",{className:"divide-y dark:divide-white/10",children:c.map(b=>p.jsxs("tr",{children:[p.jsx("td",{className:"px-3 py-2 font-mono",children:b.name}),p.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:b.value}),p.jsx("td",{className:"px-3 py-2 text-right",children:p.jsx("button",{onClick:()=>y(b.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},b.name))})]})}),p.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[p.jsx(mi,{variant:"secondary",onClick:e,children:"Abbrechen"}),p.jsx(mi,{variant:"primary",onClick:v,children:"Übernehmen"})]})]})})]})}function xO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const bO=_.forwardRef(xO);function lx({tabs:s,value:e,onChange:t,className:i,ariaLabel:n="Ansicht auswählen",variant:r="underline",hideCountUntilMd:a=!1}){if(!s?.length)return null;const u=s.find(y=>y.id===e)??s[0],c=vi("col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800 dark:focus:outline-indigo-500",r==="pillsBrand"?"dark:bg-gray-800/50":"dark:bg-white/5"),d=y=>vi(y?"bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400":"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300",a?"ml-3 hidden rounded-full px-2.5 py-0.5 text-xs font-medium md:inline-block":"ml-3 rounded-full px-2.5 py-0.5 text-xs font-medium"),f=(y,v)=>v.count===void 0?null:p.jsx("span",{className:d(y),children:v.count}),g=()=>{switch(r){case"underline":case"underlineIcons":return p.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:p.jsx("nav",{"aria-label":n,className:"-mb-px flex space-x-8",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return p.jsxs("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:vi(v?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-200",r==="underlineIcons"?"group inline-flex items-center border-b-2 px-1 py-4 text-sm font-medium":"flex items-center border-b-2 px-1 py-4 text-sm font-medium whitespace-nowrap",b&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[r==="underlineIcons"&&y.icon?p.jsx(y.icon,{"aria-hidden":"true",className:vi(v?"text-indigo-500 dark:text-indigo-400":"text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-400","mr-2 -ml-0.5 size-5")}):null,p.jsx("span",{children:y.label}),f(v,y)]},y.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const y=r==="pills"?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-gray-200":r==="pillsGray"?"bg-gray-200 text-gray-800 dark:bg-white/10 dark:text-white":"bg-indigo-100 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300",v=r==="pills"?"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200":r==="pillsGray"?"text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200";return p.jsx("nav",{"aria-label":n,className:"flex space-x-4",children:s.map(b=>{const T=b.id===u.id,E=!!b.disabled;return p.jsxs("button",{type:"button",onClick:()=>!E&&t(b.id),disabled:E,"aria-current":T?"page":void 0,className:vi(T?y:v,"inline-flex items-center rounded-md px-3 py-2 text-sm font-medium",E&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:[p.jsx("span",{children:b.label}),b.count!==void 0?p.jsx("span",{className:vi(T?"ml-2 bg-white/70 text-gray-900 dark:bg-white/10 dark:text-white":"ml-2 bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300","rounded-full px-2 py-0.5 text-xs font-medium"),children:b.count}):null]},b.id)})})}case"fullWidthUnderline":return p.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:p.jsx("nav",{"aria-label":n,className:"-mb-px flex",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return p.jsx("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:vi(v?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300","flex-1 border-b-2 px-1 py-4 text-center text-sm font-medium",b&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:y.label},y.id)})})});case"barUnderline":return p.jsx("nav",{"aria-label":n,className:"isolate flex divide-x divide-gray-200 rounded-lg bg-white shadow-sm dark:divide-white/10 dark:bg-gray-800/50 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",children:s.map((y,v)=>{const b=y.id===u.id,T=!!y.disabled;return p.jsxs("button",{type:"button",onClick:()=>!T&&t(y.id),disabled:T,"aria-current":b?"page":void 0,className:vi(b?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",v===0?"rounded-l-lg":"",v===s.length-1?"rounded-r-lg":"","group relative min-w-0 flex-1 overflow-hidden px-4 py-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10 dark:hover:bg-white/5",T&&"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[p.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center justify-center",children:[p.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",title:y.label,children:y.label}),y.count!==void 0?p.jsx("span",{className:"ml-2 shrink-0 tabular-nums min-w-[2.25rem] rounded-full bg-white/70 px-2 py-0.5 text-center text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-white",children:y.count}):null]}),p.jsx("span",{"aria-hidden":"true",className:vi(b?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},y.id)})});case"simple":return p.jsx("nav",{className:"flex border-b border-gray-200 py-4 dark:border-white/10","aria-label":n,children:p.jsx("ul",{role:"list",className:"flex min-w-full flex-none gap-x-8 px-2 text-sm/6 font-semibold text-gray-500 dark:text-gray-400",children:s.map(y=>{const v=y.id===u.id,b=!!y.disabled;return p.jsx("li",{children:p.jsx("button",{type:"button",onClick:()=>!b&&t(y.id),disabled:b,"aria-current":v?"page":void 0,className:vi(v?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",b&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:y.label})},y.id)})})});default:return null}};return p.jsxs("div",{className:i,children:[p.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[p.jsx("select",{value:u.id,onChange:y=>t(y.target.value),"aria-label":n,className:c,children:s.map(y=>p.jsx("option",{value:y.id,children:y.label},y.id))}),p.jsx(bO,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),p.jsx("div",{className:"hidden sm:block",children:g()})]})}function ma({header:s,footer:e,grayBody:t=!1,grayFooter:i=!1,edgeToEdgeMobile:n=!1,well:r=!1,noBodyPadding:a=!1,className:u,bodyClassName:c,children:d}){const f=r;return p.jsxs("div",{className:vi("overflow-hidden",n?"sm:rounded-lg":"rounded-lg",f?"bg-gray-50 dark:bg-gray-800 shadow-none":"bg-white shadow-sm dark:bg-gray-800 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",u),children:[s&&p.jsx("div",{className:"shrink-0 px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-white/10",children:s}),p.jsx("div",{className:vi("min-h-0",a?"p-0":"px-4 py-5 sm:p-6",t&&"bg-gray-50 dark:bg-gray-800",c),children:d}),e&&p.jsx("div",{className:vi("shrink-0 px-4 py-4 sm:px-6",i&&"bg-gray-50 dark:bg-gray-800/50","border-t border-gray-200 dark:border-white/10"),children:e})]})}function ux({checked:s,onChange:e,id:t,name:i,disabled:n,required:r,ariaLabel:a,ariaLabelledby:u,ariaDescribedby:c,size:d="default",variant:f="simple",className:g}){const y=b=>{n||e(b.target.checked)},v=vi("absolute inset-0 size-full appearance-none focus:outline-hidden",n&&"cursor-not-allowed");return d==="short"?p.jsxs("div",{className:vi("group relative inline-flex h-5 w-10 shrink-0 items-center justify-center rounded-full outline-offset-2 outline-indigo-600 has-focus-visible:outline-2 dark:outline-indigo-500",n&&"opacity-60",g),children:[p.jsx("span",{className:vi("absolute mx-auto h-4 w-9 rounded-full bg-gray-200 inset-ring inset-ring-gray-900/5 transition-colors duration-200 ease-in-out dark:bg-gray-800/50 dark:inset-ring-white/10",s&&"bg-indigo-600 dark:bg-indigo-500")}),p.jsx("span",{className:vi("absolute left-0 size-5 rounded-full border border-gray-300 bg-white shadow-xs transition-transform duration-200 ease-in-out dark:shadow-none",s&&"translate-x-5")}),p.jsx("input",{id:t,name:i,type:"checkbox",checked:s,onChange:y,disabled:n,required:r,"aria-label":a,"aria-labelledby":u,"aria-describedby":c,className:v})]}):p.jsxs("div",{className:vi("group relative inline-flex w-11 shrink-0 rounded-full bg-gray-200 p-0.5 inset-ring inset-ring-gray-900/5 outline-offset-2 outline-indigo-600 transition-colors duration-200 ease-in-out has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-indigo-500",s&&"bg-indigo-600 dark:bg-indigo-500",n&&"opacity-60",g),children:[f==="icon"?p.jsxs("span",{className:vi("relative size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",s&&"translate-x-5"),children:[p.jsx("span",{"aria-hidden":"true",className:vi("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-in",s?"opacity-0 duration-100":"opacity-100 duration-200"),children:p.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-gray-600",children:p.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}),p.jsx("span",{"aria-hidden":"true",className:vi("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-out",s?"opacity-100 duration-200":"opacity-0 duration-100"),children:p.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-500",children:p.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})]}):p.jsx("span",{className:vi("size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",s&&"translate-x-5")}),p.jsx("input",{id:t,name:i,type:"checkbox",checked:s,onChange:y,disabled:n,required:r,"aria-label":a,"aria-labelledby":u,"aria-describedby":c,className:v})]})}function vo({label:s,description:e,labelPosition:t="left",id:i,className:n,...r}){const a=_.useId(),u=i??`sw-${a}`,c=`${u}-label`,d=`${u}-desc`;return t==="right"?p.jsxs("div",{className:vi("flex items-center justify-between gap-3",n),children:[p.jsx(ux,{...r,id:u,ariaLabelledby:c,ariaDescribedby:e?d:void 0}),p.jsxs("div",{className:"text-sm",children:[p.jsx("label",{id:c,htmlFor:u,className:"font-medium text-gray-900 dark:text-white",children:s})," ",e?p.jsx("span",{id:d,className:"text-gray-500 dark:text-gray-400",children:e}):null]})]}):p.jsxs("div",{className:vi("flex items-center justify-between",n),children:[p.jsxs("span",{className:"flex grow flex-col",children:[p.jsx("label",{id:c,htmlFor:u,className:"text-sm/6 font-medium text-gray-900 dark:text-white",children:s}),e?p.jsx("span",{id:d,className:"text-sm text-gray-500 dark:text-gray-400",children:e}):null]}),p.jsx(ux,{...r,id:u,ariaLabelledby:c,ariaDescribedby:e?d:void 0})]})}const Nc=new Map;let q_=!1;function TO(){q_||(q_=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const s of Nc.values())s.es&&(s.es.close(),s.es=null,s.dispatchers.clear());else for(const s of Nc.values())s.refs>0&&!s.es&&QA(s)}))}function QA(s){if(!s.es&&!document.hidden){s.es=new EventSource(s.url);for(const[e,t]of s.listeners.entries()){const i=n=>{let r=null;try{r=JSON.parse(String(n.data??"null"))}catch{return}for(const a of t)a(r)};s.dispatchers.set(e,i),s.es.addEventListener(e,i)}s.es.onerror=()=>{}}}function SO(s){s.es&&(s.es.close(),s.es=null,s.dispatchers.clear())}function _O(s){let e=Nc.get(s);return e||(e={url:s,es:null,refs:0,listeners:new Map,dispatchers:new Map},Nc.set(s,e)),e}function up(s,e,t){TO();const i=_O(s);let n=i.listeners.get(e);if(n||(n=new Set,i.listeners.set(e,n)),n.add(t),i.refs+=1,i.es){if(!i.dispatchers.has(e)){const r=a=>{let u=null;try{u=JSON.parse(String(a.data??"null"))}catch{return}for(const c of i.listeners.get(e)??[])c(u)};i.dispatchers.set(e,r),i.es.addEventListener(e,r)}}else QA(i);return()=>{const r=Nc.get(s);if(!r)return;const a=r.listeners.get(e);a&&(a.delete(t),a.size===0&&r.listeners.delete(e)),r.refs=Math.max(0,r.refs-1),r.refs===0&&(SO(r),Nc.delete(s))}}async function EO(s,e){const t=await fetch(s,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const n=i&&(i.error||i.message)||t.statusText;throw new Error(n)}return i}function wO({onFinished:s,onStart:e,onProgress:t,onDone:i,onCancelled:n,onError:r}){const[a,u]=_.useState(null),[c,d]=_.useState(!1),[f,g]=_.useState(null),y=_.useRef(null),v=_.useRef(!1),b=_.useRef(!1),T=_.useRef(!1),E=_.useRef(!1),D=_.useRef(""),O=_.useRef(t),R=_.useRef(r);_.useEffect(()=>{O.current=t},[t]),_.useEffect(()=>{R.current=r},[r]);async function j(){if(!T.current){T.current=!0;try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}finally{T.current=!1}}}function F(){if(y.current)return y.current;const I=new AbortController;y.current=I;const N=()=>{b.current=!0,j()};return I.signal.addEventListener("abort",N,{once:!0}),I}function G(I){v.current||(v.current=!0,e?.(I))}_.useEffect(()=>{const I=E.current,N=!!a?.running;if(E.current=N,I&&!N){const X=String(a?.error??"").trim();y.current=null,v.current=!1,b.current||X==="abgebrochen"?(b.current=!1,n?.()):X||i?.(),s?.()}},[a?.running,a?.error,s,i,n]),_.useEffect(()=>{const I=up("/api/tasks/assets/stream","state",N=>{if(u(N),N?.running){const V=F();G(V),O.current?.({done:N?.done??0,total:N?.total??0,currentFile:N?.currentFile??""})}const X=String(N?.error??"").trim();X&&X!=="abgebrochen"&&X!==D.current&&(D.current=X,R.current?.(X))});return()=>I()},[]);async function L(){if(a?.running)return;g(null),d(!0),b.current=!1,D.current="";const I=F();try{const N=await EO("/api/tasks/generate-assets",{method:"POST"});u(N),G(I),N?.running&&t?.({done:N?.done??0,total:N?.total??0,currentFile:N?.currentFile??""})}catch(N){y.current=null,v.current=!1;const X=N?.message??String(N);g(X),r?.(X)}finally{d(!1)}}const W=!!a?.running;return p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Assets-Generator"}),p.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Erzeugt fehlende Assets (thumb/preview/meta). Fortschritt & Abbrechen oben in der Taskliste."}),f?p.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:f}):null]}),p.jsx("div",{className:"shrink-0",children:p.jsx(mi,{variant:"primary",onClick:L,disabled:c||W,children:c?"Starte…":"Start"})})]})}function AO(s,e){const t=Number(s??0),i=Number(e??0);return!i||i<=0?0:Math.max(0,Math.min(100,Math.round(t/i*100)))}function kO({tasks:s,onCancel:e}){const t=(s||[]).filter(i=>i.status!=="idle");return p.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[p.jsx("div",{className:"flex items-start justify-between gap-3",children:p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Hintergrundaufgaben"}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Laufende Hintergrundaufgaben (z.B. Assets/Previews)."})]})}),p.jsxs("div",{className:"mt-3 space-y-3",children:[t.length===0?p.jsx("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-600 dark:border-white/10 dark:bg-white/5 dark:text-gray-300",children:"Keine laufenden Aufgaben."}):null,t.map(i=>{const n=AO(i.done,i.total),r=i.status==="running",a=r&&(i.total??0)>0,u=(i.title??"").trim(),c=(i.text??"").trim();return p.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 dark:border-white/10 dark:bg-white/5 transition-opacity duration-500 "+(i.fading?"opacity-0":"opacity-100"),children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"shrink-0",children:r&&i.cancellable&&e?p.jsx("button",{type:"button",onClick:()=>e?.(i.id),className:`inline-flex h-7 w-7 items-center justify-center rounded-md\r text-red-700 hover:bg-red-50 hover:text-red-900\r - dark:text-red-300 dark:hover:bg-red-500/10 dark:hover:text-red-200`,title:"Abbrechen","aria-label":"Task abbrechen",children:"✕"}):i.status==="done"?g.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-green-700 dark:text-green-300",title:"Fertig","aria-label":"Fertig",children:"✓"}):g.jsx("span",{className:"inline-block h-7 w-7"})}),g.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[g.jsxs("div",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",children:[u||"Aufgabe",c?g.jsxs("span",{className:"font-normal text-gray-600 dark:text-gray-300",children:[" · ",c]}):null]}),i.status==="done"?g.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-[11px] font-semibold text-green-800 ring-1 ring-inset ring-green-200 dark:bg-green-500/20 dark:text-green-200 dark:ring-green-400/30",children:"fertig"}):i.status==="cancelled"?g.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10",children:"abgebrochen"}):i.status==="error"?g.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-[11px] font-semibold text-red-800 ring-1 ring-inset ring-red-200 dark:bg-red-500/20 dark:text-red-200 dark:ring-red-400/30",children:"fehler"}):null,g.jsx("div",{className:"flex-1"}),a?g.jsxs("div",{className:"shrink-0 flex items-center gap-3 text-xs text-gray-600 dark:text-gray-300",children:[g.jsxs("span",{className:"tabular-nums",children:[i.done??0,"/",i.total??0]}),g.jsxs("span",{className:"tabular-nums",children:[n,"%"]}),g.jsx("div",{className:"hidden sm:block h-2 w-40 overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:g.jsx("div",{className:"h-full bg-indigo-500",style:{width:`${n}%`}})})]}):null]})]}),i.status==="error"&&i.err?g.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:i.err}):null]},i.id)})]})]})}const tn={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!0,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!0,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:5,enableNotifications:!0};function xO(s,e=52){const t=String(s??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function bO({onAssetsGenerated:s}){const[e,t]=_.useState(tn),[i,n]=_.useState(!1),[r,a]=_.useState(!1),[u,c]=_.useState(null),[d,f]=_.useState(null),[p,y]=_.useState(null),[v,b]=_.useState(null),T=_.useRef(null),[E,D]=_.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[O,R]=_.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),j=Number(e.lowDiskPauseBelowGB??tn.lowDiskPauseBelowGB??5),F=v?.pauseGB??j,z=v?.resumeGB??j+3;_.useEffect(()=>{let G=!0;return fetch("/api/settings",{cache:"no-store"}).then(async q=>{if(!q.ok)throw new Error(await q.text());return q.json()}).then(q=>{G&&t({recordDir:(q.recordDir||tn.recordDir).toString(),doneDir:(q.doneDir||tn.doneDir).toString(),ffmpegPath:String(q.ffmpegPath??tn.ffmpegPath??""),autoAddToDownloadList:q.autoAddToDownloadList??tn.autoAddToDownloadList,autoStartAddedDownloads:q.autoStartAddedDownloads??tn.autoStartAddedDownloads,useChaturbateApi:q.useChaturbateApi??tn.useChaturbateApi,useMyFreeCamsWatcher:q.useMyFreeCamsWatcher??tn.useMyFreeCamsWatcher,autoDeleteSmallDownloads:q.autoDeleteSmallDownloads??tn.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:q.autoDeleteSmallDownloadsBelowMB??tn.autoDeleteSmallDownloadsBelowMB,blurPreviews:q.blurPreviews??tn.blurPreviews,teaserPlayback:q.teaserPlayback??tn.teaserPlayback,teaserAudio:q.teaserAudio??tn.teaserAudio,lowDiskPauseBelowGB:q.lowDiskPauseBelowGB??tn.lowDiskPauseBelowGB,enableNotifications:q.enableNotifications??tn.enableNotifications})}).catch(()=>{}),()=>{G=!1}},[]),_.useEffect(()=>{let G=!0;const q=async()=>{try{const ie=await fetch("/api/status/disk",{cache:"no-store"});if(!ie.ok)return;const W=await ie.json();G&&b(W)}catch{}};q();const ae=window.setInterval(q,5e3);return()=>{G=!1,window.clearInterval(ae)}},[]);async function N(G){y(null),f(null),c(G);try{window.focus();const q=await fetch(`/api/settings/browse?target=${G}`,{cache:"no-store"});if(q.status===204)return;if(!q.ok){const W=await q.text().catch(()=>"");throw new Error(W||`HTTP ${q.status}`)}const ie=((await q.json()).path??"").trim();if(!ie)return;t(W=>G==="record"?{...W,recordDir:ie}:G==="done"?{...W,doneDir:ie}:{...W,ffmpegPath:ie})}catch(q){y(q?.message??String(q))}finally{c(null)}}async function Y(){y(null),f(null);const G=e.recordDir.trim(),q=e.doneDir.trim(),ae=(e.ffmpegPath??"").trim();if(!G||!q){y("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const ie=!!e.autoAddToDownloadList,W=ie?!!e.autoStartAddedDownloads:!1,K=!!e.useChaturbateApi,Q=!!e.useMyFreeCamsWatcher,te=!!e.autoDeleteSmallDownloads,re=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??tn.autoDeleteSmallDownloadsBelowMB)))),U=!!e.blurPreviews,ne=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:tn.teaserPlayback,Z=!!e.teaserAudio,fe=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??tn.lowDiskPauseBelowGB))),xe=!!e.enableNotifications;n(!0);try{const ge=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({recordDir:G,doneDir:q,ffmpegPath:ae,autoAddToDownloadList:ie,autoStartAddedDownloads:W,useChaturbateApi:K,useMyFreeCamsWatcher:Q,autoDeleteSmallDownloads:te,autoDeleteSmallDownloadsBelowMB:re,blurPreviews:U,teaserPlayback:ne,teaserAudio:Z,lowDiskPauseBelowGB:fe,enableNotifications:xe})});if(!ge.ok){const Ce=await ge.text().catch(()=>"");throw new Error(Ce||`HTTP ${ge.status}`)}f("✅ Gespeichert."),window.dispatchEvent(new CustomEvent("recorder-settings-updated"))}catch(ge){y(ge?.message??String(ge))}finally{n(!1)}}function L(G,q=3500,ae=500){window.setTimeout(()=>{G(ie=>({...ie,fading:!0})),window.setTimeout(()=>{G(ie=>({...ie,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},ae)},q)}async function I(){y(null),f(null);const G=Number(e.autoDeleteSmallDownloadsBelowMB??tn.autoDeleteSmallDownloadsBelowMB??0),q=(e.doneDir||tn.doneDir).trim();if(!q){y("doneDir ist leer.");return}if(!G||G<=0){y("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen: -• Löscht Dateien in "${q}" < ${G} MB (Ordner "keep" wird übersprungen) + dark:text-red-300 dark:hover:bg-red-500/10 dark:hover:text-red-200`,title:"Abbrechen","aria-label":"Task abbrechen",children:"✕"}):i.status==="done"?p.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-green-700 dark:text-green-300",title:"Fertig","aria-label":"Fertig",children:"✓"}):p.jsx("span",{className:"inline-block h-7 w-7"})}),p.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[p.jsxs("div",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",children:[u||"Aufgabe",c?p.jsxs("span",{className:"font-normal text-gray-600 dark:text-gray-300",children:[" · ",c]}):null]}),i.status==="done"?p.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-[11px] font-semibold text-green-800 ring-1 ring-inset ring-green-200 dark:bg-green-500/20 dark:text-green-200 dark:ring-green-400/30",children:"fertig"}):i.status==="cancelled"?p.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10",children:"abgebrochen"}):i.status==="error"?p.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-[11px] font-semibold text-red-800 ring-1 ring-inset ring-red-200 dark:bg-red-500/20 dark:text-red-200 dark:ring-red-400/30",children:"fehler"}):null,p.jsx("div",{className:"flex-1"}),a?p.jsxs("div",{className:"shrink-0 flex items-center gap-3 text-xs text-gray-600 dark:text-gray-300",children:[p.jsxs("span",{className:"tabular-nums",children:[i.done??0,"/",i.total??0]}),p.jsxs("span",{className:"tabular-nums",children:[n,"%"]}),p.jsx("div",{className:"hidden sm:block h-2 w-40 overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:p.jsx("div",{className:"h-full bg-indigo-500",style:{width:`${n}%`}})})]}):null]})]}),i.status==="error"&&i.err?p.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:i.err}):null]},i.id)})]})]})}const ln={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!0,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!0,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:5,enableNotifications:!0};function CO(s,e=52){const t=String(s??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function DO({onAssetsGenerated:s}){const[e,t]=_.useState(ln),[i,n]=_.useState(!1),[r,a]=_.useState(!1),[u,c]=_.useState(null),[d,f]=_.useState(null),[g,y]=_.useState(null),[v,b]=_.useState(null),T=_.useRef(null),[E,D]=_.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[O,R]=_.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),j=Number(e.lowDiskPauseBelowGB??ln.lowDiskPauseBelowGB??5),F=v?.pauseGB??j,G=v?.resumeGB??j+3;_.useEffect(()=>{let V=!0;return fetch("/api/settings",{cache:"no-store"}).then(async Y=>{if(!Y.ok)throw new Error(await Y.text());return Y.json()}).then(Y=>{V&&t({recordDir:(Y.recordDir||ln.recordDir).toString(),doneDir:(Y.doneDir||ln.doneDir).toString(),ffmpegPath:String(Y.ffmpegPath??ln.ffmpegPath??""),autoAddToDownloadList:Y.autoAddToDownloadList??ln.autoAddToDownloadList,autoStartAddedDownloads:Y.autoStartAddedDownloads??ln.autoStartAddedDownloads,useChaturbateApi:Y.useChaturbateApi??ln.useChaturbateApi,useMyFreeCamsWatcher:Y.useMyFreeCamsWatcher??ln.useMyFreeCamsWatcher,autoDeleteSmallDownloads:Y.autoDeleteSmallDownloads??ln.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:Y.autoDeleteSmallDownloadsBelowMB??ln.autoDeleteSmallDownloadsBelowMB,blurPreviews:Y.blurPreviews??ln.blurPreviews,teaserPlayback:Y.teaserPlayback??ln.teaserPlayback,teaserAudio:Y.teaserAudio??ln.teaserAudio,lowDiskPauseBelowGB:Y.lowDiskPauseBelowGB??ln.lowDiskPauseBelowGB,enableNotifications:Y.enableNotifications??ln.enableNotifications})}).catch(()=>{}),()=>{V=!1}},[]),_.useEffect(()=>{let V=!0;const Y=async()=>{try{const ie=await fetch("/api/status/disk",{cache:"no-store"});if(!ie.ok)return;const K=await ie.json();V&&b(K)}catch{}};Y();const ne=window.setInterval(Y,5e3);return()=>{V=!1,window.clearInterval(ne)}},[]);async function L(V){y(null),f(null),c(V);try{window.focus();const Y=await fetch(`/api/settings/browse?target=${V}`,{cache:"no-store"});if(Y.status===204)return;if(!Y.ok){const K=await Y.text().catch(()=>"");throw new Error(K||`HTTP ${Y.status}`)}const ie=((await Y.json()).path??"").trim();if(!ie)return;t(K=>V==="record"?{...K,recordDir:ie}:V==="done"?{...K,doneDir:ie}:{...K,ffmpegPath:ie})}catch(Y){y(Y?.message??String(Y))}finally{c(null)}}async function W(){y(null),f(null);const V=e.recordDir.trim(),Y=e.doneDir.trim(),ne=(e.ffmpegPath??"").trim();if(!V||!Y){y("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const ie=!!e.autoAddToDownloadList,K=ie?!!e.autoStartAddedDownloads:!1,q=!!e.useChaturbateApi,Z=!!e.useMyFreeCamsWatcher,te=!!e.autoDeleteSmallDownloads,le=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??ln.autoDeleteSmallDownloadsBelowMB)))),z=!!e.blurPreviews,re=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:ln.teaserPlayback,Q=!!e.teaserAudio,pe=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??ln.lowDiskPauseBelowGB))),be=!!e.enableNotifications;n(!0);try{const ve=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({recordDir:V,doneDir:Y,ffmpegPath:ne,autoAddToDownloadList:ie,autoStartAddedDownloads:K,useChaturbateApi:q,useMyFreeCamsWatcher:Z,autoDeleteSmallDownloads:te,autoDeleteSmallDownloadsBelowMB:le,blurPreviews:z,teaserPlayback:re,teaserAudio:Q,lowDiskPauseBelowGB:pe,enableNotifications:be})});if(!ve.ok){const we=await ve.text().catch(()=>"");throw new Error(we||`HTTP ${ve.status}`)}f("✅ Gespeichert."),window.dispatchEvent(new CustomEvent("recorder-settings-updated"))}catch(ve){y(ve?.message??String(ve))}finally{n(!1)}}function I(V,Y=3500,ne=500){window.setTimeout(()=>{V(ie=>({...ie,fading:!0})),window.setTimeout(()=>{V(ie=>({...ie,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},ne)},Y)}async function N(){y(null),f(null);const V=Number(e.autoDeleteSmallDownloadsBelowMB??ln.autoDeleteSmallDownloadsBelowMB??0),Y=(e.doneDir||ln.doneDir).trim();if(!Y){y("doneDir ist leer.");return}if(!V||V<=0){y("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen: +• Löscht Dateien in "${Y}" < ${V} MB (Ordner "keep" wird übersprungen) • Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei -Fortfahren?`)){a(!0),R(ie=>({...ie,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const ie=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!ie.ok){const U=await ie.text().catch(()=>"");throw new Error(U||`HTTP ${ie.status}`)}const W=await ie.json(),K=Number(W.scannedFiles??0),Q=Number(W.orphanIdsRemoved??0),te=Number(W.generatedOrphansRemoved??0),re=Q+te;R(U=>({...U,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${K} · Orphans: ${re}`})),L(R)}catch(ie){const W=ie?.message??String(ie);y(W),R(K=>({...K,status:"error",text:"Fehler beim Aufräumen.",err:W})),L(R)}finally{a(!1)}}}async function X(){const G=T.current;if(T.current=null,D(q=>({...q,status:"cancelled",text:"Abgebrochen."})),G){G.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return g.jsx(ca,{header:g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Einstellungen"}),g.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Recorder-Konfiguration, Automatisierung und Tasks."})]}),g.jsx(di,{variant:"primary",onClick:Y,disabled:i,children:"Speichern"})]}),grayBody:!0,children:g.jsxs("div",{className:"space-y-4",children:[g.jsx(vO,{tasks:[E,O],onCancel:G=>{G==="generate-assets"&&X()}}),p&&g.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:p}),d&&g.jsx("div",{className:"rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200",children:d}),g.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[g.jsx("div",{className:"flex items-start justify-between gap-4",children:g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Aufgaben"}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Hintergrundaufgaben wie z.B. Asset/Preview-Generierung."})]})}),g.jsx("div",{className:"mt-3 space-y-3",children:g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"min-w-0 flex-1",children:g.jsx(gO,{onFinished:s,onStart:G=>{T.current=G,D(q=>({...q,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:G=>{const q=xO(G.currentFile);D(ae=>({...ae,status:"running",title:"Assets generieren",text:q||"",done:G.done,total:G.total}))},onDone:()=>{T.current=null,D(G=>({...G,status:"done",title:"Assets generieren"})),L(D)},onCancelled:()=>{T.current=null,D(G=>({...G,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),L(D)},onError:G=>{T.current=null,D(q=>({...q,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:G})),L(D)}})}),g.jsx("div",{className:"shrink-0 flex items-center gap-2",children:g.jsx(di,{variant:"secondary",onClick:I,disabled:i||r||!e.autoDeleteSmallDownloads,className:"h-9 px-3",title:"Löscht Dateien im doneDir kleiner als die Mindestgröße (keep wird übersprungen)",children:r?"…":"Aufräumen"})})]})})]}),g.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[g.jsxs("div",{className:"mb-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Pfad-Einstellungen"}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aufnahme- und Zielverzeichnisse sowie optionaler ffmpeg-Pfad."})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[g.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Aufnahme-Ordner"}),g.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[g.jsx("input",{value:e.recordDir,onChange:G=>t(q=>({...q,recordDir:G.target.value})),placeholder:"records (oder absolut: C:\\records / /mnt/data/records)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 +Fortfahren?`)){a(!0),R(ie=>({...ie,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const ie=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!ie.ok){const z=await ie.text().catch(()=>"");throw new Error(z||`HTTP ${ie.status}`)}const K=await ie.json(),q=Number(K.scannedFiles??0),Z=Number(K.orphanIdsRemoved??0),te=Number(K.generatedOrphansRemoved??0),le=Z+te;R(z=>({...z,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${q} · Orphans: ${le}`})),I(R)}catch(ie){const K=ie?.message??String(ie);y(K),R(q=>({...q,status:"error",text:"Fehler beim Aufräumen.",err:K})),I(R)}finally{a(!1)}}}async function X(){const V=T.current;if(T.current=null,D(Y=>({...Y,status:"cancelled",text:"Abgebrochen."})),V){V.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return p.jsx(ma,{header:p.jsxs("div",{className:"flex items-center justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Einstellungen"}),p.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Recorder-Konfiguration, Automatisierung und Tasks."})]}),p.jsx(mi,{variant:"primary",onClick:W,disabled:i,children:"Speichern"})]}),grayBody:!0,children:p.jsxs("div",{className:"space-y-4",children:[p.jsx(kO,{tasks:[E,O],onCancel:V=>{V==="generate-assets"&&X()}}),g&&p.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:g}),d&&p.jsx("div",{className:"rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200",children:d}),p.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[p.jsx("div",{className:"flex items-start justify-between gap-4",children:p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Aufgaben"}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Hintergrundaufgaben wie z.B. Asset/Preview-Generierung."})]})}),p.jsx("div",{className:"mt-3 space-y-3",children:p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx(wO,{onFinished:s,onStart:V=>{T.current=V,D(Y=>({...Y,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:V=>{const Y=CO(V.currentFile);D(ne=>({...ne,status:"running",title:"Assets generieren",text:Y||"",done:V.done,total:V.total}))},onDone:()=>{T.current=null,D(V=>({...V,status:"done",title:"Assets generieren"})),I(D)},onCancelled:()=>{T.current=null,D(V=>({...V,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),I(D)},onError:V=>{T.current=null,D(Y=>({...Y,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:V})),I(D)}})}),p.jsx("div",{className:"shrink-0 flex items-center gap-2",children:p.jsx(mi,{variant:"secondary",onClick:N,disabled:i||r||!e.autoDeleteSmallDownloads,className:"h-9 px-3",title:"Löscht Dateien im doneDir kleiner als die Mindestgröße (keep wird übersprungen)",children:r?"…":"Aufräumen"})})]})})]}),p.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[p.jsxs("div",{className:"mb-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Pfad-Einstellungen"}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aufnahme- und Zielverzeichnisse sowie optionaler ffmpeg-Pfad."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[p.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Aufnahme-Ordner"}),p.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[p.jsx("input",{value:e.recordDir,onChange:V=>t(Y=>({...Y,recordDir:V.target.value})),placeholder:"records (oder absolut: C:\\records / /mnt/data/records)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 - dark:bg-white/10 dark:text-white dark:ring-white/10`}),g.jsx(di,{variant:"secondary",onClick:()=>N("record"),disabled:i||u!==null,children:"Durchsuchen..."})]})]}),g.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[g.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Fertige Downloads nach"}),g.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[g.jsx("input",{value:e.doneDir,onChange:G=>t(q=>({...q,doneDir:G.target.value})),placeholder:"records/done",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 + dark:bg-white/10 dark:text-white dark:ring-white/10`}),p.jsx(mi,{variant:"secondary",onClick:()=>L("record"),disabled:i||u!==null,children:"Durchsuchen..."})]})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[p.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Fertige Downloads nach"}),p.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[p.jsx("input",{value:e.doneDir,onChange:V=>t(Y=>({...Y,doneDir:V.target.value})),placeholder:"records/done",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 - dark:bg-white/10 dark:text-white dark:ring-white/10`}),g.jsx(di,{variant:"secondary",onClick:()=>N("done"),disabled:i||u!==null,children:"Durchsuchen..."})]})]}),g.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[g.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"ffmpeg.exe"}),g.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[g.jsx("input",{value:e.ffmpegPath??"",onChange:G=>t(q=>({...q,ffmpegPath:G.target.value})),placeholder:"Leer = automatisch (FFMPEG_PATH / ffmpeg im PATH)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 + dark:bg-white/10 dark:text-white dark:ring-white/10`}),p.jsx(mi,{variant:"secondary",onClick:()=>L("done"),disabled:i||u!==null,children:"Durchsuchen..."})]})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[p.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"ffmpeg.exe"}),p.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[p.jsx("input",{value:e.ffmpegPath??"",onChange:V=>t(Y=>({...Y,ffmpegPath:V.target.value})),placeholder:"Leer = automatisch (FFMPEG_PATH / ffmpeg im PATH)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 - dark:bg-white/10 dark:text-white dark:ring-white/10`}),g.jsx(di,{variant:"secondary",onClick:()=>N("ffmpeg"),disabled:i||u!==null,children:"Durchsuchen..."})]})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[g.jsxs("div",{className:"mb-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Automatisierung & Anzeige"}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Verhalten beim Hinzufügen/Starten sowie Anzeigeoptionen."})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx(go,{checked:!!e.autoAddToDownloadList,onChange:G=>t(q=>({...q,autoAddToDownloadList:G,autoStartAddedDownloads:G?q.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),g.jsx(go,{checked:!!e.autoStartAddedDownloads,onChange:G=>t(q=>({...q,autoStartAddedDownloads:G})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),g.jsx(go,{checked:!!e.useChaturbateApi,onChange:G=>t(q=>({...q,useChaturbateApi:G})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),g.jsx(go,{checked:!!e.useMyFreeCamsWatcher,onChange:G=>t(q=>({...q,useMyFreeCamsWatcher:G})),label:"MyFreeCams Auto-Check (watched)",description:"Geht watched MyFreeCams-Models einzeln durch und startet einen Download. Wenn keine Output-Datei entsteht, ist der Stream nicht öffentlich (offline/away/private) und der Job wird wieder entfernt."}),g.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[g.jsx(go,{checked:!!e.autoDeleteSmallDownloads,onChange:G=>t(q=>({...q,autoDeleteSmallDownloads:G,autoDeleteSmallDownloadsBelowMB:q.autoDeleteSmallDownloadsBelowMB??50})),label:"Kleine Downloads automatisch löschen",description:"Löscht fertige Downloads automatisch, wenn die Datei kleiner als die eingestellte Mindestgröße ist."}),g.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center "+(e.autoDeleteSmallDownloads?"":"opacity-50 pointer-events-none"),children:[g.jsxs("div",{className:"sm:col-span-4",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Mindestgröße"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Alles darunter wird gelöscht."})]}),g.jsx("div",{className:"sm:col-span-8",children:g.jsxs("div",{className:"flex items-center justify-end gap-2",children:[g.jsx("input",{type:"number",min:0,step:1,value:e.autoDeleteSmallDownloadsBelowMB??50,onChange:G=>t(q=>({...q,autoDeleteSmallDownloadsBelowMB:Number(G.target.value||0)})),className:`h-9 w-32 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm - dark:border-white/10 dark:bg-gray-900 dark:text-gray-100`}),g.jsx("span",{className:"shrink-0 text-xs text-gray-600 dark:text-gray-300",children:"MB"})]})})]})]}),g.jsx(go,{checked:!!e.blurPreviews,onChange:G=>t(q=>({...q,blurPreviews:G})),label:"Vorschaubilder blurren",description:"Weichzeichnet Vorschaubilder/Teaser (praktisch auf mobilen Geräten oder im öffentlichen Umfeld)."}),g.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[g.jsxs("div",{className:"sm:col-span-4",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Teaser abspielen"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Standbild spart Leistung. „Bei Hover (Standard)“: Desktop spielt bei Hover ab, Mobile im Viewport. „Alle“ kann viel CPU ziehen."})]}),g.jsxs("div",{className:"sm:col-span-8",children:[g.jsx("label",{className:"sr-only",htmlFor:"teaserPlayback",children:"Teaser abspielen"}),g.jsxs("select",{id:"teaserPlayback",value:e.teaserPlayback??"hover",onChange:G=>t(q=>({...q,teaserPlayback:G.target.value})),className:`h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm - dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[g.jsx("option",{value:"still",children:"Standbild"}),g.jsx("option",{value:"hover",children:"Bei Hover (Standard)"}),g.jsx("option",{value:"all",children:"Alle"})]})]})]}),g.jsx(go,{checked:!!e.teaserAudio,onChange:G=>t(q=>({...q,teaserAudio:G})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),g.jsx(go,{checked:!!e.enableNotifications,onChange:G=>t(q=>({...q,enableNotifications:G})),label:"Benachrichtigungen",description:"Wenn aktiv, zeigt das Frontend Toasts (z.B. wenn watched Models online/live gehen oder wenn ein queued Model wieder public wird)."}),g.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Speicherplatz-Notbremse"}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aktiviert automatisch Stop + Autostart-Block bei wenig freiem Speicher (Resume bei +3 GB)."})]}),g.jsx("span",{className:"inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium "+(v?.emergency?"bg-red-100 text-red-800 dark:bg-red-500/20 dark:text-red-200":"bg-green-100 text-green-800 dark:bg-green-500/20 dark:text-green-200"),title:v?.emergency?"Notfallbremse greift gerade":"OK",children:v?.emergency?"AKTIV":"OK"})]}),g.jsxs("div",{className:"mt-3 text-sm text-gray-900 dark:text-gray-200",children:[g.jsxs("div",{children:[g.jsx("span",{className:"font-medium",children:"Schwelle:"})," ","Pause unter ",g.jsx("span",{className:"tabular-nums",children:F})," GB"," · ","Resume ab"," ",g.jsx("span",{className:"tabular-nums",children:z})," ","GB"]}),g.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:v?`Frei: ${v.freeBytesHuman}${v.recordPath?` (Pfad: ${v.recordPath})`:""}`:"Status wird geladen…"}),v?.emergency&&g.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"Notfallbremse greift: laufende Downloads werden gestoppt und Autostart bleibt gesperrt, bis wieder genug frei ist."})]})]})]})]})]})})}function Ny(...s){return s.filter(Boolean).join(" ")}const TO={sm:{btn:"px-2.5 py-1.5 text-sm",icon:"size-5",iconOnly:"h-9 w-9"},md:{btn:"px-3 py-2 text-sm",icon:"size-5",iconOnly:"h-10 w-10"}};function SO({items:s,value:e,onChange:t,size:i="md",className:n,ariaLabel:r="Optionen"}){const a=TO[i];return g.jsx("span",{className:Ny("isolate inline-flex rounded-md shadow-xs dark:shadow-none",n),role:"group","aria-label":r,children:s.map((u,c)=>{const d=u.id===e,f=c===0,p=c===s.length-1,y=!u.label&&!!u.icon;return g.jsxs("button",{type:"button",disabled:u.disabled,onClick:()=>t(u.id),"aria-pressed":d,className:Ny("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!f&&"-ml-px",f&&"rounded-l-md",p&&"rounded-r-md",d?"bg-indigo-100 text-indigo-800 inset-ring-1 inset-ring-indigo-300 hover:bg-indigo-200 dark:bg-indigo-500/40 dark:text-indigo-100 dark:inset-ring-indigo-400/50 dark:hover:bg-indigo-500/50":"bg-white text-gray-900 inset-ring-1 inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:inset-ring-gray-700 dark:hover:bg-white/20","disabled:opacity-50 disabled:cursor-not-allowed",y?`p-0 ${a.iconOnly}`:a.btn),title:typeof u.label=="string"?u.label:u.srLabel,children:[y&&u.srLabel?g.jsx("span",{className:"sr-only",children:u.srLabel}):null,u.icon?g.jsx("span",{className:Ny("shrink-0",y?"":"-ml-0.5",d?"text-indigo-600 dark:text-indigo-200":"text-gray-400 dark:text-gray-500"),children:u.icon}):null,u.label?g.jsx("span",{className:u.icon?"ml-1.5":"",children:u.label}):null]},u.id)})})}function _O({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}const EO=_.forwardRef(_O);function wO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const V_=_.forwardRef(wO);function AO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const kO=_.forwardRef(AO);function CO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"}))}const bm=_.forwardRef(CO);function DO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))}const LO=_.forwardRef(DO);function RO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))}const IO=_.forwardRef(RO);function NO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0 1 20.25 6v12A2.25 2.25 0 0 1 18 20.25H6A2.25 2.25 0 0 1 3.75 18V6A2.25 2.25 0 0 1 6 3.75h1.5m9 0h-9"}))}const G_=_.forwardRef(NO);function OO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"}))}const Tm=_.forwardRef(OO);function MO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const PO=_.forwardRef(MO);function BO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const q_=_.forwardRef(BO);function FO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"}))}const UO=_.forwardRef(FO);function jO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const $O=_.forwardRef(jO);function HO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const d0=_.forwardRef(HO);function zO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h1.5C5.496 19.5 6 18.996 6 18.375m-3.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-1.5A1.125 1.125 0 0 1 18 18.375M20.625 4.5H3.375m17.25 0c.621 0 1.125.504 1.125 1.125M20.625 4.5h-1.5C18.504 4.5 18 5.004 18 5.625m3.75 0v1.5c0 .621-.504 1.125-1.125 1.125M3.375 4.5c-.621 0-1.125.504-1.125 1.125M3.375 4.5h1.5C5.496 4.5 6 5.004 6 5.625m-3.75 0v1.5c0 .621.504 1.125 1.125 1.125m0 0h1.5m-1.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m1.5-3.75C5.496 8.25 6 7.746 6 7.125v-1.5M4.875 8.25C5.496 8.25 6 8.754 6 9.375v1.5m0-5.25v5.25m0-5.25C6 5.004 6.504 4.5 7.125 4.5h9.75c.621 0 1.125.504 1.125 1.125m1.125 2.625h1.5m-1.5 0A1.125 1.125 0 0 1 18 7.125v-1.5m1.125 2.625c-.621 0-1.125.504-1.125 1.125v1.5m2.625-2.625c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125M18 5.625v5.25M7.125 12h9.75m-9.75 0A1.125 1.125 0 0 1 6 10.875M7.125 12C6.504 12 6 12.504 6 13.125m0-2.25C6 11.496 5.496 12 4.875 12M18 10.875c0 .621-.504 1.125-1.125 1.125M18 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m-12 5.25v-5.25m0 5.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125m-12 0v-1.5c0-.621-.504-1.125-1.125-1.125M18 18.375v-5.25m0 5.25v-1.5c0-.621.504-1.125 1.125-1.125M18 13.125v1.5c0 .621.504 1.125 1.125 1.125M18 13.125c0-.621.504-1.125 1.125-1.125M6 13.125v1.5c0 .621-.504 1.125-1.125 1.125M6 13.125C6 12.504 5.496 12 4.875 12m-1.5 0h1.5m-1.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M19.125 12h1.5m0 0c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h1.5m14.25 0h1.5"}))}const VO=_.forwardRef(zO);function GO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z"}))}const K_=_.forwardRef(GO);function qO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const bh=_.forwardRef(qO);function KO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Zm6-10.125a1.875 1.875 0 1 1-3.75 0 1.875 1.875 0 0 1 3.75 0Zm1.294 6.336a6.721 6.721 0 0 1-3.17.789 6.721 6.721 0 0 1-3.168-.789 3.376 3.376 0 0 1 6.338 0Z"}))}const WO=_.forwardRef(KO);function YO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const XO=_.forwardRef(YO);function QO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"}))}const ZO=_.forwardRef(QO);function JO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))}const eM=_.forwardRef(JO);function tM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const W_=_.forwardRef(tM);function iM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const sM=_.forwardRef(iM);function nM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const Y_=_.forwardRef(nM);function rM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"}))}const aM=_.forwardRef(rM);function oM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const Oy=_.forwardRef(oM);function lM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const uM=_.forwardRef(lM);function cM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const h0=_.forwardRef(cM);function dM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"}))}const hM=_.forwardRef(dM);function fM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const X_=_.forwardRef(fM);function mM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}const Q_=_.forwardRef(mM);function pM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const gM=_.forwardRef(pM);function yM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const f0=_.forwardRef(yM);function vM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.74a.75.75 0 0 1 1.04-.207Z",clipRule:"evenodd"}))}const xM=_.forwardRef(vM);function bM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),_.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const xu=_.forwardRef(bM);function TM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.176 7.547 7.547 0 0 1-1.705-1.715.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.546 3.75 3.75 0 0 1 3.255 3.718Z",clipRule:"evenodd"}))}const lx=_.forwardRef(TM);function SM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"}))}const _M=_.forwardRef(SM);function EM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z"}))}const bu=_.forwardRef(EM);function wM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z",clipRule:"evenodd"}))}const AM=_.forwardRef(wM);function kM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.427 1.529-2.33 2.779-1.643l11.54 6.347c1.295.712 1.295 2.573 0 3.286L7.28 19.99c-1.25.687-2.779-.217-2.779-1.643V5.653Z",clipRule:"evenodd"}))}const CM=_.forwardRef(kM);function DM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M5.636 4.575a.75.75 0 0 1 0 1.061 9 9 0 0 0 0 12.728.75.75 0 1 1-1.06 1.06c-4.101-4.1-4.101-10.748 0-14.849a.75.75 0 0 1 1.06 0Zm12.728 0a.75.75 0 0 1 1.06 0c4.101 4.1 4.101 10.75 0 14.85a.75.75 0 1 1-1.06-1.061 9 9 0 0 0 0-12.728.75.75 0 0 1 0-1.06ZM7.757 6.697a.75.75 0 0 1 0 1.06 6 6 0 0 0 0 8.486.75.75 0 0 1-1.06 1.06 7.5 7.5 0 0 1 0-10.606.75.75 0 0 1 1.06 0Zm8.486 0a.75.75 0 0 1 1.06 0 7.5 7.5 0 0 1 0 10.606.75.75 0 0 1-1.06-1.06 6 6 0 0 0 0-8.486.75.75 0 0 1 0-1.06ZM9.879 8.818a.75.75 0 0 1 0 1.06 3 3 0 0 0 0 4.243.75.75 0 1 1-1.061 1.061 4.5 4.5 0 0 1 0-6.364.75.75 0 0 1 1.06 0Zm4.242 0a.75.75 0 0 1 1.061 0 4.5 4.5 0 0 1 0 6.364.75.75 0 0 1-1.06-1.06 3 3 0 0 0 0-4.243.75.75 0 0 1 0-1.061ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))}const LM=_.forwardRef(DM);function RM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}const Ic=_.forwardRef(RM);function IM(...s){return s.filter(Boolean).join(" ")}function NM(){if(typeof document>"u")return null;const s="__swipecard_hot_fx_layer__";let e=document.getElementById(s);return e||(e=document.createElement("div"),e.id=s,e.style.position="fixed",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="2147483647",e.style.contain="layout style paint",document.body.appendChild(e)),e}const OM=_.forwardRef(function({children:e,enabled:t=!0,disabled:i=!1,onTap:n,onSwipeLeft:r,onSwipeRight:a,className:u,thresholdPx:c=140,thresholdRatio:d=.28,ignoreFromBottomPx:f=72,ignoreSelector:p="[data-swipe-ignore]",snapMs:y=180,commitMs:v=180,tapIgnoreSelector:b="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:T,hotTargetSelector:E="[data-hot-target]",doubleTapMs:D=360,doubleTapMaxMovePx:O=48},R){const j=_.useRef(null),F=_.useRef(!1),z=_.useRef(0),N=_.useRef(null),Y=_.useRef(0),L=_.useRef(null),I=_.useRef(null),X=_.useRef(null),G=_.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[q,ae]=_.useState(0),[ie,W]=_.useState(null),[K,Q]=_.useState(0),te=_.useCallback(()=>{N.current!=null&&(cancelAnimationFrame(N.current),N.current=null),z.current=0,j.current&&(j.current.style.touchAction="pan-y"),Q(y),ae(0),W(null),window.setTimeout(()=>Q(0),y)},[y]),re=_.useCallback(async(be,Pe)=>{N.current!=null&&(cancelAnimationFrame(N.current),N.current=null),j.current&&(j.current.style.touchAction="pan-y");const Ye=j.current?.offsetWidth||360;Q(v),W(be==="right"?"right":"left");const lt=be==="right"?Ye+40:-(Ye+40);z.current=lt,ae(lt);let Ve=!0;if(Pe)try{Ve=be==="right"?await a():await r()}catch{Ve=!1}return Ve===!1?(Q(y),W(null),ae(0),window.setTimeout(()=>Q(0),y),!1):!0},[v,r,a,y]),U=_.useCallback(()=>{I.current!=null&&(window.clearTimeout(I.current),I.current=null)},[]),ne=_.useCallback(()=>{N.current!=null&&(cancelAnimationFrame(N.current),N.current=null),z.current=0,Q(0),ae(0),W(null);try{const be=j.current;be&&(be.style.touchAction="pan-y")}catch{}},[]),Z=_.useCallback((be,Pe)=>{const gt=L.current,Ye=j.current;if(!gt||!Ye)return;const lt=NM();if(!lt)return;let Ve=typeof be=="number"?be:window.innerWidth/2,ht=typeof Pe=="number"?Pe:window.innerHeight/2;const st=E?L.current?.querySelector(E)??Ye.querySelector(E):null;let ct=Ve,Ke=ht;if(st){const ui=st.getBoundingClientRect();ct=ui.left+ui.width/2,Ke=ui.top+ui.height/2}const _t=ct-Ve,pe=Ke-ht,We=document.createElement("div");We.style.position="absolute",We.style.left=`${Ve}px`,We.style.top=`${ht}px`,We.style.transform="translate(-50%, -50%)",We.style.pointerEvents="none",We.style.willChange="transform, opacity",We.style.zIndex="2147483647",We.style.lineHeight="1",We.style.userSelect="none",We.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const Je=document.createElement("div");Je.style.width="30px",Je.style.height="30px",Je.style.color="#f59e0b",Je.style.display="block",We.appendChild(Je),lt.appendChild(We);const ot=hA.createRoot(Je);ot.render(g.jsx(lx,{className:"w-full h-full","aria-hidden":"true"})),We.getBoundingClientRect();const St=200,vt=500,Vt=400,si=St+vt+Vt,$t=St/si,Pt=(St+vt)/si,Ht=We.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:$t*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:$t},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Pt},{transform:`translate(calc(-50% + ${_t}px), calc(-50% + ${pe}px)) scale(0.85)`,opacity:.95,offset:Pt+(1-Pt)*.75},{transform:`translate(calc(-50% + ${_t}px), calc(-50% + ${pe}px)) scale(0.55)`,opacity:0,offset:1}],{duration:si,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});st&&window.setTimeout(()=>{try{st.animate([{transform:"translateZ(0) scale(1)",filter:"brightness(1)"},{transform:"translateZ(0) scale(1.10)",filter:"brightness(1.25)",offset:.35},{transform:"translateZ(0) scale(1)",filter:"brightness(1)"}],{duration:260,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)"})}catch{}},St+vt+Math.round(Vt*.75)),Ht.onfinish=()=>{try{ot.unmount()}catch{}We.remove()}},[E]);_.useEffect(()=>()=>{I.current!=null&&window.clearTimeout(I.current)},[]),_.useImperativeHandle(R,()=>({swipeLeft:be=>re("left",be?.runAction??!0),swipeRight:be=>re("right",be?.runAction??!0),reset:()=>te()}),[re,te]);const fe=Math.abs(q),xe=q===0?null:q>0?"right":"left",ge=Y.current||Math.min(c,(j.current?.offsetWidth||360)*d),Ce=Math.max(0,Math.min(1,fe/Math.max(1,ge))),Me=Math.max(0,Math.min(1,fe/Math.max(1,ge*1.35))),Re=Math.max(-6,Math.min(6,q/28)),Ae=q===0?1:.995;return g.jsx("div",{ref:L,className:IM("relative isolate overflow-visible rounded-lg",u),children:g.jsx("div",{ref:j,className:"relative",style:{transform:q!==0?`translate3d(${q}px,0,0) rotate(${Re}deg) scale(${Ae})`:void 0,transition:K?`transform ${K}ms ease`:void 0,touchAction:"pan-y",willChange:q!==0?"transform":void 0,boxShadow:q!==0?xe==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+Ce*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+Ce*.12})`:void 0,borderRadius:q!==0?"12px":void 0,filter:q!==0?`saturate(${1+Ce*.08}) brightness(${1+Ce*.02})`:void 0},onPointerDown:be=>{if(!t||i)return;const Pe=be.target;let gt=!!(b&&Pe?.closest?.(b));if(p&&Pe?.closest?.(p))return;let Ye=!1;const lt=be.currentTarget,ht=Array.from(lt.querySelectorAll("video")).find(pe=>pe.controls);if(ht){const pe=ht.getBoundingClientRect();if(be.clientX>=pe.left&&be.clientX<=pe.right&&be.clientY>=pe.top&&be.clientY<=pe.bottom)if(pe.bottom-be.clientY<=72)Ye=!0,gt=!0;else{const vt=be.clientX-pe.left,Vt=pe.right-be.clientX;vt<=64||Vt<=64||(Ye=!0,gt=!0)}}const ct=be.currentTarget.getBoundingClientRect().bottom-be.clientY;f&&ct<=f&&(Ye=!0),G.current={id:be.pointerId,x:be.clientX,y:be.clientY,dragging:!1,captured:!1,tapIgnored:gt,noSwipe:Ye};const _t=j.current?.offsetWidth||360;Y.current=Math.min(c,_t*d),z.current=0},onPointerMove:be=>{if(!t||i||G.current.id!==be.pointerId||G.current.noSwipe)return;const Pe=be.clientX-G.current.x,gt=be.clientY-G.current.y;if(!G.current.dragging){if(Math.abs(gt)>Math.abs(Pe)&&Math.abs(gt)>8){G.current.id=null;return}if(Math.abs(Pe)<12)return;G.current.dragging=!0,be.currentTarget.style.touchAction="none",Q(0);try{be.currentTarget.setPointerCapture(be.pointerId),G.current.captured=!0}catch{G.current.captured=!1}}const Ye=(st,ct)=>{const Ke=ct*.9,_t=Math.abs(st);if(_t<=Ke)return st;const pe=_t-Ke,We=Ke+pe*.25;return Math.sign(st)*We},lt=j.current?.offsetWidth||360;z.current=Ye(Pe,lt),N.current==null&&(N.current=requestAnimationFrame(()=>{N.current=null,ae(z.current)}));const Ve=Y.current,ht=Pe>Ve?"right":Pe<-Ve?"left":null;W(st=>{if(st===ht)return st;if(ht)try{navigator.vibrate?.(10)}catch{}return ht})},onPointerUp:be=>{if(!t||i||G.current.id!==be.pointerId)return;const Pe=Y.current||Math.min(c,(j.current?.offsetWidth||360)*d),gt=G.current.dragging,Ye=G.current.captured,lt=G.current.tapIgnored;if(G.current.id=null,G.current.dragging=!1,G.current.captured=!1,Ye)try{be.currentTarget.releasePointerCapture(be.pointerId)}catch{}if(be.currentTarget.style.touchAction="pan-y",!gt){const ht=Date.now(),st=X.current,ct=st&&Math.hypot(be.clientX-st.x,be.clientY-st.y)<=O;if(!!T&&st&&ht-st.t<=D&&ct){if(X.current=null,U(),F.current)return;F.current=!0;try{Z(be.clientX,be.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await T?.()}finally{F.current=!1}})()});return}if(lt){X.current={t:ht,x:be.clientX,y:be.clientY},U(),I.current=window.setTimeout(()=>{I.current=null,X.current=null},T?D:0);return}ne(),X.current={t:ht,x:be.clientX,y:be.clientY},U(),I.current=window.setTimeout(()=>{I.current=null,X.current=null,n?.()},T?D:0);return}const Ve=z.current;N.current!=null&&(cancelAnimationFrame(N.current),N.current=null),Ve>Pe?re("right",!0):Ve<-Pe?re("left",!0):te(),z.current=0},onPointerCancel:be=>{if(!(!t||i)){if(G.current.captured&&G.current.id!=null)try{be.currentTarget.releasePointerCapture(G.current.id)}catch{}G.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},N.current!=null&&(cancelAnimationFrame(N.current),N.current=null),z.current=0;try{be.currentTarget.style.touchAction="pan-y"}catch{}te()}},children:g.jsxs("div",{className:"relative",children:[g.jsx("div",{className:"relative z-10",children:e}),g.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:q===0?0:.12+Me*.18,background:xe==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":xe==="left"?"linear-gradient(270deg, rgba(244,63,94,0.16) 0%, rgba(244,63,94,0.04) 45%, rgba(0,0,0,0) 100%)":"transparent"}}),g.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ie?1:0,boxShadow:ie==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ie==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function VA({children:s,content:e}){const t=_.useRef(null),i=_.useRef(null),[n,r]=_.useState(!1),[a,u]=_.useState(null),c=_.useRef(null),d=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},f=()=>{d(),c.current=window.setTimeout(()=>{r(!1),c.current=null},150)},p=()=>{d(),r(!0)},y=()=>{f()},v=()=>{d(),r(!1)},b=()=>{const E=t.current,D=i.current;if(!E||!D)return;const O=8,R=8,j=E.getBoundingClientRect(),F=D.getBoundingClientRect();let z=j.bottom+O;if(z+F.height>window.innerHeight-R){const L=j.top-F.height-O;L>=R?z=L:z=Math.max(R,window.innerHeight-F.height-R)}let Y=j.left;Y+F.width>window.innerWidth-R&&(Y=window.innerWidth-F.width-R),Y=Math.max(R,Y),u({left:Y,top:z})};_.useLayoutEffect(()=>{if(!n)return;const E=requestAnimationFrame(()=>b());return()=>cancelAnimationFrame(E)},[n]),_.useEffect(()=>{if(!n)return;const E=()=>requestAnimationFrame(()=>b());return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[n]),_.useEffect(()=>()=>d(),[]);const T=()=>typeof e=="function"?e(n,{close:v}):e;return g.jsxs(g.Fragment,{children:[g.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:p,onMouseLeave:y,children:s}),n&&Lc.createPortal(g.jsx("div",{ref:i,className:"fixed z-50",style:{left:a?.left??-9999,top:a?.top??-9999,visibility:a?"visible":"hidden"},onMouseEnter:p,onMouseLeave:y,children:g.jsx(ca,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:T()})}),document.body)]})}const m0=!0,MM=!1;function p0(s,e){if(!s)return;const t=e?.muted??m0;s.muted=t,s.defaultMuted=t,s.playsInline=!0,s.setAttribute("playsinline",""),s.setAttribute("webkit-playsinline","")}function g0({job:s,getFileName:e,durationSeconds:t,onDuration:i,onResolution:n,animated:r=!1,animatedMode:a="frames",animatedTrigger:u="always",autoTickMs:c=15e3,thumbStepSec:d,thumbSpread:f,thumbSamples:p,clipSeconds:y=1,variant:v="thumb",className:b,showPopover:T=!0,blur:E=!1,inlineVideo:D=!1,inlineNonce:O=0,inlineControls:R=!1,inlineLoop:j=!0,assetNonce:F=0,muted:z=m0,popoverMuted:N=m0,noGenerateTeaser:Y,alwaysLoadStill:L=!1,teaserPreloadEnabled:I=!1,teaserPreloadRootMargin:X="700px 0px"}){const G=e(s.output||""),q=E?"blur-md":"",ae=_.useMemo(()=>{const $e=s?.meta;if(!$e)return null;if(typeof $e=="string")try{return JSON.parse($e)}catch{return null}return $e},[s]),[ie,W]=_.useState(null),K=ae??ie,[Q,te]=_.useState(0),re=_.useMemo(()=>{let $e=K?.previewClips;if(typeof $e=="string")try{$e=JSON.parse($e)}catch{$e=null}!Array.isArray($e)&&Array.isArray(K?.preview?.clips)&&($e=K.preview.clips);const Mt=$e;if(!Array.isArray(Mt)||Mt.length===0)return null;let Nt=0;const ri=[];for(const Wt of Mt){const bi=Number(Wt?.startSeconds),ci=Number(Wt?.durationSeconds);if(!Number.isFinite(bi)||bi<0||!Number.isFinite(ci)||ci<=0)continue;const Bi=Nt,qi=Nt+ci;ri.push({start:bi,dur:ci,cumStart:Bi,cumEnd:qi}),Nt=qi}return ri.length?ri:null},[K]),U=_.useMemo(()=>re?re.map($e=>`${$e.start.toFixed(3)}:${$e.dur.toFixed(3)}`).join("|"):"",[re]),ne=(typeof ae?.videoWidth=="number"&&Number.isFinite(ae.videoWidth)&&ae.videoWidth>0?ae.videoWidth:void 0)??(typeof s.videoWidth=="number"&&Number.isFinite(s.videoWidth)&&s.videoWidth>0?s.videoWidth:void 0),Z=(typeof ae?.videoHeight=="number"&&Number.isFinite(ae.videoHeight)&&ae.videoHeight>0?ae.videoHeight:void 0)??(typeof s.videoHeight=="number"&&Number.isFinite(s.videoHeight)&&s.videoHeight>0?s.videoHeight:void 0),fe=(typeof ae?.fileSize=="number"&&Number.isFinite(ae.fileSize)&&ae.fileSize>0?ae.fileSize:void 0)??(typeof s.sizeBytes=="number"&&Number.isFinite(s.sizeBytes)&&s.sizeBytes>0?s.sizeBytes:void 0),xe=(typeof ae?.fps=="number"&&Number.isFinite(ae.fps)&&ae.fps>0?ae.fps:void 0)??(typeof s.fps=="number"&&Number.isFinite(s.fps)&&s.fps>0?s.fps:void 0),ge=(typeof K?.durationSeconds=="number"&&Number.isFinite(K.durationSeconds)&&K.durationSeconds>0?K.durationSeconds:void 0)??(typeof s.durationSeconds=="number"&&Number.isFinite(s.durationSeconds)&&s.durationSeconds>0?s.durationSeconds:void 0)??(typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0),Ce=typeof ge=="number"&&Number.isFinite(ge)&&ge>0?ge>1440*60?ge/1e3:ge:void 0,Me=typeof Ce=="number"&&Number.isFinite(Ce)&&Ce>0,Re=typeof ne=="number"&&typeof Z=="number"&&Number.isFinite(ne)&&Number.isFinite(Z)&&ne>0&&Z>0,Ae={muted:z,playsInline:!0,preload:"metadata"},[be,Pe]=_.useState(!0),[gt,Ye]=_.useState(!0),[lt,Ve]=_.useState(!1),[ht,st]=_.useState(!1),[ct,Ke]=_.useState(!0),_t=_.useRef(null),[pe,We]=_.useState(!1),[Je,ot]=_.useState(!1),[St,vt]=_.useState(!1),[Vt,si]=_.useState(0),[$t,Pt]=_.useState(!1),Ht=D===!0||D==="always"?"always":D==="hover"?"hover":"never",ui=Ht==="hover"||r&&(a==="clips"||a==="teaser")&&u==="hover",xt=$e=>$e.startsWith("HOT ")?$e.slice(4):$e,ni=_.useMemo(()=>{const $e=e(s.output||"");if(!$e)return"";const Mt=$e.replace(/\.[^.]+$/,"");return xt(Mt).trim()},[s.output,e]),Xt=_.useMemo(()=>G?`/api/record/video?file=${encodeURIComponent(G)}`:"",[G]),Zi=v==="fill"?"w-full h-full":"w-20 h-16",Gt=_.useRef(null),Yi=_.useRef(null),Ri=_.useRef(null),Si=_.useRef({inline:null,teaser:null,clips:null}),kt=($e,Mt)=>{Mt&&Si.current[$e]!==Mt&&(Si.current[$e]=Mt,te(Nt=>Nt+1))},[V,H]=_.useState(0),[,ee]=_.useState(0),Te=$e=>$e<0?0:$e>1?1:$e,Ue=($e,Mt,Nt=1,ri=!1)=>{if(!$e)return{ratio:0,globalSec:0,vvDur:0};const Wt=Number($e.duration);if(!(Number.isFinite(Wt)&&Wt>0))return{ratio:0,globalSec:0,vvDur:0};const ci=Number($e.currentTime);if(!Number.isFinite(ci)||ci<0)return{ratio:0,globalSec:0,vvDur:Wt};let Bi=0;const qi=re;if(ri&&Array.isArray(qi)&&qi.length>0){const Qs=qi[qi.length-1];if(ci>=Qs.cumEnd)Bi=typeof Mt=="number"&&Number.isFinite(Mt)&&Mt>0?Mt:Qs.start+Qs.dur;else{let fn=0,Pn=qi.length-1,xn=qi[0];for(;fn<=Pn;){const bn=fn+Pn>>1,an=qi[bn];if(ci=an.cumEnd)fn=bn+1;else{xn=an;break}}const mn=Math.max(0,ci-xn.cumStart),ds=Math.floor(mn/Nt)*Nt;Bi=xn.start+Math.min(ds,xn.dur)}}else Bi=Math.floor(ci/Nt)*Nt;const Fi=Math.max(0,Math.min(Bi,Wt));return{ratio:Te(Fi/Wt),globalSec:Fi,vvDur:Wt}},ft=$e=>{if($e){try{$e.pause()}catch{}try{$e.removeAttribute("src"),$e.src="",$e.load()}catch{}}};_.useEffect(()=>{st(!1),Ke(!0)},[ni,F,Y]),_.useEffect(()=>{const $e=Mt=>{const Nt=String(Mt?.detail?.file??"");!Nt||Nt!==G||(ft(Gt.current),ft(Yi.current),ft(Ri.current))};return window.addEventListener("player:release",$e),window.addEventListener("player:close",$e),()=>{window.removeEventListener("player:release",$e),window.removeEventListener("player:close",$e)}},[G]),_.useEffect(()=>{const $e=_t.current;if(!$e)return;const Mt=new IntersectionObserver(Nt=>{const ri=!!Nt[0]?.isIntersecting;We(ri),ri&&vt(!0)},{threshold:.01,rootMargin:"0px"});return Mt.observe($e),()=>Mt.disconnect()},[]),_.useEffect(()=>{const $e=_t.current;if(!$e)return;if(!I){ot(pe);return}let Mt=!0;const Nt=new IntersectionObserver(ri=>{ri[0]?.isIntersecting&&(ot(!0),Mt&&(Mt=!1,Nt.disconnect()))},{threshold:0,rootMargin:X});return Nt.observe($e),()=>Nt.disconnect()},[I,X,pe]),_.useEffect(()=>{if(!r||a!=="frames"||!pe||document.hidden)return;const $e=window.setInterval(()=>si(Mt=>Mt+1),c);return()=>window.clearInterval($e)},[r,a,pe,c]);const Et=_.useMemo(()=>{if(!r||a!=="frames"||!Me)return null;const $e=Ce,Mt=Math.max(.25,d??3);if(f){const Wt=Math.max(4,Math.min(p??16,Math.floor($e))),bi=Vt%Wt,ci=Math.max(.1,$e-Mt),Bi=Math.min(.25,ci*.02),qi=bi/Wt*ci+Bi;return Math.min($e-.05,Math.max(.05,qi))}const Nt=Math.max($e-.1,Mt),ri=Vt*Mt%Nt;return Math.min($e-.05,Math.max(.05,ri))},[r,a,Me,Ce,Vt,d,f,p]),pi=F??0,gi=_.useMemo(()=>ni?Et==null?`/api/preview?id=${encodeURIComponent(ni)}&v=${pi}`:`/api/preview?id=${encodeURIComponent(ni)}&t=${Et}&v=${pi}`:"",[ni,Et,pi]),_i=_.useMemo(()=>{if(!ni)return"";const $e=Y?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(ni)}${$e}&v=${pi}`},[ni,pi,Y]),Ei=Ht!=="never"&&pe&>&&(Ht==="always"||Ht==="hover"&&$t),fi=r&&pe&&!document.hidden&>&&!Ei&&(u==="always"||$t)&&(a==="teaser"&&ct&&!!_i||a==="clips"&&Me),yi=Me?Ce:void 0,$s=L||pe||St||ui&&$t,ns=Je||pe||St||ui&&$t;_.useEffect(()=>{let $e=!1;i&&Me&&(i(s,Number(Ce)),$e=!0),n&&Re&&(n(s,Number(ne),Number(Z)),$e=!0),$e&&Ve(!0)},[s,i,n,Me,Re,Ce,ne,Z]),_.useEffect(()=>{if(!ni||!r||a!=="teaser"||!ns)return;const $e=ae?.previewClips;if(Array.isArray($e)||typeof $e=="string"&&$e.length>0||Array.isArray(ae?.preview?.clips))return;let Nt=!1;const ri=new AbortController,Wt=async bi=>{try{const ci=await fetch(bi,{signal:ri.signal,cache:"no-store",credentials:"include"});return ci.ok?await ci.json():null}catch{return null}};return(async()=>{const bi=await Wt(`/api/record/done/meta?id=${encodeURIComponent(ni)}`),ci=G?await Wt(`/api/record/done/meta?file=${encodeURIComponent(G)}`):null,Bi=bi??ci;!Nt&&Bi&&W(Bi)})(),()=>{Nt=!0,ri.abort()}},[ni,G,r,a,ae,ns]);const Xi=$e=>{Ve(!0);const Mt=$e.currentTarget;if(i&&!Me){const Nt=Number(Mt.duration);Number.isFinite(Nt)&&Nt>0&&i(s,Nt)}if(n&&!Re){const Nt=Number(Mt.videoWidth),ri=Number(Mt.videoHeight);Number.isFinite(Nt)&&Number.isFinite(ri)&&Nt>0&&ri>0&&n(s,Nt,ri)}};if(_.useEffect(()=>{Pe(!0),Ye(!0),Si.current.inline=null,Si.current.teaser=null,Si.current.clips=null},[ni,F]),!Xt)return g.jsx("div",{className:[Zi,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const wi=ns,Jt=r&&a==="teaser"&&ct&&!!_i&&!Ei&&ns,ei=Ei?Gt:!Ei&&fi&&a==="teaser"?Yi:!Ei&&fi&&a==="clips"?Ri:null,Qi=!!ei&&pe&&typeof yi=="number"&&Number.isFinite(yi)&&yi>0,Ls=Ei?"inline":fi&&a==="teaser"?"teaser":"clips",Hs=r&&a==="frames"&&Me&&typeof Et=="number"&&Number.isFinite(Et)&&Et>=0,rn=Hs?Te(Et/Ce):0,ys=Qi?V:Hs?rn:0,xi=Qi||Hs,Cs=_.useMemo(()=>{if(!Me)return null;const $e=Ce;if(!($e>0))return null;let Nt=K?.previewClips;if(typeof Nt=="string")try{Nt=JSON.parse(Nt)}catch{Nt=null}if(!Array.isArray(Nt)||Nt.length===0)return null;const ri=Nt.map(Wt=>({start:Number(Wt?.startSeconds),dur:Number(Wt?.durationSeconds)})).filter(Wt=>Number.isFinite(Wt.start)&&Wt.start>=0&&Number.isFinite(Wt.dur)&&Wt.dur>0);return ri.length?ri.map(Wt=>{const bi=Te(Wt.start/$e),ci=Te(Wt.dur/$e);return{left:bi,width:ci,start:Wt.start,dur:Wt.dur}}):null},[K,Me,Ce]),$i=_.useMemo(()=>{if(!r)return[];if(a!=="clips")return[];if(!Me)return[];const $e=Ce,Mt=Math.max(.25,y),Nt=Math.max(8,Math.min(p??18,Math.floor($e))),ri=Math.max(.1,$e-Mt),Wt=Math.min(.25,ri*.02),bi=[];for(let ci=0;ci$i.map($e=>$e.toFixed(2)).join(","),[$i]),Ji=_.useRef(0),Ai=_.useRef(0);_.useEffect(()=>{const $e=Yi.current;if(!$e)return;if(!(fi&&a==="teaser")){try{$e.pause()}catch{}return}p0($e,{muted:z});const Nt=$e.play?.();Nt&&typeof Nt.catch=="function"&&Nt.catch(()=>{})},[fi,a,_i,z]),_.useEffect(()=>{if(!Qi){H(0),ee(0);return}const $e=ei?.current??null;if(!$e){H(0),ee(0);return}let Mt=!1,Nt=null;const ri=()=>{if(Mt||!$e.isConnected)return;const ci=Ls==="teaser"&&Array.isArray(re)&&re.length>0,Bi=Ue($e,yi,1,ci);H(Bi.ratio),ee(Bi.globalSec)};ri(),Nt=window.setInterval(ri,1e3);const Wt=()=>ri(),bi=()=>ri();return $e.addEventListener("loadedmetadata",Wt),$e.addEventListener("durationchange",Wt),$e.addEventListener("timeupdate",bi),()=>{Mt=!0,Nt!=null&&window.clearInterval(Nt),$e.removeEventListener("loadedmetadata",Wt),$e.removeEventListener("durationchange",Wt),$e.removeEventListener("timeupdate",bi)}},[Qi,ei,yi,U,Ls,re,Q]),_.useEffect(()=>{Ei&&p0(Gt.current,{muted:z})},[Ei,z]),_.useEffect(()=>{const $e=Ri.current;if(!$e)return;if(!(fi&&a==="clips")){fi||$e.pause();return}if(!$i.length)return;Ji.current=Ji.current%$i.length,Ai.current=$i[Ji.current];const Mt=()=>{try{$e.currentTime=Ai.current}catch{}const Wt=$e.play();Wt&&typeof Wt.catch=="function"&&Wt.catch(()=>{})},Nt=()=>Mt(),ri=()=>{if($i.length&&$e.currentTime-Ai.current>=y){Ji.current=(Ji.current+1)%$i.length,Ai.current=$i[Ji.current];try{$e.currentTime=Ai.current+.01}catch{}}};return $e.addEventListener("loadedmetadata",Nt),$e.addEventListener("timeupdate",ri),$e.readyState>=1&&Mt(),()=>{$e.removeEventListener("loadedmetadata",Nt),$e.removeEventListener("timeupdate",ri),$e.pause()}},[fi,a,Rs,y,$i]);const hn=(Je||pe)&&(i||n)&&!lt&&!Ei&&(i&&!Me||n&&!Re),_s=g.jsxs("div",{ref:_t,className:["group rounded bg-gray-100 dark:bg-white/5 overflow-hidden relative isolate",Zi,b??""].join(" "),onMouseEnter:ui?()=>Pt(!0):void 0,onMouseLeave:ui?()=>Pt(!1):void 0,onFocus:ui?()=>Pt(!0):void 0,onBlur:ui?()=>Pt(!1):void 0,"data-duration":Me?String(Ce):void 0,"data-res":Re?`${ne}x${Z}`:void 0,"data-size":typeof fe=="number"?String(fe):void 0,"data-fps":typeof xe=="number"?String(xe):void 0,children:[$s&&gi&&be?g.jsx("img",{src:gi,loading:L?"eager":"lazy",decoding:"async",alt:G,className:["absolute inset-0 w-full h-full object-cover",q].filter(Boolean).join(" "),onError:()=>Pe(!1)}):g.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Ei?_.createElement("video",{...Ae,ref:$e=>{Gt.current=$e,kt("inline",$e)},key:`inline-${ni}-${O}`,src:Xt,className:["absolute inset-0 w-full h-full object-cover",q,R?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:z,controls:R,loop:j,poster:wi&&gi||void 0,onLoadedMetadata:Xi,onError:()=>Ye(!1)}):null,!Ei&&Jt&&!(fi&&a==="teaser")?g.jsx("video",{src:_i,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>st(!0),onCanPlay:()=>st(!0),onError:()=>{Ke(!1),st(!1)}},`teaser-prewarm-${ni}`):null,!Ei&&fi&&a==="teaser"?g.jsx("video",{ref:$e=>{Yi.current=$e,kt("teaser",$e)},src:_i,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q,ht?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:z,playsInline:!0,autoPlay:!0,loop:!0,preload:ht?"auto":"metadata",poster:wi&&gi||void 0,onLoadedData:()=>st(!0),onPlaying:()=>st(!0),onError:()=>{Ke(!1),st(!1)}},`teaser-mp4-${ni}`):null,!Ei&&fi&&a==="clips"?g.jsx("video",{ref:$e=>{Ri.current=$e,kt("clips",$e)},src:Xt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q].filter(Boolean).join(" "),muted:z,playsInline:!0,preload:"metadata",poster:wi&&gi||void 0,onError:()=>Ye(!1)},`clips-${ni}-${Rs}`):null,xi?g.jsxs("div",{"aria-hidden":"true",className:["absolute left-0 right-0 bottom-0 z-10 pointer-events-none","h-0.5 group-hover:h-1.5","transition-[height] duration-150 ease-out","rounded-none group-hover:rounded-full","bg-black/35 dark:bg-white/10","overflow-hidden group-hover:overflow-visible"].join(" "),children:[Ls==="teaser"&&Cs?g.jsx("div",{className:"absolute inset-0",children:Cs.map(($e,Mt)=>g.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${$e.left*100}%`,width:`${$e.width*100}%`}},`seg-${Mt}-${$e.left.toFixed(6)}-${$e.width.toFixed(6)}`))}):null,g.jsx("div",{className:"absolute inset-0 origin-left transition-transform duration-150 ease-out",style:{transform:`scaleX(${Te(ys)})`,background:"rgba(99,102,241,0.95)"}}),g.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150",style:{left:`calc(${Te(ys)*100}% - 4px)`},children:g.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-white/90 shadow-[0_0_0_2px_rgba(0,0,0,0.25),0_0_10px_rgba(168,85,247,0.55)]"})})]}):null,hn?g.jsx("video",{src:Xt,preload:"metadata",muted:z,playsInline:!0,className:"hidden",onLoadedMetadata:Xi}):null]});return T?g.jsx(VA,{content:$e=>$e&&g.jsx("div",{className:"w-[420px]",children:g.jsx("div",{className:"aspect-video",children:g.jsx("video",{src:Xt,className:["w-full h-full bg-black",q].filter(Boolean).join(" "),muted:N,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation()})})}),children:_s}):_s}function Ui(...s){return s.filter(Boolean).join(" ")}const PM=s=>(s||"").replaceAll("\\","/").trim().split("/").pop()||"",BM=s=>s.startsWith("HOT ")?s.slice(4):s,FM=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function UM(s){const t=BM(PM(s||"")).replace(/\.[^.]+$/,""),i=t.match(FM);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t||null}function ja({job:s,variant:e="overlay",collapseToMenu:t=!1,inlineCount:i,busy:n=!1,compact:r=!1,isHot:a=!1,isFavorite:u=!1,isLiked:c=!1,isWatching:d=!1,onToggleFavorite:f,onToggleLike:p,onToggleHot:y,onKeep:v,onDelete:b,onToggleWatch:T,onAddToDownloads:E,order:D,className:O}){const R=e==="overlay"?r?"p-1.5":"p-2":"p-1.5",j=r?"size-4":"size-5",F="h-full w-full",z=e==="table"?`inline-flex items-center justify-center rounded-md ${R} hover:bg-gray-100/70 dark:hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`:`inline-flex items-center justify-center rounded-md bg-white/75 ${R} text-gray-900 backdrop-blur ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/60 dark:focus-visible:ring-white/40 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`,N=e==="table"?{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-500 dark:text-gray-300",keep:"text-emerald-600 dark:text-emerald-300",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-300"}:{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-800/90 dark:text-white/90",keep:"text-emerald-600 dark:text-emerald-200",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-200"},Y=D??["watch","favorite","like","hot","keep","delete","details"],L=kt=>Y.includes(kt),I=String(s?.sourceUrl??"").trim(),X=UM(s.output||""),G=X?`Mehr zu ${X} anzeigen`:"Mehr anzeigen",q=L("favorite"),ae=L("like"),ie=L("hot"),W=L("watch"),K=L("keep"),Q=L("delete"),te=L("details")&&!!X,re=L("add"),[U,ne]=_.useState("idle"),Z=_.useRef(null);_.useEffect(()=>()=>{Z.current&&window.clearTimeout(Z.current)},[]);const fe=()=>{ne("ok"),Z.current&&window.clearTimeout(Z.current),Z.current=window.setTimeout(()=>ne("idle"),800)},xe=async()=>{if(n||U==="busy"||!E&&!!!I)return!1;ne("busy");try{let V=!0;return E?V=await E(s)!==!1:I?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:I}})),V=!0):V=!1,V?fe():ne("idle"),V}catch{return ne("idle"),!1}},[ge,Ce]=_.useState(0),[Me,Re]=_.useState(4),Ae=kt=>V=>{V.preventDefault(),V.stopPropagation(),!(n||!kt)&&Promise.resolve(kt(s)).catch(()=>{})},be=te?g.jsxs("button",{type:"button",className:Ui(z),title:G,"aria-label":G,disabled:n,onClick:kt=>{kt.preventDefault(),kt.stopPropagation(),!n&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:X}}))},children:[g.jsx("span",{className:Ui("inline-flex items-center justify-center",j),children:g.jsx(W_,{className:Ui(F,N.off)})}),g.jsx("span",{className:"sr-only",children:G})]}):null,Pe=re?g.jsxs("button",{type:"button",className:Ui(z),title:I?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:n||U==="busy"||!E&&!I,onClick:async kt=>{kt.preventDefault(),kt.stopPropagation(),await xe()},children:[g.jsx("span",{className:Ui("inline-flex items-center justify-center",j),children:U==="ok"?g.jsx(xM,{className:Ui(F,"text-emerald-600 dark:text-emerald-300")}):g.jsx(V_,{className:Ui(F,N.off)})}),g.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,gt=q?g.jsx("button",{type:"button",className:z,title:u?"Favorit entfernen":"Als Favorit markieren","aria-label":u?"Favorit entfernen":"Als Favorit markieren","aria-pressed":u,disabled:n||!f,onClick:Ae(f),children:g.jsxs("span",{className:Ui("relative inline-block",j),children:[g.jsx(h0,{className:Ui("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,N.off)}),g.jsx(Ic,{className:Ui("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,N.favOn)})]})}):null,Ye=ae?g.jsx("button",{type:"button",className:z,title:c?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-label":c?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-pressed":c,disabled:n||!p,onClick:Ae(p),children:g.jsxs("span",{className:Ui("relative inline-block",j),children:[g.jsx(bh,{className:Ui("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",c?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,N.off)}),g.jsx(bu,{className:Ui("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",c?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,N.likeOn)})]})}):null,lt=ie?g.jsx("button",{type:"button","data-hot-target":!0,className:z,title:a?"HOT entfernen":"Als HOT markieren","aria-label":a?"HOT entfernen":"Als HOT markieren","aria-pressed":a,disabled:n||!y,onClick:Ae(y),children:g.jsxs("span",{className:Ui("relative inline-block",j),children:[g.jsx(K_,{className:Ui("absolute inset-0 transition-all duration-200 ease-out",a?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,N.off)}),g.jsx(lx,{className:Ui("absolute inset-0 transition-all duration-200 ease-out",a?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,N.hotOn)})]})}):null,Ve=W?g.jsx("button",{type:"button",className:z,title:d?"Watched entfernen":"Als Watched markieren","aria-label":d?"Watched entfernen":"Als Watched markieren","aria-pressed":d,disabled:n||!T,onClick:Ae(T),children:g.jsxs("span",{className:Ui("relative inline-block",j),children:[g.jsx(d0,{className:Ui("absolute inset-0 transition-all duration-200 ease-out",d?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,N.off)}),g.jsx(xu,{className:Ui("absolute inset-0 transition-all duration-200 ease-out",d?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,N.watchOn)})]})}):null,ht=K?g.jsx("button",{type:"button",className:z,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:n||!v,onClick:Ae(v),children:g.jsx("span",{className:Ui("inline-flex items-center justify-center",j),children:g.jsx(G_,{className:Ui(F,N.keep)})})}):null,st=Q?g.jsx("button",{type:"button",className:z,title:"Löschen","aria-label":"Löschen",disabled:n||!b,onClick:Ae(b),children:g.jsx("span",{className:Ui("inline-flex items-center justify-center",j),children:g.jsx(X_,{className:Ui(F,N.del)})})}):null,ct={details:be,add:Pe,favorite:gt,like:Ye,watch:Ve,hot:lt,keep:ht,delete:st},Ke=t,_t=Y.filter(kt=>!!ct[kt]),pe=Ke&&typeof i!="number",ot=(r?16:20)+(e==="overlay"?r?6:8:6)*2,St=r?2:3,vt=_.useMemo(()=>{if(!pe)return i??St;const kt=ge||0;if(kt<=0)return Math.min(_t.length,St);for(let V=_t.length;V>=0;V--)if(V*ot+ot+(V>0?V*Me:0)<=kt)return V;return 0},[pe,i,St,ge,_t.length,ot,Me]),Vt=Ke?_t.slice(0,vt):_t,si=Ke?_t.slice(vt):[],[$t,Pt]=_.useState(!1),Ht=_.useRef(null);_.useLayoutEffect(()=>{const kt=Ht.current;if(!kt||typeof window>"u")return;const V=()=>{const ee=Ht.current;if(!ee)return;const Te=Math.floor(ee.getBoundingClientRect().width||0);Te>0&&Ce(Te);const Ue=window.getComputedStyle(ee),ft=Ue.columnGap||Ue.gap||"0",Et=parseFloat(ft);Number.isFinite(Et)&&Et>=0&&Re(Et)};V();const H=new ResizeObserver(()=>V());return H.observe(kt),window.addEventListener("resize",V),()=>{window.removeEventListener("resize",V),H.disconnect()}},[]);const ui=_.useRef(null),xt=_.useRef(null),ni=208,Xt=4,Zi=8,[Gt,Yi]=_.useState(null);_.useEffect(()=>{if(!$t)return;const kt=H=>{H.key==="Escape"&&Pt(!1)},V=H=>{const ee=Ht.current,Te=xt.current,Ue=H.target;ee&&ee.contains(Ue)||Te&&Te.contains(Ue)||Pt(!1)};return window.addEventListener("keydown",kt),window.addEventListener("mousedown",V),()=>{window.removeEventListener("keydown",kt),window.removeEventListener("mousedown",V)}},[$t]),_.useLayoutEffect(()=>{if(!$t){Yi(null);return}const kt=()=>{const V=ui.current;if(!V)return;const H=V.getBoundingClientRect(),ee=window.innerWidth,Te=window.innerHeight;let Ue=H.right-ni;Ue=Math.max(Zi,Math.min(Ue,ee-ni-Zi));let ft=H.bottom+Xt;ft=Math.max(Zi,Math.min(ft,Te-Zi));const Et=Math.max(120,Te-ft-Zi);Yi({top:ft,left:Ue,maxH:Et})};return kt(),window.addEventListener("resize",kt),window.addEventListener("scroll",kt,!0),()=>{window.removeEventListener("resize",kt),window.removeEventListener("scroll",kt,!0)}},[$t]);const Ri=()=>{X&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:X}}))},Si=kt=>kt==="details"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n,onClick:V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),Ri()},children:[g.jsx(W_,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:"Details"})]},"details"):kt==="add"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!E&&!I,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await xe()},children:[g.jsx(V_,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):kt==="favorite"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!f,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await f?.(s)},children:[u?g.jsx(Ic,{className:Ui("size-4",N.favOn)}):g.jsx(h0,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:u?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):kt==="like"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!p,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await p?.(s)},children:[c?g.jsx(bu,{className:Ui("size-4",N.favOn)}):g.jsx(bh,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:c?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):kt==="watch"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!T,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await T?.(s)},children:[d?g.jsx(xu,{className:Ui("size-4",N.favOn)}):g.jsx(d0,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:d?"Watched entfernen":"Watched"})]},"watch"):kt==="hot"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!y,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await y?.(s)},children:[a?g.jsx(lx,{className:Ui("size-4",N.favOn)}):g.jsx(K_,{className:Ui("size-4",N.off)}),g.jsx("span",{className:"truncate",children:a?"HOT entfernen":"Als HOT markieren"})]},"hot"):kt==="keep"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!v,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await v?.(s)},children:[g.jsx(G_,{className:Ui("size-4",N.keep)}),g.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):kt==="delete"?g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!b,onClick:async V=>{V.preventDefault(),V.stopPropagation(),Pt(!1),await b?.(s)},children:[g.jsx(X_,{className:Ui("size-4",N.del)}),g.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return g.jsxs("div",{ref:Ht,className:Ui("relative flex items-center flex-nowrap",O??"gap-2"),children:[Vt.map(kt=>{const V=ct[kt];return V?g.jsx(_.Fragment,{children:V},kt):null}),Ke&&si.length>0?g.jsxs("div",{className:"relative",children:[g.jsx("button",{ref:ui,type:"button",className:z,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":$t,disabled:n,onClick:kt=>{kt.preventDefault(),kt.stopPropagation(),!n&&Pt(V=>!V)},children:g.jsx("span",{className:Ui("inline-flex items-center justify-center",j),children:g.jsx(UO,{className:Ui(F,N.off)})})}),$t&&Gt&&typeof document<"u"?Lc.createPortal(g.jsx("div",{ref:xt,role:"menu",className:"rounded-md bg-white/95 dark:bg-gray-900/95 shadow-lg ring-1 ring-black/10 dark:ring-white/10 p-1 z-[9999] overflow-auto",style:{position:"fixed",top:Gt.top,left:Gt.left,width:ni,maxHeight:Gt.maxH},onClick:kt=>kt.stopPropagation(),children:si.map(Si)}),document.body):null]}):null]})}function $a({tag:s,children:e,title:t,active:i,onClick:n,maxWidthClassName:r="max-w-[11rem]",className:a,stopPropagation:u=!0}){const c=s??(typeof e=="string"||typeof e=="number"?String(e):""),d=Mi("inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs",r,"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-200"),y=Mi(d,i?"bg-sky-100 text-sky-800 dark:bg-sky-400/20 dark:text-sky-100":"",n?"cursor-pointer hover:bg-sky-100 dark:hover:bg-sky-400/20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500":"",a),v=T=>T.stopPropagation(),b=u?{onPointerDown:v,onMouseDown:v}:{};return n?g.jsx("button",{type:"button",className:y,title:t??c,"aria-pressed":!!i,...b,onClick:T=>{u&&(T.preventDefault(),T.stopPropagation()),c&&n(c)},children:e??s}):g.jsx("span",{className:y,title:t??c,...b,onClick:u?v:void 0,children:e??s})}function ub({rowKey:s,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:n,maxVisible:r,maxWidthClassName:a,gapPx:u=6,className:c}){const[d,f]=_.useState(!1),p=_.useRef(null),y=_.useRef(null),v=_.useRef(null);_.useEffect(()=>f(!1),[s]),_.useEffect(()=>{if(!d)return;const N=Y=>{Y.key==="Escape"&&f(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[d]);const b=_.useMemo(()=>typeof r=="number"&&r>0?r:Number.POSITIVE_INFINITY,[r]),T=_.useMemo(()=>[...e].sort((N,Y)=>N.localeCompare(Y,void 0,{sensitivity:"base"})),[e]),[E,D]=_.useState(()=>{const N=Math.min(T.length,b);return Math.min(N,6)}),O=_.useCallback(()=>{const N=p.current,Y=y.current;if(!N||!Y)return;const L=Math.floor(N.getBoundingClientRect().width);if(L<=0)return;const I=Math.min(T.length,b);if(I<=0){D(0);return}const G=Array.from(Y.children).map(K=>K.offsetWidth).slice(0,I),q=v.current?.offsetWidth??0,ae=2,ie=K=>{let Q=0,te=0;for(let re=0;re0?u:0);if(Q+U<=K-ae)Q+=U,te++;else break}return te};let W=ie(L);if(W0?q+u:0,Q=Math.max(0,L-K);W=ie(Q),W=Math.max(0,W)}D(Math.max(0,Math.min(W,I)))},[T,b,u]);_.useLayoutEffect(()=>{O()},[O,T.join("\0"),a,b]),_.useEffect(()=>{const N=p.current;if(!N)return;const Y=new ResizeObserver(()=>O());return Y.observe(N),()=>Y.disconnect()},[O]);const R=Math.min(T.length,b),j=T.slice(0,Math.min(E,R)),F=N=>N.stopPropagation(),z=T.length-j.length;return g.jsxs(g.Fragment,{children:[d?null:g.jsxs("div",{ref:p,className:["mt-2 h-6 flex items-center gap-1.5",c].filter(Boolean).join(" "),onClick:F,onMouseDown:F,onPointerDown:F,children:[g.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:g.jsx("div",{className:"flex flex-nowrap items-center gap-1.5",children:j.length>0?j.map(N=>g.jsx($a,{tag:N,active:t.has(i(N)),onClick:n,maxWidthClassName:a},N)):g.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),z>0?g.jsxs("button",{type:"button",className:["inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs","cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500","bg-gray-100 text-gray-700 hover:bg-gray-200/70","dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20"].join(" "),onClick:N=>{N.preventDefault(),N.stopPropagation(),f(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",z]}):null]}),d?g.jsxs("div",{className:["absolute inset-0 z-30","bg-white/60 dark:bg-gray-950","px-3 py-3","pointer-events-auto"].join(" "),onClick:F,onMouseDown:F,onPointerDown:F,role:"dialog","aria-label":"Tags",children:[g.jsx("button",{type:"button",className:`\r + dark:bg-white/10 dark:text-white dark:ring-white/10`}),p.jsx(mi,{variant:"secondary",onClick:()=>L("ffmpeg"),disabled:i||u!==null,children:"Durchsuchen..."})]})]})]})]}),p.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[p.jsxs("div",{className:"mb-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Automatisierung & Anzeige"}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Verhalten beim Hinzufügen/Starten sowie Anzeigeoptionen."})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx(vo,{checked:!!e.autoAddToDownloadList,onChange:V=>t(Y=>({...Y,autoAddToDownloadList:V,autoStartAddedDownloads:V?Y.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),p.jsx(vo,{checked:!!e.autoStartAddedDownloads,onChange:V=>t(Y=>({...Y,autoStartAddedDownloads:V})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),p.jsx(vo,{checked:!!e.useChaturbateApi,onChange:V=>t(Y=>({...Y,useChaturbateApi:V})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),p.jsx(vo,{checked:!!e.useMyFreeCamsWatcher,onChange:V=>t(Y=>({...Y,useMyFreeCamsWatcher:V})),label:"MyFreeCams Auto-Check (watched)",description:"Geht watched MyFreeCams-Models einzeln durch und startet einen Download. Wenn keine Output-Datei entsteht, ist der Stream nicht öffentlich (offline/away/private) und der Job wird wieder entfernt."}),p.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[p.jsx(vo,{checked:!!e.autoDeleteSmallDownloads,onChange:V=>t(Y=>({...Y,autoDeleteSmallDownloads:V,autoDeleteSmallDownloadsBelowMB:Y.autoDeleteSmallDownloadsBelowMB??50})),label:"Kleine Downloads automatisch löschen",description:"Löscht fertige Downloads automatisch, wenn die Datei kleiner als die eingestellte Mindestgröße ist."}),p.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center "+(e.autoDeleteSmallDownloads?"":"opacity-50 pointer-events-none"),children:[p.jsxs("div",{className:"sm:col-span-4",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Mindestgröße"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Alles darunter wird gelöscht."})]}),p.jsx("div",{className:"sm:col-span-8",children:p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[p.jsx("input",{type:"number",min:0,step:1,value:e.autoDeleteSmallDownloadsBelowMB??50,onChange:V=>t(Y=>({...Y,autoDeleteSmallDownloadsBelowMB:Number(V.target.value||0)})),className:`h-9 w-32 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm + dark:border-white/10 dark:bg-gray-900 dark:text-gray-100`}),p.jsx("span",{className:"shrink-0 text-xs text-gray-600 dark:text-gray-300",children:"MB"})]})})]})]}),p.jsx(vo,{checked:!!e.blurPreviews,onChange:V=>t(Y=>({...Y,blurPreviews:V})),label:"Vorschaubilder blurren",description:"Weichzeichnet Vorschaubilder/Teaser (praktisch auf mobilen Geräten oder im öffentlichen Umfeld)."}),p.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[p.jsxs("div",{className:"sm:col-span-4",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Teaser abspielen"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Standbild spart Leistung. „Bei Hover (Standard)“: Desktop spielt bei Hover ab, Mobile im Viewport. „Alle“ kann viel CPU ziehen."})]}),p.jsxs("div",{className:"sm:col-span-8",children:[p.jsx("label",{className:"sr-only",htmlFor:"teaserPlayback",children:"Teaser abspielen"}),p.jsxs("select",{id:"teaserPlayback",value:e.teaserPlayback??"hover",onChange:V=>t(Y=>({...Y,teaserPlayback:V.target.value})),className:`h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm + dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[p.jsx("option",{value:"still",children:"Standbild"}),p.jsx("option",{value:"hover",children:"Bei Hover (Standard)"}),p.jsx("option",{value:"all",children:"Alle"})]})]})]}),p.jsx(vo,{checked:!!e.teaserAudio,onChange:V=>t(Y=>({...Y,teaserAudio:V})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),p.jsx(vo,{checked:!!e.enableNotifications,onChange:V=>t(Y=>({...Y,enableNotifications:V})),label:"Benachrichtigungen",description:"Wenn aktiv, zeigt das Frontend Toasts (z.B. wenn watched Models online/live gehen oder wenn ein queued Model wieder public wird)."}),p.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Speicherplatz-Notbremse"}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aktiviert automatisch Stop + Autostart-Block bei wenig freiem Speicher (Resume bei +3 GB)."})]}),p.jsx("span",{className:"inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium "+(v?.emergency?"bg-red-100 text-red-800 dark:bg-red-500/20 dark:text-red-200":"bg-green-100 text-green-800 dark:bg-green-500/20 dark:text-green-200"),title:v?.emergency?"Notfallbremse greift gerade":"OK",children:v?.emergency?"AKTIV":"OK"})]}),p.jsxs("div",{className:"mt-3 text-sm text-gray-900 dark:text-gray-200",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:"Schwelle:"})," ","Pause unter ",p.jsx("span",{className:"tabular-nums",children:F})," GB"," · ","Resume ab"," ",p.jsx("span",{className:"tabular-nums",children:G})," ","GB"]}),p.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:v?`Frei: ${v.freeBytesHuman}${v.recordPath?` (Pfad: ${v.recordPath})`:""}`:"Status wird geladen…"}),v?.emergency&&p.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"Notfallbremse greift: laufende Downloads werden gestoppt und Autostart bleibt gesperrt, bis wieder genug frei ist."})]})]})]})]})]})})}function My(...s){return s.filter(Boolean).join(" ")}const LO={sm:{btn:"px-2.5 py-1.5 text-sm",icon:"size-5",iconOnly:"h-9 w-9"},md:{btn:"px-3 py-2 text-sm",icon:"size-5",iconOnly:"h-10 w-10"},lg:{btn:"px-3.5 py-2.5 text-sm",icon:"size-5",iconOnly:"h-11 w-11"}};function ZA({items:s,value:e,onChange:t,size:i="md",className:n,ariaLabel:r="Optionen"}){const a=LO[i];return p.jsx("span",{className:My("isolate inline-flex rounded-md shadow-xs dark:shadow-none",n),role:"group","aria-label":r,children:s.map((u,c)=>{const d=u.id===e,f=c===0,g=c===s.length-1,y=!u.label&&!!u.icon;return p.jsxs("button",{type:"button",disabled:u.disabled,onClick:()=>t(u.id),"aria-pressed":d,className:My("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!f&&"-ml-px",f&&"rounded-l-md",g&&"rounded-r-md",d?"bg-indigo-100 text-indigo-800 inset-ring-1 inset-ring-indigo-300 hover:bg-indigo-200 dark:bg-indigo-500/40 dark:text-indigo-100 dark:inset-ring-indigo-400/50 dark:hover:bg-indigo-500/50":"bg-white text-gray-900 inset-ring-1 inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:inset-ring-gray-700 dark:hover:bg-white/20","disabled:opacity-50 disabled:cursor-not-allowed",y?`p-0 ${a.iconOnly}`:a.btn),title:typeof u.label=="string"?u.label:u.srLabel,children:[y&&u.srLabel?p.jsx("span",{className:"sr-only",children:u.srLabel}):null,u.icon?p.jsx("span",{className:My("shrink-0",y?"":"-ml-0.5",d?"text-indigo-600 dark:text-indigo-200":"text-gray-400 dark:text-gray-500"),children:u.icon}):null,u.label?p.jsx("span",{className:u.icon?"ml-1.5":"",children:u.label}):null]},u.id)})})}function RO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}const IO=_.forwardRef(RO);function NO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const K_=_.forwardRef(NO);function OO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const MO=_.forwardRef(OO);function PO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"}))}const _m=_.forwardRef(PO);function FO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))}const BO=_.forwardRef(FO);function UO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))}const jO=_.forwardRef(UO);function $O({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0 1 20.25 6v12A2.25 2.25 0 0 1 18 20.25H6A2.25 2.25 0 0 1 3.75 18V6A2.25 2.25 0 0 1 6 3.75h1.5m9 0h-9"}))}const W_=_.forwardRef($O);function HO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"}))}const Em=_.forwardRef(HO);function zO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const VO=_.forwardRef(zO);function GO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const Y_=_.forwardRef(GO);function qO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"}))}const KO=_.forwardRef(qO);function WO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const YO=_.forwardRef(WO);function XO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const g0=_.forwardRef(XO);function QO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h1.5C5.496 19.5 6 18.996 6 18.375m-3.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-1.5A1.125 1.125 0 0 1 18 18.375M20.625 4.5H3.375m17.25 0c.621 0 1.125.504 1.125 1.125M20.625 4.5h-1.5C18.504 4.5 18 5.004 18 5.625m3.75 0v1.5c0 .621-.504 1.125-1.125 1.125M3.375 4.5c-.621 0-1.125.504-1.125 1.125M3.375 4.5h1.5C5.496 4.5 6 5.004 6 5.625m-3.75 0v1.5c0 .621.504 1.125 1.125 1.125m0 0h1.5m-1.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m1.5-3.75C5.496 8.25 6 7.746 6 7.125v-1.5M4.875 8.25C5.496 8.25 6 8.754 6 9.375v1.5m0-5.25v5.25m0-5.25C6 5.004 6.504 4.5 7.125 4.5h9.75c.621 0 1.125.504 1.125 1.125m1.125 2.625h1.5m-1.5 0A1.125 1.125 0 0 1 18 7.125v-1.5m1.125 2.625c-.621 0-1.125.504-1.125 1.125v1.5m2.625-2.625c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125M18 5.625v5.25M7.125 12h9.75m-9.75 0A1.125 1.125 0 0 1 6 10.875M7.125 12C6.504 12 6 12.504 6 13.125m0-2.25C6 11.496 5.496 12 4.875 12M18 10.875c0 .621-.504 1.125-1.125 1.125M18 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m-12 5.25v-5.25m0 5.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125m-12 0v-1.5c0-.621-.504-1.125-1.125-1.125M18 18.375v-5.25m0 5.25v-1.5c0-.621.504-1.125 1.125-1.125M18 13.125v1.5c0 .621.504 1.125 1.125 1.125M18 13.125c0-.621.504-1.125 1.125-1.125M6 13.125v1.5c0 .621-.504 1.125-1.125 1.125M6 13.125C6 12.504 5.496 12 4.875 12m-1.5 0h1.5m-1.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M19.125 12h1.5m0 0c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h1.5m14.25 0h1.5"}))}const ZO=_.forwardRef(QO);function JO({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z"}))}const X_=_.forwardRef(JO);function eM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const Th=_.forwardRef(eM);function tM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Zm6-10.125a1.875 1.875 0 1 1-3.75 0 1.875 1.875 0 0 1 3.75 0Zm1.294 6.336a6.721 6.721 0 0 1-3.17.789 6.721 6.721 0 0 1-3.168-.789 3.376 3.376 0 0 1 6.338 0Z"}))}const iM=_.forwardRef(tM);function sM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const nM=_.forwardRef(sM);function rM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"}))}const aM=_.forwardRef(rM);function oM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))}const lM=_.forwardRef(oM);function uM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const Q_=_.forwardRef(uM);function cM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const dM=_.forwardRef(cM);function hM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const Z_=_.forwardRef(hM);function fM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"}))}const mM=_.forwardRef(fM);function pM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const Py=_.forwardRef(pM);function gM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const yM=_.forwardRef(gM);function vM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const y0=_.forwardRef(vM);function xM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"}))}const bM=_.forwardRef(xM);function TM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const J_=_.forwardRef(TM);function SM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}const e2=_.forwardRef(SM);function _M({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const EM=_.forwardRef(_M);function wM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const v0=_.forwardRef(wM);function AM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.74a.75.75 0 0 1 1.04-.207Z",clipRule:"evenodd"}))}const kM=_.forwardRef(AM);function CM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),_.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const bu=_.forwardRef(CM);function DM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.176 7.547 7.547 0 0 1-1.705-1.715.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.546 3.75 3.75 0 0 1 3.255 3.718Z",clipRule:"evenodd"}))}const cx=_.forwardRef(DM);function LM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"}))}const RM=_.forwardRef(LM);function IM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z"}))}const Tu=_.forwardRef(IM);function NM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z",clipRule:"evenodd"}))}const OM=_.forwardRef(NM);function MM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.427 1.529-2.33 2.779-1.643l11.54 6.347c1.295.712 1.295 2.573 0 3.286L7.28 19.99c-1.25.687-2.779-.217-2.779-1.643V5.653Z",clipRule:"evenodd"}))}const PM=_.forwardRef(MM);function FM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M5.636 4.575a.75.75 0 0 1 0 1.061 9 9 0 0 0 0 12.728.75.75 0 1 1-1.06 1.06c-4.101-4.1-4.101-10.748 0-14.849a.75.75 0 0 1 1.06 0Zm12.728 0a.75.75 0 0 1 1.06 0c4.101 4.1 4.101 10.75 0 14.85a.75.75 0 1 1-1.06-1.061 9 9 0 0 0 0-12.728.75.75 0 0 1 0-1.06ZM7.757 6.697a.75.75 0 0 1 0 1.06 6 6 0 0 0 0 8.486.75.75 0 0 1-1.06 1.06 7.5 7.5 0 0 1 0-10.606.75.75 0 0 1 1.06 0Zm8.486 0a.75.75 0 0 1 1.06 0 7.5 7.5 0 0 1 0 10.606.75.75 0 0 1-1.06-1.06 6 6 0 0 0 0-8.486.75.75 0 0 1 0-1.06ZM9.879 8.818a.75.75 0 0 1 0 1.06 3 3 0 0 0 0 4.243.75.75 0 1 1-1.061 1.061 4.5 4.5 0 0 1 0-6.364.75.75 0 0 1 1.06 0Zm4.242 0a.75.75 0 0 1 1.061 0 4.5 4.5 0 0 1 0 6.364.75.75 0 0 1-1.06-1.06 3 3 0 0 0 0-4.243.75.75 0 0 1 0-1.061ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))}const BM=_.forwardRef(FM);function UM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}const Oc=_.forwardRef(UM);function jM(...s){return s.filter(Boolean).join(" ")}function $M(){if(typeof document>"u")return null;const s="__swipecard_hot_fx_layer__";let e=document.getElementById(s);return e||(e=document.createElement("div"),e.id=s,e.style.position="fixed",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="2147483647",e.style.contain="layout style paint",document.body.appendChild(e)),e}const HM=_.forwardRef(function({children:e,enabled:t=!0,disabled:i=!1,onTap:n,onSwipeLeft:r,onSwipeRight:a,className:u,thresholdPx:c=140,thresholdRatio:d=.28,ignoreFromBottomPx:f=72,ignoreSelector:g="[data-swipe-ignore]",snapMs:y=180,commitMs:v=180,tapIgnoreSelector:b="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:T,hotTargetSelector:E="[data-hot-target]",doubleTapMs:D=360,doubleTapMaxMovePx:O=48},R){const j=_.useRef(null),F=_.useRef(!1),G=_.useRef(0),L=_.useRef(null),W=_.useRef(0),I=_.useRef(null),N=_.useRef(null),X=_.useRef(null),V=_.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[Y,ne]=_.useState(0),[ie,K]=_.useState(null),[q,Z]=_.useState(0),te=_.useCallback(()=>{L.current!=null&&(cancelAnimationFrame(L.current),L.current=null),G.current=0,j.current&&(j.current.style.touchAction="pan-y"),Z(y),ne(0),K(null),window.setTimeout(()=>Z(0),y)},[y]),le=_.useCallback(async(De,Ye)=>{L.current!=null&&(cancelAnimationFrame(L.current),L.current=null),j.current&&(j.current.style.touchAction="pan-y");const vt=j.current?.offsetWidth||360;Z(v),K(De==="right"?"right":"left");const Ge=De==="right"?vt+40:-(vt+40);G.current=Ge,ne(Ge);let ke=!0;if(Ye)try{ke=De==="right"?await a():await r()}catch{ke=!1}return ke===!1?(Z(y),K(null),ne(0),window.setTimeout(()=>Z(0),y),!1):!0},[v,r,a,y]),z=_.useCallback(()=>{N.current!=null&&(window.clearTimeout(N.current),N.current=null)},[]),re=_.useCallback(()=>{L.current!=null&&(cancelAnimationFrame(L.current),L.current=null),G.current=0,Z(0),ne(0),K(null);try{const De=j.current;De&&(De.style.touchAction="pan-y")}catch{}},[]),Q=_.useCallback((De,Ye)=>{const wt=I.current,vt=j.current;if(!wt||!vt)return;const Ge=$M();if(!Ge)return;let ke=typeof De=="number"?De:window.innerWidth/2,ut=typeof Ye=="number"?Ye:window.innerHeight/2;const rt=E?I.current?.querySelector(E)??vt.querySelector(E):null;let Je=ke,at=ut;if(rt){const qt=rt.getBoundingClientRect();Je=qt.left+qt.width/2,at=qt.top+qt.height/2}const Re=Je-ke,ze=at-ut,Ue=document.createElement("div");Ue.style.position="absolute",Ue.style.left=`${ke}px`,Ue.style.top=`${ut}px`,Ue.style.transform="translate(-50%, -50%)",Ue.style.pointerEvents="none",Ue.style.willChange="transform, opacity",Ue.style.zIndex="2147483647",Ue.style.lineHeight="1",Ue.style.userSelect="none",Ue.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const de=document.createElement("div");de.style.width="30px",de.style.height="30px",de.style.color="#f59e0b",de.style.display="block",Ue.appendChild(de),Ge.appendChild(Ue);const qe=bA.createRoot(de);qe.render(p.jsx(cx,{className:"w-full h-full","aria-hidden":"true"})),Ue.getBoundingClientRect();const ht=200,tt=500,At=400,ft=ht+tt+At,Et=ht/ft,Lt=(ht+tt)/ft,Rt=Ue.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:Et*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Et},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Lt},{transform:`translate(calc(-50% + ${Re}px), calc(-50% + ${ze}px)) scale(0.85)`,opacity:.95,offset:Lt+(1-Lt)*.75},{transform:`translate(calc(-50% + ${Re}px), calc(-50% + ${ze}px)) scale(0.55)`,opacity:0,offset:1}],{duration:ft,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});rt&&window.setTimeout(()=>{try{rt.animate([{transform:"translateZ(0) scale(1)",filter:"brightness(1)"},{transform:"translateZ(0) scale(1.10)",filter:"brightness(1.25)",offset:.35},{transform:"translateZ(0) scale(1)",filter:"brightness(1)"}],{duration:260,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)"})}catch{}},ht+tt+Math.round(At*.75)),Rt.onfinish=()=>{try{qe.unmount()}catch{}Ue.remove()}},[E]);_.useEffect(()=>()=>{N.current!=null&&window.clearTimeout(N.current)},[]),_.useImperativeHandle(R,()=>({swipeLeft:De=>le("left",De?.runAction??!0),swipeRight:De=>le("right",De?.runAction??!0),reset:()=>te()}),[le,te]);const pe=Math.abs(Y),be=Y===0?null:Y>0?"right":"left",ve=W.current||Math.min(c,(j.current?.offsetWidth||360)*d),we=Math.max(0,Math.min(1,pe/Math.max(1,ve))),He=Math.max(0,Math.min(1,pe/Math.max(1,ve*1.35))),Fe=Math.max(-6,Math.min(6,Y/28)),Ze=Y===0?1:.995;return p.jsx("div",{ref:I,className:jM("relative isolate overflow-visible rounded-lg",u),children:p.jsx("div",{ref:j,className:"relative",style:{transform:Y!==0?`translate3d(${Y}px,0,0) rotate(${Fe}deg) scale(${Ze})`:void 0,transition:q?`transform ${q}ms ease`:void 0,touchAction:"pan-y",willChange:Y!==0?"transform":void 0,boxShadow:Y!==0?be==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+we*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+we*.12})`:void 0,borderRadius:Y!==0?"12px":void 0,filter:Y!==0?`saturate(${1+we*.08}) brightness(${1+we*.02})`:void 0},onPointerDown:De=>{if(!t||i)return;const Ye=De.target;let wt=!!(b&&Ye?.closest?.(b));if(g&&Ye?.closest?.(g))return;let vt=!1;const Ge=De.currentTarget,ut=Array.from(Ge.querySelectorAll("video")).find(ze=>ze.controls);if(ut){const ze=ut.getBoundingClientRect();if(De.clientX>=ze.left&&De.clientX<=ze.right&&De.clientY>=ze.top&&De.clientY<=ze.bottom)if(ze.bottom-De.clientY<=72)vt=!0,wt=!0;else{const tt=De.clientX-ze.left,At=ze.right-De.clientX;tt<=64||At<=64||(vt=!0,wt=!0)}}const Je=De.currentTarget.getBoundingClientRect().bottom-De.clientY;f&&Je<=f&&(vt=!0),V.current={id:De.pointerId,x:De.clientX,y:De.clientY,dragging:!1,captured:!1,tapIgnored:wt,noSwipe:vt};const Re=j.current?.offsetWidth||360;W.current=Math.min(c,Re*d),G.current=0},onPointerMove:De=>{if(!t||i||V.current.id!==De.pointerId||V.current.noSwipe)return;const Ye=De.clientX-V.current.x,wt=De.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(wt)>Math.abs(Ye)&&Math.abs(wt)>8){V.current.id=null;return}if(Math.abs(Ye)<12)return;V.current.dragging=!0,De.currentTarget.style.touchAction="none",Z(0);try{De.currentTarget.setPointerCapture(De.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const vt=(rt,Je)=>{const at=Je*.9,Re=Math.abs(rt);if(Re<=at)return rt;const ze=Re-at,Ue=at+ze*.25;return Math.sign(rt)*Ue},Ge=j.current?.offsetWidth||360;G.current=vt(Ye,Ge),L.current==null&&(L.current=requestAnimationFrame(()=>{L.current=null,ne(G.current)}));const ke=W.current,ut=Ye>ke?"right":Ye<-ke?"left":null;K(rt=>{if(rt===ut)return rt;if(ut)try{navigator.vibrate?.(10)}catch{}return ut})},onPointerUp:De=>{if(!t||i||V.current.id!==De.pointerId)return;const Ye=W.current||Math.min(c,(j.current?.offsetWidth||360)*d),wt=V.current.dragging,vt=V.current.captured,Ge=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,vt)try{De.currentTarget.releasePointerCapture(De.pointerId)}catch{}if(De.currentTarget.style.touchAction="pan-y",!wt){const ut=Date.now(),rt=X.current,Je=rt&&Math.hypot(De.clientX-rt.x,De.clientY-rt.y)<=O;if(!!T&&rt&&ut-rt.t<=D&&Je){if(X.current=null,z(),F.current)return;F.current=!0;try{Q(De.clientX,De.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await T?.()}finally{F.current=!1}})()});return}if(Ge){X.current={t:ut,x:De.clientX,y:De.clientY},z(),N.current=window.setTimeout(()=>{N.current=null,X.current=null},T?D:0);return}re(),X.current={t:ut,x:De.clientX,y:De.clientY},z(),N.current=window.setTimeout(()=>{N.current=null,X.current=null,n?.()},T?D:0);return}const ke=G.current;L.current!=null&&(cancelAnimationFrame(L.current),L.current=null),ke>Ye?le("right",!0):ke<-Ye?le("left",!0):te(),G.current=0},onPointerCancel:De=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{De.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},L.current!=null&&(cancelAnimationFrame(L.current),L.current=null),G.current=0;try{De.currentTarget.style.touchAction="pan-y"}catch{}te()}},children:p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"relative z-10",children:e}),p.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:Y===0?0:.12+He*.18,background:be==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":be==="left"?"linear-gradient(270deg, rgba(244,63,94,0.16) 0%, rgba(244,63,94,0.04) 45%, rgba(0,0,0,0) 100%)":"transparent"}}),p.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ie?1:0,boxShadow:ie==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ie==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function JA({children:s,content:e}){const t=_.useRef(null),i=_.useRef(null),[n,r]=_.useState(!1),[a,u]=_.useState(null),c=_.useRef(null),d=()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},f=()=>{d(),c.current=window.setTimeout(()=>{r(!1),c.current=null},150)},g=()=>{d(),r(!0)},y=()=>{f()},v=()=>{d(),r(!1)},b=()=>{const E=t.current,D=i.current;if(!E||!D)return;const O=8,R=8,j=E.getBoundingClientRect(),F=D.getBoundingClientRect();let G=j.bottom+O;if(G+F.height>window.innerHeight-R){const I=j.top-F.height-O;I>=R?G=I:G=Math.max(R,window.innerHeight-F.height-R)}let W=j.left;W+F.width>window.innerWidth-R&&(W=window.innerWidth-F.width-R),W=Math.max(R,W),u({left:W,top:G})};_.useLayoutEffect(()=>{if(!n)return;const E=requestAnimationFrame(()=>b());return()=>cancelAnimationFrame(E)},[n]),_.useEffect(()=>{if(!n)return;const E=()=>requestAnimationFrame(()=>b());return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[n]),_.useEffect(()=>()=>d(),[]);const T=()=>typeof e=="function"?e(n,{close:v}):e;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:g,onMouseLeave:y,children:s}),n&&Ic.createPortal(p.jsx("div",{ref:i,className:"fixed z-50",style:{left:a?.left??-9999,top:a?.top??-9999,visibility:a?"visible":"hidden"},onMouseEnter:g,onMouseLeave:y,children:p.jsx(ma,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:T()})}),document.body)]})}const x0=!0,zM=!1;function Nh(s,e){if(!s)return;const t=e?.muted??x0;s.muted=t,s.defaultMuted=t,s.playsInline=!0,s.setAttribute("playsinline",""),s.setAttribute("webkit-playsinline","")}function b0({job:s,getFileName:e,durationSeconds:t,onDuration:i,onResolution:n,animated:r=!1,animatedMode:a="frames",animatedTrigger:u="always",autoTickMs:c=15e3,thumbStepSec:d,thumbSpread:f,thumbSamples:g,clipSeconds:y=.75,clipCount:v=12,variant:b="thumb",className:T,showPopover:E=!0,blur:D=!1,inlineVideo:O=!1,inlineNonce:R=0,inlineControls:j=!1,inlineLoop:F=!0,assetNonce:G=0,muted:L=x0,popoverMuted:W=x0,noGenerateTeaser:I,alwaysLoadStill:N=!1,teaserPreloadEnabled:X=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:Y,preferScrubProgress:ne=!1}){const ie=e(s.output||""),K=D?"blur-md":"",q=_.useMemo(()=>{const We=s?.meta;if(!We)return null;if(typeof We=="string")try{return JSON.parse(We)}catch{return null}return We},[s]),[Z,te]=_.useState(null),le=_.useMemo(()=>!q&&!Z?null:q?Z?{...q,...Z}:q:Z,[q,Z]),[z,re]=_.useState(0),Q=_.useMemo(()=>{let We=le?.previewClips;if(typeof We=="string")try{We=JSON.parse(We)}catch{We=null}!Array.isArray(We)&&Array.isArray(le?.preview?.clips)&&(We=le.preview.clips);const Mt=We;if(!Array.isArray(Mt)||Mt.length===0)return null;let Ot=0;const zt=[];for(const Xt of Mt){const Qi=Number(Xt?.startSeconds),Ii=Number(Xt?.durationSeconds);if(!Number.isFinite(Qi)||Qi<0||!Number.isFinite(Ii)||Ii<=0)continue;const Ni=Ot,Wi=Ot+Ii;zt.push({start:Qi,dur:Ii,cumStart:Ni,cumEnd:Wi}),Ot=Wi}return zt.length?zt:null},[le]),pe=_.useMemo(()=>Q?Q.map(We=>`${We.start.toFixed(3)}:${We.dur.toFixed(3)}`).join("|"):"",[Q]),be=(typeof q?.videoWidth=="number"&&Number.isFinite(q.videoWidth)&&q.videoWidth>0?q.videoWidth:void 0)??(typeof s.videoWidth=="number"&&Number.isFinite(s.videoWidth)&&s.videoWidth>0?s.videoWidth:void 0),ve=(typeof q?.videoHeight=="number"&&Number.isFinite(q.videoHeight)&&q.videoHeight>0?q.videoHeight:void 0)??(typeof s.videoHeight=="number"&&Number.isFinite(s.videoHeight)&&s.videoHeight>0?s.videoHeight:void 0),we=(typeof q?.fileSize=="number"&&Number.isFinite(q.fileSize)&&q.fileSize>0?q.fileSize:void 0)??(typeof s.sizeBytes=="number"&&Number.isFinite(s.sizeBytes)&&s.sizeBytes>0?s.sizeBytes:void 0),He=(typeof q?.fps=="number"&&Number.isFinite(q.fps)&&q.fps>0?q.fps:void 0)??(typeof s.fps=="number"&&Number.isFinite(s.fps)&&s.fps>0?s.fps:void 0),Fe=(typeof le?.durationSeconds=="number"&&Number.isFinite(le.durationSeconds)&&le.durationSeconds>0?le.durationSeconds:void 0)??(typeof s.durationSeconds=="number"&&Number.isFinite(s.durationSeconds)&&s.durationSeconds>0?s.durationSeconds:void 0)??(typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0),Ze=typeof Fe=="number"&&Number.isFinite(Fe)&&Fe>0?Fe>1440*60?Fe/1e3:Fe:void 0,De=typeof Ze=="number"&&Number.isFinite(Ze)&&Ze>0,Ye=typeof be=="number"&&typeof ve=="number"&&Number.isFinite(be)&&Number.isFinite(ve)&&be>0&&ve>0,wt={muted:L,playsInline:!0,preload:"metadata"},[vt,Ge]=_.useState(!0),[ke,ut]=_.useState(!0),[rt,Je]=_.useState(!1),[at,Re]=_.useState(!1),[ze,Ue]=_.useState(!0),de=_.useRef(null),[qe,ht]=_.useState(!1),[tt,At]=_.useState(!1),[ft,Et]=_.useState(!1),[Lt,Rt]=_.useState(0),[qt,Wt]=_.useState(!1),yi=O===!0||O==="always"?"always":O==="hover"?"hover":"never",Ct=yi==="hover"||r&&(a==="clips"||a==="teaser")&&u==="hover",It=We=>We.startsWith("HOT ")?We.slice(4):We,oi=_.useMemo(()=>{const We=e(s.output||"");if(!We)return"";const Mt=We.replace(/\.[^.]+$/,"");return It(Mt).trim()},[s.output,e]),wi=_.useMemo(()=>ie?`/api/record/video?file=${encodeURIComponent(ie)}`:"",[ie]),Di=b==="fill"?"w-full h-full":"w-20 h-16",Yt=_.useRef(null),Nt=_.useRef(null),H=_.useRef(null),U=_.useRef({inline:null,teaser:null,clips:null}),ee=(We,Mt)=>{Mt&&U.current[We]!==Mt&&(U.current[We]=Mt,re(Ot=>Ot+1))},[Te,Me]=_.useState(0),[,gt]=_.useState(0),Tt=We=>We<0?0:We>1?1:We,gi=(We,Mt,Ot=y,zt=!1)=>{if(!We)return{ratio:0,globalSec:0,vvDur:0};const Xt=Number(We.duration);if(!(Number.isFinite(Xt)&&Xt>0))return{ratio:0,globalSec:0,vvDur:0};const Ii=Number(We.currentTime);if(!Number.isFinite(Ii)||Ii<0)return{ratio:0,globalSec:0,vvDur:Xt};const Ni=Q;let Wi=0;if(zt&&Array.isArray(Ni)&&Ni.length>0){const os=Ni[Ni.length-1];if(Ii>=os.cumEnd)Wi=typeof Mt=="number"&&Number.isFinite(Mt)&&Mt>0?Mt:os.start+os.dur;else{let jn=0,Dn=Ni.length-1,Tn=0;for(;jn<=Dn;){const dn=jn+Dn>>1,sn=Ni[dn];if(Ii=sn.cumEnd)jn=dn+1;else{Tn=dn;break}}return Wi=Ni[Tn].start,{ratio:Ni.length>0?Tt(Tn/Ni.length):0,globalSec:Math.max(0,Wi),vvDur:Xt}}}return Number.isFinite(Ot)&&Ot>0?Wi=Math.floor(Ii/Ot)*Ot:Wi=Ii,{ratio:Tt(Math.min(Wi,Xt)/Xt),globalSec:Math.max(0,Wi),vvDur:Xt}},si=We=>{if(We){try{We.pause()}catch{}try{We.removeAttribute("src"),We.src="",We.load()}catch{}}};_.useEffect(()=>{Re(!1),Ue(!0)},[oi,G,I]),_.useEffect(()=>{const We=Mt=>{const Ot=String(Mt?.detail?.file??"");!Ot||Ot!==ie||(si(Yt.current),si(Nt.current),si(H.current))};return window.addEventListener("player:release",We),window.addEventListener("player:close",We),()=>{window.removeEventListener("player:release",We),window.removeEventListener("player:close",We)}},[ie]),_.useEffect(()=>{const We=de.current;if(!We)return;const Mt=new IntersectionObserver(Ot=>{const zt=!!Ot[0]?.isIntersecting;ht(zt),zt&&Et(!0)},{threshold:.01,rootMargin:"0px"});return Mt.observe(We),()=>Mt.disconnect()},[]),_.useEffect(()=>{const We=de.current;if(!We)return;if(!X){At(qe);return}let Mt=!0;const Ot=new IntersectionObserver(zt=>{zt[0]?.isIntersecting&&(At(!0),Mt&&(Mt=!1,Ot.disconnect()))},{threshold:0,rootMargin:V});return Ot.observe(We),()=>Ot.disconnect()},[X,V,qe]),_.useEffect(()=>{if(!r||a!=="frames"||!qe||document.hidden)return;const We=window.setInterval(()=>Rt(Mt=>Mt+1),c);return()=>window.clearInterval(We)},[r,a,qe,c]);const xi=_.useMemo(()=>{if(!r||a!=="frames"||!De)return null;const We=Ze,Mt=Math.max(.25,d??3);if(f){const Xt=Math.max(4,Math.min(g??16,Math.floor(We))),Qi=Lt%Xt,Ii=Math.max(.1,We-Mt),Ni=Math.min(.25,Ii*.02),Wi=Qi/Xt*Ii+Ni;return Math.min(We-.05,Math.max(.05,Wi))}const Ot=Math.max(We-.1,Mt),zt=Lt*Mt%Ot;return Math.min(We-.05,Math.max(.05,zt))},[r,a,De,Ze,Lt,d,f,g]),Ri=G??0,hi=_.useMemo(()=>oi?xi==null?`/api/preview?id=${encodeURIComponent(oi)}&v=${Ri}`:`/api/preview?id=${encodeURIComponent(oi)}&t=${xi}&v=${Ri}`:"",[oi,xi,Ri]),li=_.useMemo(()=>{if(!oi)return"";const We=I?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(oi)}${We}&v=${Ri}`},[oi,Ri,I]),Kt=yi!=="never"&&qe&&ke&&(yi==="always"||yi==="hover"&&qt),Si=r&&qe&&!document.hidden&&ke&&!Kt&&(u==="always"||qt)&&(a==="teaser"&&ze&&!!li||a==="clips"&&De),jt=De&&typeof Ze=="number"?Ze:void 0,ui=N||qe||ft||Ct&&qt,ei=tt||qe||ft||Ct&&qt;_.useEffect(()=>{let We=!1;i&&De&&(i(s,Number(Ze)),We=!0),n&&Ye&&(n(s,Number(be),Number(ve)),We=!0),We&&Je(!0)},[s,i,n,De,Ye,Ze,be,ve]),_.useEffect(()=>{if(!oi||!r||a!=="teaser"||!ei)return;const We=q?.previewClips;if(Array.isArray(We)||typeof We=="string"&&We.length>0||Array.isArray(q?.preview?.clips))return;let Ot=!1;const zt=new AbortController,Xt=async Qi=>{try{const Ii=await fetch(Qi,{signal:zt.signal,cache:"no-store",credentials:"include"});return Ii.ok?await Ii.json():null}catch{return null}};return(async()=>{const Qi=await Xt(`/api/record/done/meta?id=${encodeURIComponent(oi)}`),Ii=ie?await Xt(`/api/record/done/meta?file=${encodeURIComponent(ie)}`):null,Ni=Qi??Ii;!Ot&&Ni&&te(Ni)})(),()=>{Ot=!0,zt.abort()}},[oi,ie,r,a,q,ei]);const ti=We=>{Je(!0);const Mt=We.currentTarget;if(i&&!De){const Ot=Number(Mt.duration);Number.isFinite(Ot)&&Ot>0&&i(s,Ot)}if(n&&!Ye){const Ot=Number(Mt.videoWidth),zt=Number(Mt.videoHeight);Number.isFinite(Ot)&&Number.isFinite(zt)&&Ot>0&&zt>0&&n(s,Ot,zt)}};if(_.useEffect(()=>{Ge(!0),ut(!0),U.current.inline=null,U.current.teaser=null,U.current.clips=null},[oi,G]),!wi)return p.jsx("div",{className:[Di,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Ui=ei,rs=r&&a==="teaser"&&ze&&!!li&&!Kt&&ei,Ks=Kt?Yt:!Kt&&Si&&a==="teaser"?Nt:!Kt&&Si&&a==="clips"?H:null,Is=!!Ks&&qe,qi=Kt?"inline":Si&&a==="teaser"?"teaser":"clips",_i=r&&a==="frames"&&De&&typeof xi=="number"&&Number.isFinite(xi)&&xi>=0,Ns=_i?Tt(xi/Ze):0,Ji=!Kt&&ne&&typeof Y=="number"&&Number.isFinite(Y),as=Ji?Tt(Y):Is?Te:_i?Ns:0,ji=!Kt&&(Ji||(Is||_i)),ds=_.useMemo(()=>{if(!De)return null;const We=Ze;if(!(We>0))return null;let Ot=le?.previewClips;if(typeof Ot=="string")try{Ot=JSON.parse(Ot)}catch{Ot=null}if(!Array.isArray(Ot)||Ot.length===0)return null;const zt=Ot.map(Xt=>({start:Number(Xt?.startSeconds),dur:Number(Xt?.durationSeconds)})).filter(Xt=>Number.isFinite(Xt.start)&&Xt.start>=0&&Number.isFinite(Xt.dur)&&Xt.dur>0);return zt.length?zt.map(Xt=>{const Qi=Tt(Xt.start/We),Ii=Tt(Xt.dur/We);return{left:Qi,width:Ii,start:Xt.start,dur:Xt.dur}}):null},[le,De,Ze]),Ki=_.useMemo(()=>{if(!r)return[];if(a!=="clips")return[];if(!De)return[];const We=Ze,Mt=Math.max(.25,y),Ot=Math.max(8,Math.min(v??g??12,Math.floor(We))),zt=Math.max(.1,We-Mt),Xt=Math.min(.25,zt*.02),Qi=[];for(let Ii=0;IiKi.map(We=>We.toFixed(2)).join(","),[Ki]),ss=_.useRef(0),Ps=_.useRef(0);_.useEffect(()=>{const We=Nt.current;if(!We)return;if(!(Si&&a==="teaser")){try{We.pause()}catch{}return}Nh(We,{muted:L});const Ot=We.play?.();Ot&&typeof Ot.catch=="function"&&Ot.catch(()=>{})},[Si,a,li,L]),_.useEffect(()=>{if(!Is){Me(0),gt(0);return}const We=Ks?.current??null;if(!We){Me(0),gt(0);return}let Mt=!1,Ot=null;const zt=()=>{if(Mt||!We.isConnected)return;const Ii=qi==="teaser"&&Array.isArray(Q)&&Q.length>0,Ni=gi(We,jt,y,Ii);Me(Ni.ratio),gt(Ni.globalSec)};zt(),Ot=window.setInterval(zt,100);const Xt=()=>zt(),Qi=()=>zt();return We.addEventListener("loadedmetadata",Xt),We.addEventListener("durationchange",Xt),We.addEventListener("timeupdate",Qi),()=>{Mt=!0,Ot!=null&&window.clearInterval(Ot),We.removeEventListener("loadedmetadata",Xt),We.removeEventListener("durationchange",Xt),We.removeEventListener("timeupdate",Qi)}},[Is,Ks,jt,pe,qi,Q,z]),_.useEffect(()=>{Kt&&Nh(Yt.current,{muted:L})},[Kt,L]),_.useEffect(()=>{const We=H.current;if(!We)return;if(!(Si&&a==="clips")){Si||We.pause();return}if(!Ki.length)return;ss.current=ss.current%Ki.length,Ps.current=Ki[ss.current];const Mt=()=>{try{We.currentTime=Ps.current}catch{}const Xt=We.play();Xt&&typeof Xt.catch=="function"&&Xt.catch(()=>{})},Ot=()=>Mt(),zt=()=>{if(Ki.length&&We.currentTime-Ps.current>=y){ss.current=(ss.current+1)%Ki.length,Ps.current=Ki[ss.current];try{We.currentTime=Ps.current+.01}catch{}}};return We.addEventListener("loadedmetadata",Ot),We.addEventListener("timeupdate",zt),We.readyState>=1&&Mt(),()=>{We.removeEventListener("loadedmetadata",Ot),We.removeEventListener("timeupdate",zt),We.pause()}},[Si,a,Mi,y,Ki]);const ni=(tt||qe)&&(i||n)&&!rt&&!Kt&&(i&&!De||n&&!Ye),Fs=!!ds&&(qi==="teaser"||!Kt&&Ji&&a==="teaser"),tn=p.jsxs("div",{ref:de,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",Di,T??""].join(" "),onMouseEnter:Ct?()=>Wt(!0):void 0,onMouseLeave:Ct?()=>Wt(!1):void 0,onFocus:Ct?()=>Wt(!0):void 0,onBlur:Ct?()=>Wt(!1):void 0,"data-duration":De?String(Ze):void 0,"data-res":Ye?`${be}x${ve}`:void 0,"data-size":typeof we=="number"?String(we):void 0,"data-fps":typeof He=="number"?String(He):void 0,children:[ui&&hi&&vt?p.jsx("img",{src:hi,loading:N?"eager":"lazy",decoding:"async",alt:ie,className:["absolute inset-0 w-full h-full object-cover",K].filter(Boolean).join(" "),onError:()=>Ge(!1)}):p.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Kt?_.createElement("video",{...wt,ref:We=>{Yt.current=We,ee("inline",We)},key:`inline-${oi}-${R}`,src:wi,className:["absolute inset-0 w-full h-full object-cover",K,j?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:L,controls:j,loop:F,poster:Ui&&hi||void 0,onLoadedMetadata:ti,onError:()=>ut(!1)}):null,!Kt&&rs&&!(Si&&a==="teaser")?p.jsx("video",{src:li,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>Re(!0),onCanPlay:()=>Re(!0),onError:()=>{Ue(!1),Re(!1)}},`teaser-prewarm-${oi}`):null,!Kt&&Si&&a==="teaser"?p.jsx("video",{ref:We=>{Nt.current=We,ee("teaser",We)},src:li,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",K,at?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:L,playsInline:!0,autoPlay:!0,loop:!0,preload:at?"auto":"metadata",poster:Ui&&hi||void 0,onLoadedData:()=>Re(!0),onPlaying:()=>Re(!0),onError:()=>{Ue(!1),Re(!1)}},`teaser-mp4-${oi}`):null,!Kt&&Si&&a==="clips"?p.jsx("video",{ref:We=>{H.current=We,ee("clips",We)},src:wi,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",K].filter(Boolean).join(" "),muted:L,playsInline:!0,preload:"metadata",poster:Ui&&hi||void 0,onError:()=>ut(!1)},`clips-${oi}-${Mi}`):null,ji?p.jsxs("div",{"aria-hidden":"true",className:["absolute left-0 right-0 bottom-0 z-40 pointer-events-none","h-0.5 group-hover:h-1","transition-[height] duration-150 ease-out","rounded-none group-hover:rounded-full","bg-black/35 dark:bg-white/10","overflow-hidden group-hover:overflow-visible"].join(" "),children:[Fs?p.jsx("div",{className:"absolute inset-0",children:ds.map((We,Mt)=>p.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${We.left*100}%`,width:`${We.width*100}%`}},`seg-${Mt}-${We.left.toFixed(6)}-${We.width.toFixed(6)}`))}):null,p.jsx("div",{className:["absolute inset-0 origin-left",qi==="teaser"?"":"transition-transform duration-150 ease-out"].join(" "),style:{transform:`scaleX(${Tt(as)})`,background:"rgba(99,102,241,0.95)"}})]}):null,ni?p.jsx("video",{src:wi,preload:"metadata",muted:L,playsInline:!0,className:"hidden",onLoadedMetadata:ti}):null]});return E?p.jsx(JA,{content:We=>We&&p.jsx("div",{className:"w-[420px]",children:p.jsx("div",{className:"aspect-video",children:p.jsx("video",{src:wi,className:["w-full h-full bg-black",K].filter(Boolean).join(" "),muted:W,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation()})})}),children:tn}):tn}function $i(...s){return s.filter(Boolean).join(" ")}const VM=s=>(s||"").replaceAll("\\","/").trim().split("/").pop()||"",GM=s=>s.startsWith("HOT ")?s.slice(4):s,qM=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function KM(s){const t=GM(VM(s||"")).replace(/\.[^.]+$/,""),i=t.match(qM);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t||null}function pa({job:s,variant:e="overlay",collapseToMenu:t=!1,inlineCount:i,busy:n=!1,compact:r=!1,isHot:a=!1,isFavorite:u=!1,isLiked:c=!1,isWatching:d=!1,onToggleFavorite:f,onToggleLike:g,onToggleHot:y,onKeep:v,onDelete:b,onToggleWatch:T,onAddToDownloads:E,order:D,className:O}){const R=e==="overlay"?r?"p-1.5":"p-2":"p-1.5",j=r?"size-4":"size-5",F="h-full w-full",G=e==="table"?`inline-flex items-center justify-center rounded-md ${R} hover:bg-gray-100/70 dark:hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`:`inline-flex items-center justify-center rounded-md bg-white/75 ${R} text-gray-900 backdrop-blur ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/60 dark:focus-visible:ring-white/40 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`,L=e==="table"?{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-500 dark:text-gray-300",keep:"text-emerald-600 dark:text-emerald-300",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-300"}:{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-800/90 dark:text-white/90",keep:"text-emerald-600 dark:text-emerald-200",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-200"},W=D??["watch","favorite","like","hot","keep","delete","details"],I=Nt=>W.includes(Nt),N=String(s?.sourceUrl??"").trim(),X=KM(s.output||""),V=X?`Mehr zu ${X} anzeigen`:"Mehr anzeigen",Y=I("favorite"),ne=I("like"),ie=I("hot"),K=I("watch"),q=I("keep"),Z=I("delete"),te=I("details")&&!!X,le=I("add"),[z,re]=_.useState("idle"),Q=_.useRef(null);_.useEffect(()=>()=>{Q.current&&window.clearTimeout(Q.current)},[]);const pe=()=>{re("ok"),Q.current&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>re("idle"),800)},be=async()=>{if(n||z==="busy"||!E&&!!!N)return!1;re("busy");try{let H=!0;return E?H=await E(s)!==!1:N?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:N}})),H=!0):H=!1,H?pe():re("idle"),H}catch{return re("idle"),!1}},[ve,we]=_.useState(0),[He,Fe]=_.useState(4),Ze=Nt=>H=>{H.preventDefault(),H.stopPropagation(),!(n||!Nt)&&Promise.resolve(Nt(s)).catch(()=>{})},De=te?p.jsxs("button",{type:"button",className:$i(G),title:V,"aria-label":V,disabled:n,onClick:Nt=>{Nt.preventDefault(),Nt.stopPropagation(),!n&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:X}}))},children:[p.jsx("span",{className:$i("inline-flex items-center justify-center",j),children:p.jsx(Q_,{className:$i(F,L.off)})}),p.jsx("span",{className:"sr-only",children:V})]}):null,Ye=le?p.jsxs("button",{type:"button",className:$i(G),title:N?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:n||z==="busy"||!E&&!N,onClick:async Nt=>{Nt.preventDefault(),Nt.stopPropagation(),await be()},children:[p.jsx("span",{className:$i("inline-flex items-center justify-center",j),children:z==="ok"?p.jsx(kM,{className:$i(F,"text-emerald-600 dark:text-emerald-300")}):p.jsx(K_,{className:$i(F,L.off)})}),p.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,wt=Y?p.jsx("button",{type:"button",className:G,title:u?"Favorit entfernen":"Als Favorit markieren","aria-label":u?"Favorit entfernen":"Als Favorit markieren","aria-pressed":u,disabled:n||!f,onClick:Ze(f),children:p.jsxs("span",{className:$i("relative inline-block",j),children:[p.jsx(y0,{className:$i("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,L.off)}),p.jsx(Oc,{className:$i("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,L.favOn)})]})}):null,vt=ne?p.jsx("button",{type:"button",className:G,title:c?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-label":c?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-pressed":c,disabled:n||!g,onClick:Ze(g),children:p.jsxs("span",{className:$i("relative inline-block",j),children:[p.jsx(Th,{className:$i("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",c?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,L.off)}),p.jsx(Tu,{className:$i("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",c?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,L.likeOn)})]})}):null,Ge=ie?p.jsx("button",{type:"button","data-hot-target":!0,className:G,title:a?"HOT entfernen":"Als HOT markieren","aria-label":a?"HOT entfernen":"Als HOT markieren","aria-pressed":a,disabled:n||!y,onClick:Ze(y),children:p.jsxs("span",{className:$i("relative inline-block",j),children:[p.jsx(X_,{className:$i("absolute inset-0 transition-all duration-200 ease-out",a?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,L.off)}),p.jsx(cx,{className:$i("absolute inset-0 transition-all duration-200 ease-out",a?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,L.hotOn)})]})}):null,ke=K?p.jsx("button",{type:"button",className:G,title:d?"Watched entfernen":"Als Watched markieren","aria-label":d?"Watched entfernen":"Als Watched markieren","aria-pressed":d,disabled:n||!T,onClick:Ze(T),children:p.jsxs("span",{className:$i("relative inline-block",j),children:[p.jsx(g0,{className:$i("absolute inset-0 transition-all duration-200 ease-out",d?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",F,L.off)}),p.jsx(bu,{className:$i("absolute inset-0 transition-all duration-200 ease-out",d?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",F,L.watchOn)})]})}):null,ut=q?p.jsx("button",{type:"button",className:G,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:n||!v,onClick:Ze(v),children:p.jsx("span",{className:$i("inline-flex items-center justify-center",j),children:p.jsx(W_,{className:$i(F,L.keep)})})}):null,rt=Z?p.jsx("button",{type:"button",className:G,title:"Löschen","aria-label":"Löschen",disabled:n||!b,onClick:Ze(b),children:p.jsx("span",{className:$i("inline-flex items-center justify-center",j),children:p.jsx(J_,{className:$i(F,L.del)})})}):null,Je={details:De,add:Ye,favorite:wt,like:vt,watch:ke,hot:Ge,keep:ut,delete:rt},at=t,Re=W.filter(Nt=>!!Je[Nt]),ze=at&&typeof i!="number",qe=(r?16:20)+(e==="overlay"?r?6:8:6)*2,ht=r?2:3,tt=_.useMemo(()=>{if(!ze)return i??ht;const Nt=ve||0;if(Nt<=0)return Math.min(Re.length,ht);for(let H=Re.length;H>=0;H--)if(H*qe+qe+(H>0?H*He:0)<=Nt)return H;return 0},[ze,i,ht,ve,Re.length,qe,He]),At=at?Re.slice(0,tt):Re,ft=at?Re.slice(tt):[],[Et,Lt]=_.useState(!1),Rt=_.useRef(null);_.useLayoutEffect(()=>{const Nt=Rt.current;if(!Nt||typeof window>"u")return;const H=()=>{const ee=Rt.current;if(!ee)return;const Te=Math.floor(ee.getBoundingClientRect().width||0);Te>0&&we(Te);const Me=window.getComputedStyle(ee),gt=Me.columnGap||Me.gap||"0",Tt=parseFloat(gt);Number.isFinite(Tt)&&Tt>=0&&Fe(Tt)};H();const U=new ResizeObserver(()=>H());return U.observe(Nt),window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H),U.disconnect()}},[]);const qt=_.useRef(null),Wt=_.useRef(null),yi=208,Ct=4,It=8,[oi,wi]=_.useState(null);_.useEffect(()=>{if(!Et)return;const Nt=U=>{U.key==="Escape"&&Lt(!1)},H=U=>{const ee=Rt.current,Te=Wt.current,Me=U.target;ee&&ee.contains(Me)||Te&&Te.contains(Me)||Lt(!1)};return window.addEventListener("keydown",Nt),window.addEventListener("mousedown",H),()=>{window.removeEventListener("keydown",Nt),window.removeEventListener("mousedown",H)}},[Et]),_.useLayoutEffect(()=>{if(!Et){wi(null);return}const Nt=()=>{const H=qt.current;if(!H)return;const U=H.getBoundingClientRect(),ee=window.innerWidth,Te=window.innerHeight;let Me=U.right-yi;Me=Math.max(It,Math.min(Me,ee-yi-It));let gt=U.bottom+Ct;gt=Math.max(It,Math.min(gt,Te-It));const Tt=Math.max(120,Te-gt-It);wi({top:gt,left:Me,maxH:Tt})};return Nt(),window.addEventListener("resize",Nt),window.addEventListener("scroll",Nt,!0),()=>{window.removeEventListener("resize",Nt),window.removeEventListener("scroll",Nt,!0)}},[Et]);const Di=()=>{X&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:X}}))},Yt=Nt=>Nt==="details"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n,onClick:H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),Di()},children:[p.jsx(Q_,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:"Details"})]},"details"):Nt==="add"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!E&&!N,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await be()},children:[p.jsx(K_,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):Nt==="favorite"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!f,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await f?.(s)},children:[u?p.jsx(Oc,{className:$i("size-4",L.favOn)}):p.jsx(y0,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:u?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):Nt==="like"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!g,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await g?.(s)},children:[c?p.jsx(Tu,{className:$i("size-4",L.favOn)}):p.jsx(Th,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:c?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):Nt==="watch"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!T,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await T?.(s)},children:[d?p.jsx(bu,{className:$i("size-4",L.favOn)}):p.jsx(g0,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:d?"Watched entfernen":"Watched"})]},"watch"):Nt==="hot"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!y,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await y?.(s)},children:[a?p.jsx(cx,{className:$i("size-4",L.favOn)}):p.jsx(X_,{className:$i("size-4",L.off)}),p.jsx("span",{className:"truncate",children:a?"HOT entfernen":"Als HOT markieren"})]},"hot"):Nt==="keep"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!v,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await v?.(s)},children:[p.jsx(W_,{className:$i("size-4",L.keep)}),p.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):Nt==="delete"?p.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:n||!b,onClick:async H=>{H.preventDefault(),H.stopPropagation(),Lt(!1),await b?.(s)},children:[p.jsx(J_,{className:$i("size-4",L.del)}),p.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return p.jsxs("div",{ref:Rt,className:$i("relative flex items-center flex-nowrap",O??"gap-2"),children:[At.map(Nt=>{const H=Je[Nt];return H?p.jsx(_.Fragment,{children:H},Nt):null}),at&&ft.length>0?p.jsxs("div",{className:"relative",children:[p.jsx("button",{ref:qt,type:"button",className:G,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":Et,disabled:n,onClick:Nt=>{Nt.preventDefault(),Nt.stopPropagation(),!n&&Lt(H=>!H)},children:p.jsx("span",{className:$i("inline-flex items-center justify-center",j),children:p.jsx(KO,{className:$i(F,L.off)})})}),Et&&oi&&typeof document<"u"?Ic.createPortal(p.jsx("div",{ref:Wt,role:"menu",className:"rounded-md bg-white/95 dark:bg-gray-900/95 shadow-lg ring-1 ring-black/10 dark:ring-white/10 p-1 z-[9999] overflow-auto",style:{position:"fixed",top:oi.top,left:oi.left,width:yi,maxHeight:oi.maxH},onClick:Nt=>Nt.stopPropagation(),children:ft.map(Yt)}),document.body):null]}):null]})}function fa({tag:s,children:e,title:t,active:i,onClick:n,maxWidthClassName:r="max-w-[11rem]",className:a,stopPropagation:u=!0}){const c=s??(typeof e=="string"||typeof e=="number"?String(e):""),d=vi("inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs",r,"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-200"),y=vi(d,i?"bg-sky-100 text-sky-800 dark:bg-sky-400/20 dark:text-sky-100":"",n?"cursor-pointer hover:bg-sky-100 dark:hover:bg-sky-400/20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500":"",a),v=T=>T.stopPropagation(),b=u?{onPointerDown:v,onMouseDown:v}:{};return n?p.jsx("button",{type:"button",className:y,title:t??c,"aria-pressed":!!i,...b,onClick:T=>{u&&(T.preventDefault(),T.stopPropagation()),c&&n(c)},children:e??s}):p.jsx("span",{className:y,title:t??c,...b,onClick:u?v:void 0,children:e??s})}function hb({rowKey:s,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:n,maxVisible:r,maxWidthClassName:a,gapPx:u=6,className:c}){const[d,f]=_.useState(!1),g=_.useRef(null),y=_.useRef(null),v=_.useRef(null);_.useEffect(()=>f(!1),[s]),_.useEffect(()=>{if(!d)return;const L=W=>{W.key==="Escape"&&f(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[d]);const b=_.useMemo(()=>typeof r=="number"&&r>0?r:Number.POSITIVE_INFINITY,[r]),T=_.useMemo(()=>[...e].sort((L,W)=>L.localeCompare(W,void 0,{sensitivity:"base"})),[e]),[E,D]=_.useState(()=>{const L=Math.min(T.length,b);return Math.min(L,6)}),O=_.useCallback(()=>{const L=g.current,W=y.current;if(!L||!W)return;const I=Math.floor(L.getBoundingClientRect().width);if(I<=0)return;const N=Math.min(T.length,b);if(N<=0){D(0);return}const V=Array.from(W.children).map(q=>q.offsetWidth).slice(0,N),Y=v.current?.offsetWidth??0,ne=2,ie=q=>{let Z=0,te=0;for(let le=0;le0?u:0);if(Z+z<=q-ne)Z+=z,te++;else break}return te};let K=ie(I);if(K0?Y+u:0,Z=Math.max(0,I-q);K=ie(Z),K=Math.max(0,K)}D(Math.max(0,Math.min(K,N)))},[T,b,u]);_.useLayoutEffect(()=>{O()},[O,T.join("\0"),a,b]),_.useEffect(()=>{const L=g.current;if(!L)return;const W=new ResizeObserver(()=>O());return W.observe(L),()=>W.disconnect()},[O]);const R=Math.min(T.length,b),j=T.slice(0,Math.min(E,R)),F=L=>L.stopPropagation(),G=T.length-j.length;return p.jsxs(p.Fragment,{children:[d?null:p.jsxs("div",{ref:g,className:["mt-2 h-6 flex items-center gap-1.5",c].filter(Boolean).join(" "),onClick:F,onMouseDown:F,onPointerDown:F,children:[p.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:p.jsx("div",{className:"flex flex-nowrap items-center gap-1.5",children:j.length>0?j.map(L=>p.jsx(fa,{tag:L,active:t.has(i(L)),onClick:n,maxWidthClassName:a},L)):p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),G>0?p.jsxs("button",{type:"button",className:["inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs","cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500","bg-gray-100 text-gray-700 hover:bg-gray-200/70","dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20"].join(" "),onClick:L=>{L.preventDefault(),L.stopPropagation(),f(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",G]}):null]}),d?p.jsxs("div",{className:["absolute inset-0 z-30","bg-white/60 dark:bg-gray-950","px-3 py-3","pointer-events-auto"].join(" "),onClick:F,onMouseDown:F,onPointerDown:F,role:"dialog","aria-label":"Tags",children:[p.jsx("button",{type:"button",className:`\r absolute right-2 top-2 z-10\r rounded-md bg-gray-100/80 px-2 py-1 text-xs font-semibold text-gray-700\r hover:bg-gray-200/80\r dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20\r - `,onClick:()=>f(!1),"aria-label":"Schließen",title:"Schließen",children:"✕"}),g.jsx("div",{className:"h-full overflow-auto pr-1",children:g.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.map(N=>g.jsx($a,{tag:N,active:t.has(i(N)),onClick:n,maxWidthClassName:a},N))})})]}):null,g.jsxs("div",{className:"absolute -left-[9999px] -top-[9999px] opacity-0 pointer-events-none",children:[g.jsx("div",{ref:y,className:"flex flex-nowrap items-center gap-1.5",children:T.slice(0,R).map(N=>g.jsx($a,{tag:N,active:t.has(i(N)),onClick:n,maxWidthClassName:a},N))}),g.jsx("button",{ref:v,type:"button",className:"inline-flex items-center rounded-md bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-200",children:"+99"})]})]})}const GA=/^HOT[ \u00A0]+/i,qA=s=>String(s||"").replaceAll(" "," "),gc=s=>GA.test(qA(s)),Eo=s=>qA(s).replace(GA,"");function cb(s){if(!s)return"";const e=Math.round(Number(s.w)),t=Math.round(Number(s.h));if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return"";const i=Math.min(e,t),n=Math.max(12,Math.round(i*.02)),r=a=>Math.abs(i-a)<=n;return r(4320)?"8K":r(2160)||i>=2e3?"4K":r(1440)?"1440p":r(1080)?"1080p":r(720)?"720p":r(480)?"480p":r(360)?"360p":r(240)?"240p":`${i}p`}const jM=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n};function $M({rows:s,isSmall:e,isLoading:t,teaserPlayback:i,teaserAudio:n,hoverTeaserKey:r,blurPreviews:a,teaserKey:u,inlinePlay:c,deletingKeys:d,keepingKeys:f,removingKeys:p,swipeRefs:y,assetNonce:v,keyFor:b,baseName:T,modelNameFromOutput:E,runtimeOf:D,sizeBytesOf:O,formatBytes:R,lower:j,onHoverPreviewKeyChange:F,onOpenPlayer:z,openPlayer:N,startInline:Y,tryAutoplayInline:L,registerTeaserHost:I,deleteVideo:X,keepVideo:G,modelsByKey:q,activeTagSet:ae,onToggleTagFilter:ie,onToggleHot:W,onToggleFavorite:K,onToggleLike:Q,onToggleWatch:te}){const re=_.useCallback(Me=>{const Re=(typeof Me.meta?.videoWidth=="number"&&Number.isFinite(Me.meta.videoWidth)?Me.meta.videoWidth:0)||(typeof Me.videoWidth=="number"&&Number.isFinite(Me.videoWidth)?Me.videoWidth:0),Ae=(typeof Me.meta?.videoHeight=="number"&&Number.isFinite(Me.meta.videoHeight)?Me.meta.videoHeight:0)||(typeof Me.videoHeight=="number"&&Number.isFinite(Me.videoHeight)?Me.videoHeight:0);return Re>0&&Ae>0?{w:Re,h:Ae}:null},[]),U=(Me,Re)=>{const Ae=b(Me),be=c?.key===Ae,Pe=Re?.disableInline?!1:be,Ye=!(!Re?.forceStill&&!!n&&(Pe||r===Ae)),lt=Pe?c?.nonce??0:0,Ve=!!Re?.forceLoadStill,ht=Re?.forceStill?!1:Re?.mobileStackTopOnlyVideo?i==="all"||(i==="hover"?u===Ae:!1):i==="all"?!0:i==="hover"?u===Ae:!1,st=d.has(Ae)||f.has(Ae)||p.has(Ae),ct=E(Me.output),Ke=T(Me.output||""),_t=gc(Ke),pe=q[j(ct)],We=!!pe?.favorite,Je=pe?.liked===!0,ot=!!pe?.watching,St=jM(pe?.tags),vt=D(Me),Vt=R(O(Me)),si=re(Me),$t=cb(si),Pt=`inline-prev-${encodeURIComponent(Ae)}`,Ht=["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200",!e&&"hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",st&&"pointer-events-none opacity-70",d.has(Ae)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",f.has(Ae)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",p.has(Ae)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),ui=g.jsx("div",{role:"button",tabIndex:0,className:Ht,onClick:e?void 0:()=>N(Me),onKeyDown:xt=>{(xt.key==="Enter"||xt.key===" ")&&z(Me)},children:g.jsxs(ca,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[g.jsx("div",{id:Pt,ref:Re?.disableInline||Re?.isDecorative?void 0:I(Ae),className:"relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||Re?.disablePreviewHover?void 0:()=>F?.(Ae),onMouseLeave:e||Re?.disablePreviewHover?void 0:()=>F?.(null),onClick:xt=>{xt.preventDefault(),xt.stopPropagation(),!(e||Re?.disableInline)&&Y(Ae)},children:g.jsxs("div",{className:"absolute inset-0",children:[Pe?null:g.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 "+(Pe?"opacity-0":"opacity-100"),children:g.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[vt,si?`${si.w}×${si.h}`:$t||"",Vt].filter(Boolean).join(" • "),children:[g.jsx("span",{children:vt}),$t?g.jsx("span",{"aria-hidden":"true",children:"•"}):null,$t?g.jsx("span",{children:$t}):null,g.jsx("span",{"aria-hidden":"true",children:"•"}),g.jsx("span",{children:Vt})]})}),g.jsx(g0,{job:Me,getFileName:T,className:"h-full w-full",showPopover:!1,blur:Pe?!1:!!a,animated:ht,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!Re?.disableInline&&Pe?"always":!1,inlineNonce:lt,inlineControls:Pe,inlineLoop:!1,muted:Ye,popoverMuted:Ye,assetNonce:v??0,alwaysLoadStill:Ve||!0,teaserPreloadEnabled:Re?.mobileStackTopOnlyVideo?!0:!e,teaserPreloadRootMargin:e?"900px 0px":"700px 0px"})]})}),g.jsxs("div",{className:"relative min-h-[112px] overflow-hidden px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:ct}),g.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[_t?g.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,g.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:Eo(Ke)||"—"})]})]}),g.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[ot?g.jsx(xu,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Je?g.jsx(bu,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,We?g.jsx(Ic,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),g.jsx("div",{className:"mt-2",onClick:xt=>xt.stopPropagation(),onMouseDown:xt=>xt.stopPropagation(),children:g.jsx("div",{className:"w-full",children:g.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:g.jsx(ja,{job:Me,variant:"table",busy:st,collapseToMenu:!0,compact:!1,isHot:_t,isFavorite:We,isLiked:Je,isWatching:ot,onToggleWatch:te,onToggleFavorite:K,onToggleLike:Q,onToggleHot:W,onKeep:G,onDelete:X,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),g.jsx("div",{className:"mt-2",onClick:xt=>xt.stopPropagation(),onMouseDown:xt=>xt.stopPropagation(),children:g.jsx(ub,{rowKey:Ae,tags:St,activeTagSet:ae,lower:j,onToggleTagFilter:ie})})]})]})});return{k:Ae,j:Me,busy:st,isHot:_t,inlineDomId:Pt,cardInner:ui}},ne=3,Z=e?s.slice(0,ne):[],fe=e?s:[],xe=15,ge=24,Ce=(Math.min(Z.length,ne)-1)*xe;return g.jsxs("div",{className:"relative",children:[e?g.jsx("div",{className:"relative",children:s.length===0?null:g.jsxs("div",{className:"relative mx-auto w-full max-w-[560px] overflow-visible",children:[g.jsx("div",{className:"relative overflow-visible",style:{minHeight:Ce>0?`${Ce}px`:void 0,paddingTop:`${Ce+ge}px`},children:Z.map((Me,Re)=>{const Ae=Re===0,{k:be,busy:Pe,isHot:gt,cardInner:Ye,inlineDomId:lt}=U(Me,Ae?{forceLoadStill:!0,mobileStackTopOnlyVideo:!0}:{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0}),Ve=Re,ht=-(Ve*xe),st=1-Ve*.03,ct=1-Ve*.14;return Ae?g.jsx("div",{className:"absolute inset-x-0 top-0",style:{zIndex:30,transform:`translateY(${ht}px) scale(${st})`,transformOrigin:"top center"},children:g.jsx(OM,{ref:Ke=>{Ke?y.current.set(be,Ke):y.current.delete(be)},enabled:!0,disabled:Pe,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{gt||await W?.(Me)},onTap:()=>{Y(be),requestAnimationFrame(()=>{L(lt)||requestAnimationFrame(()=>L(lt))})},onSwipeLeft:()=>X(Me),onSwipeRight:()=>G(Me),children:Ye})},be):g.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none",style:{zIndex:20-Ve,transform:`translateY(${ht}px) scale(${st}) translateZ(0)`,opacity:ct,transformOrigin:"top center"},"aria-hidden":"true",children:g.jsxs("div",{className:"relative",children:[Ye,g.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},be)}).reverse()}),fe.length>ne?g.jsx("div",{className:"sr-only","aria-hidden":"true",children:fe.slice(ne).map(Me=>{const Re=b(Me);return g.jsx("div",{className:"relative aspect-video",children:g.jsx(g0,{job:Me,getFileName:T,className:"h-full w-full",showPopover:!1,blur:!!a,animated:!1,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!1,inlineControls:!1,inlineLoop:!1,muted:!0,popoverMuted:!0,assetNonce:v??0,alwaysLoadStill:!0,teaserPreloadEnabled:!1})},`preload-still-${Re}`)})}):null,s.length>1?g.jsx("div",{className:"mt-2 text-center text-xs text-gray-500 dark:text-gray-400",children:"Wische nach links zum Löschen • nach rechts zum Behalten"}):null]})}):g.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:s.map(Me=>{const{k:Re,cardInner:Ae}=U(Me);return g.jsx(_.Fragment,{children:Ae},Re)})}),t&&s.length===0?g.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:g.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[g.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),g.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function HM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const zM=_.forwardRef(HM);function VM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const GM=_.forwardRef(VM);function qM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const KM=_.forwardRef(qM);function WM({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const YM=_.forwardRef(WM);function cr(...s){return s.filter(Boolean).join(" ")}function Z_(s){return s==="center"?"text-center":s==="right"?"text-right":"text-left"}function XM(s){return s==="center"?"justify-center":s==="right"?"justify-end":"justify-start"}function J_(s,e){const t=s===0,i=s===e-1;return t||i?"pl-2 pr-2":"px-2"}function e2(s){return s==null?{isNull:!0,kind:"string",value:""}:s instanceof Date?{isNull:!1,kind:"number",value:s.getTime()}:typeof s=="number"?{isNull:!1,kind:"number",value:s}:typeof s=="boolean"?{isNull:!1,kind:"number",value:s?1:0}:typeof s=="bigint"?{isNull:!1,kind:"number",value:Number(s)}:{isNull:!1,kind:"string",value:String(s).toLocaleLowerCase()}}function Th({columns:s,rows:e,getRowKey:t,title:i,description:n,actions:r,fullWidth:a=!1,card:u=!0,striped:c=!1,stickyHeader:d=!1,compact:f=!1,isLoading:p=!1,emptyLabel:y="Keine Daten vorhanden.",className:v,rowClassName:b,onRowClick:T,onRowContextMenu:E,sort:D,onSortChange:O,defaultSort:R=null}){const j=f?"py-2":"py-4",F=f?"py-3":"py-3.5",z=D!==void 0,[N,Y]=_.useState(R),L=z?D:N,I=_.useCallback(G=>{z||Y(G),O?.(G)},[z,O]),X=_.useMemo(()=>{if(!L)return e;const G=s.find(ie=>ie.key===L.key);if(!G)return e;const q=L.direction==="asc"?1:-1,ae=e.map((ie,W)=>({r:ie,i:W}));return ae.sort((ie,W)=>{let K=0;if(G.sortFn)K=G.sortFn(ie.r,W.r);else{const Q=G.sortValue?G.sortValue(ie.r):ie.r?.[G.key],te=G.sortValue?G.sortValue(W.r):W.r?.[G.key],re=e2(Q),U=e2(te);re.isNull&&!U.isNull?K=1:!re.isNull&&U.isNull?K=-1:re.kind==="number"&&U.kind==="number"?K=re.valueU.value?1:0:K=String(re.value).localeCompare(String(U.value),void 0,{numeric:!0})}return K===0?ie.i-W.i:K*q}),ae.map(ie=>ie.r)},[e,s,L]);return g.jsxs("div",{className:cr(a?"":"px-4 sm:px-6 lg:px-8",v),children:[(i||n||r)&&g.jsxs("div",{className:"sm:flex sm:items-center",children:[g.jsxs("div",{className:"sm:flex-auto",children:[i&&g.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-white",children:i}),n&&g.jsx("p",{className:"mt-2 text-sm text-gray-700 dark:text-gray-300",children:n})]}),r&&g.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-16 sm:flex-none",children:r})]}),g.jsx("div",{className:cr(i||n||r?"mt-8":""),children:g.jsx("div",{className:"flow-root",children:g.jsx("div",{className:"overflow-x-auto",children:g.jsx("div",{className:cr("inline-block min-w-full align-middle",a?"":"sm:px-6 lg:px-8"),children:g.jsx("div",{className:cr(u&&"overflow-hidden shadow-sm outline-1 outline-black/5 rounded-lg dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"),children:g.jsxs("table",{className:"relative min-w-full divide-y divide-gray-200 dark:divide-white/10",children:[g.jsx("thead",{className:cr(u&&"bg-gray-50/90 dark:bg-gray-800/70",d&&"sticky top-0 z-10 backdrop-blur-sm shadow-sm"),children:g.jsx("tr",{children:s.map((G,q)=>{const ae=J_(q,s.length),ie=!!L&&L.key===G.key,W=ie?L.direction:void 0,K=G.sortable&&!G.srOnlyHeader?ie?W==="asc"?"ascending":"descending":"none":void 0,Q=()=>{if(!(!G.sortable||G.srOnlyHeader))return I(ie?W==="asc"?{key:G.key,direction:"desc"}:null:{key:G.key,direction:"asc"})};return g.jsx("th",{scope:"col","aria-sort":K,className:cr(F,ae,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",Z_(G.align),G.widthClassName,G.headerClassName),children:G.srOnlyHeader?g.jsx("span",{className:"sr-only",children:G.header}):G.sortable?g.jsxs("button",{type:"button",onClick:Q,className:cr("group inline-flex w-full items-center gap-2 select-none rounded-md px-1.5 py-1 -my-1 hover:bg-gray-100/70 dark:hover:bg-white/5",XM(G.align)),children:[g.jsx("span",{children:G.header}),g.jsx("span",{className:cr("flex-none rounded-sm text-gray-400 dark:text-gray-500",ie?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:g.jsx(zM,{"aria-hidden":"true",className:cr("size-5 transition-transform",ie&&W==="asc"&&"rotate-180")})})]}):G.header},G.key)})})}),g.jsx("tbody",{className:cr("divide-y divide-gray-200 dark:divide-white/10",u?"bg-white dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),children:p?g.jsx("tr",{children:g.jsx("td",{colSpan:s.length,className:cr(j,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):X.length===0?g.jsx("tr",{children:g.jsx("td",{colSpan:s.length,className:cr(j,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:y})}):X.map((G,q)=>{const ae=t?t(G,q):String(q);return g.jsx("tr",{className:cr(c&&"even:bg-gray-50 dark:even:bg-gray-800/50",T&&"cursor-pointer",T&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",b?.(G,q)),onClick:()=>T?.(G),onContextMenu:E?ie=>{ie.preventDefault(),E(G,ie)}:void 0,children:s.map((ie,W)=>{const K=J_(W,s.length),Q=ie.cell?.(G,q)??ie.accessor?.(G)??G?.[ie.key];return g.jsx("td",{className:cr(j,K,"text-sm whitespace-nowrap",Z_(ie.align),ie.className,ie.key===s[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Q},ie.key)})},ae)})})]})})})})})})]})}function QM({rows:s,isLoading:e,keyFor:t,baseName:i,lower:n,modelNameFromOutput:r,runtimeOf:a,sizeBytesOf:u,formatBytes:c,resolutions:d,durations:f,canHover:p,teaserAudio:y,hoverTeaserKey:v,setHoverTeaserKey:b,teaserPlayback:T="hover",teaserKey:E,registerTeaserHost:D,handleDuration:O,handleResolution:R,blurPreviews:j,assetNonce:F,deletingKeys:z,keepingKeys:N,removingKeys:Y,modelsByKey:L,activeTagSet:I,onToggleTagFilter:X,onOpenPlayer:G,onSortModeChange:q,page:ae,onPageChange:ie,onToggleHot:W,onToggleFavorite:K,onToggleLike:Q,onToggleWatch:te,deleteVideo:re,keepVideo:U}){const[ne,Z]=_.useState(null),fe=_.useCallback(Ae=>{const be=Ae?.durationSeconds;if(typeof be=="number"&&Number.isFinite(be)&&be>0)return be;const Pe=Date.parse(String(Ae?.startedAt||"")),gt=Date.parse(String(Ae?.endedAt||""));if(Number.isFinite(Pe)&&Number.isFinite(gt)&>>Pe){const Ye=(gt-Pe)/1e3;if(Ye>=1&&Ye<=1440*60)return Ye}return Number.POSITIVE_INFINITY},[]),xe=_.useCallback(Ae=>{const be=String(Ae??"").trim();if(!be)return[];const Pe=be.split(/[\n,;|]+/g).map(lt=>lt.trim()).filter(Boolean),gt=new Set,Ye=[];for(const lt of Pe){const Ve=lt.toLowerCase();gt.has(Ve)||(gt.add(Ve),Ye.push(lt))}return Ye.sort((lt,Ve)=>lt.localeCompare(Ve,void 0,{sensitivity:"base"})),Ye},[]),ge=_.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Ae=>{const be=t(Ae),gt=!(!!y&&v===be);return g.jsx("div",{ref:D(be),className:"py-1",onClick:Ye=>Ye.stopPropagation(),onMouseDown:Ye=>Ye.stopPropagation(),onMouseEnter:()=>{p&&b(be)},onMouseLeave:()=>{p&&b(null)},children:g.jsx(g0,{job:Ae,getFileName:i,durationSeconds:f[be],muted:gt,popoverMuted:gt,onDuration:O,onResolution:R,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:j,animated:T==="all"?!0:T==="hover"?E===be:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:F})})}},{key:"Model",header:"Model",sortable:!0,sortValue:Ae=>{const be=i(Ae.output||""),Pe=gc(be),gt=r(Ae.output),Ye=Eo(be);return`${gt} ${Pe?"HOT":""} ${Ye}`.trim()},cell:Ae=>{const be=i(Ae.output||""),Pe=gc(be),gt=Eo(be),Ye=r(Ae.output),lt=n(r(Ae.output)),Ve=xe(L[lt]?.tags);return g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:Ye}),g.jsxs("div",{className:"mt-0.5 min-w-0 text-xs text-gray-500 dark:text-gray-400",children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("span",{className:"truncate",title:gt,children:gt||"—"}),(()=>{const ht=t(Ae),st=d[ht]??null,ct=cb(st);return ct?g.jsx("span",{className:`shrink-0 rounded-md bg-gray-100 px-1.5 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 - dark:bg-white/5 dark:text-gray-200 dark:ring-white/10`,title:st?`${st.w}×${st.h}`:"Auflösung",children:ct}):null})(),Pe?g.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[11px] font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null]}),Ve.length>0?g.jsx("div",{className:"mt-1",onClick:ht=>ht.stopPropagation(),onMouseDown:ht=>ht.stopPropagation(),children:g.jsx(ub,{rowKey:t(Ae),tags:Ve,activeTagSet:I,lower:n,onToggleTagFilter:X,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Ae=>{const be=Date.parse(String(Ae.endedAt||""));return Number.isFinite(be)?be:Number.NEGATIVE_INFINITY},cell:Ae=>{const be=Date.parse(String(Ae.endedAt||""));if(!Number.isFinite(be))return g.jsx("span",{className:"text-xs text-gray-400",children:"—"});const Pe=new Date(be),gt=Pe.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),Ye=Pe.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return g.jsxs("time",{dateTime:Pe.toISOString(),title:`${gt} ${Ye}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[g.jsx("span",{className:"font-medium",children:gt}),g.jsx("span",{className:"mx-1 text-gray-400 dark:text-gray-600",children:"·"}),g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:Ye})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Ae=>fe(Ae),cell:Ae=>g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a(Ae)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Ae=>{const be=u(Ae);return typeof be=="number"?be:Number.NEGATIVE_INFINITY},cell:Ae=>g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:c(u(Ae))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Ae=>{const be=t(Ae),Pe=z.has(be)||N.has(be)||Y.has(be),gt=i(Ae.output||""),Ye=gc(gt),lt=n(r(Ae.output)),Ve=L[lt],ht=!!Ve?.favorite,st=Ve?.liked===!0,ct=!!Ve?.watching;return g.jsx(ja,{job:Ae,variant:"table",busy:Pe,isHot:Ye,isFavorite:ht,isLiked:st,isWatching:ct,onToggleWatch:te,onToggleFavorite:K,onToggleLike:Q,onToggleHot:W,onKeep:U,onDelete:re,order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,f,y,v,D,p,b,O,R,j,T,E,F,n,r,L,I,X,d,z,N,Y,te,K,Q,W,U,re,u,c,a,xe,fe]),Ce=_.useCallback(Ae=>{if(!Ae)return"completed_desc";const be=Ae,Pe=String(be.key??be.columnKey??be.id??""),gt=String(be.dir??be.direction??be.order??"").toLowerCase(),Ye=gt==="asc"||gt==="1"||gt==="true";return Pe==="completedAt"?Ye?"completed_asc":"completed_desc":Pe==="runtime"?Ye?"duration_asc":"duration_desc":Pe==="size"?Ye?"size_asc":"size_desc":Pe==="Model"||Pe==="video"?Ye?"file_asc":"file_desc":Ye?"completed_asc":"completed_desc"},[]),Me=_.useCallback(Ae=>{Z(Ae),q(Ce(Ae)),ae!==1&&ie(1)},[q,Ce,ae,ie]),Re=_.useCallback(Ae=>{const be=t(Ae);return["transition-all duration-300",(z.has(be)||Y.has(be))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",z.has(be)&&"animate-pulse",(N.has(be)||Y.has(be))&&"pointer-events-none",N.has(be)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",Y.has(be)&&"opacity-0"].filter(Boolean).join(" ")},[t,z,N,Y]);return g.jsxs("div",{className:"relative",children:[g.jsx(Th,{rows:s,columns:ge,getRowKey:Ae=>t(Ae),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:ne,onSortChange:Me,onRowClick:G,rowClassName:Re}),e&&s.length===0?g.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:g.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[g.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),g.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function ZM({rows:s,isLoading:e,blurPreviews:t,durations:i,teaserPlayback:n,teaserAudio:r,hoverTeaserKey:a,teaserKey:u,handleDuration:c,keyFor:d,baseName:f,modelNameFromOutput:p,runtimeOf:y,sizeBytesOf:v,formatBytes:b,deletingKeys:T,keepingKeys:E,removingKeys:D,deletedKeys:O,registerTeaserHost:R,onHoverPreviewKeyChange:j,onOpenPlayer:F,deleteVideo:z,keepVideo:N,onToggleHot:Y,lower:L,modelsByKey:I,activeTagSet:X,onToggleTagFilter:G,onToggleFavorite:q,onToggleLike:ae,onToggleWatch:ie}){const W=n==="hover"||n==="all",K=_.useCallback(re=>U=>{if(!W){R(re)(null);return}R(re)(U)},[R,W]),Q=re=>{const U=String(re??"").trim();if(!U)return[];const ne=U.split(/[\n,;|]+/g).map(xe=>xe.trim()).filter(Boolean),Z=new Set,fe=[];for(const xe of ne){const ge=xe.toLowerCase();Z.has(ge)||(Z.add(ge),fe.push(xe))}return fe},te=_.useCallback(re=>{const U=(typeof re.meta?.videoWidth=="number"&&Number.isFinite(re.meta.videoWidth)?re.meta.videoWidth:0)||(typeof re.videoWidth=="number"&&Number.isFinite(re.videoWidth)?re.videoWidth:0),ne=(typeof re.meta?.videoHeight=="number"&&Number.isFinite(re.meta.videoHeight)?re.meta.videoHeight:0)||(typeof re.videoHeight=="number"&&Number.isFinite(re.videoHeight)?re.videoHeight:0);return U>0&&ne>0?{w:U,h:ne}:null},[]);return g.jsxs("div",{className:"relative",children:[g.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:s.map(re=>{const U=d(re),Z=!(!!r&&a===U),fe=p(re.output),xe=L(fe),ge=I[xe],Ce=!!ge?.favorite,Me=ge?.liked===!0,Re=!!ge?.watching,Ae=Q(ge?.tags),be=f(re.output||""),Pe=gc(be),gt=Eo(be),Ye=y(re),lt=b(v(re)),Ve=te(re),ht=cb(Ve),st=T.has(U)||E.has(U)||D.has(U),ct=O.has(U);return g.jsxs("div",{role:"button",tabIndex:0,className:["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",st&&"pointer-events-none opacity-70",T.has(U)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",D.has(U)&&"opacity-0 translate-y-2 scale-[0.98]",ct&&"hidden"].filter(Boolean).join(" "),onClick:()=>F(re),onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&F(re)},children:[g.jsx("div",{className:"group relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:K(U),onMouseEnter:()=>j?.(U),onMouseLeave:()=>j?.(null),children:g.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[g.jsx("div",{className:"absolute inset-0",children:g.jsx(g0,{job:re,getFileName:Ke=>Eo(f(Ke)),durationSeconds:i[U]??re?.durationSeconds,onDuration:c,variant:"fill",showPopover:!1,blur:t,animated:n==="all"?!0:n==="hover"?u===U:!1,animatedMode:"teaser",animatedTrigger:"always",clipSeconds:1,thumbSamples:18,muted:Z,popoverMuted:Z})}),g.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10",children:g.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Ye,Ve?`${Ve.w}×${Ve.h}`:ht||"",lt].filter(Boolean).join(" • "),children:[g.jsx("span",{children:Ye}),ht?g.jsx("span",{"aria-hidden":"true",children:"•"}):null,ht?g.jsx("span",{children:ht}):null,g.jsx("span",{"aria-hidden":"true",children:"•"}),g.jsx("span",{children:lt})]})})]})}),g.jsxs("div",{className:"relative min-h-[112px] overflow-hidden px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("div",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",children:fe}),g.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[Re?g.jsx(xu,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Me?g.jsx(bu,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Ce?g.jsx(Ic,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),g.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Pe?g.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,g.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:Eo(gt)||"—"})]}),g.jsx("div",{className:"mt-2",onClick:Ke=>Ke.stopPropagation(),onMouseDown:Ke=>Ke.stopPropagation(),children:g.jsx("div",{className:"w-full",children:g.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:g.jsx(ja,{job:re,variant:"table",busy:st,collapseToMenu:!0,compact:!0,isHot:Pe,isFavorite:Ce,isLiked:Me,isWatching:Re,onToggleWatch:ie,onToggleFavorite:q,onToggleLike:ae,onToggleHot:Y,onKeep:N,onDelete:z,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),g.jsx("div",{className:"mt-2",onClick:Ke=>Ke.stopPropagation(),onMouseDown:Ke=>Ke.stopPropagation(),children:g.jsx(ub,{rowKey:U,tags:Ae,activeTagSet:X,lower:L,onToggleTagFilter:G})})]})]},U)})}),e&&s.length===0?g.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:g.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[g.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),g.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function t2(s,e,t){return Math.max(e,Math.min(t,s))}function My(s,e){const t=[];for(let i=s;i<=e;i++)t.push(i);return t}function JM(s,e,t,i){if(s<=1)return[1];const n=1,r=s,a=My(n,Math.min(t,r)),u=My(Math.max(r-t+1,t+1),r),c=Math.max(Math.min(e-i,r-t-i*2-1),t+1),d=Math.min(Math.max(e+i,t+i*2+2),r-t),f=[];f.push(...a),c>t+1?f.push("ellipsis"):t+1t&&f.push(r-t),f.push(...u);const p=new Set;return f.filter(y=>{const v=String(y);return p.has(v)?!1:(p.add(v),!0)})}function e3({active:s,disabled:e,rounded:t,onClick:i,children:n,title:r}){const a=t==="l"?"rounded-l-md":t==="r"?"rounded-r-md":"";return g.jsx("button",{type:"button",disabled:e,onClick:e?void 0:i,title:r,className:Mi("relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:z-20 focus:outline-offset-0",a,e?"opacity-50 cursor-not-allowed":"cursor-pointer",s?"z-10 bg-indigo-600 text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:bg-indigo-500 dark:focus-visible:outline-indigo-500":"text-gray-900 inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:text-gray-200 dark:inset-ring-gray-700 dark:hover:bg-white/5"),"aria-current":s?"page":void 0,children:n})}function KA({page:s,pageSize:e,totalItems:t,onPageChange:i,siblingCount:n=1,boundaryCount:r=1,showSummary:a=!0,className:u,ariaLabel:c="Pagination",prevLabel:d="Previous",nextLabel:f="Next"}){const p=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),y=t2(s||1,1,p);if(p<=1)return null;const v=t===0?0:(y-1)*e+1,b=Math.min(y*e,t),T=JM(p,y,r,n),E=D=>i(t2(D,1,p));return g.jsxs("div",{className:Mi("flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6 dark:border-white/10 dark:bg-transparent",u),children:[g.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[g.jsx("button",{type:"button",onClick:()=>E(y-1),disabled:y<=1,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:d}),g.jsx("button",{type:"button",onClick:()=>E(y+1),disabled:y>=p,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:f})]}),g.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[g.jsx("div",{children:a?g.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",g.jsx("span",{className:"font-medium",children:v})," to"," ",g.jsx("span",{className:"font-medium",children:b})," of"," ",g.jsx("span",{className:"font-medium",children:t})," results"]}):null}),g.jsx("div",{children:g.jsxs("nav",{"aria-label":c,className:"isolate inline-flex -space-x-px rounded-md shadow-xs dark:shadow-none",children:[g.jsxs("button",{type:"button",onClick:()=>E(y-1),disabled:y<=1,className:"relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[g.jsx("span",{className:"sr-only",children:d}),g.jsx(GM,{"aria-hidden":"true",className:"size-5"})]}),T.map((D,O)=>D==="ellipsis"?g.jsx("span",{className:"relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 inset-ring inset-ring-gray-300 dark:text-gray-400 dark:inset-ring-gray-700",children:"…"},`e-${O}`):g.jsx(e3,{active:D===y,onClick:()=>E(D),rounded:"none",children:D},D)),g.jsxs("button",{type:"button",onClick:()=>E(y+1),disabled:y>=p,className:"relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[g.jsx("span",{className:"sr-only",children:f}),g.jsx(KM,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const WA=_.createContext(null);function t3(s){switch(s){case"success":return{Icon:PO,cls:"text-emerald-500"};case"error":return{Icon:gM,cls:"text-rose-500"};case"warning":return{Icon:$O,cls:"text-amber-500"};default:return{Icon:XO,cls:"text-sky-500"}}}function i3(s){switch(s){case"success":return"border-emerald-200/70 dark:border-emerald-400/20";case"error":return"border-rose-200/70 dark:border-rose-400/20";case"warning":return"border-amber-200/70 dark:border-amber-400/20";default:return"border-sky-200/70 dark:border-sky-400/20"}}function s3(s){switch(s){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function n3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function r3({children:s,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[n,r]=_.useState([]),[a,u]=_.useState(!0),c=_.useCallback(async()=>{try{const E=await fetch("/api/settings",{cache:"no-store"});if(!E.ok)return;const D=await E.json();u(!!(D?.enableNotifications??!0))}catch{}},[]);_.useEffect(()=>{c();const E=()=>c();return window.addEventListener("recorder-settings-updated",E),()=>window.removeEventListener("recorder-settings-updated",E)},[c]),_.useEffect(()=>{a||r(E=>E.filter(D=>D.type==="error"))},[a]);const d=_.useCallback(E=>{r(D=>D.filter(O=>O.id!==E))},[]),f=_.useCallback(()=>r([]),[]),p=_.useCallback(E=>{if(!a&&E.type!=="error")return"";const D=n3(),O=E.durationMs??t;return r(R=>[{...E,id:D,durationMs:O},...R].slice(0,Math.max(1,e))),O&&O>0&&window.setTimeout(()=>d(D),O),D},[t,e,d,a]),y=_.useMemo(()=>({push:p,remove:d,clear:f}),[p,d,f]),v=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",b=i.endsWith("left")?"sm:items-start":"sm:items-end",T=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return g.jsxs(WA.Provider,{value:y,children:[s,g.jsx("div",{"aria-live":"assertive",className:["pointer-events-none fixed z-[80] inset-x-0",T].join(" "),children:g.jsx("div",{className:["flex w-full px-4 py-6 sm:p-6",v].join(" "),children:g.jsx("div",{className:["flex w-full flex-col space-y-3",b].join(" "),children:n.map(E=>{const{Icon:D,cls:O}=t3(E.type),R=(E.title||"").trim()||s3(E.type),j=(E.message||"").trim(),F=(E.imageUrl||"").trim(),z=(E.imageAlt||R).trim();return g.jsx(xh,{appear:!0,show:!0,children:g.jsx("div",{className:["pointer-events-auto w-full max-w-sm overflow-hidden rounded-xl","border bg-white/90 shadow-lg backdrop-blur","outline-1 outline-black/5","dark:bg-gray-950/70 dark:-outline-offset-1 dark:outline-white/10",i3(E.type),"transition data-closed:opacity-0 data-enter:transform data-enter:duration-200 data-enter:ease-out","data-closed:data-enter:translate-y-2 sm:data-closed:data-enter:translate-y-0",i.endsWith("right")?"sm:data-closed:data-enter:translate-x-2":"sm:data-closed:data-enter:-translate-x-2"].join(" "),children:g.jsx("div",{className:"p-4",children:g.jsxs("div",{className:"flex items-start gap-3",children:[F?g.jsx("div",{className:"shrink-0",children:g.jsx("img",{src:F,alt:z,loading:"lazy",referrerPolicy:"no-referrer",className:["h-12 w-12 rounded-lg object-cover","ring-1 ring-black/10 dark:ring-white/10"].join(" ")})}):g.jsx("div",{className:"shrink-0",children:g.jsx(D,{className:["size-6",O].join(" "),"aria-hidden":"true"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:R}),j?g.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300 break-words",children:j}):null]}),g.jsxs("button",{type:"button",onClick:()=>d(E.id),className:"shrink-0 rounded-md text-gray-400 hover:text-gray-600 focus:outline-2 focus:outline-offset-2 focus:outline-indigo-600 dark:hover:text-white dark:focus:outline-indigo-500",children:[g.jsx("span",{className:"sr-only",children:"Close"}),g.jsx(YM,{"aria-hidden":"true",className:"size-5"})]})]})})})},E.id)})})})})]})}function a3(){const s=_.useContext(WA);if(!s)throw new Error("useToast must be used within ");return s}function YA(){const{push:s,remove:e,clear:t}=a3(),i=n=>(r,a,u)=>s({type:n,title:r,message:a,...u});return{push:s,remove:e,clear:t,success:i("success"),error:i("error"),info:i("info"),warning:i("warning")}}function o3(s){return typeof s=="number"?s:s==="xs"?12:s==="sm"?16:s==="lg"?28:20}function i2(...s){return s.filter(Boolean).join(" ")}function s2({size:s="md",className:e,label:t,srLabel:i="Lädt…",center:n=!1}){const r=o3(s);return g.jsxs("span",{className:i2("inline-flex items-center gap-2",n&&"justify-center w-full"),role:"status","aria-live":"polite",children:[g.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:i2("animate-spin text-gray-500",e),"aria-hidden":"true",children:[g.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),g.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",d:"M21 12a9 9 0 0 0-9-9",opacity:"0.95"})]}),t?g.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200",children:t}):g.jsx("span",{className:"sr-only",children:i})]})}const db=s=>(s||"").replaceAll("\\","/"),Gr=s=>{const t=db(s).split("/");return t[t.length-1]||""},qn=s=>{const e=s?.id;return e!=null&&String(e).trim()!==""?String(e):Gr(s.output||"")||String(s?.output||"")},l3=s=>{const e=db(String(s??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function n2(s){if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`}function Py(s){if(typeof s!="number"||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function r2(s){const[e,t]=_.useState(!1);return _.useEffect(()=>{const i=window.matchMedia(s),n=()=>t(i.matches);return n(),i.addEventListener?i.addEventListener("change",n):i.addListener(n),()=>{i.removeEventListener?i.removeEventListener("change",n):i.removeListener(n)}},[s]),e}const Qd=s=>{const e=Gr(s||""),t=Eo(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i},kr=s=>(s||"").trim().toLowerCase(),u3=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n.sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})),n},By=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function c3({jobs:s,doneJobs:e,blurPreviews:t,teaserPlayback:i,teaserAudio:n,onOpenPlayer:r,onDeleteJob:a,onToggleHot:u,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,doneTotal:p,page:y,pageSize:v,onPageChange:b,assetNonce:T,sortMode:E,onSortModeChange:D,modelsByKey:O,loadMode:R="paged"}){const j=R==="all",F=i??"hover",z=r2("(hover: hover) and (pointer: fine)"),N=YA(),Y=_.useRef(new Map),[L,I]=_.useState(null),[X,G]=_.useState(null),q=_.useRef(null),ae=_.useRef(new WeakMap),[ie,W]=_.useState(()=>new Set),[K,Q]=_.useState(()=>new Set),[te,re]=_.useState(!1),U=_.useRef(!1),ne="finishedDownloads_lastUndo_v1",[Z,fe]=_.useState(()=>{if(typeof window>"u")return null;try{const _e=localStorage.getItem(ne);if(!_e)return null;const Le=JSON.parse(_e);if(!Le||Le.v!==1||!Le.action)return null;const Ne=Date.now()-Number(Le.ts||0);return!Number.isFinite(Ne)||Ne<0||Ne>1800*1e3?(localStorage.removeItem(ne),null):Le.action}catch{return null}}),[xe,ge]=_.useState(!1);_.useEffect(()=>{try{if(!Z){localStorage.removeItem(ne);return}const _e={v:1,action:Z,ts:Date.now()};localStorage.setItem(ne,JSON.stringify(_e))}catch{}},[Z]);const[Ce,Me]=_.useState({}),[Re,Ae]=_.useState(null),[be,Pe]=_.useState(null),[gt,Ye]=_.useState(0),lt=_.useRef(null),Ve=_.useCallback(()=>{lt.current&&window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>Ye(_e=>_e+1),80)},[]),ht=_.useRef({pending:0,t:0,timer:0}),st=_.useCallback(_e=>{!_e||!Number.isFinite(_e)||(ht.current.pending+=_e,!ht.current.timer&&(ht.current.timer=window.setTimeout(()=>{ht.current.timer=0;const Le=ht.current.pending;ht.current.pending=0,Le&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:Le}}))},120)))},[]),ct="finishedDownloads_view",Ke="finishedDownloads_includeKeep_v2",_t="finishedDownloads_mobileOptionsOpen_v1",[pe,We]=_.useState("table"),[Je,ot]=_.useState(!1),[St,vt]=_.useState(!1),Vt=_.useRef(new Map),[si,$t]=_.useState([]),Pt=_.useMemo(()=>new Set(si.map(kr)),[si]),Ht=_.useMemo(()=>{const _e={},Le={};for(const[Ne,et]of Object.entries(O??{})){const bt=kr(Ne),Qt=u3(et?.tags);_e[bt]=Qt,Le[bt]=new Set(Qt.map(kr))}return{tagsByModelKey:_e,tagSetByModelKey:Le}},[O]),[ui,xt]=_.useState(""),ni=_.useDeferredValue(ui),Xt=_.useMemo(()=>kr(ni).split(/\s+/g).map(_e=>_e.trim()).filter(Boolean),[ni]),Zi=_.useCallback(()=>xt(""),[]),Gt=_.useCallback(_e=>{const Le=kr(_e);$t(Ne=>Ne.some(bt=>kr(bt)===Le)?Ne.filter(bt=>kr(bt)!==Le):[...Ne,_e])},[]),Yi=Xt.length>0||Pt.size>0,Ri=Yi||j,Si=_.useCallback(async _e=>{re(!0);try{const Le=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(E)}&withCount=1${Je?"&includeKeep=1":""}`,{cache:"no-store",signal:_e});if(!Le.ok)return;const Ne=await Le.json().catch(()=>null),et=Array.isArray(Ne?.items)?Ne.items:[],bt=Number(Ne?.count??Ne?.totalCount??et.length);Ae(et),Pe(Number.isFinite(bt)?bt:et.length)}finally{re(!1)}},[E,Je]),kt=_.useCallback(()=>$t([]),[]);_.useEffect(()=>{try{const _e=localStorage.getItem("finishedDownloads_pendingTags");if(!_e)return;const Le=JSON.parse(_e),Ne=Array.isArray(Le)?Le.map(et=>String(et||"").trim()).filter(Boolean):[];if(Ne.length===0)return;Lc.flushSync(()=>$t(Ne)),y!==1&&b(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]),_.useEffect(()=>{if(!Ri)return;const _e=new AbortController,Le=window.setTimeout(()=>{Si(_e.signal).catch(()=>{})},250);return()=>{window.clearTimeout(Le),_e.abort()}},[Ri,Si]),_.useEffect(()=>{if(gt===0)return;const _e=new AbortController;let Le=!0;const Ne=()=>{U.current=!1};return U.current=!0,Ri?((async()=>{try{await Si(_e.signal),Le&&(gi.current=0)}catch{}finally{Le&&Ne()}})(),()=>{Le=!1,_e.abort(),Ne()}):(re(!0),(async()=>{try{const[et,bt]=await Promise.all([fetch(`/api/record/done?page=${y}&pageSize=${v}&sort=${encodeURIComponent(E)}${Je?"&includeKeep=1":""}`,{cache:"no-store",signal:_e.signal}),fetch(`/api/record/done/meta${Je?"?includeKeep=1":""}`,{cache:"no-store",signal:_e.signal})]);if(!Le||_e.signal.aborted)return;let Qt=et.ok&&bt.ok;if(et.ok){const ti=await et.json().catch(()=>null);if(!Le||_e.signal.aborted)return;const le=Array.isArray(ti?.items)?ti.items:Array.isArray(ti)?ti:[];Ae(le)}if(bt.ok){const ti=await bt.json().catch(()=>null);if(!Le||_e.signal.aborted)return;const le=Number(ti?.count??0),we=Number.isFinite(le)&&le>=0?le:0;Pe(we);const ut=Math.max(1,Math.ceil(we/v));if(y>ut){b(ut),Ae(null);return}}if(Qt)gi.current=0;else if(Le&&!_e.signal.aborted&&gi.current<2){gi.current+=1;const ti=gi.current;window.setTimeout(()=>{_e.signal.aborted||Ye(le=>le+1)},400*ti)}}catch{}finally{Le&&(re(!1),Ne())}})(),()=>{Le=!1,_e.abort(),Ne()})},[gt,Ri,Si,y,v,E,Je,b]),_.useEffect(()=>{Ri||(Ae(null),Pe(null))},[y,v,E,Je,Ri]),_.useEffect(()=>{if(!Je){Yi||(Ae(null),Pe(null));return}if(Yi)return;const _e=new AbortController;return(async()=>{try{const Le=await fetch(`/api/record/done?page=${y}&pageSize=${v}&sort=${encodeURIComponent(E)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:_e.signal});if(!Le.ok)return;const Ne=await Le.json().catch(()=>null),et=Array.isArray(Ne?.items)?Ne.items:[],bt=Number(Ne?.count??Ne?.totalCount??et.length);Ae(et),Pe(Number.isFinite(bt)?bt:et.length)}catch{}})(),()=>_e.abort()},[Je,Yi,y,v,E]),_.useEffect(()=>{try{const _e=localStorage.getItem(ct);We(_e==="table"||_e==="cards"||_e==="gallery"?_e:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{We("table")}},[]),_.useEffect(()=>{try{localStorage.setItem(ct,pe)}catch{}},[pe]),_.useEffect(()=>{try{const _e=localStorage.getItem(Ke);ot(_e==="1"||_e==="true"||_e==="yes")}catch{ot(!1)}},[]),_.useEffect(()=>{try{localStorage.setItem(Ke,Je?"1":"0")}catch{}},[Je]),_.useEffect(()=>{try{const _e=localStorage.getItem(_t);vt(_e==="1"||_e==="true"||_e==="yes")}catch{vt(!1)}},[]),_.useEffect(()=>{try{localStorage.setItem(_t,St?"1":"0")}catch{}},[St]);const[V,H]=_.useState({}),ee=_.useRef({}),Te=_.useRef(null),[Ue,ft]=_.useState({}),Et=_.useRef({}),pi=_.useRef(null),gi=_.useRef(0);_.useEffect(()=>{Et.current=Ue},[Ue]);const _i=_.useCallback(()=>{pi.current==null&&(pi.current=window.setTimeout(()=>{pi.current=null,ft({...Et.current})},200))},[]);_.useEffect(()=>()=>{pi.current!=null&&(window.clearTimeout(pi.current),pi.current=null)},[]),_.useEffect(()=>{ee.current=V},[V]);const Ei=_.useCallback(()=>{Te.current==null&&(Te.current=window.setTimeout(()=>{Te.current=null,H({...ee.current})},200))},[]);_.useEffect(()=>()=>{Te.current!=null&&(window.clearTimeout(Te.current),Te.current=null)},[]);const[fi,yi]=_.useState(null),$s=!n,ns=_.useCallback(_e=>{const Ne=document.getElementById(_e)?.querySelector("video");if(!Ne)return!1;p0(Ne,{muted:$s});const et=Ne.play?.();return et&&typeof et.catch=="function"&&et.catch(()=>{}),!0},[$s]),Xi=_.useCallback(_e=>{yi(Le=>Le?.key===_e?{key:_e,nonce:Le.nonce+1}:{key:_e,nonce:1})},[]),wi=_.useCallback(_e=>{yi(null),r(_e)},[r]),Jt=_.useCallback((_e,Le)=>{Q(Ne=>{const et=new Set(Ne);return Le?et.add(_e):et.delete(_e),et})},[]),ei=_.useCallback(_e=>{W(Le=>{const Ne=new Set(Le);return Ne.add(_e),Ne})},[]),[Qi,Ls]=_.useState(()=>new Set),Hs=_.useCallback((_e,Le)=>{Ls(Ne=>{const et=new Set(Ne);return Le?et.add(_e):et.delete(_e),et})},[]),[rn,ys]=_.useState(()=>new Set),xi=_.useRef(new Map);_.useEffect(()=>()=>{for(const _e of xi.current.values())window.clearTimeout(_e);xi.current.clear()},[]);const Cs=_.useCallback((_e,Le)=>{ys(Ne=>{const et=new Set(Ne);return Le?et.add(_e):et.delete(_e),et})},[]),$i=_.useCallback(_e=>{const Le=xi.current.get(_e);Le!=null&&(window.clearTimeout(Le),xi.current.delete(_e))},[]),Rs=_.useCallback(_e=>{$i(_e),W(Le=>{const Ne=new Set(Le);return Ne.delete(_e),Ne}),ys(Le=>{const Ne=new Set(Le);return Ne.delete(_e),Ne}),Q(Le=>{const Ne=new Set(Le);return Ne.delete(_e),Ne}),Ls(Le=>{const Ne=new Set(Le);return Ne.delete(_e),Ne})},[$i]),Ji=_.useCallback(_e=>{Cs(_e,!0),$i(_e);const Le=window.setTimeout(()=>{xi.current.delete(_e),ei(_e),Cs(_e,!1)},320);xi.current.set(_e,Le)},[ei,Cs,$i]),Ai=_.useCallback(async(_e,Le)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:_e}})),Le?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:_e}})),await new Promise(Ne=>window.setTimeout(Ne,250))},[]),hn=_.useCallback(async _e=>{const Le=Gr(_e.output||""),Ne=qn(_e);if(!Le)return N.error("Löschen nicht möglich","Kein Dateiname gefunden – kann nicht löschen."),!1;if(K.has(Ne))return!1;Jt(Ne,!0);try{if(await Ai(Le,{close:!0}),a){const we=(await a(_e))?.undoToken;return fe(typeof we=="string"&&we?{kind:"delete",undoToken:we,originalFile:Le,rowKey:Ne}:null),Ji(Ne),Ve(),st(-1),!0}const et=await fetch(`/api/record/delete?file=${encodeURIComponent(Le)}`,{method:"POST"});if(!et.ok){const le=await et.text().catch(()=>"");throw new Error(le||`HTTP ${et.status}`)}const bt=await et.json().catch(()=>null),Qt=bt?.from==="keep"?"keep":"done",ti=typeof bt?.undoToken=="string"?bt.undoToken:"";return fe(ti?{kind:"delete",undoToken:ti,originalFile:Le,rowKey:Ne,from:Qt}:null),Ji(Ne),Ve(),st(-1),!0}catch{return Rs(Ne),N.error("Löschen fehlgeschlagen: ",Le),!1}finally{Jt(Ne,!1)}},[K,Jt,Ai,a,Ji,N,Rs,Ve,st]),_s=_.useCallback(async _e=>{const Le=Gr(_e.output||""),Ne=qn(_e);if(!Le)return N.error("Keep nicht möglich","Kein Dateiname gefunden – kann nicht behalten."),!1;if(Qi.has(Ne)||K.has(Ne))return!1;Hs(Ne,!0);try{await Ai(Le,{close:!0});const et=await fetch(`/api/record/keep?file=${encodeURIComponent(Le)}`,{method:"POST"});if(!et.ok){const ti=await et.text().catch(()=>"");throw new Error(ti||`HTTP ${et.status}`)}const bt=await et.json().catch(()=>null),Qt=typeof bt?.newFile=="string"&&bt.newFile?bt.newFile:Le;return fe({kind:"keep",keptFile:Qt,originalFile:Le,rowKey:Ne}),Ji(Ne),Ve(),st(Je?0:-1),!0}catch{return N.error("Keep fehlgeschlagen",Le),!1}finally{Hs(Ne,!1)}},[Qi,K,Hs,Ai,Ji,N,Ve,st,Je]),$e=_.useCallback((_e,Le)=>{!_e||!Le||_e===Le||Me(Ne=>{const et={...Ne};for(const[bt,Qt]of Object.entries(et))(bt===_e||bt===Le||Qt===_e||Qt===Le)&&delete et[bt];return et[_e]=Le,et})},[]),Mt=_.useCallback(async()=>{if(!Z||xe)return;ge(!0);const _e=Le=>{W(Ne=>{const et=new Set(Ne);return et.delete(Le),et}),Q(Ne=>{const et=new Set(Ne);return et.delete(Le),et}),Ls(Ne=>{const et=new Set(Ne);return et.delete(Le),et}),ys(Ne=>{const et=new Set(Ne);return et.delete(Le),et})};try{if(Z.kind==="delete"){const Le=await fetch(`/api/record/restore?token=${encodeURIComponent(Z.undoToken)}`,{method:"POST"});if(!Le.ok){const Qt=await Le.text().catch(()=>"");throw new Error(Qt||`HTTP ${Le.status}`)}const Ne=await Le.json().catch(()=>null),et=String(Ne?.restoredFile||Z.originalFile);Z.rowKey&&_e(Z.rowKey),_e(Z.originalFile),_e(et);const bt=Z.from==="keep"&&!Je?0:1;st(bt),Ve(),fe(null);return}if(Z.kind==="keep"){const Le=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Z.keptFile)}`,{method:"POST"});if(!Le.ok){const bt=await Le.text().catch(()=>"");throw new Error(bt||`HTTP ${Le.status}`)}const Ne=await Le.json().catch(()=>null),et=String(Ne?.newFile||Z.originalFile);Z.rowKey&&_e(Z.rowKey),_e(Z.originalFile),_e(et),st(1),Ve(),fe(null);return}if(Z.kind==="hot"){const Le=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Z.currentFile)}`,{method:"POST"});if(!Le.ok){const Qt=await Le.text().catch(()=>"");throw new Error(Qt||`HTTP ${Le.status}`)}const Ne=await Le.json().catch(()=>null),et=String(Ne?.oldFile||Z.currentFile),bt=String(Ne?.newFile||"");bt&&$e(et,bt),Ve(),fe(null);return}}catch(Le){N.error("Undo fehlgeschlagen",String(Le?.message||Le))}finally{ge(!1)}},[Z,xe,N,Ve,Je,st,$e]),Nt=_.useCallback(async _e=>{const Le=Gr(_e.output||"");if(!Le){N.error("HOT nicht möglich","Kein Dateiname gefunden – kann nicht HOT togglen.");return}const Ne=ti=>gc(ti)?Eo(ti):`HOT ${ti}`,et=(ti,le)=>{!ti||!le||ti===le||$e(ti,le)},bt=Le,Qt=Ne(bt);$e(bt,Qt);try{if(await Ai(bt,{close:!0}),u){const At=await u(_e),Ct=typeof At?.oldFile=="string"?At.oldFile:"",ce=typeof At?.newFile=="string"?At.newFile:"";Ct&&ce&&et(Ct,ce),fe({kind:"hot",currentFile:ce||Qt}),(E==="file_asc"||E==="file_desc")&&Ve();return}const ti=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(bt)}`,{method:"POST"});if(!ti.ok){const At=await ti.text().catch(()=>"");throw new Error(At||`HTTP ${ti.status}`)}const le=await ti.json().catch(()=>null),we=typeof le?.oldFile=="string"&&le.oldFile?le.oldFile:bt,ut=typeof le?.newFile=="string"&&le.newFile?le.newFile:Qt;we!==ut&&et(we,ut),fe({kind:"hot",currentFile:ut}),Ve()}catch(ti){$e(Qt,bt),fe(null),N.error("HOT umbenennen fehlgeschlagen",String(ti?.message||ti))}},[N,$e,Ai,u,Ve,E]),ri=_.useCallback(_e=>{const Le=db(_e.output||""),Ne=Gr(Le),et=Ce[Ne];if(!et)return _e;const bt=Le.lastIndexOf("/"),Qt=bt>=0?Le.slice(0,bt+1):"";return{..._e,output:Qt+et}},[Ce]),Wt=Re??e,bi=be??p,Bi=_.useMemo(()=>{const _e=new Map;for(const Ne of Wt){const et=ri(Ne);_e.set(qn(et),et)}for(const Ne of s){const et=ri(Ne),bt=qn(et);_e.has(bt)&&_e.set(bt,{..._e.get(bt),...et})}return Array.from(_e.values()).filter(Ne=>ie.has(qn(Ne))||l3(Ne.output)?!1:Ne.status==="finished"||Ne.status==="failed"||Ne.status==="stopped")},[s,Wt,ie,ri]),qi=_.useRef(new Map);_.useEffect(()=>{const _e=new Map;for(const Le of Bi){const Ne=Gr(Le.output||"");Ne&&_e.set(Ne,qn(Le))}qi.current=_e},[Bi]),_.useEffect(()=>{const _e=Le=>{const Ne=Le.detail;if(!Ne?.file)return;const et=qi.current.get(Ne.file)||Ne.file;if(Ne.phase==="start"){Jt(et,!0),Ji(et);return}if(Ne.phase==="error"){Rs(et),Vt.current.get(et)?.reset();return}if(Ne.phase==="success"){Jt(et,!1),Ve();return}};return window.addEventListener("finished-downloads:delete",_e),()=>window.removeEventListener("finished-downloads:delete",_e)},[Ji,Jt,Ve,Rs]),_.useEffect(()=>{const _e=()=>{U.current||Ve()};return window.addEventListener("finished-downloads:reload",_e),()=>window.removeEventListener("finished-downloads:reload",_e)},[Ve]),_.useEffect(()=>{const _e=Le=>{const Ne=Le.detail,et=String(Ne?.oldFile??"").trim(),bt=String(Ne?.newFile??"").trim();!et||!bt||et===bt||$e(et,bt)};return window.addEventListener("finished-downloads:rename",_e),()=>window.removeEventListener("finished-downloads:rename",_e)},[$e]);const Fi=_.useMemo(()=>{const _e=Bi.filter(Ne=>!ie.has(qn(Ne))),Le=Xt.length?_e.filter(Ne=>{const et=Gr(Ne.output||""),bt=Qd(Ne.output),Qt=kr(bt),ti=Ht.tagsByModelKey[Qt]??[],le=kr([et,Eo(et),bt,Ne.id,ti.join(" ")].join(" "));for(const we of Xt)if(!le.includes(we))return!1;return!0}):_e;return Pt.size===0?Le:Le.filter(Ne=>{const et=kr(Qd(Ne.output)),bt=Ht.tagSetByModelKey[et];if(!bt||bt.size===0)return!1;for(const Qt of Pt)if(!bt.has(Qt))return!1;return!0})},[Bi,ie,Pt,Ht,Xt]),Es=Ri?Fi.length:bi,Qs=_.useMemo(()=>{if(!Ri)return Fi;const _e=(y-1)*v,Le=_e+v;return Fi.slice(Math.max(0,_e),Math.max(0,Le))},[Ri,Fi,y,v]),fn=!Ri&&Es===0,Pn=Yi&&Fi.length===0,xn=j&&Fi.length===0,mn=te&&(fn||xn||Pn);_.useEffect(()=>{if(!Yi)return;const _e=Math.max(1,Math.ceil(Fi.length/v));y>_e&&b(_e)},[Yi,Fi.length,y,v,b]),_.useEffect(()=>{if(!(F==="hover"&&!z&&(pe==="cards"||pe==="gallery"||pe==="table"))){I(null),q.current?.disconnect(),q.current=null;return}if(pe==="cards"&&fi?.key){I(fi.key);return}q.current?.disconnect();const Le=new IntersectionObserver(Ne=>{let et=null,bt=0;for(const Qt of Ne){if(!Qt.isIntersecting)continue;const ti=ae.current.get(Qt.target);ti&&Qt.intersectionRatio>bt&&(bt=Qt.intersectionRatio,et=ti)}et&&I(Qt=>Qt===et?Qt:et)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});q.current=Le;for(const[Ne,et]of Y.current)ae.current.set(et,Ne),Le.observe(et);return()=>{Le.disconnect(),q.current===Le&&(q.current=null)}},[pe,F,z,fi?.key]);const ds=_e=>{const Le=qn(_e),Ne=V[Le]??_e?.durationSeconds;if(typeof Ne=="number"&&Number.isFinite(Ne)&&Ne>0)return n2(Ne*1e3);const et=Date.parse(String(_e.startedAt||"")),bt=Date.parse(String(_e.endedAt||""));return Number.isFinite(et)&&Number.isFinite(bt)&&bt>et?n2(bt-et):"—"},bn=_.useCallback(_e=>Le=>{const Ne=Y.current.get(_e);Ne&&q.current&&q.current.unobserve(Ne),Le?(Y.current.set(_e,Le),ae.current.set(Le,_e),q.current?.observe(Le)):Y.current.delete(_e)},[]),an=_.useCallback((_e,Le)=>{if(!Number.isFinite(Le)||Le<=0)return;const Ne=qn(_e),et=ee.current[Ne];typeof et=="number"&&Math.abs(et-Le)<.5||(ee.current={...ee.current,[Ne]:Le},Ei())},[Ei]),Zn=_.useCallback((_e,Le,Ne)=>{if(!Number.isFinite(Le)||!Number.isFinite(Ne)||Le<=0||Ne<=0)return;const et=qn(_e),bt=Et.current[et];bt&&bt.w===Le&&bt.h===Ne||(Et.current={...Et.current,[et]:{w:Le,h:Ne}},_i())},[_i]),Ii=r2("(max-width: 639px)");return _.useEffect(()=>{if(!Ii||pe!=="cards")return;const _e=Qs[0];if(!_e){I(null);return}const Le=qn(_e);I(Ne=>Ne===Le?Ne:Le)},[Ii,pe,Qs,qn]),_.useEffect(()=>{Ii||(Vt.current=new Map)},[Ii]),_.useEffect(()=>{fn&&y!==1&&b(1)},[fn,y,b]),g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"sticky top-[56px] z-20",children:g.jsxs("div",{className:` - rounded-xl border border-gray-200/70 bg-white/80 shadow-sm - backdrop-blur supports-[backdrop-filter]:bg-white/60 - dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40 - `,children:[g.jsxs("div",{className:"flex items-center gap-3 p-3",children:[g.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),g.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Es})]}),g.jsxs("div",{className:"sm:hidden flex items-center gap-2 min-w-0 flex-1",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),g.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Es})]}),g.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[te?g.jsx(s2,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"}):null,g.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 flex-1",children:[g.jsx("input",{value:ui,onChange:_e=>xt(_e.target.value),placeholder:"Suchen…",className:` - h-9 w-full max-w-[420px] rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm - focus:outline-none focus:ring-2 focus:ring-indigo-500 - dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark] - `}),(ui||"").trim()!==""?g.jsx(di,{size:"sm",variant:"soft",onClick:Zi,children:"Leeren"}):null]}),g.jsx("div",{className:"hidden sm:block",children:g.jsx(go,{label:"Behaltene Downloads anzeigen",checked:Je,onChange:_e=>{y!==1&&b(1),ot(_e),Ve()}})}),pe!=="table"&&g.jsxs("div",{className:"hidden sm:block",children:[g.jsx("label",{className:"sr-only",htmlFor:"finished-sort",children:"Sortierung"}),g.jsxs("select",{id:"finished-sort",value:E,onChange:_e=>{const Le=_e.target.value;D(Le),y!==1&&b(1)},className:` - h-9 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm - dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark] - `,children:[g.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),g.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),g.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),g.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),g.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),g.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),g.jsx("option",{value:"size_desc",children:"Größe ↓"}),g.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}),g.jsx(di,{size:Ii?"sm":"md",variant:"soft",className:Ii?"h-9":"h-10",disabled:!Z||xe,onClick:Mt,title:Z?`Letzte Aktion rückgängig machen (${Z.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),g.jsx(SO,{value:pe,onChange:_e=>We(_e),size:Ii?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:g.jsx(hM,{className:Ii?"size-4":"size-5"}),label:Ii?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:g.jsx(aM,{className:Ii?"size-4":"size-5"}),label:Ii?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:g.jsx(uM,{className:Ii?"size-4":"size-5"}),label:Ii?void 0:"Galerie",srLabel:"Galerie"}]}),g.jsxs("button",{type:"button",className:`sm:hidden relative inline-flex items-center justify-center rounded-md border border-gray-200 bg-white p-2 shadow-sm - hover:bg-gray-50 dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-white/10`,onClick:()=>vt(_e=>!_e),"aria-expanded":St,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[g.jsx(EO,{className:"size-5"}),Yi||Je?g.jsx("span",{className:"absolute -top-1 -right-1 h-2.5 w-2.5 rounded-full bg-indigo-500 ring-2 ring-white dark:ring-gray-950"}):null]})]})]}),si.length>0?g.jsxs("div",{className:"hidden sm:flex items-center gap-2 border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:[g.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[si.map(_e=>g.jsx($a,{tag:_e,active:!0,onClick:Gt},_e)),g.jsx(di,{className:` - ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium - text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10 - `,size:"sm",variant:"soft",onClick:kt,children:"Zurücksetzen"})]})]}):null,g.jsxs("div",{id:"finished-mobile-options",className:["sm:hidden overflow-hidden transition-[max-height,opacity] duration-200 ease-in-out",St?"max-h-[720px] opacity-100":"max-h-0 opacity-0"].join(" "),children:[g.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 p-3",children:g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{value:ui,onChange:_e=>xt(_e.target.value),placeholder:"Suchen…",className:` - h-10 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 - focus:outline-none focus:ring-2 focus:ring-indigo-500 - dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark] - `}),(ui||"").trim()!==""?g.jsx(di,{size:"sm",variant:"soft",onClick:Zi,children:"Clear"}):null]})}),g.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Keep anzeigen"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Behaltene Downloads in der Liste"})]}),g.jsx(ox,{checked:Je,onChange:_e=>{y!==1&&b(1),ot(_e),Ve()},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),pe!=="table"?g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:[g.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:"Sortierung"}),g.jsxs("select",{id:"finished-sort-mobile",value:E,onChange:_e=>{const Le=_e.target.value;D(Le),y!==1&&b(1)},className:` - w-full h-10 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm - dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark] - `,children:[g.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),g.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),g.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),g.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),g.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),g.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),g.jsx("option",{value:"size_desc",children:"Größe ↓"}),g.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}):null]})}),si.length>0?g.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[si.map(_e=>g.jsx($a,{tag:_e,active:!0,onClick:Gt},_e)),g.jsx(di,{className:` - ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium - text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10 - `,size:"sm",variant:"soft",onClick:kt,children:"Zurücksetzen"})]})]})}):null]})]})}),mn?g.jsx(ca,{grayBody:!0,children:g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Lade Downloads…"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Bitte warte einen Moment."})]}),g.jsx(s2,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):fn||xn?g.jsx(ca,{grayBody:!0,children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:g.jsx("span",{className:"text-lg",children:"📁"})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine abgeschlossenen Downloads"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Im Zielordner ist aktuell nichts vorhanden."})]})]})}):Pn?g.jsxs(ca,{grayBody:!0,children:[g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),si.length>0||(ui||"").trim()!==""?g.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[si.length>0?g.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:kt,children:"Tag-Filter zurücksetzen"}):null,(ui||"").trim()!==""?g.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:Zi,children:"Suche zurücksetzen"}):null]}):null]}):g.jsxs(g.Fragment,{children:[pe==="cards"&&g.jsx("div",{className:Ii?"mt-8":"",children:g.jsx($M,{rows:Qs,isSmall:Ii,isLoading:te,blurPreviews:t,durations:V,teaserKey:L,teaserPlayback:F,teaserAudio:n,hoverTeaserKey:X,inlinePlay:fi,deletingKeys:K,keepingKeys:Qi,removingKeys:rn,swipeRefs:Vt,keyFor:qn,baseName:Gr,modelNameFromOutput:Qd,runtimeOf:ds,sizeBytesOf:By,formatBytes:Py,lower:kr,onOpenPlayer:r,openPlayer:wi,startInline:Xi,tryAutoplayInline:ns,registerTeaserHost:bn,handleDuration:an,deleteVideo:hn,keepVideo:_s,releasePlayingFile:Ai,modelsByKey:O,onToggleHot:Nt,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,activeTagSet:Pt,onToggleTagFilter:Gt,onHoverPreviewKeyChange:G,assetNonce:T??0})}),pe==="table"&&g.jsx(QM,{rows:Qs,isLoading:te,keyFor:qn,baseName:Gr,lower:kr,modelNameFromOutput:Qd,runtimeOf:ds,sizeBytesOf:By,formatBytes:Py,resolutions:Ue,durations:V,canHover:z,teaserAudio:n,hoverTeaserKey:X,setHoverTeaserKey:G,teaserPlayback:F,teaserKey:L,registerTeaserHost:bn,handleDuration:an,handleResolution:Zn,blurPreviews:t,assetNonce:T,deletingKeys:K,keepingKeys:Qi,removingKeys:rn,modelsByKey:O,activeTagSet:Pt,onToggleTagFilter:Gt,onOpenPlayer:r,onSortModeChange:D,page:y,onPageChange:b,onToggleHot:Nt,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,deleteVideo:hn,keepVideo:_s}),pe==="gallery"&&g.jsx(ZM,{rows:Qs,isLoading:te,blurPreviews:t,durations:V,handleDuration:an,teaserKey:L,teaserPlayback:F,teaserAudio:n,hoverTeaserKey:X,keyFor:qn,baseName:Gr,modelNameFromOutput:Qd,runtimeOf:ds,sizeBytesOf:By,formatBytes:Py,deletingKeys:K,keepingKeys:Qi,removingKeys:rn,deletedKeys:ie,registerTeaserHost:bn,onOpenPlayer:r,deleteVideo:hn,keepVideo:_s,onToggleHot:Nt,lower:kr,modelsByKey:O,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,activeTagSet:Pt,onToggleTagFilter:Gt,onHoverPreviewKeyChange:G}),g.jsx(KA,{page:y,pageSize:v,totalItems:Es,onPageChange:_e=>{Lc.flushSync(()=>{yi(null),I(null),G(null)});for(const Le of Qs){const Ne=Gr(Le.output||"");Ne&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:Ne}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:Ne}})))}window.scrollTo({top:0,behavior:"auto"}),b(_e)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Fy,a2;function ap(){if(a2)return Fy;a2=1;var s;return typeof window<"u"?s=window:typeof o0<"u"?s=o0:typeof self<"u"?s=self:s={},Fy=s,Fy}var d3=ap();const de=Vc(d3),h3={},f3=Object.freeze(Object.defineProperty({__proto__:null,default:h3},Symbol.toStringTag,{value:"Module"})),m3=HI(f3);var Uy,o2;function XA(){if(o2)return Uy;o2=1;var s=typeof o0<"u"?o0:typeof window<"u"?window:{},e=m3,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Uy=t,Uy}var p3=XA();const yt=Vc(p3);var Sm={exports:{}},jy={exports:{}},l2;function g3(){return l2||(l2=1,(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i=n.length?{done:!0}:{done:!1,value:n[u++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(n,r){if(n){if(typeof n=="string")return t(n,r);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(n);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(n,r)}}function t(n,r){(r==null||r>n.length)&&(r=n.length);for(var a=0,u=new Array(r);a=400&&u.statusCode<=599){var d=c;if(r)if(s.TextDecoder){var f=t(u.headers&&u.headers["content-type"]);try{d=new TextDecoder(f).decode(c)}catch{}}else d=String.fromCharCode.apply(null,new Uint8Array(c));n({cause:d});return}n(null,c)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(n,r){var a=r.split("="),u=a[0],c=a[1];return u.trim()==="charset"?c.trim():n},"utf-8")}return Vy=e,Vy}var f2;function T3(){if(f2)return Sm.exports;f2=1;var s=ap(),e=g3(),t=y3(),i=v3(),n=x3();d.httpHandler=b3(),d.requestInterceptorsStorage=new i,d.responseInterceptorsStorage=new i,d.retryManager=new n;var r=function(b){var T={};return b&&b.trim().split(` -`).forEach(function(E){var D=E.indexOf(":"),O=E.slice(0,D).trim().toLowerCase(),R=E.slice(D+1).trim();typeof T[O]>"u"?T[O]=R:Array.isArray(T[O])?T[O].push(R):T[O]=[T[O],R]}),T};Sm.exports=d,Sm.exports.default=d,d.XMLHttpRequest=s.XMLHttpRequest||y,d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:s.XDomainRequest,a(["get","put","post","patch","head","delete"],function(v){d[v==="delete"?"del":v]=function(b,T,E){return T=c(b,T,E),T.method=v.toUpperCase(),f(T)}});function a(v,b){for(var T=0;T"u")throw new Error("callback argument missing");if(v.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var b={uri:v.uri||v.url,headers:v.headers||{},body:v.body,metadata:v.metadata||{},retry:v.retry,timeout:v.timeout},T=d.requestInterceptorsStorage.execute(v.requestType,b);v.uri=T.uri,v.headers=T.headers,v.body=T.body,v.metadata=T.metadata,v.retry=T.retry,v.timeout=T.timeout}var E=!1,D=function(Q,te,re){E||(E=!0,v.callback(Q,te,re))};function O(){z.readyState===4&&!d.responseInterceptorsStorage.getIsEnabled()&&setTimeout(F,0)}function R(){var K=void 0;if(z.response?K=z.response:K=z.responseText||p(z),ae)try{K=JSON.parse(K)}catch{}return K}function j(K){if(clearTimeout(ie),clearTimeout(v.retryTimeout),K instanceof Error||(K=new Error(""+(K||"Unknown XMLHttpRequest Error"))),K.statusCode=0,!Y&&d.retryManager.getIsEnabled()&&v.retry&&v.retry.shouldRetry()){v.retryTimeout=setTimeout(function(){v.retry.moveToNextAttempt(),v.xhr=z,f(v)},v.retry.getCurrentFuzzedDelay());return}if(v.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var Q={headers:W.headers||{},body:W.body,responseUrl:z.responseURL,responseType:z.responseType},te=d.responseInterceptorsStorage.execute(v.requestType,Q);W.body=te.body,W.headers=te.headers}return D(K,W)}function F(){if(!Y){var K;clearTimeout(ie),clearTimeout(v.retryTimeout),v.useXDR&&z.status===void 0?K=200:K=z.status===1223?204:z.status;var Q=W,te=null;if(K!==0?(Q={body:R(),statusCode:K,method:I,headers:{},url:L,rawRequest:z},z.getAllResponseHeaders&&(Q.headers=r(z.getAllResponseHeaders()))):te=new Error("Internal XMLHttpRequest Error"),v.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var re={headers:Q.headers||{},body:Q.body,responseUrl:z.responseURL,responseType:z.responseType},U=d.responseInterceptorsStorage.execute(v.requestType,re);Q.body=U.body,Q.headers=U.headers}return D(te,Q,Q.body)}}var z=v.xhr||null;z||(v.cors||v.useXDR?z=new d.XDomainRequest:z=new d.XMLHttpRequest);var N,Y,L=z.url=v.uri||v.url,I=z.method=v.method||"GET",X=v.body||v.data,G=z.headers=v.headers||{},q=!!v.sync,ae=!1,ie,W={body:void 0,headers:{},statusCode:0,method:I,url:L,rawRequest:z};if("json"in v&&v.json!==!1&&(ae=!0,G.accept||G.Accept||(G.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(G["content-type"]||G["Content-Type"]||(G["Content-Type"]="application/json"),X=JSON.stringify(v.json===!0?X:v.json))),z.onreadystatechange=O,z.onload=F,z.onerror=j,z.onprogress=function(){},z.onabort=function(){Y=!0,clearTimeout(v.retryTimeout)},z.ontimeout=j,z.open(I,L,!q,v.username,v.password),q||(z.withCredentials=!!v.withCredentials),!q&&v.timeout>0&&(ie=setTimeout(function(){if(!Y){Y=!0,z.abort("timeout");var K=new Error("XMLHttpRequest timeout");K.code="ETIMEDOUT",j(K)}},v.timeout)),z.setRequestHeader)for(N in G)G.hasOwnProperty(N)&&z.setRequestHeader(N,G[N]);else if(v.headers&&!u(v.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in v&&(z.responseType=v.responseType),"beforeSend"in v&&typeof v.beforeSend=="function"&&v.beforeSend(z),z.send(X||null),z}function p(v){try{if(v.responseType==="document")return v.responseXML;var b=v.responseXML&&v.responseXML.documentElement.nodeName==="parsererror";if(v.responseType===""&&!b)return v.responseXML}catch{}return null}function y(){}return Sm.exports}var S3=T3();const QA=Vc(S3);var Gy={exports:{}},qy,m2;function _3(){if(m2)return qy;m2=1;var s=XA(),e=Object.create||(function(){function L(){}return function(I){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return L.prototype=I,new L}})();function t(L,I){this.name="ParsingError",this.code=L.code,this.message=I||L.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(L){function I(G,q,ae,ie){return(G|0)*3600+(q|0)*60+(ae|0)+(ie|0)/1e3}var X=L.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return X?X[3]?I(X[1],X[2],X[3].replace(":",""),X[4]):X[1]>59?I(X[1],X[2],0,X[4]):I(0,X[1],X[2],X[4]):null}function n(){this.values=e(null)}n.prototype={set:function(L,I){!this.get(L)&&I!==""&&(this.values[L]=I)},get:function(L,I,X){return X?this.has(L)?this.values[L]:I[X]:this.has(L)?this.values[L]:I},has:function(L){return L in this.values},alt:function(L,I,X){for(var G=0;G=0&&I<=100)?(this.set(L,I),!0):!1}};function r(L,I,X,G){var q=G?L.split(G):[L];for(var ae in q)if(typeof q[ae]=="string"){var ie=q[ae].split(X);if(ie.length===2){var W=ie[0].trim(),K=ie[1].trim();I(W,K)}}}function a(L,I,X){var G=L;function q(){var W=i(L);if(W===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+G);return L=L.replace(/^[^\sa-zA-Z-]+/,""),W}function ae(W,K){var Q=new n;r(W,function(te,re){switch(te){case"region":for(var U=X.length-1;U>=0;U--)if(X[U].id===re){Q.set(te,X[U].region);break}break;case"vertical":Q.alt(te,re,["rl","lr"]);break;case"line":var ne=re.split(","),Z=ne[0];Q.integer(te,Z),Q.percent(te,Z)&&Q.set("snapToLines",!1),Q.alt(te,Z,["auto"]),ne.length===2&&Q.alt("lineAlign",ne[1],["start","center","end"]);break;case"position":ne=re.split(","),Q.percent(te,ne[0]),ne.length===2&&Q.alt("positionAlign",ne[1],["start","center","end"]);break;case"size":Q.percent(te,re);break;case"align":Q.alt(te,re,["start","center","end","left","right"]);break}},/:/,/\s/),K.region=Q.get("region",null),K.vertical=Q.get("vertical","");try{K.line=Q.get("line","auto")}catch{}K.lineAlign=Q.get("lineAlign","start"),K.snapToLines=Q.get("snapToLines",!0),K.size=Q.get("size",100);try{K.align=Q.get("align","center")}catch{K.align=Q.get("align","middle")}try{K.position=Q.get("position","auto")}catch{K.position=Q.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},K.align)}K.positionAlign=Q.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},K.align)}function ie(){L=L.replace(/^\s+/,"")}if(ie(),I.startTime=q(),ie(),L.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+G);L=L.substr(3),ie(),I.endTime=q(),ie(),ae(L,I)}var u=s.createElement&&s.createElement("textarea"),c={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},f={v:"title",lang:"lang"},p={rt:"ruby"};function y(L,I){function X(){if(!I)return null;function Z(xe){return I=I.substr(xe.length),xe}var fe=I.match(/^([^<]*)(<[^>]*>?)?/);return Z(fe[1]?fe[1]:fe[2])}function G(Z){return u.innerHTML=Z,Z=u.textContent,u.textContent="",Z}function q(Z,fe){return!p[fe.localName]||p[fe.localName]===Z.localName}function ae(Z,fe){var xe=c[Z];if(!xe)return null;var ge=L.document.createElement(xe),Ce=f[Z];return Ce&&fe&&(ge[Ce]=fe.trim()),ge}for(var ie=L.document.createElement("div"),W=ie,K,Q=[];(K=X())!==null;){if(K[0]==="<"){if(K[1]==="/"){Q.length&&Q[Q.length-1]===K.substr(2).replace(">","")&&(Q.pop(),W=W.parentNode);continue}var te=i(K.substr(1,K.length-2)),re;if(te){re=L.document.createProcessingInstruction("timestamp",te),W.appendChild(re);continue}var U=K.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!U||(re=ae(U[1],U[3]),!re)||!q(W,re))continue;if(U[2]){var ne=U[2].split(".");ne.forEach(function(Z){var fe=/^bg_/.test(Z),xe=fe?Z.slice(3):Z;if(d.hasOwnProperty(xe)){var ge=fe?"background-color":"color",Ce=d[xe];re.style[ge]=Ce}}),re.className=ne.join(" ")}Q.push(U[1]),W.appendChild(re),W=re;continue}W.appendChild(L.document.createTextNode(G(K)))}return ie}var v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function b(L){for(var I=0;I=X[0]&&L<=X[1])return!0}return!1}function T(L){var I=[],X="",G;if(!L||!L.childNodes)return"ltr";function q(W,K){for(var Q=K.childNodes.length-1;Q>=0;Q--)W.push(K.childNodes[Q])}function ae(W){if(!W||!W.length)return null;var K=W.pop(),Q=K.textContent||K.innerText;if(Q){var te=Q.match(/^.*(\n|\r)/);return te?(W.length=0,te[0]):Q}if(K.tagName==="ruby")return ae(W);if(K.childNodes)return q(W,K),ae(W)}for(q(I,L);X=ae(I);)for(var ie=0;ie=0&&L.line<=100))return L.line;if(!L.track||!L.track.textTrackList||!L.track.textTrackList.mediaElement)return-1;for(var I=L.track,X=I.textTrackList,G=0,q=0;qL.left&&this.topL.top},R.prototype.overlapsAny=function(L){for(var I=0;I=L.top&&this.bottom<=L.bottom&&this.left>=L.left&&this.right<=L.right},R.prototype.overlapsOppositeAxis=function(L,I){switch(I){case"+x":return this.leftL.right;case"+y":return this.topL.bottom}},R.prototype.intersectPercentage=function(L){var I=Math.max(0,Math.min(this.right,L.right)-Math.max(this.left,L.left)),X=Math.max(0,Math.min(this.bottom,L.bottom)-Math.max(this.top,L.top)),G=I*X;return G/(this.height*this.width)},R.prototype.toCSSCompatValues=function(L){return{top:this.top-L.top,bottom:L.bottom-this.bottom,left:this.left-L.left,right:L.right-this.right,height:this.height,width:this.width}},R.getSimpleBoxPosition=function(L){var I=L.div?L.div.offsetHeight:L.tagName?L.offsetHeight:0,X=L.div?L.div.offsetWidth:L.tagName?L.offsetWidth:0,G=L.div?L.div.offsetTop:L.tagName?L.offsetTop:0;L=L.div?L.div.getBoundingClientRect():L.tagName?L.getBoundingClientRect():L;var q={left:L.left,right:L.right,top:L.top||G,height:L.height||I,bottom:L.bottom||G+(L.height||I),width:L.width||X};return q};function j(L,I,X,G){function q(xe,ge){for(var Ce,Me=new R(xe),Re=1,Ae=0;Aebe&&(Ce=new R(xe),Re=be),xe=new R(Me)}return Ce||Me}var ae=new R(I),ie=I.cue,W=E(ie),K=[];if(ie.snapToLines){var Q;switch(ie.vertical){case"":K=["+y","-y"],Q="height";break;case"rl":K=["+x","-x"],Q="width";break;case"lr":K=["-x","+x"],Q="width";break}var te=ae.lineHeight,re=te*Math.round(W),U=X[Q]+te,ne=K[0];Math.abs(re)>U&&(re=re<0?-1:1,re*=Math.ceil(U/te)*te),W<0&&(re+=ie.vertical===""?X.height:X.width,K=K.reverse()),ae.move(ne,re)}else{var Z=ae.lineHeight/X.height*100;switch(ie.lineAlign){case"center":W-=Z/2;break;case"end":W-=Z;break}switch(ie.vertical){case"":I.applyStyles({top:I.formatStyle(W,"%")});break;case"rl":I.applyStyles({left:I.formatStyle(W,"%")});break;case"lr":I.applyStyles({right:I.formatStyle(W,"%")});break}K=["+y","-x","+x","-y"],ae=new R(I)}var fe=q(ae,K);I.move(fe.toCSSCompatValues(X))}function F(){}F.StringDecoder=function(){return{decode:function(L){if(!L)return"";if(typeof L!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(L))}}},F.convertCueToDOMTree=function(L,I){return!L||!I?null:y(L,I)};var z=.05,N="sans-serif",Y="1.5%";return F.processCues=function(L,I,X){if(!L||!I||!X)return null;for(;X.firstChild;)X.removeChild(X.firstChild);var G=L.document.createElement("div");G.style.position="absolute",G.style.left="0",G.style.right="0",G.style.top="0",G.style.bottom="0",G.style.margin=Y,X.appendChild(G);function q(te){for(var re=0;re")===-1){I.cue.id=ie;continue}case"CUE":try{a(ie,I.cue,I.regionList)}catch(te){I.reportOrThrowError(te),I.cue=null,I.state="BADCUE";continue}I.state="CUETEXT";continue;case"CUETEXT":var Q=ie.indexOf("-->")!==-1;if(!ie||Q&&(K=!0)){I.oncue&&I.oncue(I.cue),I.cue=null,I.state="ID";continue}I.cue.text&&(I.cue.text+=` -`),I.cue.text+=ie.replace(/\u2028/g,` + `,onClick:()=>f(!1),"aria-label":"Schließen",title:"Schließen",children:"✕"}),p.jsx("div",{className:"h-full overflow-auto pr-1",children:p.jsx("div",{className:"flex flex-wrap gap-1.5",children:T.map(L=>p.jsx(fa,{tag:L,active:t.has(i(L)),onClick:n,maxWidthClassName:a},L))})})]}):null,p.jsxs("div",{className:"absolute -left-[9999px] -top-[9999px] opacity-0 pointer-events-none",children:[p.jsx("div",{ref:y,className:"flex flex-nowrap items-center gap-1.5",children:T.slice(0,R).map(L=>p.jsx(fa,{tag:L,active:t.has(i(L)),onClick:n,maxWidthClassName:a},L))}),p.jsx("button",{ref:v,type:"button",className:"inline-flex items-center rounded-md bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-200",children:"+99"})]})]})}function t2(s,e,t){return Math.max(e,Math.min(t,s))}function WM(s){const e=Math.max(0,Math.floor(s)),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}function ek({imageCount:s,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:n,stepSeconds:r=0}){const a=_.useRef(null),u=_.useRef(null),c=_.useRef(void 0),d=_.useCallback(()=>{u.current=null,t(c.current)},[t]),f=_.useCallback(F=>{c.current=F,u.current==null&&(u.current=window.requestAnimationFrame(d))},[d]);_.useEffect(()=>()=>{u.current!=null&&(window.cancelAnimationFrame(u.current),u.current=null)},[]);const g=_.useCallback(F=>{if(!a.current||s<1)return;const G=a.current.getBoundingClientRect();if(G.width<=0)return;const L=F-G.left,W=t2(L/G.width,0,.999999);return t2(Math.floor(W*s),0,s-1)},[s]),y=_.useCallback(F=>{const G=g(F.clientX);f(G)},[g,f]),v=_.useCallback(F=>{const G=g(F.clientX);f(G)},[g,f]),b=_.useCallback(()=>{f(void 0)},[f]),T=_.useCallback(F=>{F.stopPropagation();const G=g(F.clientX);f(G);try{F.currentTarget.setPointerCapture?.(F.pointerId)}catch{}},[g,f]),E=_.useCallback(F=>{if(F.stopPropagation(),!i)return;const G=g(F.clientX);typeof G=="number"&&i(G)},[g,i]);if(!s||s<1)return null;const D=typeof e=="number"?(e+.5)/s*100:void 0,O=typeof e=="number"?r>0?WM(e*r):`${e+1}/${s}`:"",R=typeof e=="number",j=typeof D=="number"?{left:`clamp(24px, ${D}%, calc(100% - 24px))`,transform:"translateX(-50%)"}:void 0;return p.jsxs("div",{ref:a,className:["relative h-7 w-full select-none touch-none cursor-col-resize","opacity-0 transition-opacity duration-150","pointer-events-none","group-hover:opacity-100 group-focus-within:opacity-100","group-hover:pointer-events-auto group-focus-within:pointer-events-auto",n].filter(Boolean).join(" "),onPointerMove:y,onPointerEnter:v,onPointerLeave:b,onPointerDown:T,onMouseDown:F=>F.stopPropagation(),onClick:E,title:R?O:`Preview scrubber (${s})`,role:"slider","aria-label":"Preview scrubber","aria-valuemin":1,"aria-valuemax":s,"aria-valuenow":typeof e=="number"?e+1:void 0,children:[p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-4 bg-white/35 ring-1 ring-white/40 backdrop-blur-[1px]",children:typeof D=="number"?p.jsx("div",{className:"absolute inset-y-0 w-[2px] bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:`${D}%`,transform:"translateX(-50%)"}}):null}),p.jsx("div",{className:["pointer-events-none absolute bottom-[19px] z-10","rounded bg-black/70 px-1.5 py-0.5","text-[11px] leading-none text-white whitespace-nowrap","transition-opacity duration-100",R?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:j,children:O})]})}const tk=/^HOT[ \u00A0]+/i,ik=s=>String(s||"").replaceAll(" "," "),vc=s=>tk.test(ik(s)),gr=s=>ik(s).replace(tk,"");function fb(s){if(!s)return"";const e=Math.round(Number(s.w)),t=Math.round(Number(s.h));if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return"";const i=Math.min(e,t),n=Math.max(12,Math.round(i*.02)),r=a=>Math.abs(i-a)<=n;return r(4320)?"8K":r(2160)||i>=2e3?"4K":r(1440)?"1440p":r(1080)?"1080p":r(720)?"720p":r(480)?"480p":r(360)?"360p":r(240)?"240p":`${i}p`}const YM=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n};function XM(...s){for(const e of s)if(typeof e=="string"){const t=e.trim();if(t)return t}}function Fy(s){if(!(typeof s!="number"||!Number.isFinite(s)||s<=0))return s>1440*60?s/1e3:s}function i2(s,e,t){return Math.max(e,Math.min(t,s))}const QM=5;function ZM(s){if(s<=1)return[1,1];const e=16/9;let t=1,i=s,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let a=1;a<=s;a++){const u=Math.max(1,Math.ceil(s/a)),c=a*u-s,d=a/u,f=Math.abs(d-e);(c{const ze=Re?.meta;if(!ze)return null;if(typeof ze=="string")try{return JSON.parse(ze)}catch{return null}return ze},[]),be=_.useCallback(Re=>{const ze=pe(Re),Ue=(typeof ze?.videoWidth=="number"&&Number.isFinite(ze.videoWidth)?ze.videoWidth:0)||(typeof Re.videoWidth=="number"&&Number.isFinite(Re.videoWidth)?Re.videoWidth:0),de=(typeof ze?.videoHeight=="number"&&Number.isFinite(ze.videoHeight)?ze.videoHeight:0)||(typeof Re.videoHeight=="number"&&Number.isFinite(Re.videoHeight)?Re.videoHeight:0);return Ue>0&&de>0?{w:Ue,h:de}:null},[pe]),ve=_.useCallback(Re=>{const ze=pe(Re);let Ue=ze?.previewSprite??ze?.preview?.sprite??ze?.sprite??Re?.previewSprite??Re?.preview?.sprite??null;if(typeof Ue=="string")try{Ue=JSON.parse(Ue)}catch{Ue=null}const de=Number(Ue?.count??Ue?.frames??Ue?.imageCount),qe=Number(Ue?.stepSeconds??Ue?.step??Ue?.intervalSeconds);if(Number.isFinite(de)&&de>=2)return{count:Math.max(2,Math.floor(de)),stepSeconds:Number.isFinite(qe)&&qe>0?qe:5};const ht=E(Re),tt=u[ht]??(typeof Re?.durationSeconds=="number"?Re.durationSeconds:void 0);return typeof tt=="number"&&Number.isFinite(tt)&&tt>1?{count:Math.max(2,Math.min(240,Math.floor(tt/5)+1)),stepSeconds:5}:null},[pe,E,u]),[we,He]=_.useState({}),[Fe,Ze]=_.useState({}),De=_.useCallback((Re,ze)=>{He(Ue=>{if(ze===void 0){if(!(Re in Ue))return Ue;const de={...Ue};return delete de[Re],de}return Ue[Re]===ze?Ue:{...Ue,[Re]:ze}})},[]),Ye=_.useCallback(Re=>{De(Re,void 0)},[De]),wt=_.useCallback((Re,ze)=>{Ze(Ue=>{if(ze===void 0){if(!(Re in Ue))return Ue;const de={...Ue};return delete de[Re],de}return Ue[Re]===ze?Ue:{...Ue,[Re]:ze}})},[]),vt=(Re,ze)=>{const Ue=E(Re),de=d?.key===Ue,qe=ze?.disableInline?!1:de,tt=!(!ze?.forceStill&&!!n&&(qe||r===Ue)),At=qe?d?.nonce??0:0,ft=!!ze?.forceLoadStill,Et=ze?.forceStill?!1:ze?.mobileStackTopOnlyVideo?i==="all"||(i==="hover"?c===Ue:!1):i==="all"?!0:i==="hover"?c===Ue:!1,Lt=f.has(Ue)||g.has(Ue)||y.has(Ue),Rt=O(Re.output),qt=D(Re.output||""),Wt=gr(qt.replace(/\.[^.]+$/,"")).trim(),yi=G(Rt),Ct=q[yi],It=pe(Re),oi=ve(Re),wi=we[Ue],Di=Fe[Ue]===!0,Yt=XM(It?.previewSprite?.path,It?.previewSpritePath,Ct?.previewScrubberPath,Wt?`/api/preview-sprite/${encodeURIComponent(Wt)}`:void 0),Nt=Yt?Yt.replace(/\/+$/,""):void 0,H=It?.previewSprite?.stepSeconds??It?.previewSpriteStepSeconds,U=typeof H=="number"&&Number.isFinite(H)&&H>0?H:oi?.stepSeconds&&oi.stepSeconds>0?oi.stepSeconds:QM,ee=Fy(It?.durationSeconds)??Fy(Re?.durationSeconds)??Fy(u[Ue]),Te=typeof ee=="number"&&ee>0?Math.max(1,Math.min(200,Math.floor(ee/U)+1)):void 0,Me=It?.previewSprite?.count??It?.previewSpriteCount??Ct?.previewScrubberCount??Te,gt=It?.previewSprite?.cols??It?.previewSpriteCols,Tt=It?.previewSprite?.rows??It?.previewSpriteRows,gi=typeof Me=="number"&&Number.isFinite(Me)?Math.max(0,Math.floor(Me)):0,[si,xi]=gi>1?ZM(gi):[0,0],Ri=Number(gt),hi=Number(Tt),li=Number.isFinite(Ri)&&Number.isFinite(hi)&&Ri>0&&hi>0&&!(gi>1&&Ri===1&&hi===1)&&(gi<=1||Ri*hi>=gi),Kt=li?Math.floor(Ri):si,Si=li?Math.floor(hi):xi,jt=(typeof It?.updatedAtUnix=="number"&&Number.isFinite(It.updatedAtUnix)?It.updatedAtUnix:void 0)??(typeof It?.fileModUnix=="number"&&Number.isFinite(It.fileModUnix)?It.fileModUnix:void 0)??b??0,ui=Nt&&jt?`${Nt}?v=${encodeURIComponent(String(jt))}`:Nt||void 0,ei=!!ui&&gi>1,ti=ei&&Kt>0&&Si>0,Ui=ei?gi:0,rs=ei?U:0,Ks=typeof wi=="number"&&Ui>1?i2(wi/(Ui-1),0,1):void 0,Is=ti&&typeof wi=="number"?(()=>{const ni=i2(wi,0,Math.max(0,gi-1)),Fs=ni%Kt,tn=Math.floor(ni/Kt),We=Kt<=1?0:Fs/(Kt-1)*100,Mt=Si<=1?0:tn/(Si-1)*100;return{backgroundImage:`url("${ui}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Kt*100}% ${Si*100}%`,backgroundPosition:`${We}% ${Mt}%`}})():void 0,qi=vc(qt),_i=!!Ct?.favorite,Ns=Ct?.liked===!0,Ji=!!Ct?.watching,as=YM(Ct?.tags),Ms=R(Re),ji=F(j(Re)),ds=be(Re),Ki=fb(ds),Mi=`inline-prev-${encodeURIComponent(Ue)}`,ss=["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200",!e&&"hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",Lt&&"pointer-events-none opacity-70",f.has(Ue)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",g.has(Ue)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",y.has(Ue)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),Ps=p.jsx("div",{role:"button",tabIndex:0,className:ss,onClick:e?void 0:()=>I(Re),onKeyDown:ni=>{(ni.key==="Enter"||ni.key===" ")&&(ni.preventDefault(),W(Re))},children:p.jsxs(ma,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[p.jsx("div",{id:Mi,ref:ze?.disableInline||ze?.isDecorative?void 0:Y(Ue),className:"relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||ze?.disablePreviewHover?void 0:()=>L?.(Ue),onMouseLeave:()=>{!e&&!ze?.disablePreviewHover&&L?.(null),Ye(Ue)},onClick:ni=>{ni.preventDefault(),ni.stopPropagation(),!(e||ze?.disableInline)&&X(Ue)},children:p.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[qe?null:p.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover:opacity-0 group-focus-within:opacity-0 "+(qe?"opacity-0":"opacity-100"),children:p.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Ms,ds?`${ds.w}×${ds.h}`:Ki||"",ji].filter(Boolean).join(" • "),children:[p.jsx("span",{children:Ms}),Ki?p.jsx("span",{"aria-hidden":"true",children:"•"}):null,Ki?p.jsx("span",{children:Ki}):null,p.jsx("span",{"aria-hidden":"true",children:"•"}),p.jsx("span",{children:ji})]})}),p.jsx(b0,{job:Re,getFileName:ni=>gr(D(ni)),className:"h-full w-full",variant:"fill",durationSeconds:u[Ue]??Re?.durationSeconds,onDuration:ne,showPopover:!1,blur:qe?!1:!!a,animated:Et,animatedMode:"teaser",animatedTrigger:"always",clipSeconds:1,thumbSamples:18,inlineVideo:!ze?.disableInline&&qe?"always":!1,inlineNonce:At,inlineControls:qe,inlineLoop:!1,muted:tt,popoverMuted:tt,assetNonce:b??0,alwaysLoadStill:ft,teaserPreloadEnabled:ze?.mobileStackTopOnlyVideo?!0:!e,teaserPreloadRootMargin:e?"900px 0px":"700px 0px",scrubProgressRatio:Ks,preferScrubProgress:Di&&typeof wi=="number"}),ti&&ui?p.jsx("img",{src:ui,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,ti&&Is&&!qe?p.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:p.jsx("div",{className:"h-full w-full",style:Is})}):null,!ze?.isDecorative&&!qe&&Ui>1?p.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:ni=>ni.stopPropagation(),onMouseDown:ni=>ni.stopPropagation(),onMouseEnter:()=>wt(Ue,!0),onMouseLeave:()=>{wt(Ue,!1),De(Ue,void 0)},children:p.jsx(ek,{className:"pointer-events-auto px-1",imageCount:Ui,activeIndex:wi,onActiveIndexChange:ni=>De(Ue,ni),onIndexClick:ni=>{if(e||ze?.disableInline){T(Re,ni,Ui);return}const Fs=rs>0?ni*rs:0;if(N){N(Ue,Fs,Mi),requestAnimationFrame(()=>{V(Mi)||requestAnimationFrame(()=>{V(Mi)})});return}X(Ue),requestAnimationFrame(()=>{V(Mi)||requestAnimationFrame(()=>{V(Mi)})})},stepSeconds:rs})}):null]})}),p.jsxs("div",{className:"relative min-h-[112px] overflow-hidden px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:Rt}),p.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[qi?p.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,p.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:gr(qt)||"—"})]})]}),p.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[Ji?p.jsx(bu,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Ns?p.jsx(Tu,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,_i?p.jsx(Oc,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),p.jsx("div",{className:"mt-2",onClick:ni=>ni.stopPropagation(),onMouseDown:ni=>ni.stopPropagation(),children:p.jsx("div",{className:"w-full",children:p.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:p.jsx(pa,{job:Re,variant:"table",busy:Lt,collapseToMenu:!0,compact:!1,isHot:qi,isFavorite:_i,isLiked:Ns,isWatching:Ji,onToggleWatch:Q,onToggleFavorite:z,onToggleLike:re,onToggleHot:le,onKeep:K,onDelete:ie,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),p.jsx("div",{className:"mt-2",onClick:ni=>ni.stopPropagation(),onMouseDown:ni=>ni.stopPropagation(),children:p.jsx(hb,{rowKey:Ue,tags:as,activeTagSet:Z,lower:G,onToggleTagFilter:te})})]})]})});return{k:Ue,j:Re,busy:Lt,isHot:qi,inlineDomId:Mi,cardInner:Ps}},Ge=3,ke=e?s.slice(0,Ge):[],ut=e?s:[],rt=15,Je=24,at=(Math.min(ke.length,Ge)-1)*rt;return p.jsxs("div",{className:"relative",children:[e?p.jsx("div",{className:"relative",children:s.length===0?null:p.jsxs("div",{className:"relative mx-auto w-full max-w-[560px] overflow-visible",children:[p.jsx("div",{className:"relative overflow-visible",style:{minHeight:at>0?`${at}px`:void 0,paddingTop:`${at+Je}px`},children:ke.map((Re,ze)=>{const Ue=ze===0,{k:de,busy:qe,isHot:ht,cardInner:tt,inlineDomId:At}=vt(Re,Ue?{forceLoadStill:!0,mobileStackTopOnlyVideo:!0}:{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0}),ft=ze,Et=-(ft*rt),Lt=1-ft*.03,Rt=1-ft*.14;return Ue?p.jsx("div",{className:"absolute inset-x-0 top-0",style:{zIndex:30,transform:`translateY(${Et}px) scale(${Lt})`,transformOrigin:"top center"},children:p.jsx(HM,{ref:qt=>{qt?v.current.set(de,qt):v.current.delete(de)},enabled:!0,disabled:qe,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{ht||await le?.(Re)},onTap:()=>{X(de),requestAnimationFrame(()=>{V(At)||requestAnimationFrame(()=>V(At))})},onSwipeLeft:()=>ie(Re),onSwipeRight:()=>K(Re),children:tt})},de):p.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none",style:{zIndex:20-ft,transform:`translateY(${Et}px) scale(${Lt}) translateZ(0)`,opacity:Rt,transformOrigin:"top center"},"aria-hidden":"true",children:p.jsxs("div",{className:"relative",children:[tt,p.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},de)}).reverse()}),ut.length>Ge?p.jsx("div",{className:"sr-only","aria-hidden":"true",children:ut.slice(Ge).map(Re=>{const ze=E(Re);return p.jsx("div",{className:"relative aspect-video",children:p.jsx(b0,{job:Re,getFileName:D,className:"h-full w-full",showPopover:!1,blur:!!a,animated:!1,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!1,inlineControls:!1,inlineLoop:!1,muted:!0,popoverMuted:!0,assetNonce:b??0,alwaysLoadStill:!0,teaserPreloadEnabled:!1})},`preload-still-${ze}`)})}):null,s.length>1?p.jsx("div",{className:"mt-2 text-center text-xs text-gray-500 dark:text-gray-400",children:"Wische nach links zum Löschen • nach rechts zum Behalten"}):null]})}):p.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:s.map(Re=>{const{k:ze,cardInner:Ue}=vt(Re);return p.jsx(_.Fragment,{children:Ue},ze)})}),t&&s.length===0?p.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[p.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),p.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function e3({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const t3=_.forwardRef(e3);function i3({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const s3=_.forwardRef(i3);function n3({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const r3=_.forwardRef(n3);function a3({title:s,titleId:e,...t},i){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),s?_.createElement("title",{id:e},s):null,_.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const o3=_.forwardRef(a3);function hr(...s){return s.filter(Boolean).join(" ")}function s2(s){return s==="center"?"text-center":s==="right"?"text-right":"text-left"}function l3(s){return s==="center"?"justify-center":s==="right"?"justify-end":"justify-start"}function n2(s,e){const t=s===0,i=s===e-1;return t||i?"pl-2 pr-2":"px-2"}function r2(s){return s==null?{isNull:!0,kind:"string",value:""}:s instanceof Date?{isNull:!1,kind:"number",value:s.getTime()}:typeof s=="number"?{isNull:!1,kind:"number",value:s}:typeof s=="boolean"?{isNull:!1,kind:"number",value:s?1:0}:typeof s=="bigint"?{isNull:!1,kind:"number",value:Number(s)}:{isNull:!1,kind:"string",value:String(s).toLocaleLowerCase()}}function Sh({columns:s,rows:e,getRowKey:t,title:i,description:n,actions:r,fullWidth:a=!1,card:u=!0,striped:c=!1,stickyHeader:d=!1,compact:f=!1,isLoading:g=!1,emptyLabel:y="Keine Daten vorhanden.",className:v,rowClassName:b,onRowClick:T,onRowContextMenu:E,sort:D,onSortChange:O,defaultSort:R=null}){const j=f?"py-2":"py-4",F=f?"py-3":"py-3.5",G=D!==void 0,[L,W]=_.useState(R),I=G?D:L,N=_.useCallback(V=>{G||W(V),O?.(V)},[G,O]),X=_.useMemo(()=>{if(!I)return e;const V=s.find(ie=>ie.key===I.key);if(!V)return e;const Y=I.direction==="asc"?1:-1,ne=e.map((ie,K)=>({r:ie,i:K}));return ne.sort((ie,K)=>{let q=0;if(V.sortFn)q=V.sortFn(ie.r,K.r);else{const Z=V.sortValue?V.sortValue(ie.r):ie.r?.[V.key],te=V.sortValue?V.sortValue(K.r):K.r?.[V.key],le=r2(Z),z=r2(te);le.isNull&&!z.isNull?q=1:!le.isNull&&z.isNull?q=-1:le.kind==="number"&&z.kind==="number"?q=le.valuez.value?1:0:q=String(le.value).localeCompare(String(z.value),void 0,{numeric:!0})}return q===0?ie.i-K.i:q*Y}),ne.map(ie=>ie.r)},[e,s,I]);return p.jsxs("div",{className:hr(a?"":"px-4 sm:px-6 lg:px-8",v),children:[(i||n||r)&&p.jsxs("div",{className:"sm:flex sm:items-center",children:[p.jsxs("div",{className:"sm:flex-auto",children:[i&&p.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-white",children:i}),n&&p.jsx("p",{className:"mt-2 text-sm text-gray-700 dark:text-gray-300",children:n})]}),r&&p.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-16 sm:flex-none",children:r})]}),p.jsx("div",{className:hr(i||n||r?"mt-8":""),children:p.jsx("div",{className:"flow-root",children:p.jsx("div",{className:"overflow-x-auto",children:p.jsx("div",{className:hr("inline-block min-w-full align-middle",a?"":"sm:px-6 lg:px-8"),children:p.jsx("div",{className:hr(u&&"overflow-hidden shadow-sm outline-1 outline-black/5 rounded-lg dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"),children:p.jsxs("table",{className:"relative min-w-full divide-y divide-gray-200 dark:divide-white/10",children:[p.jsx("thead",{className:hr(u&&"bg-gray-50/90 dark:bg-gray-800/70",d&&"sticky top-0 z-10 backdrop-blur-sm shadow-sm"),children:p.jsx("tr",{children:s.map((V,Y)=>{const ne=n2(Y,s.length),ie=!!I&&I.key===V.key,K=ie?I.direction:void 0,q=V.sortable&&!V.srOnlyHeader?ie?K==="asc"?"ascending":"descending":"none":void 0,Z=()=>{if(!(!V.sortable||V.srOnlyHeader))return N(ie?K==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return p.jsx("th",{scope:"col","aria-sort":q,className:hr(F,ne,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",s2(V.align),V.widthClassName,V.headerClassName),children:V.srOnlyHeader?p.jsx("span",{className:"sr-only",children:V.header}):V.sortable?p.jsxs("button",{type:"button",onClick:Z,className:hr("group inline-flex w-full items-center gap-2 select-none rounded-md px-1.5 py-1 -my-1 hover:bg-gray-100/70 dark:hover:bg-white/5",l3(V.align)),children:[p.jsx("span",{children:V.header}),p.jsx("span",{className:hr("flex-none rounded-sm text-gray-400 dark:text-gray-500",ie?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:p.jsx(t3,{"aria-hidden":"true",className:hr("size-5 transition-transform",ie&&K==="asc"&&"rotate-180")})})]}):V.header},V.key)})})}),p.jsx("tbody",{className:hr("divide-y divide-gray-200 dark:divide-white/10",u?"bg-white dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),children:g?p.jsx("tr",{children:p.jsx("td",{colSpan:s.length,className:hr(j,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):X.length===0?p.jsx("tr",{children:p.jsx("td",{colSpan:s.length,className:hr(j,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:y})}):X.map((V,Y)=>{const ne=t?t(V,Y):String(Y);return p.jsx("tr",{className:hr(c&&"even:bg-gray-50 dark:even:bg-gray-800/50",T&&"cursor-pointer",T&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",b?.(V,Y)),onClick:()=>T?.(V),onContextMenu:E?ie=>{ie.preventDefault(),E(V,ie)}:void 0,children:s.map((ie,K)=>{const q=n2(K,s.length),Z=ie.cell?.(V,Y)??ie.accessor?.(V)??V?.[ie.key];return p.jsx("td",{className:hr(j,q,"text-sm whitespace-nowrap",s2(ie.align),ie.className,ie.key===s[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Z},ie.key)})},ne)})})]})})})})})})]})}function u3({rows:s,isLoading:e,keyFor:t,baseName:i,lower:n,modelNameFromOutput:r,runtimeOf:a,sizeBytesOf:u,formatBytes:c,resolutions:d,durations:f,canHover:g,teaserAudio:y,hoverTeaserKey:v,setHoverTeaserKey:b,teaserPlayback:T="hover",teaserKey:E,registerTeaserHost:D,handleDuration:O,handleResolution:R,blurPreviews:j,assetNonce:F,deletingKeys:G,keepingKeys:L,removingKeys:W,modelsByKey:I,activeTagSet:N,onToggleTagFilter:X,onOpenPlayer:V,onSortModeChange:Y,page:ne,onPageChange:ie,onToggleHot:K,onToggleFavorite:q,onToggleLike:Z,onToggleWatch:te,deleteVideo:le,keepVideo:z}){const[re,Q]=_.useState(null),pe=_.useCallback(Ge=>{const ke=Ge?.durationSeconds;if(typeof ke=="number"&&Number.isFinite(ke)&&ke>0)return ke;const ut=Date.parse(String(Ge?.startedAt||"")),rt=Date.parse(String(Ge?.endedAt||""));if(Number.isFinite(ut)&&Number.isFinite(rt)&&rt>ut){const Je=(rt-ut)/1e3;if(Je>=1&&Je<=1440*60)return Je}return Number.POSITIVE_INFINITY},[]),be=_.useCallback(Ge=>{const ke=String(Ge??"").trim();if(!ke)return[];const ut=ke.split(/[\n,;|]+/g).map(at=>at.trim()).filter(Boolean),rt=new Set,Je=[];for(const at of ut){const Re=at.toLowerCase();rt.has(Re)||(rt.add(Re),Je.push(at))}return Je.sort((at,Re)=>at.localeCompare(Re,void 0,{sensitivity:"base"})),Je},[]),ve=_.useCallback(Ge=>{const ke=Ge?.meta;if(!ke)return null;if(typeof ke=="string")try{return JSON.parse(ke)}catch{return null}return ke},[]),we=_.useCallback(Ge=>{const ke=ve(Ge);let ut=ke?.previewSprite??ke?.preview?.sprite??null;if(typeof ut=="string")try{ut=JSON.parse(ut)}catch{ut=null}const rt=Number(ut?.count),Je=Number(ut?.stepSeconds);return!Number.isFinite(rt)||rt<2?null:{count:Math.max(2,Math.floor(rt)),stepSeconds:Number.isFinite(Je)&&Je>0?Je:5}},[ve]),[He,Fe]=_.useState({}),Ze=_.useCallback((Ge,ke)=>{Fe(ut=>ut[Ge]===ke?ut:{...ut,[Ge]:ke})},[]),De=_.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Ge=>{const ke=t(Ge),rt=!(!!y&&v===ke),Je=we(Ge),at=He[ke],Re=i(Ge.output||""),ze=gr(Re.replace(/\.[^.]+$/,"")).trim(),Ue=Je&&typeof at=="number"?Math.max(0,at*Je.stepSeconds):void 0,de=ze&&typeof Ue=="number"?`/api/preview?id=${encodeURIComponent(ze)}&t=${Ue.toFixed(3)}&v=${F??0}`:"";return p.jsxs("div",{ref:D(ke),className:"group relative py-1",onClick:qe=>qe.stopPropagation(),onMouseDown:qe=>qe.stopPropagation(),onMouseEnter:()=>{g&&b(ke)},onMouseLeave:()=>{g&&b(null),Ze(ke,void 0)},children:[p.jsx(b0,{job:Ge,getFileName:i,durationSeconds:f[ke],muted:rt,popoverMuted:rt,onDuration:O,onResolution:R,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:j,animated:T==="all"?!0:T==="hover"?E===ke:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:F}),Je&&typeof at=="number"&&de?p.jsx("img",{src:de,alt:"","aria-hidden":"true",className:"pointer-events-none absolute left-0 top-1 z-[15] h-16 w-28 rounded-md object-cover ring-1 ring-black/5 dark:ring-white/10",draggable:!1}):null]})}},{key:"Model",header:"Model",sortable:!0,sortValue:Ge=>{const ke=i(Ge.output||""),ut=vc(ke),rt=r(Ge.output),Je=gr(ke);return`${rt} ${ut?"HOT":""} ${Je}`.trim()},cell:Ge=>{const ke=i(Ge.output||""),ut=vc(ke),rt=gr(ke),Je=r(Ge.output),at=n(r(Ge.output)),Re=be(I[at]?.tags);return p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:Je}),p.jsxs("div",{className:"mt-0.5 min-w-0 text-xs text-gray-500 dark:text-gray-400",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("span",{className:"truncate",title:rt,children:rt||"—"}),(()=>{const ze=t(Ge),Ue=d[ze]??null,de=fb(Ue);return de?p.jsx("span",{className:`shrink-0 rounded-md bg-gray-100 px-1.5 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200\r + dark:bg-white/5 dark:text-gray-200 dark:ring-white/10`,title:Ue?`${Ue.w}×${Ue.h}`:"Auflösung",children:de}):null})(),ut?p.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[11px] font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null]}),Re.length>0?p.jsx("div",{className:"mt-1",onClick:ze=>ze.stopPropagation(),onMouseDown:ze=>ze.stopPropagation(),children:p.jsx(hb,{rowKey:t(Ge),tags:Re,activeTagSet:N,lower:n,onToggleTagFilter:X,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Ge=>{const ke=Date.parse(String(Ge.endedAt||""));return Number.isFinite(ke)?ke:Number.NEGATIVE_INFINITY},cell:Ge=>{const ke=Date.parse(String(Ge.endedAt||""));if(!Number.isFinite(ke))return p.jsx("span",{className:"text-xs text-gray-400",children:"—"});const ut=new Date(ke),rt=ut.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),Je=ut.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return p.jsxs("time",{dateTime:ut.toISOString(),title:`${rt} ${Je}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[p.jsx("span",{className:"font-medium",children:rt}),p.jsx("span",{className:"mx-1 text-gray-400 dark:text-gray-600",children:"·"}),p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:Je})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Ge=>pe(Ge),cell:Ge=>p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:a(Ge)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Ge=>{const ke=u(Ge);return typeof ke=="number"?ke:Number.NEGATIVE_INFINITY},cell:Ge=>p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:c(u(Ge))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Ge=>{const ke=t(Ge),ut=G.has(ke)||L.has(ke)||W.has(ke),rt=i(Ge.output||""),Je=vc(rt),at=n(r(Ge.output)),Re=I[at],ze=!!Re?.favorite,Ue=Re?.liked===!0,de=!!Re?.watching;return p.jsx(pa,{job:Ge,variant:"table",busy:ut,isHot:Je,isFavorite:ze,isLiked:Ue,isWatching:de,onToggleWatch:te,onToggleFavorite:q,onToggleLike:Z,onToggleHot:K,onKeep:z,onDelete:le,order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,f,y,v,D,g,b,O,R,j,T,E,F,n,r,I,N,X,d,G,L,W,we,He,Ze,te,q,Z,K,z,le,u,c,a,be,pe]),Ye=_.useCallback(Ge=>{if(!Ge)return"completed_desc";const ke=Ge,ut=String(ke.key??ke.columnKey??ke.id??""),rt=String(ke.dir??ke.direction??ke.order??"").toLowerCase(),Je=rt==="asc"||rt==="1"||rt==="true";return ut==="completedAt"?Je?"completed_asc":"completed_desc":ut==="runtime"?Je?"duration_asc":"duration_desc":ut==="size"?Je?"size_asc":"size_desc":ut==="Model"||ut==="video"?Je?"file_asc":"file_desc":Je?"completed_asc":"completed_desc"},[]),wt=_.useCallback(Ge=>{Q(Ge),Y(Ye(Ge)),ne!==1&&ie(1)},[Y,Ye,ne,ie]),vt=_.useCallback(Ge=>{const ke=t(Ge);return["transition-all duration-300",(G.has(ke)||W.has(ke))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",G.has(ke)&&"animate-pulse",(L.has(ke)||W.has(ke))&&"pointer-events-none",L.has(ke)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",W.has(ke)&&"opacity-0"].filter(Boolean).join(" ")},[t,G,L,W]);return p.jsxs("div",{className:"relative",children:[p.jsx(Sh,{rows:s,columns:De,getRowKey:Ge=>t(Ge),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:re,onSortChange:wt,onRowClick:V,rowClassName:vt}),e&&s.length===0?p.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[p.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),p.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function a2(...s){for(const e of s)if(typeof e=="string"){const t=e.trim();if(t)return t}}function c3(s){if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return typeof s=="object"?s:null}function By(s){if(!(typeof s!="number"||!Number.isFinite(s)||s<=0))return s>1440*60?s/1e3:s}function o2(s,e,t){return Math.max(e,Math.min(t,s))}const d3=5;function h3(s){if(s<=1)return[1,1];const e=16/9;let t=1,i=s,n=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(let a=1;a<=s;a++){const u=Math.max(1,Math.ceil(s/a)),c=a*u-s,d=a/u,f=Math.abs(d-e);(cHe=>{if(!q){j(we)(null);return}j(we)(He)},[j,q]),te=we=>{const He=String(we??"").trim();if(!He)return[];const Fe=He.split(/[\n,;|]+/g).map(Ye=>Ye.trim()).filter(Boolean),Ze=new Set,De=[];for(const Ye of Fe){const wt=Ye.toLowerCase();Ze.has(wt)||(Ze.add(wt),De.push(Ye))}return De},le=_.useCallback(we=>{const He=(typeof we?.meta?.videoWidth=="number"&&Number.isFinite(we.meta.videoWidth)?we.meta.videoWidth:0)||(typeof we?.videoWidth=="number"&&Number.isFinite(we.videoWidth)?we.videoWidth:0),Fe=(typeof we?.meta?.videoHeight=="number"&&Number.isFinite(we.meta.videoHeight)?we.meta.videoHeight:0)||(typeof we?.videoHeight=="number"&&Number.isFinite(we.videoHeight)?we.videoHeight:0);return He>0&&Fe>0?{w:He,h:Fe}:null},[]),[z,re]=_.useState(null),[Q,pe]=_.useState({}),be=_.useCallback((we,He)=>{pe(Fe=>{if(He===void 0){if(!(we in Fe))return Fe;const Ze={...Fe};return delete Ze[we],Ze}return Fe[we]===He?Fe:{...Fe,[we]:He}})},[]),ve=_.useCallback(we=>{be(we,void 0)},[be]);return p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:s.map(we=>{const He=f(we),Ze=!(!!r&&a===He),De=y(we.output),Ye=N(De),wt=X[Ye],vt=!!wt?.favorite,Ge=wt?.liked===!0,ke=!!wt?.watching,ut=te(wt?.tags),rt=g(we.output||""),Je=vc(rt),at=gr(rt),Re=v(we),ze=T(b(we)),Ue=le(we),de=fb(Ue),qe=E.has(He)||D.has(He)||O.has(He),ht=R.has(He),tt=a2(wt?.image,wt?.imageUrl,we?.meta?.modelImage,we?.meta?.modelImageUrl),ft=gr(g(we.output||"")).replace(/\.[^.]+$/,"").trim(),Et=c3(we?.meta),Lt=a2(Et?.previewSprite?.path,Et?.previewSpritePath,wt?.previewScrubberPath,ft?`/api/preview-sprite/${encodeURIComponent(ft)}`:void 0),Rt=Lt?Lt.replace(/\/+$/,""):void 0,qt=Et?.previewSprite?.stepSeconds??Et?.previewSpriteStepSeconds,Wt=typeof qt=="number"&&Number.isFinite(qt)&&qt>0?qt:d3,yi=By(Et?.durationSeconds)??By(we?.durationSeconds)??By(i[He]),Ct=typeof yi=="number"&&yi>0?Math.max(1,Math.min(200,Math.floor(yi/Wt)+1)):void 0,It=Et?.previewSprite?.count??Et?.previewSpriteCount??wt?.previewScrubberCount??Ct,oi=Et?.previewSprite?.cols??Et?.previewSpriteCols,wi=Et?.previewSprite?.rows??Et?.previewSpriteRows,Di=typeof It=="number"&&Number.isFinite(It)?Math.max(0,Math.floor(It)):0,[Yt,Nt]=Di>1?h3(Di):[0,0],H=typeof oi=="number"&&Number.isFinite(oi)?Math.max(0,Math.floor(oi)):Yt,U=typeof wi=="number"&&Number.isFinite(wi)?Math.max(0,Math.floor(wi)):Nt,ee=(typeof Et?.updatedAtUnix=="number"&&Number.isFinite(Et.updatedAtUnix)?Et.updatedAtUnix:void 0)??(typeof Et?.fileModUnix=="number"&&Number.isFinite(Et.fileModUnix)?Et.fileModUnix:void 0)??0,Te=Rt&&ee?`${Rt}?v=${encodeURIComponent(String(ee))}`:Rt||void 0,Me=!!Te&&Di>1,gt=Me&&H>0&&U>0,Tt=Me?Di:0,gi=Me?Wt:0,si=Me,xi=Q[He],Ri=typeof xi=="number"&&Tt>1?o2(xi/(Tt-1),0,1):void 0,hi=gt&&typeof xi=="number"?(()=>{const jt=o2(xi,0,Math.max(0,Di-1)),ui=jt%H,ei=Math.floor(jt/H),ti=H<=1?0:ui/(H-1)*100,Ui=U<=1?0:ei/(U-1)*100;return{backgroundImage:`url("${Te}")`,backgroundRepeat:"no-repeat",backgroundSize:`${H*100}% ${U*100}%`,backgroundPosition:`${ti}% ${Ui}%`}})():void 0,li=z===He&&!!tt,Kt=!li&&!!hi,Si=li||Kt;return p.jsxs("div",{role:"button",tabIndex:0,className:["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",qe&&"pointer-events-none opacity-70",E.has(He)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",O.has(He)&&"opacity-0 translate-y-2 scale-[0.98]",ht&&"hidden"].filter(Boolean).join(" "),onClick:()=>G(we),onKeyDown:jt=>{(jt.key==="Enter"||jt.key===" ")&&G(we)},children:[p.jsx("div",{className:"group relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:Z(He),onMouseEnter:()=>F?.(He),onMouseLeave:()=>{F?.(null),ve(He),re(jt=>jt===He?null:jt)},children:p.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[p.jsx("div",{className:"absolute inset-0",children:p.jsx(b0,{job:we,getFileName:jt=>gr(g(jt)),durationSeconds:i[He]??we?.durationSeconds,onDuration:c,variant:"fill",showPopover:!1,blur:t,animated:Si?!1:n==="all"?!0:n==="hover"?u===He:!1,animatedMode:"teaser",animatedTrigger:"always",clipSeconds:1,thumbSamples:18,muted:Ze,popoverMuted:Ze,scrubProgressRatio:Ri,preferScrubProgress:typeof xi=="number"})}),gt&&Te?p.jsx("img",{src:Te,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Kt&&hi?p.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:p.jsx("div",{className:"h-full w-full",style:hi})}):null,li&&tt?p.jsxs("div",{className:"absolute inset-0 z-[6]",children:[p.jsx("img",{src:tt,alt:De?`${De} preview`:"Model preview",className:"h-full w-full object-cover",draggable:!1}),p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/65 to-transparent px-2 py-1.5",children:p.jsx("div",{className:"text-[10px] font-semibold tracking-wide text-white/95",children:"MODEL PREVIEW"})})]}):null,si?p.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:jt=>jt.stopPropagation(),onMouseDown:jt=>jt.stopPropagation(),children:p.jsx(ek,{className:"pointer-events-auto px-1",imageCount:Tt,activeIndex:xi,onActiveIndexChange:jt=>be(He,jt),onIndexClick:jt=>{be(He,jt),d(we,jt,Tt)},stepSeconds:gi})}):null,p.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover:opacity-0 group-focus-within:opacity-0",children:p.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Re,Ue?`${Ue.w}×${Ue.h}`:de||"",ze].filter(Boolean).join(" • "),children:[p.jsx("span",{children:Re}),de?p.jsx("span",{"aria-hidden":"true",children:"•"}):null,de?p.jsx("span",{children:de}):null,p.jsx("span",{"aria-hidden":"true",children:"•"}),p.jsx("span",{children:ze})]})})]})}),p.jsxs("div",{className:"relative min-h-[118px] px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Je?p.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,p.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:gr(at)||"—",children:gr(at)||"—"})]})}),p.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[p.jsx("div",{className:"min-w-0",children:p.jsx("span",{className:["block truncate text-xs text-gray-500 dark:text-gray-400",tt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:tt?`${De} (Hover: Model-Preview)`:De,onMouseEnter:jt=>{jt.stopPropagation(),tt&&re(He)},onMouseLeave:jt=>{jt.stopPropagation(),re(ui=>ui===He?null:ui)},onMouseDown:jt=>jt.stopPropagation(),onClick:jt=>jt.stopPropagation(),children:De||"—"})}),p.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[ke?p.jsx(bu,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Ge?p.jsx(Tu,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,vt?p.jsx(Oc,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),p.jsx("div",{className:"mt-2",onClick:jt=>jt.stopPropagation(),onMouseDown:jt=>jt.stopPropagation(),children:p.jsx("div",{className:"w-full",children:p.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:p.jsx(pa,{job:we,variant:"table",busy:qe,collapseToMenu:!0,compact:!0,isHot:Je,isFavorite:vt,isLiked:Ge,isWatching:ke,onToggleWatch:K,onToggleFavorite:ne,onToggleLike:ie,onToggleHot:I,onKeep:W,onDelete:L,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),p.jsx("div",{className:"mt-2",onClick:jt=>jt.stopPropagation(),onMouseDown:jt=>jt.stopPropagation(),children:p.jsx(hb,{rowKey:He,tags:ut,activeTagSet:V,lower:N,onToggleTagFilter:Y})})]})]},He)})}),e&&s.length===0?p.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[p.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),p.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function l2(s,e,t){return Math.max(e,Math.min(t,s))}function Uy(s,e){const t=[];for(let i=s;i<=e;i++)t.push(i);return t}function m3(s,e,t,i){if(s<=1)return[1];const n=1,r=s,a=Uy(n,Math.min(t,r)),u=Uy(Math.max(r-t+1,t+1),r),c=Math.max(Math.min(e-i,r-t-i*2-1),t+1),d=Math.min(Math.max(e+i,t+i*2+2),r-t),f=[];f.push(...a),c>t+1?f.push("ellipsis"):t+1t&&f.push(r-t),f.push(...u);const g=new Set;return f.filter(y=>{const v=String(y);return g.has(v)?!1:(g.add(v),!0)})}function p3({active:s,disabled:e,rounded:t,onClick:i,children:n,title:r}){const a=t==="l"?"rounded-l-md":t==="r"?"rounded-r-md":"";return p.jsx("button",{type:"button",disabled:e,onClick:e?void 0:i,title:r,className:vi("relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:z-20 focus:outline-offset-0",a,e?"opacity-50 cursor-not-allowed":"cursor-pointer",s?"z-10 bg-indigo-600 text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:bg-indigo-500 dark:focus-visible:outline-indigo-500":"text-gray-900 inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:text-gray-200 dark:inset-ring-gray-700 dark:hover:bg-white/5"),"aria-current":s?"page":void 0,children:n})}function dx({page:s,pageSize:e,totalItems:t,onPageChange:i,siblingCount:n=1,boundaryCount:r=1,showSummary:a=!0,className:u,ariaLabel:c="Pagination",prevLabel:d="Previous",nextLabel:f="Next"}){const g=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),y=l2(s||1,1,g);if(g<=1)return null;const v=t===0?0:(y-1)*e+1,b=Math.min(y*e,t),T=m3(g,y,r,n),E=D=>i(l2(D,1,g));return p.jsxs("div",{className:vi("flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6 dark:border-white/10 dark:bg-transparent",u),children:[p.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[p.jsx("button",{type:"button",onClick:()=>E(y-1),disabled:y<=1,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:d}),p.jsx("button",{type:"button",onClick:()=>E(y+1),disabled:y>=g,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:f})]}),p.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[p.jsx("div",{children:a?p.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Showing ",p.jsx("span",{className:"font-medium",children:v})," to"," ",p.jsx("span",{className:"font-medium",children:b})," of"," ",p.jsx("span",{className:"font-medium",children:t})," results"]}):null}),p.jsx("div",{children:p.jsxs("nav",{"aria-label":c,className:"isolate inline-flex -space-x-px rounded-md shadow-xs dark:shadow-none",children:[p.jsxs("button",{type:"button",onClick:()=>E(y-1),disabled:y<=1,className:"relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[p.jsx("span",{className:"sr-only",children:d}),p.jsx(s3,{"aria-hidden":"true",className:"size-5"})]}),T.map((D,O)=>D==="ellipsis"?p.jsx("span",{className:"relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 inset-ring inset-ring-gray-300 dark:text-gray-400 dark:inset-ring-gray-700",children:"…"},`e-${O}`):p.jsx(p3,{active:D===y,onClick:()=>E(D),rounded:"none",children:D},D)),p.jsxs("button",{type:"button",onClick:()=>E(y+1),disabled:y>=g,className:"relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[p.jsx("span",{className:"sr-only",children:f}),p.jsx(r3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const sk=_.createContext(null);function g3(s){switch(s){case"success":return{Icon:VO,cls:"text-emerald-500"};case"error":return{Icon:EM,cls:"text-rose-500"};case"warning":return{Icon:YO,cls:"text-amber-500"};default:return{Icon:nM,cls:"text-sky-500"}}}function y3(s){switch(s){case"success":return"border-emerald-200/70 dark:border-emerald-400/20";case"error":return"border-rose-200/70 dark:border-rose-400/20";case"warning":return"border-amber-200/70 dark:border-amber-400/20";default:return"border-sky-200/70 dark:border-sky-400/20"}}function v3(s){switch(s){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function x3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function b3({children:s,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[n,r]=_.useState([]),[a,u]=_.useState(!0),c=_.useCallback(async()=>{try{const E=await fetch("/api/settings",{cache:"no-store"});if(!E.ok)return;const D=await E.json();u(!!(D?.enableNotifications??!0))}catch{}},[]);_.useEffect(()=>{c();const E=()=>c();return window.addEventListener("recorder-settings-updated",E),()=>window.removeEventListener("recorder-settings-updated",E)},[c]),_.useEffect(()=>{a||r(E=>E.filter(D=>D.type==="error"))},[a]);const d=_.useCallback(E=>{r(D=>D.filter(O=>O.id!==E))},[]),f=_.useCallback(()=>r([]),[]),g=_.useCallback(E=>{if(!a&&E.type!=="error")return"";const D=x3(),O=E.durationMs??t;return r(R=>[{...E,id:D,durationMs:O},...R].slice(0,Math.max(1,e))),O&&O>0&&window.setTimeout(()=>d(D),O),D},[t,e,d,a]),y=_.useMemo(()=>({push:g,remove:d,clear:f}),[g,d,f]),v=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",b=i.endsWith("left")?"sm:items-start":"sm:items-end",T=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return p.jsxs(sk.Provider,{value:y,children:[s,p.jsx("div",{"aria-live":"assertive",className:["pointer-events-none fixed z-[80] inset-x-0",T].join(" "),children:p.jsx("div",{className:["flex w-full px-4 py-6 sm:p-6",v].join(" "),children:p.jsx("div",{className:["flex w-full flex-col space-y-3",b].join(" "),children:n.map(E=>{const{Icon:D,cls:O}=g3(E.type),R=(E.title||"").trim()||v3(E.type),j=(E.message||"").trim(),F=(E.imageUrl||"").trim(),G=(E.imageAlt||R).trim();return p.jsx(bh,{appear:!0,show:!0,children:p.jsx("div",{className:["pointer-events-auto w-full max-w-sm overflow-hidden rounded-xl","border bg-white/90 shadow-lg backdrop-blur","outline-1 outline-black/5","dark:bg-gray-950/70 dark:-outline-offset-1 dark:outline-white/10",y3(E.type),"transition data-closed:opacity-0 data-enter:transform data-enter:duration-200 data-enter:ease-out","data-closed:data-enter:translate-y-2 sm:data-closed:data-enter:translate-y-0",i.endsWith("right")?"sm:data-closed:data-enter:translate-x-2":"sm:data-closed:data-enter:-translate-x-2"].join(" "),children:p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"flex items-start gap-3",children:[F?p.jsx("div",{className:"shrink-0",children:p.jsx("img",{src:F,alt:G,loading:"lazy",referrerPolicy:"no-referrer",className:["h-12 w-12 rounded-lg object-cover","ring-1 ring-black/10 dark:ring-white/10"].join(" ")})}):p.jsx("div",{className:"shrink-0",children:p.jsx(D,{className:["size-6",O].join(" "),"aria-hidden":"true"})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:R}),j?p.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300 break-words",children:j}):null]}),p.jsxs("button",{type:"button",onClick:()=>d(E.id),className:"shrink-0 rounded-md text-gray-400 hover:text-gray-600 focus:outline-2 focus:outline-offset-2 focus:outline-indigo-600 dark:hover:text-white dark:focus:outline-indigo-500",children:[p.jsx("span",{className:"sr-only",children:"Close"}),p.jsx(o3,{"aria-hidden":"true",className:"size-5"})]})]})})})},E.id)})})})})]})}function T3(){const s=_.useContext(sk);if(!s)throw new Error("useToast must be used within ");return s}function nk(){const{push:s,remove:e,clear:t}=T3(),i=n=>(r,a,u)=>s({type:n,title:r,message:a,...u});return{push:s,remove:e,clear:t,success:i("success"),error:i("error"),info:i("info"),warning:i("warning")}}function S3(s){return typeof s=="number"?s:s==="xs"?12:s==="sm"?16:s==="lg"?28:20}function u2(...s){return s.filter(Boolean).join(" ")}function c2({size:s="md",className:e,label:t,srLabel:i="Lädt…",center:n=!1}){const r=S3(s);return p.jsxs("span",{className:u2("inline-flex items-center gap-2",n&&"justify-center w-full"),role:"status","aria-live":"polite",children:[p.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:u2("animate-spin text-gray-500",e),"aria-hidden":"true",children:[p.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),p.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",d:"M21 12a9 9 0 0 0-9-9",opacity:"0.95"})]}),t?p.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200",children:t}):p.jsx("span",{className:"sr-only",children:i})]})}const mb=s=>(s||"").replaceAll("\\","/"),Yr=s=>{const t=mb(s).split("/");return t[t.length-1]||""},On=s=>{const e=s?.id;return e!=null&&String(e).trim()!==""?String(e):Yr(s.output||"")||String(s?.output||"")},_3=s=>{const e=mb(String(s??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function d2(s){if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`}function jy(s){if(typeof s!="number"||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function h2(s){const[e,t]=_.useState(!1);return _.useEffect(()=>{const i=window.matchMedia(s),n=()=>t(i.matches);return n(),i.addEventListener?i.addEventListener("change",n):i.addListener(n),()=>{i.removeEventListener?i.removeEventListener("change",n):i.removeListener(n)}},[s]),e}const Zd=s=>{const e=Yr(s||""),t=gr(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i},Rr=s=>(s||"").trim().toLowerCase(),E3=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n.sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})),n},$y=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function w3({jobs:s,doneJobs:e,blurPreviews:t,teaserPlayback:i,teaserAudio:n,onOpenPlayer:r,onDeleteJob:a,onToggleHot:u,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,doneTotal:g,page:y,pageSize:v,onPageChange:b,assetNonce:T,sortMode:E,onSortModeChange:D,modelsByKey:O,loadMode:R="paged"}){const j=R==="all",F=i??"hover",G=h2("(hover: hover) and (pointer: fine)"),L=nk(),W=_.useRef(new Map),[I,N]=_.useState(null),[X,V]=_.useState(null),Y=_.useRef(null),ne=_.useRef(new WeakMap),[ie,K]=_.useState(()=>new Set),[q,Z]=_.useState(()=>new Set),[te,le]=_.useState(!1),z=_.useRef(!1),re="finishedDownloads_lastUndo_v1",[Q,pe]=_.useState(()=>{if(typeof window>"u")return null;try{const xe=localStorage.getItem(re);if(!xe)return null;const Ce=JSON.parse(xe);if(!Ce||Ce.v!==1||!Ce.action)return null;const Ie=Date.now()-Number(Ce.ts||0);return!Number.isFinite(Ie)||Ie<0||Ie>1800*1e3?(localStorage.removeItem(re),null):Ce.action}catch{return null}}),[be,ve]=_.useState(!1);_.useEffect(()=>{try{if(!Q){localStorage.removeItem(re);return}const xe={v:1,action:Q,ts:Date.now()};localStorage.setItem(re,JSON.stringify(xe))}catch{}},[Q]);const[we,He]=_.useState({}),[Fe,Ze]=_.useState(null),[De,Ye]=_.useState(null),[wt,vt]=_.useState(0),Ge=_.useRef(null),ke=_.useCallback(()=>{Ge.current&&window.clearTimeout(Ge.current),Ge.current=window.setTimeout(()=>vt(xe=>xe+1),80)},[]),ut=_.useRef({pending:0,t:0,timer:0}),rt=_.useCallback(xe=>{!xe||!Number.isFinite(xe)||(ut.current.pending+=xe,!ut.current.timer&&(ut.current.timer=window.setTimeout(()=>{ut.current.timer=0;const Ce=ut.current.pending;ut.current.pending=0,Ce&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:Ce}}))},120)))},[]),Je="finishedDownloads_view",at="finishedDownloads_includeKeep_v2",Re="finishedDownloads_mobileOptionsOpen_v1",[ze,Ue]=_.useState("table"),[de,qe]=_.useState(!1),[ht,tt]=_.useState(!1),At=_.useRef(new Map),[ft,Et]=_.useState([]),Lt=_.useMemo(()=>new Set(ft.map(Rr)),[ft]),Rt=_.useMemo(()=>{const xe={},Ce={};for(const[Ie,Xe]of Object.entries(O??{})){const xt=Rr(Ie),Ft=E3(Xe?.tags);xe[xt]=Ft,Ce[xt]=new Set(Ft.map(Rr))}return{tagsByModelKey:xe,tagSetByModelKey:Ce}},[O]),[qt,Wt]=_.useState(""),yi=_.useDeferredValue(qt),Ct=_.useMemo(()=>Rr(yi).split(/\s+/g).map(xe=>xe.trim()).filter(Boolean),[yi]),It=_.useCallback(()=>Wt(""),[]),oi=_.useCallback(xe=>{const Ce=Rr(xe);Et(Ie=>Ie.some(xt=>Rr(xt)===Ce)?Ie.filter(xt=>Rr(xt)!==Ce):[...Ie,xe])},[]),wi=Ct.length>0||Lt.size>0,Di=wi||j,Yt=_.useCallback(async xe=>{le(!0);try{const Ce=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(E)}&withCount=1${de?"&includeKeep=1":""}`,{cache:"no-store",signal:xe});if(!Ce.ok)return;const Ie=await Ce.json().catch(()=>null),Xe=Array.isArray(Ie?.items)?Ie.items:[],xt=Number(Ie?.count??Ie?.totalCount??Xe.length);Ze(Xe),Ye(Number.isFinite(xt)?xt:Xe.length)}finally{le(!1)}},[E,de]),Nt=_.useCallback(()=>Et([]),[]);_.useEffect(()=>{try{const xe=localStorage.getItem("finishedDownloads_pendingTags");if(!xe)return;const Ce=JSON.parse(xe),Ie=Array.isArray(Ce)?Ce.map(Xe=>String(Xe||"").trim()).filter(Boolean):[];if(Ie.length===0)return;Ic.flushSync(()=>Et(Ie)),y!==1&&b(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]),_.useEffect(()=>{if(!Di)return;const xe=new AbortController,Ce=window.setTimeout(()=>{Yt(xe.signal).catch(()=>{})},250);return()=>{window.clearTimeout(Ce),xe.abort()}},[Di,Yt]),_.useEffect(()=>{if(wt===0)return;const xe=new AbortController;let Ce=!0;const Ie=()=>{z.current=!1};return z.current=!0,Di?((async()=>{try{await Yt(xe.signal),Ce&&(si.current=0)}catch{}finally{Ce&&Ie()}})(),()=>{Ce=!1,xe.abort(),Ie()}):(le(!0),(async()=>{try{const[Xe,xt]=await Promise.all([fetch(`/api/record/done?page=${y}&pageSize=${v}&sort=${encodeURIComponent(E)}${de?"&includeKeep=1":""}`,{cache:"no-store",signal:xe.signal}),fetch(`/api/record/done/meta${de?"?includeKeep=1":""}`,{cache:"no-store",signal:xe.signal})]);if(!Ce||xe.signal.aborted)return;let Ft=Xe.ok&&xt.ok;if(Xe.ok){const ii=await Xe.json().catch(()=>null);if(!Ce||xe.signal.aborted)return;const oe=Array.isArray(ii?.items)?ii.items:Array.isArray(ii)?ii:[];Ze(oe)}if(xt.ok){const ii=await xt.json().catch(()=>null);if(!Ce||xe.signal.aborted)return;const oe=Number(ii?.count??0),Se=Number.isFinite(oe)&&oe>=0?oe:0;Ye(Se);const ct=Math.max(1,Math.ceil(Se/v));if(y>ct){b(ct),Ze(null);return}}if(Ft)si.current=0;else if(Ce&&!xe.signal.aborted&&si.current<2){si.current+=1;const ii=si.current;window.setTimeout(()=>{xe.signal.aborted||vt(oe=>oe+1)},400*ii)}}catch{}finally{Ce&&(le(!1),Ie())}})(),()=>{Ce=!1,xe.abort(),Ie()})},[wt,Di,Yt,y,v,E,de,b]),_.useEffect(()=>{Di||(Ze(null),Ye(null))},[y,v,E,de,Di]),_.useEffect(()=>{if(!de){wi||(Ze(null),Ye(null));return}if(wi)return;const xe=new AbortController;return(async()=>{try{const Ce=await fetch(`/api/record/done?page=${y}&pageSize=${v}&sort=${encodeURIComponent(E)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:xe.signal});if(!Ce.ok)return;const Ie=await Ce.json().catch(()=>null),Xe=Array.isArray(Ie?.items)?Ie.items:[],xt=Number(Ie?.count??Ie?.totalCount??Xe.length);Ze(Xe),Ye(Number.isFinite(xt)?xt:Xe.length)}catch{}})(),()=>xe.abort()},[de,wi,y,v,E]),_.useEffect(()=>{try{const xe=localStorage.getItem(Je);Ue(xe==="table"||xe==="cards"||xe==="gallery"?xe:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Ue("table")}},[]),_.useEffect(()=>{try{localStorage.setItem(Je,ze)}catch{}},[ze]),_.useEffect(()=>{try{const xe=localStorage.getItem(at);qe(xe==="1"||xe==="true"||xe==="yes")}catch{qe(!1)}},[]),_.useEffect(()=>{try{localStorage.setItem(at,de?"1":"0")}catch{}},[de]),_.useEffect(()=>{try{const xe=localStorage.getItem(Re);tt(xe==="1"||xe==="true"||xe==="yes")}catch{tt(!1)}},[]),_.useEffect(()=>{try{localStorage.setItem(Re,ht?"1":"0")}catch{}},[ht]);const[H,U]=_.useState({}),ee=_.useRef({}),Te=_.useRef(null),[Me,gt]=_.useState({}),Tt=_.useRef({}),gi=_.useRef(null),si=_.useRef(0);_.useEffect(()=>{Tt.current=Me},[Me]);const xi=_.useCallback(()=>{gi.current==null&&(gi.current=window.setTimeout(()=>{gi.current=null,gt({...Tt.current})},200))},[]);_.useEffect(()=>()=>{gi.current!=null&&(window.clearTimeout(gi.current),gi.current=null)},[]),_.useEffect(()=>{ee.current=H},[H]);const Ri=_.useCallback(()=>{Te.current==null&&(Te.current=window.setTimeout(()=>{Te.current=null,U({...ee.current})},200))},[]);_.useEffect(()=>()=>{Te.current!=null&&(window.clearTimeout(Te.current),Te.current=null)},[]);const[hi,li]=_.useState(null),Kt=!n,Si=_.useCallback(xe=>{const Ie=document.getElementById(xe)?.querySelector("video");if(!Ie)return!1;Nh(Ie,{muted:Kt});const Xe=Ie.play?.();return Xe&&typeof Xe.catch=="function"&&Xe.catch(()=>{}),!0},[Kt]),jt=_.useCallback(xe=>{li(Ce=>Ce?.key===xe?{key:xe,nonce:Ce.nonce+1}:{key:xe,nonce:1})},[]),ui=_.useCallback((xe,Ce,Ie)=>{const Xe=Number.isFinite(Ce)&&Ce>0?Ce:0;li(Ft=>Ft?.key===xe?{key:xe,nonce:Ft.nonce+1}:{key:xe,nonce:1});const xt=Ft=>{const oe=document.getElementById(Ie)?.querySelector("video");if(!oe){Ft>0&&requestAnimationFrame(()=>xt(Ft-1));return}Nh(oe,{muted:Kt});const Se=()=>{try{const ge=Number(oe.duration),Be=Number.isFinite(ge)&&ge>0?Math.max(0,ge-.05):Xe;oe.currentTime=Math.max(0,Math.min(Xe,Be))}catch{}const fe=oe.play?.();fe&&typeof fe.catch=="function"&&fe.catch(()=>{})};if(oe.readyState>=1){Se();return}const ct=()=>{oe.removeEventListener("loadedmetadata",ct),Se()};oe.addEventListener("loadedmetadata",ct,{once:!0});const ue=oe.play?.();ue&&typeof ue.catch=="function"&&ue.catch(()=>{})};requestAnimationFrame(()=>xt(8))},[Kt]),ei=_.useCallback(xe=>{li(null),r(xe)},[r]),ti=_.useCallback((xe,Ce)=>{const Ie=Number.isFinite(Ce)&&Ce>=0?Ce:0;li(null),r(xe,Ie)},[r]),Ui=_.useCallback((xe,Ce,Ie)=>{const Xe=Number.isFinite(Ce)?Math.floor(Ce):0,xt=Number.isFinite(Ie)?Math.floor(Ie):0;if(xt<=0){ei(xe);return}const Ft=On(xe),ii=H[Ft]??xe?.durationSeconds??0;if(!Number.isFinite(ii)||ii<=0){ei(xe);return}const oe=Math.max(0,Math.min(Xe,xt-1)),Se=ii/xt,ct=oe*Se;ti(xe,ct)},[H,On,ei,ti]),rs=_.useCallback((xe,Ce)=>{Z(Ie=>{const Xe=new Set(Ie);return Ce?Xe.add(xe):Xe.delete(xe),Xe})},[]),Ks=_.useCallback(xe=>{K(Ce=>{const Ie=new Set(Ce);return Ie.add(xe),Ie})},[]),[Is,qi]=_.useState(()=>new Set),_i=_.useCallback((xe,Ce)=>{qi(Ie=>{const Xe=new Set(Ie);return Ce?Xe.add(xe):Xe.delete(xe),Xe})},[]),[Ns,Ji]=_.useState(()=>new Set),as=_.useRef(new Map);_.useEffect(()=>()=>{for(const xe of as.current.values())window.clearTimeout(xe);as.current.clear()},[]);const Ms=_.useCallback((xe,Ce)=>{Ji(Ie=>{const Xe=new Set(Ie);return Ce?Xe.add(xe):Xe.delete(xe),Xe})},[]),ji=_.useCallback(xe=>{const Ce=as.current.get(xe);Ce!=null&&(window.clearTimeout(Ce),as.current.delete(xe))},[]),ds=_.useCallback(xe=>{ji(xe),K(Ce=>{const Ie=new Set(Ce);return Ie.delete(xe),Ie}),Ji(Ce=>{const Ie=new Set(Ce);return Ie.delete(xe),Ie}),Z(Ce=>{const Ie=new Set(Ce);return Ie.delete(xe),Ie}),qi(Ce=>{const Ie=new Set(Ce);return Ie.delete(xe),Ie})},[ji]),Ki=_.useCallback(xe=>{Ms(xe,!0),ji(xe);const Ce=window.setTimeout(()=>{as.current.delete(xe),Ks(xe),Ms(xe,!1)},320);as.current.set(xe,Ce)},[Ks,Ms,ji]),Mi=_.useCallback(async(xe,Ce)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:xe}})),Ce?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:xe}})),await new Promise(Ie=>window.setTimeout(Ie,250))},[]),ss=_.useCallback(async xe=>{const Ce=Yr(xe.output||""),Ie=On(xe);if(!Ce)return L.error("Löschen nicht möglich","Kein Dateiname gefunden – kann nicht löschen."),!1;if(q.has(Ie))return!1;rs(Ie,!0);try{if(await Mi(Ce,{close:!0}),a){const Se=(await a(xe))?.undoToken;return pe(typeof Se=="string"&&Se?{kind:"delete",undoToken:Se,originalFile:Ce,rowKey:Ie}:null),Ki(Ie),ke(),rt(-1),!0}const Xe=await fetch(`/api/record/delete?file=${encodeURIComponent(Ce)}`,{method:"POST"});if(!Xe.ok){const oe=await Xe.text().catch(()=>"");throw new Error(oe||`HTTP ${Xe.status}`)}const xt=await Xe.json().catch(()=>null),Ft=xt?.from==="keep"?"keep":"done",ii=typeof xt?.undoToken=="string"?xt.undoToken:"";return pe(ii?{kind:"delete",undoToken:ii,originalFile:Ce,rowKey:Ie,from:Ft}:null),Ki(Ie),ke(),rt(-1),!0}catch{return ds(Ie),L.error("Löschen fehlgeschlagen: ",Ce),!1}finally{rs(Ie,!1)}},[q,rs,Mi,a,Ki,L,ds,ke,rt]),Ps=_.useCallback(async xe=>{const Ce=Yr(xe.output||""),Ie=On(xe);if(!Ce)return L.error("Keep nicht möglich","Kein Dateiname gefunden – kann nicht behalten."),!1;if(Is.has(Ie)||q.has(Ie))return!1;_i(Ie,!0);try{await Mi(Ce,{close:!0});const Xe=await fetch(`/api/record/keep?file=${encodeURIComponent(Ce)}`,{method:"POST"});if(!Xe.ok){const ii=await Xe.text().catch(()=>"");throw new Error(ii||`HTTP ${Xe.status}`)}const xt=await Xe.json().catch(()=>null),Ft=typeof xt?.newFile=="string"&&xt.newFile?xt.newFile:Ce;return pe({kind:"keep",keptFile:Ft,originalFile:Ce,rowKey:Ie}),Ki(Ie),ke(),rt(de?0:-1),!0}catch{return L.error("Keep fehlgeschlagen",Ce),!1}finally{_i(Ie,!1)}},[Is,q,_i,Mi,Ki,L,ke,rt,de]),ni=_.useCallback((xe,Ce)=>{!xe||!Ce||xe===Ce||He(Ie=>{const Xe={...Ie};for(const[xt,Ft]of Object.entries(Xe))(xt===xe||xt===Ce||Ft===xe||Ft===Ce)&&delete Xe[xt];return Xe[xe]=Ce,Xe})},[]),Fs=_.useCallback((xe,Ce)=>{!xe&&!Ce||He(Ie=>{const Xe={...Ie};for(const[xt,Ft]of Object.entries(Xe))(xt===xe||xt===Ce||Ft===xe||Ft===Ce)&&delete Xe[xt];return Xe})},[]),tn=_.useCallback(async()=>{if(!Q||be)return;ve(!0);const xe=Ce=>{K(Ie=>{const Xe=new Set(Ie);return Xe.delete(Ce),Xe}),Z(Ie=>{const Xe=new Set(Ie);return Xe.delete(Ce),Xe}),qi(Ie=>{const Xe=new Set(Ie);return Xe.delete(Ce),Xe}),Ji(Ie=>{const Xe=new Set(Ie);return Xe.delete(Ce),Xe})};try{if(Q.kind==="delete"){const Ce=await fetch(`/api/record/restore?token=${encodeURIComponent(Q.undoToken)}`,{method:"POST"});if(!Ce.ok){const Ft=await Ce.text().catch(()=>"");throw new Error(Ft||`HTTP ${Ce.status}`)}const Ie=await Ce.json().catch(()=>null),Xe=String(Ie?.restoredFile||Q.originalFile);Q.rowKey&&xe(Q.rowKey),xe(Q.originalFile),xe(Xe);const xt=Q.from==="keep"&&!de?0:1;rt(xt),ke(),pe(null);return}if(Q.kind==="keep"){const Ce=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Q.keptFile)}`,{method:"POST"});if(!Ce.ok){const xt=await Ce.text().catch(()=>"");throw new Error(xt||`HTTP ${Ce.status}`)}const Ie=await Ce.json().catch(()=>null),Xe=String(Ie?.newFile||Q.originalFile);Q.rowKey&&xe(Q.rowKey),xe(Q.originalFile),xe(Xe),rt(1),ke(),pe(null);return}if(Q.kind==="hot"){const Ce=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Q.currentFile)}`,{method:"POST"});if(!Ce.ok){const Ft=await Ce.text().catch(()=>"");throw new Error(Ft||`HTTP ${Ce.status}`)}const Ie=await Ce.json().catch(()=>null),Xe=String(Ie?.oldFile||Q.currentFile),xt=String(Ie?.newFile||"");xt&&ni(Xe,xt),ke(),pe(null);return}}catch(Ce){L.error("Undo fehlgeschlagen",String(Ce?.message||Ce))}finally{ve(!1)}},[Q,be,L,ke,de,rt,ni]),We=_.useCallback(async xe=>{const Ce=Yr(xe.output||"");if(!Ce){L.error("HOT nicht möglich","Kein Dateiname gefunden – kann nicht HOT togglen.");return}const Ie=ii=>vc(ii)?gr(ii):`HOT ${ii}`,Xe=(ii,oe)=>{!ii||!oe||ii===oe||ni(ii,oe)},xt=Ce,Ft=Ie(xt);ni(xt,Ft);try{if(await Mi(xt,{close:!0}),u){const ue=await u(xe),fe=typeof ue?.oldFile=="string"?ue.oldFile:"",ge=typeof ue?.newFile=="string"?ue.newFile:"";fe&&ge&&Xe(fe,ge),pe({kind:"hot",currentFile:ge||Ft}),(E==="file_asc"||E==="file_desc")&&ke();return}const ii=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(xt)}`,{method:"POST"});if(!ii.ok){const ue=await ii.text().catch(()=>"");throw new Error(ue||`HTTP ${ii.status}`)}const oe=await ii.json().catch(()=>null),Se=typeof oe?.oldFile=="string"&&oe.oldFile?oe.oldFile:xt,ct=typeof oe?.newFile=="string"&&oe.newFile?oe.newFile:Ft;Se!==ct&&Xe(Se,ct),pe({kind:"hot",currentFile:ct}),ke()}catch(ii){Fs(xt,Ft),pe(null),L.error("HOT umbenennen fehlgeschlagen",String(ii?.message||ii))}},[L,ni,Fs,Mi,u,ke,E]),Mt=_.useCallback(xe=>{const Ce=mb(xe.output||""),Ie=Yr(Ce),Xe=we[Ie];if(!Xe)return xe;const xt=Ce.lastIndexOf("/"),Ft=xt>=0?Ce.slice(0,xt+1):"";return{...xe,output:Ft+Xe}},[we]),Ot=Fe??e,zt=De??g,Qi=_.useMemo(()=>{const xe=new Map;for(const Ie of Ot){const Xe=Mt(Ie);xe.set(On(Xe),Xe)}for(const Ie of s){const Xe=Mt(Ie),xt=On(Xe);xe.has(xt)&&xe.set(xt,{...xe.get(xt),...Xe})}return Array.from(xe.values()).filter(Ie=>ie.has(On(Ie))||_3(Ie.output)?!1:Ie.status==="finished"||Ie.status==="failed"||Ie.status==="stopped")},[s,Ot,ie,Mt]),Ii=_.useRef(new Map);_.useEffect(()=>{const xe=new Map;for(const Ce of Qi){const Ie=Yr(Ce.output||"");Ie&&xe.set(Ie,On(Ce))}Ii.current=xe},[Qi]),_.useEffect(()=>{const xe=Ce=>{const Ie=Ce.detail;if(!Ie?.file)return;const Xe=Ii.current.get(Ie.file)||Ie.file;if(Ie.phase==="start"){rs(Xe,!0),Ki(Xe);return}if(Ie.phase==="error"){ds(Xe),At.current.get(Xe)?.reset();return}if(Ie.phase==="success"){rs(Xe,!1),ke();return}};return window.addEventListener("finished-downloads:delete",xe),()=>window.removeEventListener("finished-downloads:delete",xe)},[Ki,rs,ke,ds]),_.useEffect(()=>{const xe=()=>{z.current||ke()};return window.addEventListener("finished-downloads:reload",xe),()=>window.removeEventListener("finished-downloads:reload",xe)},[ke]),_.useEffect(()=>{const xe=Ce=>{const Ie=Ce.detail,Xe=String(Ie?.oldFile??"").trim(),xt=String(Ie?.newFile??"").trim();!Xe||!xt||Xe===xt||ni(Xe,xt)};return window.addEventListener("finished-downloads:rename",xe),()=>window.removeEventListener("finished-downloads:rename",xe)},[ni]);const Ni=_.useMemo(()=>{const xe=Qi.filter(Ie=>!ie.has(On(Ie))),Ce=Ct.length?xe.filter(Ie=>{const Xe=Yr(Ie.output||""),xt=Zd(Ie.output),Ft=Rr(xt),ii=Rt.tagsByModelKey[Ft]??[],oe=Rr([Xe,gr(Xe),xt,Ie.id,ii.join(" ")].join(" "));for(const Se of Ct)if(!oe.includes(Se))return!1;return!0}):xe;return Lt.size===0?Ce:Ce.filter(Ie=>{const Xe=Rr(Zd(Ie.output)),xt=Rt.tagSetByModelKey[Xe];if(!xt||xt.size===0)return!1;for(const Ft of Lt)if(!xt.has(Ft))return!1;return!0})},[Qi,ie,Lt,Rt,Ct]),Wi=Di?Ni.length:zt,Ds=_.useMemo(()=>{if(!Di)return Ni;const xe=(y-1)*v,Ce=xe+v;return Ni.slice(Math.max(0,xe),Math.max(0,Ce))},[Di,Ni,y,v]),os=!Di&&Wi===0,jn=wi&&Ni.length===0,Dn=j&&Ni.length===0,Tn=te&&(os||Dn||jn);_.useEffect(()=>{if(!wi)return;const xe=Math.max(1,Math.ceil(Ni.length/v));y>xe&&b(xe)},[wi,Ni.length,y,v,b]),_.useEffect(()=>{if(!(F==="hover"&&!G&&(ze==="cards"||ze==="gallery"||ze==="table"))){N(null),Y.current?.disconnect(),Y.current=null;return}if(ze==="cards"&&hi?.key){N(hi.key);return}Y.current?.disconnect();const Ce=new IntersectionObserver(Ie=>{let Xe=null,xt=0;for(const Ft of Ie){if(!Ft.isIntersecting)continue;const ii=ne.current.get(Ft.target);ii&&Ft.intersectionRatio>xt&&(xt=Ft.intersectionRatio,Xe=ii)}Xe&&N(Ft=>Ft===Xe?Ft:Xe)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});Y.current=Ce;for(const[Ie,Xe]of W.current)ne.current.set(Xe,Ie),Ce.observe(Xe);return()=>{Ce.disconnect(),Y.current===Ce&&(Y.current=null)}},[ze,F,G,hi?.key]);const ls=xe=>{const Ce=On(xe),Ie=H[Ce]??xe?.durationSeconds;if(typeof Ie=="number"&&Number.isFinite(Ie)&&Ie>0)return d2(Ie*1e3);const Xe=Date.parse(String(xe.startedAt||"")),xt=Date.parse(String(xe.endedAt||""));return Number.isFinite(Xe)&&Number.isFinite(xt)&&xt>Xe?d2(xt-Xe):"—"},tr=_.useCallback(xe=>Ce=>{const Ie=W.current.get(xe);Ie&&Y.current&&Y.current.unobserve(Ie),Ce?(W.current.set(xe,Ce),ne.current.set(Ce,xe),Y.current?.observe(Ce)):W.current.delete(xe)},[]),dn=_.useCallback((xe,Ce)=>{if(!Number.isFinite(Ce)||Ce<=0)return;const Ie=On(xe),Xe=ee.current[Ie];typeof Xe=="number"&&Math.abs(Xe-Ce)<.5||(ee.current={...ee.current,[Ie]:Ce},Ri())},[Ri]),sn=_.useCallback((xe,Ce,Ie)=>{if(!Number.isFinite(Ce)||!Number.isFinite(Ie)||Ce<=0||Ie<=0)return;const Xe=On(xe),xt=Tt.current[Xe];xt&&xt.w===Ce&&xt.h===Ie||(Tt.current={...Tt.current,[Xe]:{w:Ce,h:Ie}},xi())},[xi]),hs=h2("(max-width: 639px)");return _.useEffect(()=>{if(!hs||ze!=="cards")return;const xe=Ds[0];if(!xe){N(null);return}const Ce=On(xe);N(Ie=>Ie===Ce?Ie:Ce)},[hs,ze,Ds,On]),_.useEffect(()=>{hs||(At.current=new Map)},[hs]),_.useEffect(()=>{os&&y!==1&&b(1)},[os,y,b]),p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-[56px] z-20",children:p.jsxs("div",{className:`\r + rounded-xl border border-gray-200/70 bg-white/80 shadow-sm\r + backdrop-blur supports-[backdrop-filter]:bg-white/60\r + dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40\r + `,children:[p.jsxs("div",{className:"flex items-center gap-3 p-3",children:[p.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),p.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Wi})]}),p.jsxs("div",{className:"sm:hidden flex items-center gap-2 min-w-0 flex-1",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),p.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Wi})]}),p.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[te?p.jsx(c2,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"}):null,p.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 flex-1",children:[p.jsx("input",{value:qt,onChange:xe=>Wt(xe.target.value),placeholder:"Suchen…",className:`\r + h-9 w-full max-w-[420px] rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r + focus:outline-none focus:ring-2 focus:ring-indigo-500\r + dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r + `}),(qt||"").trim()!==""?p.jsx(mi,{size:"sm",variant:"soft",onClick:It,children:"Leeren"}):null]}),p.jsx("div",{className:"hidden sm:block",children:p.jsx(vo,{label:"Behaltene Downloads anzeigen",checked:de,onChange:xe=>{y!==1&&b(1),qe(xe),ke()}})}),ze!=="table"&&p.jsxs("div",{className:"hidden sm:block",children:[p.jsx("label",{className:"sr-only",htmlFor:"finished-sort",children:"Sortierung"}),p.jsxs("select",{id:"finished-sort",value:E,onChange:xe=>{const Ce=xe.target.value;D(Ce),y!==1&&b(1)},className:`\r + h-9 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r + dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r + `,children:[p.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),p.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),p.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),p.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),p.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),p.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),p.jsx("option",{value:"size_desc",children:"Größe ↓"}),p.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}),p.jsx(mi,{size:hs?"sm":"md",variant:"soft",className:hs?"h-9":"h-10",disabled:!Q||be,onClick:tn,title:Q?`Letzte Aktion rückgängig machen (${Q.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),p.jsx(ZA,{value:ze,onChange:xe=>Ue(xe),size:hs?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:p.jsx(bM,{className:hs?"size-4":"size-5"}),label:hs?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:p.jsx(mM,{className:hs?"size-4":"size-5"}),label:hs?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:p.jsx(yM,{className:hs?"size-4":"size-5"}),label:hs?void 0:"Galerie",srLabel:"Galerie"}]}),p.jsxs("button",{type:"button",className:`sm:hidden relative inline-flex items-center justify-center rounded-md border border-gray-200 bg-white p-2 shadow-sm\r + hover:bg-gray-50 dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-white/10`,onClick:()=>tt(xe=>!xe),"aria-expanded":ht,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[p.jsx(IO,{className:"size-5"}),wi||de?p.jsx("span",{className:"absolute -top-1 -right-1 h-2.5 w-2.5 rounded-full bg-indigo-500 ring-2 ring-white dark:ring-gray-950"}):null]})]})]}),ft.length>0?p.jsxs("div",{className:"hidden sm:flex items-center gap-2 border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:[p.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[ft.map(xe=>p.jsx(fa,{tag:xe,active:!0,onClick:oi},xe)),p.jsx(mi,{className:`\r + ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r + text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r + `,size:"sm",variant:"soft",onClick:Nt,children:"Zurücksetzen"})]})]}):null,p.jsxs("div",{id:"finished-mobile-options",className:["sm:hidden overflow-hidden transition-[max-height,opacity] duration-200 ease-in-out",ht?"max-h-[720px] opacity-100":"max-h-0 opacity-0"].join(" "),children:[p.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 p-3",children:p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{value:qt,onChange:xe=>Wt(xe.target.value),placeholder:"Suchen…",className:`\r + h-10 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900\r + focus:outline-none focus:ring-2 focus:ring-indigo-500\r + dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r + `}),(qt||"").trim()!==""?p.jsx(mi,{size:"sm",variant:"soft",onClick:It,children:"Clear"}):null]})}),p.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Keep anzeigen"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Behaltene Downloads in der Liste"})]}),p.jsx(ux,{checked:de,onChange:xe=>{y!==1&&b(1),qe(xe),ke()},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),ze!=="table"?p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:[p.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:"Sortierung"}),p.jsxs("select",{id:"finished-sort-mobile",value:E,onChange:xe=>{const Ce=xe.target.value;D(Ce),y!==1&&b(1)},className:`\r + w-full h-10 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r + dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r + `,children:[p.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),p.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),p.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),p.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),p.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),p.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),p.jsx("option",{value:"size_desc",children:"Größe ↓"}),p.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}):null]})}),ft.length>0?p.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[ft.map(xe=>p.jsx(fa,{tag:xe,active:!0,onClick:oi},xe)),p.jsx(mi,{className:`\r + ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r + text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r + `,size:"sm",variant:"soft",onClick:Nt,children:"Zurücksetzen"})]})]})}):null]})]})}),Tn?p.jsx(ma,{grayBody:!0,children:p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Lade Downloads…"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Bitte warte einen Moment."})]}),p.jsx(c2,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):os||Dn?p.jsx(ma,{grayBody:!0,children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:p.jsx("span",{className:"text-lg",children:"📁"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine abgeschlossenen Downloads"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Im Zielordner ist aktuell nichts vorhanden."})]})]})}):jn?p.jsxs(ma,{grayBody:!0,children:[p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),ft.length>0||(qt||"").trim()!==""?p.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[ft.length>0?p.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:Nt,children:"Tag-Filter zurücksetzen"}):null,(qt||"").trim()!==""?p.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:It,children:"Suche zurücksetzen"}):null]}):null]}):p.jsxs(p.Fragment,{children:[ze==="cards"&&p.jsx("div",{className:hs?"mt-8":"",children:p.jsx(JM,{rows:Ds,isSmall:hs,isLoading:te,blurPreviews:t,durations:H,teaserKey:I,teaserPlayback:F,teaserAudio:n,hoverTeaserKey:X,inlinePlay:hi,deletingKeys:q,keepingKeys:Is,removingKeys:Ns,swipeRefs:At,keyFor:On,baseName:Yr,modelNameFromOutput:Zd,runtimeOf:ls,sizeBytesOf:$y,formatBytes:jy,lower:Rr,onOpenPlayer:r,openPlayer:ei,onOpenPlayerAt:ti,handleScrubberClickIndex:Ui,startInlineAt:ui,startInline:jt,tryAutoplayInline:Si,registerTeaserHost:tr,handleDuration:dn,deleteVideo:ss,keepVideo:Ps,releasePlayingFile:Mi,modelsByKey:O,onToggleHot:We,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,activeTagSet:Lt,onToggleTagFilter:oi,onHoverPreviewKeyChange:V,assetNonce:T??0})}),ze==="table"&&p.jsx(u3,{rows:Ds,isLoading:te,keyFor:On,baseName:Yr,lower:Rr,modelNameFromOutput:Zd,runtimeOf:ls,sizeBytesOf:$y,formatBytes:jy,resolutions:Me,durations:H,canHover:G,teaserAudio:n,hoverTeaserKey:X,setHoverTeaserKey:V,teaserPlayback:F,teaserKey:I,registerTeaserHost:tr,handleDuration:dn,handleResolution:sn,blurPreviews:t,assetNonce:T,deletingKeys:q,keepingKeys:Is,removingKeys:Ns,modelsByKey:O,activeTagSet:Lt,onToggleTagFilter:oi,onOpenPlayer:r,handleScrubberClickIndex:Ui,onSortModeChange:D,page:y,onPageChange:b,onToggleHot:We,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,deleteVideo:ss,keepVideo:Ps}),ze==="gallery"&&p.jsx(f3,{rows:Ds,isLoading:te,blurPreviews:t,durations:H,handleDuration:dn,teaserKey:I,teaserPlayback:F,teaserAudio:n,hoverTeaserKey:X,keyFor:On,baseName:Yr,modelNameFromOutput:Zd,runtimeOf:ls,sizeBytesOf:$y,formatBytes:jy,deletingKeys:q,keepingKeys:Is,removingKeys:Ns,deletedKeys:ie,registerTeaserHost:tr,onOpenPlayer:r,handleScrubberClickIndex:Ui,deleteVideo:ss,keepVideo:Ps,onToggleHot:We,lower:Rr,modelsByKey:O,onToggleFavorite:c,onToggleLike:d,onToggleWatch:f,activeTagSet:Lt,onToggleTagFilter:oi,onHoverPreviewKeyChange:V}),p.jsx(dx,{page:y,pageSize:v,totalItems:Wi,onPageChange:xe=>{Ic.flushSync(()=>{li(null),N(null),V(null)});for(const Ce of Ds){const Ie=Yr(Ce.output||"");Ie&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:Ie}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:Ie}})))}window.scrollTo({top:0,behavior:"auto"}),b(xe)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Hy,f2;function cp(){if(f2)return Hy;f2=1;var s;return typeof window<"u"?s=window:typeof h0<"u"?s=h0:typeof self<"u"?s=self:s={},Hy=s,Hy}var A3=cp();const he=qc(A3),k3={},C3=Object.freeze(Object.defineProperty({__proto__:null,default:k3},Symbol.toStringTag,{value:"Module"})),D3=QI(C3);var zy,m2;function rk(){if(m2)return zy;m2=1;var s=typeof h0<"u"?h0:typeof window<"u"?window:{},e=D3,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),zy=t,zy}var L3=rk();const _t=qc(L3);var wm={exports:{}},Vy={exports:{}},p2;function R3(){return p2||(p2=1,(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i=n.length?{done:!0}:{done:!1,value:n[u++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(n,r){if(n){if(typeof n=="string")return t(n,r);var a=Object.prototype.toString.call(n).slice(8,-1);if(a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set")return Array.from(n);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(n,r)}}function t(n,r){(r==null||r>n.length)&&(r=n.length);for(var a=0,u=new Array(r);a=400&&u.statusCode<=599){var d=c;if(r)if(s.TextDecoder){var f=t(u.headers&&u.headers["content-type"]);try{d=new TextDecoder(f).decode(c)}catch{}}else d=String.fromCharCode.apply(null,new Uint8Array(c));n({cause:d});return}n(null,c)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(n,r){var a=r.split("="),u=a[0],c=a[1];return u.trim()==="charset"?c.trim():n},"utf-8")}return Wy=e,Wy}var b2;function P3(){if(b2)return wm.exports;b2=1;var s=cp(),e=R3(),t=I3(),i=N3(),n=O3();d.httpHandler=M3(),d.requestInterceptorsStorage=new i,d.responseInterceptorsStorage=new i,d.retryManager=new n;var r=function(b){var T={};return b&&b.trim().split(` +`).forEach(function(E){var D=E.indexOf(":"),O=E.slice(0,D).trim().toLowerCase(),R=E.slice(D+1).trim();typeof T[O]>"u"?T[O]=R:Array.isArray(T[O])?T[O].push(R):T[O]=[T[O],R]}),T};wm.exports=d,wm.exports.default=d,d.XMLHttpRequest=s.XMLHttpRequest||y,d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:s.XDomainRequest,a(["get","put","post","patch","head","delete"],function(v){d[v==="delete"?"del":v]=function(b,T,E){return T=c(b,T,E),T.method=v.toUpperCase(),f(T)}});function a(v,b){for(var T=0;T"u")throw new Error("callback argument missing");if(v.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var b={uri:v.uri||v.url,headers:v.headers||{},body:v.body,metadata:v.metadata||{},retry:v.retry,timeout:v.timeout},T=d.requestInterceptorsStorage.execute(v.requestType,b);v.uri=T.uri,v.headers=T.headers,v.body=T.body,v.metadata=T.metadata,v.retry=T.retry,v.timeout=T.timeout}var E=!1,D=function(Z,te,le){E||(E=!0,v.callback(Z,te,le))};function O(){G.readyState===4&&!d.responseInterceptorsStorage.getIsEnabled()&&setTimeout(F,0)}function R(){var q=void 0;if(G.response?q=G.response:q=G.responseText||g(G),ne)try{q=JSON.parse(q)}catch{}return q}function j(q){if(clearTimeout(ie),clearTimeout(v.retryTimeout),q instanceof Error||(q=new Error(""+(q||"Unknown XMLHttpRequest Error"))),q.statusCode=0,!W&&d.retryManager.getIsEnabled()&&v.retry&&v.retry.shouldRetry()){v.retryTimeout=setTimeout(function(){v.retry.moveToNextAttempt(),v.xhr=G,f(v)},v.retry.getCurrentFuzzedDelay());return}if(v.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var Z={headers:K.headers||{},body:K.body,responseUrl:G.responseURL,responseType:G.responseType},te=d.responseInterceptorsStorage.execute(v.requestType,Z);K.body=te.body,K.headers=te.headers}return D(q,K)}function F(){if(!W){var q;clearTimeout(ie),clearTimeout(v.retryTimeout),v.useXDR&&G.status===void 0?q=200:q=G.status===1223?204:G.status;var Z=K,te=null;if(q!==0?(Z={body:R(),statusCode:q,method:N,headers:{},url:I,rawRequest:G},G.getAllResponseHeaders&&(Z.headers=r(G.getAllResponseHeaders()))):te=new Error("Internal XMLHttpRequest Error"),v.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var le={headers:Z.headers||{},body:Z.body,responseUrl:G.responseURL,responseType:G.responseType},z=d.responseInterceptorsStorage.execute(v.requestType,le);Z.body=z.body,Z.headers=z.headers}return D(te,Z,Z.body)}}var G=v.xhr||null;G||(v.cors||v.useXDR?G=new d.XDomainRequest:G=new d.XMLHttpRequest);var L,W,I=G.url=v.uri||v.url,N=G.method=v.method||"GET",X=v.body||v.data,V=G.headers=v.headers||{},Y=!!v.sync,ne=!1,ie,K={body:void 0,headers:{},statusCode:0,method:N,url:I,rawRequest:G};if("json"in v&&v.json!==!1&&(ne=!0,V.accept||V.Accept||(V.Accept="application/json"),N!=="GET"&&N!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),X=JSON.stringify(v.json===!0?X:v.json))),G.onreadystatechange=O,G.onload=F,G.onerror=j,G.onprogress=function(){},G.onabort=function(){W=!0,clearTimeout(v.retryTimeout)},G.ontimeout=j,G.open(N,I,!Y,v.username,v.password),Y||(G.withCredentials=!!v.withCredentials),!Y&&v.timeout>0&&(ie=setTimeout(function(){if(!W){W=!0,G.abort("timeout");var q=new Error("XMLHttpRequest timeout");q.code="ETIMEDOUT",j(q)}},v.timeout)),G.setRequestHeader)for(L in V)V.hasOwnProperty(L)&&G.setRequestHeader(L,V[L]);else if(v.headers&&!u(v.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in v&&(G.responseType=v.responseType),"beforeSend"in v&&typeof v.beforeSend=="function"&&v.beforeSend(G),G.send(X||null),G}function g(v){try{if(v.responseType==="document")return v.responseXML;var b=v.responseXML&&v.responseXML.documentElement.nodeName==="parsererror";if(v.responseType===""&&!b)return v.responseXML}catch{}return null}function y(){}return wm.exports}var F3=P3();const ak=qc(F3);var Yy={exports:{}},Xy,T2;function B3(){if(T2)return Xy;T2=1;var s=rk(),e=Object.create||(function(){function I(){}return function(N){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return I.prototype=N,new I}})();function t(I,N){this.name="ParsingError",this.code=I.code,this.message=N||I.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(I){function N(V,Y,ne,ie){return(V|0)*3600+(Y|0)*60+(ne|0)+(ie|0)/1e3}var X=I.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return X?X[3]?N(X[1],X[2],X[3].replace(":",""),X[4]):X[1]>59?N(X[1],X[2],0,X[4]):N(0,X[1],X[2],X[4]):null}function n(){this.values=e(null)}n.prototype={set:function(I,N){!this.get(I)&&N!==""&&(this.values[I]=N)},get:function(I,N,X){return X?this.has(I)?this.values[I]:N[X]:this.has(I)?this.values[I]:N},has:function(I){return I in this.values},alt:function(I,N,X){for(var V=0;V=0&&N<=100)?(this.set(I,N),!0):!1}};function r(I,N,X,V){var Y=V?I.split(V):[I];for(var ne in Y)if(typeof Y[ne]=="string"){var ie=Y[ne].split(X);if(ie.length===2){var K=ie[0].trim(),q=ie[1].trim();N(K,q)}}}function a(I,N,X){var V=I;function Y(){var K=i(I);if(K===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return I=I.replace(/^[^\sa-zA-Z-]+/,""),K}function ne(K,q){var Z=new n;r(K,function(te,le){switch(te){case"region":for(var z=X.length-1;z>=0;z--)if(X[z].id===le){Z.set(te,X[z].region);break}break;case"vertical":Z.alt(te,le,["rl","lr"]);break;case"line":var re=le.split(","),Q=re[0];Z.integer(te,Q),Z.percent(te,Q)&&Z.set("snapToLines",!1),Z.alt(te,Q,["auto"]),re.length===2&&Z.alt("lineAlign",re[1],["start","center","end"]);break;case"position":re=le.split(","),Z.percent(te,re[0]),re.length===2&&Z.alt("positionAlign",re[1],["start","center","end"]);break;case"size":Z.percent(te,le);break;case"align":Z.alt(te,le,["start","center","end","left","right"]);break}},/:/,/\s/),q.region=Z.get("region",null),q.vertical=Z.get("vertical","");try{q.line=Z.get("line","auto")}catch{}q.lineAlign=Z.get("lineAlign","start"),q.snapToLines=Z.get("snapToLines",!0),q.size=Z.get("size",100);try{q.align=Z.get("align","center")}catch{q.align=Z.get("align","middle")}try{q.position=Z.get("position","auto")}catch{q.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},q.align)}q.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},q.align)}function ie(){I=I.replace(/^\s+/,"")}if(ie(),N.startTime=Y(),ie(),I.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);I=I.substr(3),ie(),N.endTime=Y(),ie(),ne(I,N)}var u=s.createElement&&s.createElement("textarea"),c={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},f={v:"title",lang:"lang"},g={rt:"ruby"};function y(I,N){function X(){if(!N)return null;function Q(be){return N=N.substr(be.length),be}var pe=N.match(/^([^<]*)(<[^>]*>?)?/);return Q(pe[1]?pe[1]:pe[2])}function V(Q){return u.innerHTML=Q,Q=u.textContent,u.textContent="",Q}function Y(Q,pe){return!g[pe.localName]||g[pe.localName]===Q.localName}function ne(Q,pe){var be=c[Q];if(!be)return null;var ve=I.document.createElement(be),we=f[Q];return we&&pe&&(ve[we]=pe.trim()),ve}for(var ie=I.document.createElement("div"),K=ie,q,Z=[];(q=X())!==null;){if(q[0]==="<"){if(q[1]==="/"){Z.length&&Z[Z.length-1]===q.substr(2).replace(">","")&&(Z.pop(),K=K.parentNode);continue}var te=i(q.substr(1,q.length-2)),le;if(te){le=I.document.createProcessingInstruction("timestamp",te),K.appendChild(le);continue}var z=q.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!z||(le=ne(z[1],z[3]),!le)||!Y(K,le))continue;if(z[2]){var re=z[2].split(".");re.forEach(function(Q){var pe=/^bg_/.test(Q),be=pe?Q.slice(3):Q;if(d.hasOwnProperty(be)){var ve=pe?"background-color":"color",we=d[be];le.style[ve]=we}}),le.className=re.join(" ")}Z.push(z[1]),K.appendChild(le),K=le;continue}K.appendChild(I.document.createTextNode(V(q)))}return ie}var v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function b(I){for(var N=0;N=X[0]&&I<=X[1])return!0}return!1}function T(I){var N=[],X="",V;if(!I||!I.childNodes)return"ltr";function Y(K,q){for(var Z=q.childNodes.length-1;Z>=0;Z--)K.push(q.childNodes[Z])}function ne(K){if(!K||!K.length)return null;var q=K.pop(),Z=q.textContent||q.innerText;if(Z){var te=Z.match(/^.*(\n|\r)/);return te?(K.length=0,te[0]):Z}if(q.tagName==="ruby")return ne(K);if(q.childNodes)return Y(K,q),ne(K)}for(Y(N,I);X=ne(N);)for(var ie=0;ie=0&&I.line<=100))return I.line;if(!I.track||!I.track.textTrackList||!I.track.textTrackList.mediaElement)return-1;for(var N=I.track,X=N.textTrackList,V=0,Y=0;YI.left&&this.topI.top},R.prototype.overlapsAny=function(I){for(var N=0;N=I.top&&this.bottom<=I.bottom&&this.left>=I.left&&this.right<=I.right},R.prototype.overlapsOppositeAxis=function(I,N){switch(N){case"+x":return this.leftI.right;case"+y":return this.topI.bottom}},R.prototype.intersectPercentage=function(I){var N=Math.max(0,Math.min(this.right,I.right)-Math.max(this.left,I.left)),X=Math.max(0,Math.min(this.bottom,I.bottom)-Math.max(this.top,I.top)),V=N*X;return V/(this.height*this.width)},R.prototype.toCSSCompatValues=function(I){return{top:this.top-I.top,bottom:I.bottom-this.bottom,left:this.left-I.left,right:I.right-this.right,height:this.height,width:this.width}},R.getSimpleBoxPosition=function(I){var N=I.div?I.div.offsetHeight:I.tagName?I.offsetHeight:0,X=I.div?I.div.offsetWidth:I.tagName?I.offsetWidth:0,V=I.div?I.div.offsetTop:I.tagName?I.offsetTop:0;I=I.div?I.div.getBoundingClientRect():I.tagName?I.getBoundingClientRect():I;var Y={left:I.left,right:I.right,top:I.top||V,height:I.height||N,bottom:I.bottom||V+(I.height||N),width:I.width||X};return Y};function j(I,N,X,V){function Y(be,ve){for(var we,He=new R(be),Fe=1,Ze=0;ZeDe&&(we=new R(be),Fe=De),be=new R(He)}return we||He}var ne=new R(N),ie=N.cue,K=E(ie),q=[];if(ie.snapToLines){var Z;switch(ie.vertical){case"":q=["+y","-y"],Z="height";break;case"rl":q=["+x","-x"],Z="width";break;case"lr":q=["-x","+x"],Z="width";break}var te=ne.lineHeight,le=te*Math.round(K),z=X[Z]+te,re=q[0];Math.abs(le)>z&&(le=le<0?-1:1,le*=Math.ceil(z/te)*te),K<0&&(le+=ie.vertical===""?X.height:X.width,q=q.reverse()),ne.move(re,le)}else{var Q=ne.lineHeight/X.height*100;switch(ie.lineAlign){case"center":K-=Q/2;break;case"end":K-=Q;break}switch(ie.vertical){case"":N.applyStyles({top:N.formatStyle(K,"%")});break;case"rl":N.applyStyles({left:N.formatStyle(K,"%")});break;case"lr":N.applyStyles({right:N.formatStyle(K,"%")});break}q=["+y","-x","+x","-y"],ne=new R(N)}var pe=Y(ne,q);N.move(pe.toCSSCompatValues(X))}function F(){}F.StringDecoder=function(){return{decode:function(I){if(!I)return"";if(typeof I!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(I))}}},F.convertCueToDOMTree=function(I,N){return!I||!N?null:y(I,N)};var G=.05,L="sans-serif",W="1.5%";return F.processCues=function(I,N,X){if(!I||!N||!X)return null;for(;X.firstChild;)X.removeChild(X.firstChild);var V=I.document.createElement("div");V.style.position="absolute",V.style.left="0",V.style.right="0",V.style.top="0",V.style.bottom="0",V.style.margin=W,X.appendChild(V);function Y(te){for(var le=0;le")===-1){N.cue.id=ie;continue}case"CUE":try{a(ie,N.cue,N.regionList)}catch(te){N.reportOrThrowError(te),N.cue=null,N.state="BADCUE";continue}N.state="CUETEXT";continue;case"CUETEXT":var Z=ie.indexOf("-->")!==-1;if(!ie||Z&&(q=!0)){N.oncue&&N.oncue(N.cue),N.cue=null,N.state="ID";continue}N.cue.text&&(N.cue.text+=` +`),N.cue.text+=ie.replace(/\u2028/g,` `).replace(/u2029/g,` -`);continue;case"BADCUE":ie||(I.state="ID");continue}}}catch(te){I.reportOrThrowError(te),I.state==="CUETEXT"&&I.cue&&I.oncue&&I.oncue(I.cue),I.cue=null,I.state=I.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var L=this;try{if(L.buffer+=L.decoder.decode(),(L.cue||L.state==="HEADER")&&(L.buffer+=` +`);continue;case"BADCUE":ie||(N.state="ID");continue}}}catch(te){N.reportOrThrowError(te),N.state==="CUETEXT"&&N.cue&&N.oncue&&N.oncue(N.cue),N.cue=null,N.state=N.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var I=this;try{if(I.buffer+=I.decoder.decode(),(I.cue||I.state==="HEADER")&&(I.buffer+=` -`,L.parse()),L.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(I){L.reportOrThrowError(I)}return L.onflush&&L.onflush(),this}},qy=F,qy}var Ky,p2;function E3(){if(p2)return Ky;p2=1;var s="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(a){if(typeof a!="string")return!1;var u=e[a.toLowerCase()];return u?a.toLowerCase():!1}function n(a){if(typeof a!="string")return!1;var u=t[a.toLowerCase()];return u?a.toLowerCase():!1}function r(a,u,c){this.hasBeenReset=!1;var d="",f=!1,p=a,y=u,v=c,b=null,T="",E=!0,D="auto",O="start",R="auto",j="auto",F=100,z="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return d},set:function(N){d=""+N}},pauseOnExit:{enumerable:!0,get:function(){return f},set:function(N){f=!!N}},startTime:{enumerable:!0,get:function(){return p},set:function(N){if(typeof N!="number")throw new TypeError("Start time must be set to a number.");p=N,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return y},set:function(N){if(typeof N!="number")throw new TypeError("End time must be set to a number.");y=N,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return v},set:function(N){v=""+N,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return b},set:function(N){b=N,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return T},set:function(N){var Y=i(N);if(Y===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");T=Y,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return E},set:function(N){E=!!N,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return D},set:function(N){if(typeof N!="number"&&N!==s)throw new SyntaxError("Line: an invalid number or illegal string was specified.");D=N,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return O},set:function(N){var Y=n(N);Y?(O=Y,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return R},set:function(N){if(N<0||N>100)throw new Error("Position must be between 0 and 100.");R=N,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return j},set:function(N){var Y=n(N);Y?(j=Y,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return F},set:function(N){if(N<0||N>100)throw new Error("Size must be between 0 and 100.");F=N,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return z},set:function(N){var Y=n(N);if(!Y)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");z=Y,this.hasBeenReset=!0}}}),this.displayState=void 0}return r.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Ky=r,Ky}var Wy,g2;function w3(){if(g2)return Wy;g2=1;var s={"":!0,up:!0};function e(n){if(typeof n!="string")return!1;var r=s[n.toLowerCase()];return r?n.toLowerCase():!1}function t(n){return typeof n=="number"&&n>=0&&n<=100}function i(){var n=100,r=3,a=0,u=100,c=0,d=100,f="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return n},set:function(p){if(!t(p))throw new Error("Width must be between 0 and 100.");n=p}},lines:{enumerable:!0,get:function(){return r},set:function(p){if(typeof p!="number")throw new TypeError("Lines must be set to a number.");r=p}},regionAnchorY:{enumerable:!0,get:function(){return u},set:function(p){if(!t(p))throw new Error("RegionAnchorX must be between 0 and 100.");u=p}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(p){if(!t(p))throw new Error("RegionAnchorY must be between 0 and 100.");a=p}},viewportAnchorY:{enumerable:!0,get:function(){return d},set:function(p){if(!t(p))throw new Error("ViewportAnchorY must be between 0 and 100.");d=p}},viewportAnchorX:{enumerable:!0,get:function(){return c},set:function(p){if(!t(p))throw new Error("ViewportAnchorX must be between 0 and 100.");c=p}},scroll:{enumerable:!0,get:function(){return f},set:function(p){var y=e(p);y===!1?console.warn("Scroll: an invalid or illegal string was specified."):f=y}}})}return Wy=i,Wy}var y2;function A3(){if(y2)return Gy.exports;y2=1;var s=ap(),e=Gy.exports={WebVTT:_3(),VTTCue:E3(),VTTRegion:w3()};s.vttjs=e,s.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,n=s.VTTCue,r=s.VTTRegion;return e.shim=function(){s.VTTCue=t,s.VTTRegion=i},e.restore=function(){s.VTTCue=n,s.VTTRegion=r},s.VTTCue||e.shim(),Gy.exports}var k3=A3();const v2=Vc(k3);function nn(){return nn=Object.assign?Object.assign.bind():function(s){for(var e=1;e-1},e.trigger=function(i){var n=this.listeners[i];if(n)if(arguments.length===2)for(var r=n.length,a=0;a100)throw new Error("Position must be between 0 and 100.");R=L,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return j},set:function(L){var W=n(L);W?(j=W,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return F},set:function(L){if(L<0||L>100)throw new Error("Size must be between 0 and 100.");F=L,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return G},set:function(L){var W=n(L);if(!W)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");G=W,this.hasBeenReset=!0}}}),this.displayState=void 0}return r.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Qy=r,Qy}var Zy,_2;function j3(){if(_2)return Zy;_2=1;var s={"":!0,up:!0};function e(n){if(typeof n!="string")return!1;var r=s[n.toLowerCase()];return r?n.toLowerCase():!1}function t(n){return typeof n=="number"&&n>=0&&n<=100}function i(){var n=100,r=3,a=0,u=100,c=0,d=100,f="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return n},set:function(g){if(!t(g))throw new Error("Width must be between 0 and 100.");n=g}},lines:{enumerable:!0,get:function(){return r},set:function(g){if(typeof g!="number")throw new TypeError("Lines must be set to a number.");r=g}},regionAnchorY:{enumerable:!0,get:function(){return u},set:function(g){if(!t(g))throw new Error("RegionAnchorX must be between 0 and 100.");u=g}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(g){if(!t(g))throw new Error("RegionAnchorY must be between 0 and 100.");a=g}},viewportAnchorY:{enumerable:!0,get:function(){return d},set:function(g){if(!t(g))throw new Error("ViewportAnchorY must be between 0 and 100.");d=g}},viewportAnchorX:{enumerable:!0,get:function(){return c},set:function(g){if(!t(g))throw new Error("ViewportAnchorX must be between 0 and 100.");c=g}},scroll:{enumerable:!0,get:function(){return f},set:function(g){var y=e(g);y===!1?console.warn("Scroll: an invalid or illegal string was specified."):f=y}}})}return Zy=i,Zy}var E2;function $3(){if(E2)return Yy.exports;E2=1;var s=cp(),e=Yy.exports={WebVTT:B3(),VTTCue:U3(),VTTRegion:j3()};s.vttjs=e,s.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,n=s.VTTCue,r=s.VTTRegion;return e.shim=function(){s.VTTCue=t,s.VTTRegion=i},e.restore=function(){s.VTTCue=n,s.VTTRegion=r},s.VTTCue||e.shim(),Yy.exports}var H3=$3();const w2=qc(H3);function cn(){return cn=Object.assign?Object.assign.bind():function(s){for(var e=1;e-1},e.trigger=function(i){var n=this.listeners[i];if(n)if(arguments.length===2)for(var r=n.length,a=0;a-1;t=this.buffer.indexOf(` -`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const L3=" ",Yy=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},R3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Kn=function(s){const e={};if(!s)return e;const t=s.split(R3());let i=t.length,n;for(;i--;)t[i]!==""&&(n=/([^=]*)=(.*)/.exec(t[i]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},b2=s=>{const e=s.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class I3 extends hb{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,a)=>{const u=a(e);return u===e?r:r.concat([u])},[e]).forEach(r=>{for(let a=0;ar),this.customParsers.push(r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const i=n=>e.test(n)?t(n):n;this.tagMappers.push(i)}}const N3=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),ul=function(s){const e={};return Object.keys(s).forEach(function(t){e[N3(t)]=s[t]}),e},Xy=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const n="#EXT-X-SERVER-CONTROL",r="holdBack",a="partHoldBack",u=t&&t*3,c=i&&i*2;t&&!e.hasOwnProperty(r)&&(e[r]=u,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${u}).`})),u&&e[r]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&r&&(n.map=r),!n.key&&a&&(n.key=a),!n.timeline&&typeof p=="number"&&(n.timeline=p),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(T){let E,D;if(t.manifest.definitions){for(const O in t.manifest.definitions)if(T.uri&&(T.uri=T.uri.replace(`{$${O}}`,t.manifest.definitions[O])),T.attributes)for(const R in T.attributes)typeof T.attributes[R]=="string"&&(T.attributes[R]=T.attributes[R].replace(`{$${O}}`,t.manifest.definitions[O]))}({tag(){({version(){T.version&&(this.manifest.version=T.version)},"allow-cache"(){this.manifest.allowCache=T.allowed,"allowed"in T||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const O={};"length"in T&&(n.byterange=O,O.length=T.length,"offset"in T||(T.offset=y)),"offset"in T&&(n.byterange=O,O.offset=T.offset),y=O.offset+O.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),T.title&&(n.title=T.title),T.duration>0&&(n.duration=T.duration),T.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!T.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(T.attributes.METHOD==="NONE"){a=null;return}if(!T.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(T.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:T.attributes};return}if(T.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:T.attributes.URI};return}if(T.attributes.KEYFORMAT===f){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(T.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(T.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),T.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(T.attributes.KEYID&&T.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:T.attributes.KEYFORMAT,keyId:T.attributes.KEYID.substring(2)},pssh:ZA(T.attributes.URI.split(",")[1])};return}T.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:T.attributes.METHOD||"AES-128",uri:T.attributes.URI},typeof T.attributes.IV<"u"&&(a.iv=T.attributes.IV)},"media-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+T.number});return}this.manifest.mediaSequence=T.number},"discontinuity-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+T.number});return}this.manifest.discontinuitySequence=T.number,p=T.number},"playlist-type"(){if(!/VOD|EVENT/.test(T.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+T.playlist});return}this.manifest.playlistType=T.playlistType},map(){r={},T.uri&&(r.uri=T.uri),T.byterange&&(r.byterange=T.byterange),a&&(r.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!T.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),nn(n.attributes,T.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(T.attributes&&T.attributes.TYPE&&T.attributes["GROUP-ID"]&&T.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const O=this.manifest.mediaGroups[T.attributes.TYPE];O[T.attributes["GROUP-ID"]]=O[T.attributes["GROUP-ID"]]||{},E=O[T.attributes["GROUP-ID"]],D={default:/yes/i.test(T.attributes.DEFAULT)},D.default?D.autoselect=!0:D.autoselect=/yes/i.test(T.attributes.AUTOSELECT),T.attributes.LANGUAGE&&(D.language=T.attributes.LANGUAGE),T.attributes.URI&&(D.uri=T.attributes.URI),T.attributes["INSTREAM-ID"]&&(D.instreamId=T.attributes["INSTREAM-ID"]),T.attributes.CHARACTERISTICS&&(D.characteristics=T.attributes.CHARACTERISTICS),T.attributes.FORCED&&(D.forced=/yes/i.test(T.attributes.FORCED)),E[T.attributes.NAME]=D},discontinuity(){p+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=T.dateTimeString,this.manifest.dateTimeObject=T.dateTimeObject),n.dateTimeString=T.dateTimeString,n.dateTimeObject=T.dateTimeObject;const{lastProgramDateTime:O}=this;this.lastProgramDateTime=new Date(T.dateTimeString).getTime(),O===null&&this.manifest.segments.reduceRight((R,j)=>(j.programDateTime=R-j.duration*1e3,j.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(T.duration)||T.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+T.duration});return}this.manifest.targetDuration=T.duration,Xy.call(this,this.manifest)},start(){if(!T.attributes||isNaN(T.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:T.attributes["TIME-OFFSET"],precise:T.attributes.PRECISE}},"cue-out"(){n.cueOut=T.data},"cue-out-cont"(){n.cueOutCont=T.data},"cue-in"(){n.cueIn=T.data},skip(){this.manifest.skip=ul(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const O=this.manifest.segments.length,R=ul(T.attributes);n.parts=n.parts||[],n.parts.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=v),v=R.byterange.offset+R.byterange.length);const j=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${j} for segment #${O}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((F,z)=>{F.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${z} lacks required attribute(s): LAST-PART`})})},"server-control"(){const O=this.manifest.serverControl=ul(T.attributes);O.hasOwnProperty("canBlockReload")||(O.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Xy.call(this,this.manifest),O.canSkipDateranges&&!O.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const O=this.manifest.segments.length,R=ul(T.attributes),j=R.type&&R.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=j?v:0,j&&(v=R.byterange.offset+R.byterange.length)));const F=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${F} for segment #${O}`,T.attributes,["TYPE","URI"]),!!R.type)for(let z=0;zz.id===R.id);this.manifest.dateRanges[F]=nn(this.manifest.dateRanges[F],R),b[R.id]=nn(b[R.id],R),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=ul(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const O=(R,j)=>{if(R in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${R}`});return}this.manifest.definitions[R]=j};if("QUERYPARAM"in T.attributes){if("NAME"in T.attributes||"IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const R=this.params.get(T.attributes.QUERYPARAM);if(!R){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${T.attributes.QUERYPARAM}`});return}O(T.attributes.QUERYPARAM,decodeURIComponent(R));return}if("NAME"in T.attributes){if("IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in T.attributes)||typeof T.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${T.attributes.NAME}`});return}O(T.attributes.NAME,T.attributes.VALUE);return}if("IMPORT"in T.attributes){if(!this.mainDefinitions[T.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${T.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}O(T.attributes.IMPORT,this.mainDefinitions[T.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:T.attributes,uri:T.uri,timeline:p}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",T.attributes,["BANDWIDTH","URI"])}}[T.tagType]||c).call(t)},uri(){n.uri=T.uri,i.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=p,r&&(n.map=r),v=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){T.segment?(n.custom=n.custom||{},n.custom[T.customType]=T.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[T.customType]=T.data)}})[T.type].call(t)})}requiredCompatibilityversion(e,t){(ep&&(f-=p,f-=p,f-=Nn(2))}return Number(f)},G3=function(e,t){var i={},n=i.le,r=n===void 0?!1:n;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Nn(e);for(var a=H3(e),u=new Uint8Array(new ArrayBuffer(a)),c=0;c=t.length&&d.call(t,function(f,p){var y=c[p]?c[p]&e[a+p]:e[a+p];return f===y})},K3=function(e,t,i){t.forEach(function(n){for(var r in e.mediaGroups[n])for(var a in e.mediaGroups[n][r]){var u=e.mediaGroups[n][r][a];i(u,n,r,a)}})},Zd={},ho={},Ql={},_2;function lp(){if(_2)return Ql;_2=1;function s(r,a,u){if(u===void 0&&(u=Array.prototype),r&&typeof u.find=="function")return u.find.call(r,a);for(var c=0;c=0&&V=0){for(var Ue=H.length-1;Te0},lookupPrefix:function(V){for(var H=this;H;){var ee=H._nsMap;if(ee){for(var Te in ee)if(Object.prototype.hasOwnProperty.call(ee,Te)&&ee[Te]===V)return Te}H=H.nodeType==y?H.ownerDocument:H.parentNode}return null},lookupNamespaceURI:function(V){for(var H=this;H;){var ee=H._nsMap;if(ee&&Object.prototype.hasOwnProperty.call(ee,V))return ee[V];H=H.nodeType==y?H.ownerDocument:H.parentNode}return null},isDefaultNamespace:function(V){var H=this.lookupPrefix(V);return H==null}};function ne(V){return V=="<"&&"<"||V==">"&&">"||V=="&"&&"&"||V=='"'&&"""||"&#"+V.charCodeAt()+";"}c(f,U),c(f,U.prototype);function Z(V,H){if(H(V))return!0;if(V=V.firstChild)do if(Z(V,H))return!0;while(V=V.nextSibling)}function fe(){this.ownerDocument=this}function xe(V,H,ee){V&&V._inc++;var Te=ee.namespaceURI;Te===t.XMLNS&&(H._nsMap[ee.prefix?ee.localName:""]=ee.value)}function ge(V,H,ee,Te){V&&V._inc++;var Ue=ee.namespaceURI;Ue===t.XMLNS&&delete H._nsMap[ee.prefix?ee.localName:""]}function Ce(V,H,ee){if(V&&V._inc){V._inc++;var Te=H.childNodes;if(ee)Te[Te.length++]=ee;else{for(var Ue=H.firstChild,ft=0;Ue;)Te[ft++]=Ue,Ue=Ue.nextSibling;Te.length=ft,delete Te[Te.length]}}}function Me(V,H){var ee=H.previousSibling,Te=H.nextSibling;return ee?ee.nextSibling=Te:V.firstChild=Te,Te?Te.previousSibling=ee:V.lastChild=ee,H.parentNode=null,H.previousSibling=null,H.nextSibling=null,Ce(V.ownerDocument,V),H}function Re(V){return V&&(V.nodeType===U.DOCUMENT_NODE||V.nodeType===U.DOCUMENT_FRAGMENT_NODE||V.nodeType===U.ELEMENT_NODE)}function Ae(V){return V&&(Pe(V)||gt(V)||be(V)||V.nodeType===U.DOCUMENT_FRAGMENT_NODE||V.nodeType===U.COMMENT_NODE||V.nodeType===U.PROCESSING_INSTRUCTION_NODE)}function be(V){return V&&V.nodeType===U.DOCUMENT_TYPE_NODE}function Pe(V){return V&&V.nodeType===U.ELEMENT_NODE}function gt(V){return V&&V.nodeType===U.TEXT_NODE}function Ye(V,H){var ee=V.childNodes||[];if(e(ee,Pe)||be(H))return!1;var Te=e(ee,be);return!(H&&Te&&ee.indexOf(Te)>ee.indexOf(H))}function lt(V,H){var ee=V.childNodes||[];function Te(ft){return Pe(ft)&&ft!==H}if(e(ee,Te))return!1;var Ue=e(ee,be);return!(H&&Ue&&ee.indexOf(Ue)>ee.indexOf(H))}function Ve(V,H,ee){if(!Re(V))throw new G(L,"Unexpected parent node type "+V.nodeType);if(ee&&ee.parentNode!==V)throw new G(I,"child not in parent");if(!Ae(H)||be(H)&&V.nodeType!==U.DOCUMENT_NODE)throw new G(L,"Unexpected node type "+H.nodeType+" for parent node type "+V.nodeType)}function ht(V,H,ee){var Te=V.childNodes||[],Ue=H.childNodes||[];if(H.nodeType===U.DOCUMENT_FRAGMENT_NODE){var ft=Ue.filter(Pe);if(ft.length>1||e(Ue,gt))throw new G(L,"More than one element or text in fragment");if(ft.length===1&&!Ye(V,ee))throw new G(L,"Element in fragment can not be inserted before doctype")}if(Pe(H)&&!Ye(V,ee))throw new G(L,"Only one element can be added and only after doctype");if(be(H)){if(e(Te,be))throw new G(L,"Only one doctype is allowed");var Et=e(Te,Pe);if(ee&&Te.indexOf(Et)1||e(Ue,gt))throw new G(L,"More than one element or text in fragment");if(ft.length===1&&!lt(V,ee))throw new G(L,"Element in fragment can not be inserted before doctype")}if(Pe(H)&&!lt(V,ee))throw new G(L,"Only one element can be added and only after doctype");if(be(H)){let gi=function(_i){return be(_i)&&_i!==ee};var pi=gi;if(e(Te,gi))throw new G(L,"Only one doctype is allowed");var Et=e(Te,Pe);if(ee&&Te.indexOf(Et)0&&Z(ee.documentElement,function(Ue){if(Ue!==ee&&Ue.nodeType===p){var ft=Ue.getAttribute("class");if(ft){var Et=V===ft;if(!Et){var pi=a(ft);Et=H.every(u(pi))}Et&&Te.push(Ue)}}}),Te})},createElement:function(V){var H=new pe;H.ownerDocument=this,H.nodeName=V,H.tagName=V,H.localName=V,H.childNodes=new q;var ee=H.attributes=new W;return ee._ownerElement=H,H},createDocumentFragment:function(){var V=new Ht;return V.ownerDocument=this,V.childNodes=new q,V},createTextNode:function(V){var H=new ot;return H.ownerDocument=this,H.appendData(V),H},createComment:function(V){var H=new St;return H.ownerDocument=this,H.appendData(V),H},createCDATASection:function(V){var H=new vt;return H.ownerDocument=this,H.appendData(V),H},createProcessingInstruction:function(V,H){var ee=new ui;return ee.ownerDocument=this,ee.tagName=ee.nodeName=ee.target=V,ee.nodeValue=ee.data=H,ee},createAttribute:function(V){var H=new We;return H.ownerDocument=this,H.name=V,H.nodeName=V,H.localName=V,H.specified=!0,H},createEntityReference:function(V){var H=new Pt;return H.ownerDocument=this,H.nodeName=V,H},createElementNS:function(V,H){var ee=new pe,Te=H.split(":"),Ue=ee.attributes=new W;return ee.childNodes=new q,ee.ownerDocument=this,ee.nodeName=H,ee.tagName=H,ee.namespaceURI=V,Te.length==2?(ee.prefix=Te[0],ee.localName=Te[1]):ee.localName=H,Ue._ownerElement=ee,ee},createAttributeNS:function(V,H){var ee=new We,Te=H.split(":");return ee.ownerDocument=this,ee.nodeName=H,ee.name=H,ee.namespaceURI=V,ee.specified=!0,Te.length==2?(ee.prefix=Te[0],ee.localName=Te[1]):ee.localName=H,ee}},d(fe,U);function pe(){this._nsMap={}}pe.prototype={nodeType:p,hasAttribute:function(V){return this.getAttributeNode(V)!=null},getAttribute:function(V){var H=this.getAttributeNode(V);return H&&H.value||""},getAttributeNode:function(V){return this.attributes.getNamedItem(V)},setAttribute:function(V,H){var ee=this.ownerDocument.createAttribute(V);ee.value=ee.nodeValue=""+H,this.setAttributeNode(ee)},removeAttribute:function(V){var H=this.getAttributeNode(V);H&&this.removeAttributeNode(H)},appendChild:function(V){return V.nodeType===F?this.insertBefore(V,null):_t(this,V)},setAttributeNode:function(V){return this.attributes.setNamedItem(V)},setAttributeNodeNS:function(V){return this.attributes.setNamedItemNS(V)},removeAttributeNode:function(V){return this.attributes.removeNamedItem(V.nodeName)},removeAttributeNS:function(V,H){var ee=this.getAttributeNodeNS(V,H);ee&&this.removeAttributeNode(ee)},hasAttributeNS:function(V,H){return this.getAttributeNodeNS(V,H)!=null},getAttributeNS:function(V,H){var ee=this.getAttributeNodeNS(V,H);return ee&&ee.value||""},setAttributeNS:function(V,H,ee){var Te=this.ownerDocument.createAttributeNS(V,H);Te.value=Te.nodeValue=""+ee,this.setAttributeNode(Te)},getAttributeNodeNS:function(V,H){return this.attributes.getNamedItemNS(V,H)},getElementsByTagName:function(V){return new ae(this,function(H){var ee=[];return Z(H,function(Te){Te!==H&&Te.nodeType==p&&(V==="*"||Te.tagName==V)&&ee.push(Te)}),ee})},getElementsByTagNameNS:function(V,H){return new ae(this,function(ee){var Te=[];return Z(ee,function(Ue){Ue!==ee&&Ue.nodeType===p&&(V==="*"||Ue.namespaceURI===V)&&(H==="*"||Ue.localName==H)&&Te.push(Ue)}),Te})}},fe.prototype.getElementsByTagName=pe.prototype.getElementsByTagName,fe.prototype.getElementsByTagNameNS=pe.prototype.getElementsByTagNameNS,d(pe,U);function We(){}We.prototype.nodeType=y,d(We,U);function Je(){}Je.prototype={data:"",substringData:function(V,H){return this.data.substring(V,V+H)},appendData:function(V){V=this.data+V,this.nodeValue=this.data=V,this.length=V.length},insertData:function(V,H){this.replaceData(V,0,H)},appendChild:function(V){throw new Error(Y[L])},deleteData:function(V,H){this.replaceData(V,H,"")},replaceData:function(V,H,ee){var Te=this.data.substring(0,V),Ue=this.data.substring(V+H);ee=Te+ee+Ue,this.nodeValue=this.data=ee,this.length=ee.length}},d(Je,U);function ot(){}ot.prototype={nodeName:"#text",nodeType:v,splitText:function(V){var H=this.data,ee=H.substring(V);H=H.substring(0,V),this.data=this.nodeValue=H,this.length=H.length;var Te=this.ownerDocument.createTextNode(ee);return this.parentNode&&this.parentNode.insertBefore(Te,this.nextSibling),Te}},d(ot,Je);function St(){}St.prototype={nodeName:"#comment",nodeType:O},d(St,Je);function vt(){}vt.prototype={nodeName:"#cdata-section",nodeType:b},d(vt,Je);function Vt(){}Vt.prototype.nodeType=j,d(Vt,U);function si(){}si.prototype.nodeType=z,d(si,U);function $t(){}$t.prototype.nodeType=E,d($t,U);function Pt(){}Pt.prototype.nodeType=T,d(Pt,U);function Ht(){}Ht.prototype.nodeName="#document-fragment",Ht.prototype.nodeType=F,d(Ht,U);function ui(){}ui.prototype.nodeType=D,d(ui,U);function xt(){}xt.prototype.serializeToString=function(V,H,ee){return ni.call(V,H,ee)},U.prototype.toString=ni;function ni(V,H){var ee=[],Te=this.nodeType==9&&this.documentElement||this,Ue=Te.prefix,ft=Te.namespaceURI;if(ft&&Ue==null){var Ue=Te.lookupPrefix(ft);if(Ue==null)var Et=[{namespace:ft,prefix:null}]}return Gt(this,ee,V,H,Et),ee.join("")}function Xt(V,H,ee){var Te=V.prefix||"",Ue=V.namespaceURI;if(!Ue||Te==="xml"&&Ue===t.XML||Ue===t.XMLNS)return!1;for(var ft=ee.length;ft--;){var Et=ee[ft];if(Et.prefix===Te)return Et.namespace!==Ue}return!0}function Zi(V,H,ee){V.push(" ",H,'="',ee.replace(/[<>&"\t\n\r]/g,ne),'"')}function Gt(V,H,ee,Te,Ue){if(Ue||(Ue=[]),Te)if(V=Te(V),V){if(typeof V=="string"){H.push(V);return}}else return;switch(V.nodeType){case p:var ft=V.attributes,Et=ft.length,Jt=V.firstChild,pi=V.tagName;ee=t.isHTML(V.namespaceURI)||ee;var gi=pi;if(!ee&&!V.prefix&&V.namespaceURI){for(var _i,Ei=0;Ei=0;fi--){var yi=Ue[fi];if(yi.prefix===""&&yi.namespace===V.namespaceURI){_i=yi.namespace;break}}if(_i!==V.namespaceURI)for(var fi=Ue.length-1;fi>=0;fi--){var yi=Ue[fi];if(yi.namespace===V.namespaceURI){yi.prefix&&(gi=yi.prefix+":"+pi);break}}}H.push("<",gi);for(var $s=0;$s"),ee&&/^script$/i.test(pi))for(;Jt;)Jt.data?H.push(Jt.data):Gt(Jt,H,ee,Te,Ue.slice()),Jt=Jt.nextSibling;else for(;Jt;)Gt(Jt,H,ee,Te,Ue.slice()),Jt=Jt.nextSibling;H.push("")}else H.push("/>");return;case R:case F:for(var Jt=V.firstChild;Jt;)Gt(Jt,H,ee,Te,Ue.slice()),Jt=Jt.nextSibling;return;case y:return Zi(H,V.name,V.value);case v:return H.push(V.data.replace(/[<&>]/g,ne));case b:return H.push("");case O:return H.push("");case j:var ei=V.publicId,Qi=V.systemId;if(H.push("");else if(Qi&&Qi!=".")H.push(" SYSTEM ",Qi,">");else{var Ls=V.internalSubset;Ls&&H.push(" [",Ls,"]"),H.push(">")}return;case D:return H.push("");case T:return H.push("&",V.nodeName,";");default:H.push("??",V.nodeName)}}function Yi(V,H,ee){var Te;switch(H.nodeType){case p:Te=H.cloneNode(!1),Te.ownerDocument=V;case F:break;case y:ee=!0;break}if(Te||(Te=H.cloneNode(!1)),Te.ownerDocument=V,Te.parentNode=null,ee)for(var Ue=H.firstChild;Ue;)Te.appendChild(Yi(V,Ue,ee)),Ue=Ue.nextSibling;return Te}function Ri(V,H,ee){var Te=new H.constructor;for(var Ue in H)if(Object.prototype.hasOwnProperty.call(H,Ue)){var ft=H[Ue];typeof ft!="object"&&ft!=Te[Ue]&&(Te[Ue]=ft)}switch(H.childNodes&&(Te.childNodes=new q),Te.ownerDocument=V,Te.nodeType){case p:var Et=H.attributes,pi=Te.attributes=new W,gi=Et.length;pi._ownerElement=Te;for(var _i=0;_i",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` -`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),s.entityMap=s.HTML_ENTITIES})(Zy)),Zy}var _m={},A2;function Y3(){if(A2)return _m;A2=1;var s=lp().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),n=0,r=1,a=2,u=3,c=4,d=5,f=6,p=7;function y(L,I){this.message=L,this.locator=I,Error.captureStackTrace&&Error.captureStackTrace(this,y)}y.prototype=new Error,y.prototype.name=y.name;function v(){}v.prototype={parse:function(L,I,X){var G=this.domBuilder;G.startDocument(),j(I,I={}),b(L,I,X,G,this.errorHandler),G.endDocument()}};function b(L,I,X,G,q){function ae(_t){if(_t>65535){_t-=65536;var pe=55296+(_t>>10),We=56320+(_t&1023);return String.fromCharCode(pe,We)}else return String.fromCharCode(_t)}function ie(_t){var pe=_t.slice(1,-1);return Object.hasOwnProperty.call(X,pe)?X[pe]:pe.charAt(0)==="#"?ae(parseInt(pe.substr(1).replace("x","0x"))):(q.error("entity not found:"+_t),_t)}function W(_t){if(_t>fe){var pe=L.substring(fe,_t).replace(/&#?\w+;/g,ie);U&&K(fe),G.characters(pe,0,_t-fe),fe=_t}}function K(_t,pe){for(;_t>=te&&(pe=re.exec(L));)Q=pe.index,te=Q+pe[0].length,U.lineNumber++;U.columnNumber=_t-Q+1}for(var Q=0,te=0,re=/.*(?:\r\n?|\n)|.*$/g,U=G.locator,ne=[{currentNSMap:I}],Z={},fe=0;;){try{var xe=L.indexOf("<",fe);if(xe<0){if(!L.substr(fe).match(/^\s*$/)){var ge=G.doc,Ce=ge.createTextNode(L.substr(fe));ge.appendChild(Ce),G.currentElement=Ce}return}switch(xe>fe&&W(xe),L.charAt(xe+1)){case"/":var Ve=L.indexOf(">",xe+3),Me=L.substring(xe+2,Ve).replace(/[ \t\n\r]+$/g,""),Re=ne.pop();Ve<0?(Me=L.substring(xe+2).replace(/[\s<].*/,""),q.error("end tag name: "+Me+" is not complete:"+Re.tagName),Ve=xe+1+Me.length):Me.match(/\sfe?fe=Ve:W(Math.max(xe,fe)+1)}}function T(L,I){return I.lineNumber=L.lineNumber,I.columnNumber=L.columnNumber,I}function E(L,I,X,G,q,ae){function ie(U,ne,Z){X.attributeNames.hasOwnProperty(U)&&ae.fatalError("Attribute "+U+" redefined"),X.addValue(U,ne.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,q),Z)}for(var W,K,Q=++I,te=n;;){var re=L.charAt(Q);switch(re){case"=":if(te===r)W=L.slice(I,Q),te=u;else if(te===a)te=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(te===u||te===r)if(te===r&&(ae.warning('attribute value must after "="'),W=L.slice(I,Q)),I=Q+1,Q=L.indexOf(re,I),Q>0)K=L.slice(I,Q),ie(W,K,I-1),te=d;else throw new Error("attribute value no end '"+re+"' match");else if(te==c)K=L.slice(I,Q),ie(W,K,I),ae.warning('attribute "'+W+'" missed start quot('+re+")!!"),I=Q+1,te=d;else throw new Error('attribute value must after "="');break;case"/":switch(te){case n:X.setTagName(L.slice(I,Q));case d:case f:case p:te=p,X.closed=!0;case c:case r:break;case a:X.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ae.error("unexpected end of input"),te==n&&X.setTagName(L.slice(I,Q)),Q;case">":switch(te){case n:X.setTagName(L.slice(I,Q));case d:case f:case p:break;case c:case r:K=L.slice(I,Q),K.slice(-1)==="/"&&(X.closed=!0,K=K.slice(0,-1));case a:te===a&&(K=W),te==c?(ae.warning('attribute "'+K+'" missed quot(")!'),ie(W,K,I)):((!s.isHTML(G[""])||!K.match(/^(?:disabled|checked|selected)$/i))&&ae.warning('attribute "'+K+'" missed value!! "'+K+'" instead!!'),ie(K,K,I));break;case u:throw new Error("attribute value missed!!")}return Q;case"€":re=" ";default:if(re<=" ")switch(te){case n:X.setTagName(L.slice(I,Q)),te=f;break;case r:W=L.slice(I,Q),te=a;break;case c:var K=L.slice(I,Q);ae.warning('attribute "'+K+'" missed quot(")!!'),ie(W,K,I);case d:te=f;break}else switch(te){case a:X.tagName,(!s.isHTML(G[""])||!W.match(/^(?:disabled|checked|selected)$/i))&&ae.warning('attribute "'+W+'" missed value!! "'+W+'" instead2!!'),ie(W,W,I),I=Q,te=r;break;case d:ae.warning('attribute space is required"'+W+'"!!');case f:te=r,I=Q;break;case u:te=c,I=Q;break;case p:throw new Error("elements closed character '/' and '>' must be connected to")}}Q++}}function D(L,I,X){for(var G=L.tagName,q=null,re=L.length;re--;){var ae=L[re],ie=ae.qName,W=ae.value,U=ie.indexOf(":");if(U>0)var K=ae.prefix=ie.slice(0,U),Q=ie.slice(U+1),te=K==="xmlns"&&Q;else Q=ie,K=null,te=ie==="xmlns"&&"";ae.localName=Q,te!==!1&&(q==null&&(q={},j(X,X={})),X[te]=q[te]=W,ae.uri=s.XMLNS,I.startPrefixMapping(te,W))}for(var re=L.length;re--;){ae=L[re];var K=ae.prefix;K&&(K==="xml"&&(ae.uri=s.XML),K!=="xmlns"&&(ae.uri=X[K||""]))}var U=G.indexOf(":");U>0?(K=L.prefix=G.slice(0,U),Q=L.localName=G.slice(U+1)):(K=null,Q=L.localName=G);var ne=L.uri=X[K||""];if(I.startElement(ne,Q,G,L),L.closed){if(I.endElement(ne,Q,G),q)for(K in q)Object.prototype.hasOwnProperty.call(q,K)&&I.endPrefixMapping(K)}else return L.currentNSMap=X,L.localNSMap=q,!0}function O(L,I,X,G,q){if(/^(?:script|textarea)$/i.test(X)){var ae=L.indexOf("",I),ie=L.substring(I+1,ae);if(/[&<]/.test(ie))return/^script$/i.test(X)?(q.characters(ie,0,ie.length),ae):(ie=ie.replace(/&#?\w+;/g,G),q.characters(ie,0,ie.length),ae)}return I+1}function R(L,I,X,G){var q=G[X];return q==null&&(q=L.lastIndexOf(""),q",I+4);return ae>I?(X.comment(L,I+4,ae-I-4),ae+3):(G.error("Unclosed comment"),-1)}else return-1;default:if(L.substr(I+3,6)=="CDATA["){var ae=L.indexOf("]]>",I+9);return X.startCDATA(),X.characters(L,I+9,ae-I-9),X.endCDATA(),ae+3}var ie=Y(L,I),W=ie.length;if(W>1&&/!doctype/i.test(ie[0][0])){var K=ie[1][0],Q=!1,te=!1;W>3&&(/^public$/i.test(ie[2][0])?(Q=ie[3][0],te=W>4&&ie[4][0]):/^system$/i.test(ie[2][0])&&(te=ie[3][0]));var re=ie[W-1];return X.startDTD(K,Q,te),X.endDTD(),re.index+re[0].length}}return-1}function z(L,I,X){var G=L.indexOf("?>",I);if(G){var q=L.substring(I,G).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return q?(q[0].length,X.processingInstruction(q[1],q[2]),G+2):-1}return-1}function N(){this.attributeNames={}}N.prototype={setTagName:function(L){if(!i.test(L))throw new Error("invalid tagName:"+L);this.tagName=L},addValue:function(L,I,X){if(!i.test(L))throw new Error("invalid attribute:"+L);this.attributeNames[L]=this.length,this[this.length++]={qName:L,value:I,offset:X}},length:0,getLocalName:function(L){return this[L].localName},getLocator:function(L){return this[L].locator},getQName:function(L){return this[L].qName},getURI:function(L){return this[L].uri},getValue:function(L){return this[L].value}};function Y(L,I){var X,G=[],q=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(q.lastIndex=I,q.exec(L);X=q.exec(L);)if(G.push(X),X[1])return G}return _m.XMLReader=v,_m.ParseError=y,_m}var k2;function X3(){if(k2)return Jd;k2=1;var s=lp(),e=nk(),t=W3(),i=Y3(),n=e.DOMImplementation,r=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function c(E){return E.replace(/\r[\n\u0085]/g,` +`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const G3=" ",Jy=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},q3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Xn=function(s){const e={};if(!s)return e;const t=s.split(q3());let i=t.length,n;for(;i--;)t[i]!==""&&(n=/([^=]*)=(.*)/.exec(t[i]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},k2=s=>{const e=s.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class K3 extends pb{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,a)=>{const u=a(e);return u===e?r:r.concat([u])},[e]).forEach(r=>{for(let a=0;ar),this.customParsers.push(r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const i=n=>e.test(n)?t(n):n;this.tagMappers.push(i)}}const W3=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),cl=function(s){const e={};return Object.keys(s).forEach(function(t){e[W3(t)]=s[t]}),e},ev=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const n="#EXT-X-SERVER-CONTROL",r="holdBack",a="partHoldBack",u=t&&t*3,c=i&&i*2;t&&!e.hasOwnProperty(r)&&(e[r]=u,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${u}).`})),u&&e[r]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&r&&(n.map=r),!n.key&&a&&(n.key=a),!n.timeline&&typeof g=="number"&&(n.timeline=g),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(T){let E,D;if(t.manifest.definitions){for(const O in t.manifest.definitions)if(T.uri&&(T.uri=T.uri.replace(`{$${O}}`,t.manifest.definitions[O])),T.attributes)for(const R in T.attributes)typeof T.attributes[R]=="string"&&(T.attributes[R]=T.attributes[R].replace(`{$${O}}`,t.manifest.definitions[O]))}({tag(){({version(){T.version&&(this.manifest.version=T.version)},"allow-cache"(){this.manifest.allowCache=T.allowed,"allowed"in T||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const O={};"length"in T&&(n.byterange=O,O.length=T.length,"offset"in T||(T.offset=y)),"offset"in T&&(n.byterange=O,O.offset=T.offset),y=O.offset+O.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),T.title&&(n.title=T.title),T.duration>0&&(n.duration=T.duration),T.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!T.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(T.attributes.METHOD==="NONE"){a=null;return}if(!T.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(T.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:T.attributes};return}if(T.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:T.attributes.URI};return}if(T.attributes.KEYFORMAT===f){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(T.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(T.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),T.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(T.attributes.KEYID&&T.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:T.attributes.KEYFORMAT,keyId:T.attributes.KEYID.substring(2)},pssh:ok(T.attributes.URI.split(",")[1])};return}T.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:T.attributes.METHOD||"AES-128",uri:T.attributes.URI},typeof T.attributes.IV<"u"&&(a.iv=T.attributes.IV)},"media-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+T.number});return}this.manifest.mediaSequence=T.number},"discontinuity-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+T.number});return}this.manifest.discontinuitySequence=T.number,g=T.number},"playlist-type"(){if(!/VOD|EVENT/.test(T.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+T.playlist});return}this.manifest.playlistType=T.playlistType},map(){r={},T.uri&&(r.uri=T.uri),T.byterange&&(r.byterange=T.byterange),a&&(r.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!T.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),cn(n.attributes,T.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(T.attributes&&T.attributes.TYPE&&T.attributes["GROUP-ID"]&&T.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const O=this.manifest.mediaGroups[T.attributes.TYPE];O[T.attributes["GROUP-ID"]]=O[T.attributes["GROUP-ID"]]||{},E=O[T.attributes["GROUP-ID"]],D={default:/yes/i.test(T.attributes.DEFAULT)},D.default?D.autoselect=!0:D.autoselect=/yes/i.test(T.attributes.AUTOSELECT),T.attributes.LANGUAGE&&(D.language=T.attributes.LANGUAGE),T.attributes.URI&&(D.uri=T.attributes.URI),T.attributes["INSTREAM-ID"]&&(D.instreamId=T.attributes["INSTREAM-ID"]),T.attributes.CHARACTERISTICS&&(D.characteristics=T.attributes.CHARACTERISTICS),T.attributes.FORCED&&(D.forced=/yes/i.test(T.attributes.FORCED)),E[T.attributes.NAME]=D},discontinuity(){g+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=T.dateTimeString,this.manifest.dateTimeObject=T.dateTimeObject),n.dateTimeString=T.dateTimeString,n.dateTimeObject=T.dateTimeObject;const{lastProgramDateTime:O}=this;this.lastProgramDateTime=new Date(T.dateTimeString).getTime(),O===null&&this.manifest.segments.reduceRight((R,j)=>(j.programDateTime=R-j.duration*1e3,j.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(T.duration)||T.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+T.duration});return}this.manifest.targetDuration=T.duration,ev.call(this,this.manifest)},start(){if(!T.attributes||isNaN(T.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:T.attributes["TIME-OFFSET"],precise:T.attributes.PRECISE}},"cue-out"(){n.cueOut=T.data},"cue-out-cont"(){n.cueOutCont=T.data},"cue-in"(){n.cueIn=T.data},skip(){this.manifest.skip=cl(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const O=this.manifest.segments.length,R=cl(T.attributes);n.parts=n.parts||[],n.parts.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=v),v=R.byterange.offset+R.byterange.length);const j=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${j} for segment #${O}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((F,G)=>{F.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${G} lacks required attribute(s): LAST-PART`})})},"server-control"(){const O=this.manifest.serverControl=cl(T.attributes);O.hasOwnProperty("canBlockReload")||(O.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),ev.call(this,this.manifest),O.canSkipDateranges&&!O.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const O=this.manifest.segments.length,R=cl(T.attributes),j=R.type&&R.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=j?v:0,j&&(v=R.byterange.offset+R.byterange.length)));const F=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${F} for segment #${O}`,T.attributes,["TYPE","URI"]),!!R.type)for(let G=0;GG.id===R.id);this.manifest.dateRanges[F]=cn(this.manifest.dateRanges[F],R),b[R.id]=cn(b[R.id],R),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=cl(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const O=(R,j)=>{if(R in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${R}`});return}this.manifest.definitions[R]=j};if("QUERYPARAM"in T.attributes){if("NAME"in T.attributes||"IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const R=this.params.get(T.attributes.QUERYPARAM);if(!R){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${T.attributes.QUERYPARAM}`});return}O(T.attributes.QUERYPARAM,decodeURIComponent(R));return}if("NAME"in T.attributes){if("IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in T.attributes)||typeof T.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${T.attributes.NAME}`});return}O(T.attributes.NAME,T.attributes.VALUE);return}if("IMPORT"in T.attributes){if(!this.mainDefinitions[T.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${T.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}O(T.attributes.IMPORT,this.mainDefinitions[T.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:T.attributes,uri:T.uri,timeline:g}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",T.attributes,["BANDWIDTH","URI"])}}[T.tagType]||c).call(t)},uri(){n.uri=T.uri,i.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=g,r&&(n.map=r),v=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){T.segment?(n.custom=n.custom||{},n.custom[T.customType]=T.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[T.customType]=T.data)}})[T.type].call(t)})}requiredCompatibilityversion(e,t){(eg&&(f-=g,f-=g,f-=Fn(2))}return Number(f)},aP=function(e,t){var i={},n=i.le,r=n===void 0?!1:n;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Fn(e);for(var a=sP(e),u=new Uint8Array(new ArrayBuffer(a)),c=0;c=t.length&&d.call(t,function(f,g){var y=c[g]?c[g]&e[a+g]:e[a+g];return f===y})},lP=function(e,t,i){t.forEach(function(n){for(var r in e.mediaGroups[n])for(var a in e.mediaGroups[n][r]){var u=e.mediaGroups[n][r][a];i(u,n,r,a)}})},Jd={},mo={},Zl={},L2;function hp(){if(L2)return Zl;L2=1;function s(r,a,u){if(u===void 0&&(u=Array.prototype),r&&typeof u.find=="function")return u.find.call(r,a);for(var c=0;c=0&&H=0){for(var Me=U.length-1;Te0},lookupPrefix:function(H){for(var U=this;U;){var ee=U._nsMap;if(ee){for(var Te in ee)if(Object.prototype.hasOwnProperty.call(ee,Te)&&ee[Te]===H)return Te}U=U.nodeType==y?U.ownerDocument:U.parentNode}return null},lookupNamespaceURI:function(H){for(var U=this;U;){var ee=U._nsMap;if(ee&&Object.prototype.hasOwnProperty.call(ee,H))return ee[H];U=U.nodeType==y?U.ownerDocument:U.parentNode}return null},isDefaultNamespace:function(H){var U=this.lookupPrefix(H);return U==null}};function re(H){return H=="<"&&"<"||H==">"&&">"||H=="&"&&"&"||H=='"'&&"""||"&#"+H.charCodeAt()+";"}c(f,z),c(f,z.prototype);function Q(H,U){if(U(H))return!0;if(H=H.firstChild)do if(Q(H,U))return!0;while(H=H.nextSibling)}function pe(){this.ownerDocument=this}function be(H,U,ee){H&&H._inc++;var Te=ee.namespaceURI;Te===t.XMLNS&&(U._nsMap[ee.prefix?ee.localName:""]=ee.value)}function ve(H,U,ee,Te){H&&H._inc++;var Me=ee.namespaceURI;Me===t.XMLNS&&delete U._nsMap[ee.prefix?ee.localName:""]}function we(H,U,ee){if(H&&H._inc){H._inc++;var Te=U.childNodes;if(ee)Te[Te.length++]=ee;else{for(var Me=U.firstChild,gt=0;Me;)Te[gt++]=Me,Me=Me.nextSibling;Te.length=gt,delete Te[Te.length]}}}function He(H,U){var ee=U.previousSibling,Te=U.nextSibling;return ee?ee.nextSibling=Te:H.firstChild=Te,Te?Te.previousSibling=ee:H.lastChild=ee,U.parentNode=null,U.previousSibling=null,U.nextSibling=null,we(H.ownerDocument,H),U}function Fe(H){return H&&(H.nodeType===z.DOCUMENT_NODE||H.nodeType===z.DOCUMENT_FRAGMENT_NODE||H.nodeType===z.ELEMENT_NODE)}function Ze(H){return H&&(Ye(H)||wt(H)||De(H)||H.nodeType===z.DOCUMENT_FRAGMENT_NODE||H.nodeType===z.COMMENT_NODE||H.nodeType===z.PROCESSING_INSTRUCTION_NODE)}function De(H){return H&&H.nodeType===z.DOCUMENT_TYPE_NODE}function Ye(H){return H&&H.nodeType===z.ELEMENT_NODE}function wt(H){return H&&H.nodeType===z.TEXT_NODE}function vt(H,U){var ee=H.childNodes||[];if(e(ee,Ye)||De(U))return!1;var Te=e(ee,De);return!(U&&Te&&ee.indexOf(Te)>ee.indexOf(U))}function Ge(H,U){var ee=H.childNodes||[];function Te(gt){return Ye(gt)&>!==U}if(e(ee,Te))return!1;var Me=e(ee,De);return!(U&&Me&&ee.indexOf(Me)>ee.indexOf(U))}function ke(H,U,ee){if(!Fe(H))throw new V(I,"Unexpected parent node type "+H.nodeType);if(ee&&ee.parentNode!==H)throw new V(N,"child not in parent");if(!Ze(U)||De(U)&&H.nodeType!==z.DOCUMENT_NODE)throw new V(I,"Unexpected node type "+U.nodeType+" for parent node type "+H.nodeType)}function ut(H,U,ee){var Te=H.childNodes||[],Me=U.childNodes||[];if(U.nodeType===z.DOCUMENT_FRAGMENT_NODE){var gt=Me.filter(Ye);if(gt.length>1||e(Me,wt))throw new V(I,"More than one element or text in fragment");if(gt.length===1&&!vt(H,ee))throw new V(I,"Element in fragment can not be inserted before doctype")}if(Ye(U)&&!vt(H,ee))throw new V(I,"Only one element can be added and only after doctype");if(De(U)){if(e(Te,De))throw new V(I,"Only one doctype is allowed");var Tt=e(Te,Ye);if(ee&&Te.indexOf(Tt)1||e(Me,wt))throw new V(I,"More than one element or text in fragment");if(gt.length===1&&!Ge(H,ee))throw new V(I,"Element in fragment can not be inserted before doctype")}if(Ye(U)&&!Ge(H,ee))throw new V(I,"Only one element can be added and only after doctype");if(De(U)){let si=function(xi){return De(xi)&&xi!==ee};var gi=si;if(e(Te,si))throw new V(I,"Only one doctype is allowed");var Tt=e(Te,Ye);if(ee&&Te.indexOf(Tt)0&&Q(ee.documentElement,function(Me){if(Me!==ee&&Me.nodeType===g){var gt=Me.getAttribute("class");if(gt){var Tt=H===gt;if(!Tt){var gi=a(gt);Tt=U.every(u(gi))}Tt&&Te.push(Me)}}}),Te})},createElement:function(H){var U=new ze;U.ownerDocument=this,U.nodeName=H,U.tagName=H,U.localName=H,U.childNodes=new Y;var ee=U.attributes=new K;return ee._ownerElement=U,U},createDocumentFragment:function(){var H=new Rt;return H.ownerDocument=this,H.childNodes=new Y,H},createTextNode:function(H){var U=new qe;return U.ownerDocument=this,U.appendData(H),U},createComment:function(H){var U=new ht;return U.ownerDocument=this,U.appendData(H),U},createCDATASection:function(H){var U=new tt;return U.ownerDocument=this,U.appendData(H),U},createProcessingInstruction:function(H,U){var ee=new qt;return ee.ownerDocument=this,ee.tagName=ee.nodeName=ee.target=H,ee.nodeValue=ee.data=U,ee},createAttribute:function(H){var U=new Ue;return U.ownerDocument=this,U.name=H,U.nodeName=H,U.localName=H,U.specified=!0,U},createEntityReference:function(H){var U=new Lt;return U.ownerDocument=this,U.nodeName=H,U},createElementNS:function(H,U){var ee=new ze,Te=U.split(":"),Me=ee.attributes=new K;return ee.childNodes=new Y,ee.ownerDocument=this,ee.nodeName=U,ee.tagName=U,ee.namespaceURI=H,Te.length==2?(ee.prefix=Te[0],ee.localName=Te[1]):ee.localName=U,Me._ownerElement=ee,ee},createAttributeNS:function(H,U){var ee=new Ue,Te=U.split(":");return ee.ownerDocument=this,ee.nodeName=U,ee.name=U,ee.namespaceURI=H,ee.specified=!0,Te.length==2?(ee.prefix=Te[0],ee.localName=Te[1]):ee.localName=U,ee}},d(pe,z);function ze(){this._nsMap={}}ze.prototype={nodeType:g,hasAttribute:function(H){return this.getAttributeNode(H)!=null},getAttribute:function(H){var U=this.getAttributeNode(H);return U&&U.value||""},getAttributeNode:function(H){return this.attributes.getNamedItem(H)},setAttribute:function(H,U){var ee=this.ownerDocument.createAttribute(H);ee.value=ee.nodeValue=""+U,this.setAttributeNode(ee)},removeAttribute:function(H){var U=this.getAttributeNode(H);U&&this.removeAttributeNode(U)},appendChild:function(H){return H.nodeType===F?this.insertBefore(H,null):Re(this,H)},setAttributeNode:function(H){return this.attributes.setNamedItem(H)},setAttributeNodeNS:function(H){return this.attributes.setNamedItemNS(H)},removeAttributeNode:function(H){return this.attributes.removeNamedItem(H.nodeName)},removeAttributeNS:function(H,U){var ee=this.getAttributeNodeNS(H,U);ee&&this.removeAttributeNode(ee)},hasAttributeNS:function(H,U){return this.getAttributeNodeNS(H,U)!=null},getAttributeNS:function(H,U){var ee=this.getAttributeNodeNS(H,U);return ee&&ee.value||""},setAttributeNS:function(H,U,ee){var Te=this.ownerDocument.createAttributeNS(H,U);Te.value=Te.nodeValue=""+ee,this.setAttributeNode(Te)},getAttributeNodeNS:function(H,U){return this.attributes.getNamedItemNS(H,U)},getElementsByTagName:function(H){return new ne(this,function(U){var ee=[];return Q(U,function(Te){Te!==U&&Te.nodeType==g&&(H==="*"||Te.tagName==H)&&ee.push(Te)}),ee})},getElementsByTagNameNS:function(H,U){return new ne(this,function(ee){var Te=[];return Q(ee,function(Me){Me!==ee&&Me.nodeType===g&&(H==="*"||Me.namespaceURI===H)&&(U==="*"||Me.localName==U)&&Te.push(Me)}),Te})}},pe.prototype.getElementsByTagName=ze.prototype.getElementsByTagName,pe.prototype.getElementsByTagNameNS=ze.prototype.getElementsByTagNameNS,d(ze,z);function Ue(){}Ue.prototype.nodeType=y,d(Ue,z);function de(){}de.prototype={data:"",substringData:function(H,U){return this.data.substring(H,H+U)},appendData:function(H){H=this.data+H,this.nodeValue=this.data=H,this.length=H.length},insertData:function(H,U){this.replaceData(H,0,U)},appendChild:function(H){throw new Error(W[I])},deleteData:function(H,U){this.replaceData(H,U,"")},replaceData:function(H,U,ee){var Te=this.data.substring(0,H),Me=this.data.substring(H+U);ee=Te+ee+Me,this.nodeValue=this.data=ee,this.length=ee.length}},d(de,z);function qe(){}qe.prototype={nodeName:"#text",nodeType:v,splitText:function(H){var U=this.data,ee=U.substring(H);U=U.substring(0,H),this.data=this.nodeValue=U,this.length=U.length;var Te=this.ownerDocument.createTextNode(ee);return this.parentNode&&this.parentNode.insertBefore(Te,this.nextSibling),Te}},d(qe,de);function ht(){}ht.prototype={nodeName:"#comment",nodeType:O},d(ht,de);function tt(){}tt.prototype={nodeName:"#cdata-section",nodeType:b},d(tt,de);function At(){}At.prototype.nodeType=j,d(At,z);function ft(){}ft.prototype.nodeType=G,d(ft,z);function Et(){}Et.prototype.nodeType=E,d(Et,z);function Lt(){}Lt.prototype.nodeType=T,d(Lt,z);function Rt(){}Rt.prototype.nodeName="#document-fragment",Rt.prototype.nodeType=F,d(Rt,z);function qt(){}qt.prototype.nodeType=D,d(qt,z);function Wt(){}Wt.prototype.serializeToString=function(H,U,ee){return yi.call(H,U,ee)},z.prototype.toString=yi;function yi(H,U){var ee=[],Te=this.nodeType==9&&this.documentElement||this,Me=Te.prefix,gt=Te.namespaceURI;if(gt&&Me==null){var Me=Te.lookupPrefix(gt);if(Me==null)var Tt=[{namespace:gt,prefix:null}]}return oi(this,ee,H,U,Tt),ee.join("")}function Ct(H,U,ee){var Te=H.prefix||"",Me=H.namespaceURI;if(!Me||Te==="xml"&&Me===t.XML||Me===t.XMLNS)return!1;for(var gt=ee.length;gt--;){var Tt=ee[gt];if(Tt.prefix===Te)return Tt.namespace!==Me}return!0}function It(H,U,ee){H.push(" ",U,'="',ee.replace(/[<>&"\t\n\r]/g,re),'"')}function oi(H,U,ee,Te,Me){if(Me||(Me=[]),Te)if(H=Te(H),H){if(typeof H=="string"){U.push(H);return}}else return;switch(H.nodeType){case g:var gt=H.attributes,Tt=gt.length,ei=H.firstChild,gi=H.tagName;ee=t.isHTML(H.namespaceURI)||ee;var si=gi;if(!ee&&!H.prefix&&H.namespaceURI){for(var xi,Ri=0;Ri=0;hi--){var li=Me[hi];if(li.prefix===""&&li.namespace===H.namespaceURI){xi=li.namespace;break}}if(xi!==H.namespaceURI)for(var hi=Me.length-1;hi>=0;hi--){var li=Me[hi];if(li.namespace===H.namespaceURI){li.prefix&&(si=li.prefix+":"+gi);break}}}U.push("<",si);for(var Kt=0;Kt"),ee&&/^script$/i.test(gi))for(;ei;)ei.data?U.push(ei.data):oi(ei,U,ee,Te,Me.slice()),ei=ei.nextSibling;else for(;ei;)oi(ei,U,ee,Te,Me.slice()),ei=ei.nextSibling;U.push("")}else U.push("/>");return;case R:case F:for(var ei=H.firstChild;ei;)oi(ei,U,ee,Te,Me.slice()),ei=ei.nextSibling;return;case y:return It(U,H.name,H.value);case v:return U.push(H.data.replace(/[<&>]/g,re));case b:return U.push("");case O:return U.push("");case j:var ti=H.publicId,Ui=H.systemId;if(U.push("");else if(Ui&&Ui!=".")U.push(" SYSTEM ",Ui,">");else{var rs=H.internalSubset;rs&&U.push(" [",rs,"]"),U.push(">")}return;case D:return U.push("");case T:return U.push("&",H.nodeName,";");default:U.push("??",H.nodeName)}}function wi(H,U,ee){var Te;switch(U.nodeType){case g:Te=U.cloneNode(!1),Te.ownerDocument=H;case F:break;case y:ee=!0;break}if(Te||(Te=U.cloneNode(!1)),Te.ownerDocument=H,Te.parentNode=null,ee)for(var Me=U.firstChild;Me;)Te.appendChild(wi(H,Me,ee)),Me=Me.nextSibling;return Te}function Di(H,U,ee){var Te=new U.constructor;for(var Me in U)if(Object.prototype.hasOwnProperty.call(U,Me)){var gt=U[Me];typeof gt!="object"&>!=Te[Me]&&(Te[Me]=gt)}switch(U.childNodes&&(Te.childNodes=new Y),Te.ownerDocument=H,Te.nodeType){case g:var Tt=U.attributes,gi=Te.attributes=new K,si=Tt.length;gi._ownerElement=Te;for(var xi=0;xi",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` +`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),s.entityMap=s.HTML_ENTITIES})(iv)),iv}var Am={},N2;function cP(){if(N2)return Am;N2=1;var s=hp().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),n=0,r=1,a=2,u=3,c=4,d=5,f=6,g=7;function y(I,N){this.message=I,this.locator=N,Error.captureStackTrace&&Error.captureStackTrace(this,y)}y.prototype=new Error,y.prototype.name=y.name;function v(){}v.prototype={parse:function(I,N,X){var V=this.domBuilder;V.startDocument(),j(N,N={}),b(I,N,X,V,this.errorHandler),V.endDocument()}};function b(I,N,X,V,Y){function ne(Re){if(Re>65535){Re-=65536;var ze=55296+(Re>>10),Ue=56320+(Re&1023);return String.fromCharCode(ze,Ue)}else return String.fromCharCode(Re)}function ie(Re){var ze=Re.slice(1,-1);return Object.hasOwnProperty.call(X,ze)?X[ze]:ze.charAt(0)==="#"?ne(parseInt(ze.substr(1).replace("x","0x"))):(Y.error("entity not found:"+Re),Re)}function K(Re){if(Re>pe){var ze=I.substring(pe,Re).replace(/&#?\w+;/g,ie);z&&q(pe),V.characters(ze,0,Re-pe),pe=Re}}function q(Re,ze){for(;Re>=te&&(ze=le.exec(I));)Z=ze.index,te=Z+ze[0].length,z.lineNumber++;z.columnNumber=Re-Z+1}for(var Z=0,te=0,le=/.*(?:\r\n?|\n)|.*$/g,z=V.locator,re=[{currentNSMap:N}],Q={},pe=0;;){try{var be=I.indexOf("<",pe);if(be<0){if(!I.substr(pe).match(/^\s*$/)){var ve=V.doc,we=ve.createTextNode(I.substr(pe));ve.appendChild(we),V.currentElement=we}return}switch(be>pe&&K(be),I.charAt(be+1)){case"/":var ke=I.indexOf(">",be+3),He=I.substring(be+2,ke).replace(/[ \t\n\r]+$/g,""),Fe=re.pop();ke<0?(He=I.substring(be+2).replace(/[\s<].*/,""),Y.error("end tag name: "+He+" is not complete:"+Fe.tagName),ke=be+1+He.length):He.match(/\spe?pe=ke:K(Math.max(be,pe)+1)}}function T(I,N){return N.lineNumber=I.lineNumber,N.columnNumber=I.columnNumber,N}function E(I,N,X,V,Y,ne){function ie(z,re,Q){X.attributeNames.hasOwnProperty(z)&&ne.fatalError("Attribute "+z+" redefined"),X.addValue(z,re.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,Y),Q)}for(var K,q,Z=++N,te=n;;){var le=I.charAt(Z);switch(le){case"=":if(te===r)K=I.slice(N,Z),te=u;else if(te===a)te=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(te===u||te===r)if(te===r&&(ne.warning('attribute value must after "="'),K=I.slice(N,Z)),N=Z+1,Z=I.indexOf(le,N),Z>0)q=I.slice(N,Z),ie(K,q,N-1),te=d;else throw new Error("attribute value no end '"+le+"' match");else if(te==c)q=I.slice(N,Z),ie(K,q,N),ne.warning('attribute "'+K+'" missed start quot('+le+")!!"),N=Z+1,te=d;else throw new Error('attribute value must after "="');break;case"/":switch(te){case n:X.setTagName(I.slice(N,Z));case d:case f:case g:te=g,X.closed=!0;case c:case r:break;case a:X.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ne.error("unexpected end of input"),te==n&&X.setTagName(I.slice(N,Z)),Z;case">":switch(te){case n:X.setTagName(I.slice(N,Z));case d:case f:case g:break;case c:case r:q=I.slice(N,Z),q.slice(-1)==="/"&&(X.closed=!0,q=q.slice(0,-1));case a:te===a&&(q=K),te==c?(ne.warning('attribute "'+q+'" missed quot(")!'),ie(K,q,N)):((!s.isHTML(V[""])||!q.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+q+'" missed value!! "'+q+'" instead!!'),ie(q,q,N));break;case u:throw new Error("attribute value missed!!")}return Z;case"€":le=" ";default:if(le<=" ")switch(te){case n:X.setTagName(I.slice(N,Z)),te=f;break;case r:K=I.slice(N,Z),te=a;break;case c:var q=I.slice(N,Z);ne.warning('attribute "'+q+'" missed quot(")!!'),ie(K,q,N);case d:te=f;break}else switch(te){case a:X.tagName,(!s.isHTML(V[""])||!K.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+K+'" missed value!! "'+K+'" instead2!!'),ie(K,K,N),N=Z,te=r;break;case d:ne.warning('attribute space is required"'+K+'"!!');case f:te=r,N=Z;break;case u:te=c,N=Z;break;case g:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function D(I,N,X){for(var V=I.tagName,Y=null,le=I.length;le--;){var ne=I[le],ie=ne.qName,K=ne.value,z=ie.indexOf(":");if(z>0)var q=ne.prefix=ie.slice(0,z),Z=ie.slice(z+1),te=q==="xmlns"&&Z;else Z=ie,q=null,te=ie==="xmlns"&&"";ne.localName=Z,te!==!1&&(Y==null&&(Y={},j(X,X={})),X[te]=Y[te]=K,ne.uri=s.XMLNS,N.startPrefixMapping(te,K))}for(var le=I.length;le--;){ne=I[le];var q=ne.prefix;q&&(q==="xml"&&(ne.uri=s.XML),q!=="xmlns"&&(ne.uri=X[q||""]))}var z=V.indexOf(":");z>0?(q=I.prefix=V.slice(0,z),Z=I.localName=V.slice(z+1)):(q=null,Z=I.localName=V);var re=I.uri=X[q||""];if(N.startElement(re,Z,V,I),I.closed){if(N.endElement(re,Z,V),Y)for(q in Y)Object.prototype.hasOwnProperty.call(Y,q)&&N.endPrefixMapping(q)}else return I.currentNSMap=X,I.localNSMap=Y,!0}function O(I,N,X,V,Y){if(/^(?:script|textarea)$/i.test(X)){var ne=I.indexOf("",N),ie=I.substring(N+1,ne);if(/[&<]/.test(ie))return/^script$/i.test(X)?(Y.characters(ie,0,ie.length),ne):(ie=ie.replace(/&#?\w+;/g,V),Y.characters(ie,0,ie.length),ne)}return N+1}function R(I,N,X,V){var Y=V[X];return Y==null&&(Y=I.lastIndexOf(""),Y",N+4);return ne>N?(X.comment(I,N+4,ne-N-4),ne+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(I.substr(N+3,6)=="CDATA["){var ne=I.indexOf("]]>",N+9);return X.startCDATA(),X.characters(I,N+9,ne-N-9),X.endCDATA(),ne+3}var ie=W(I,N),K=ie.length;if(K>1&&/!doctype/i.test(ie[0][0])){var q=ie[1][0],Z=!1,te=!1;K>3&&(/^public$/i.test(ie[2][0])?(Z=ie[3][0],te=K>4&&ie[4][0]):/^system$/i.test(ie[2][0])&&(te=ie[3][0]));var le=ie[K-1];return X.startDTD(q,Z,te),X.endDTD(),le.index+le[0].length}}return-1}function G(I,N,X){var V=I.indexOf("?>",N);if(V){var Y=I.substring(N,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return Y?(Y[0].length,X.processingInstruction(Y[1],Y[2]),V+2):-1}return-1}function L(){this.attributeNames={}}L.prototype={setTagName:function(I){if(!i.test(I))throw new Error("invalid tagName:"+I);this.tagName=I},addValue:function(I,N,X){if(!i.test(I))throw new Error("invalid attribute:"+I);this.attributeNames[I]=this.length,this[this.length++]={qName:I,value:N,offset:X}},length:0,getLocalName:function(I){return this[I].localName},getLocator:function(I){return this[I].locator},getQName:function(I){return this[I].qName},getURI:function(I){return this[I].uri},getValue:function(I){return this[I].value}};function W(I,N){var X,V=[],Y=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(Y.lastIndex=N,Y.exec(I);X=Y.exec(I);)if(V.push(X),X[1])return V}return Am.XMLReader=v,Am.ParseError=y,Am}var O2;function dP(){if(O2)return eh;O2=1;var s=hp(),e=fk(),t=uP(),i=cP(),n=e.DOMImplementation,r=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function c(E){return E.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` -`)}function d(E){this.options=E||{locator:{}}}d.prototype.parseFromString=function(E,D){var O=this.options,R=new u,j=O.domBuilder||new p,F=O.errorHandler,z=O.locator,N=O.xmlns||{},Y=/\/x?html?$/.test(D),L=Y?t.HTML_ENTITIES:t.XML_ENTITIES;z&&j.setDocumentLocator(z),R.errorHandler=f(F,j,z),R.domBuilder=O.domBuilder||j,Y&&(N[""]=r.HTML),N.xml=N.xml||r.XML;var I=O.normalizeLineEndings||c;return E&&typeof E=="string"?R.parse(I(E),N,L):R.errorHandler.error("invalid doc source"),j.doc};function f(E,D,O){if(!E){if(D instanceof p)return D;E=D}var R={},j=E instanceof Function;O=O||{};function F(z){var N=E[z];!N&&j&&(N=E.length==2?function(Y){E(z,Y)}:E),R[z]=N&&function(Y){N("[xmldom "+z+"] "+Y+v(O))}||function(){}}return F("warning"),F("error"),F("fatalError"),R}function p(){this.cdata=!1}function y(E,D){D.lineNumber=E.lineNumber,D.columnNumber=E.columnNumber}p.prototype={startDocument:function(){this.doc=new n().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(E,D,O,R){var j=this.doc,F=j.createElementNS(E,O||D),z=R.length;T(this,F),this.currentElement=F,this.locator&&y(this.locator,F);for(var N=0;N=D+O||D?new java.lang.String(E,D,O)+"":E}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(E){p.prototype[E]=function(){return null}});function T(E,D){E.currentElement?E.currentElement.appendChild(D):E.doc.appendChild(D)}return Jd.__DOMHandler=p,Jd.normalizeLineEndings=c,Jd.DOMParser=d,Jd}var C2;function Q3(){if(C2)return Zd;C2=1;var s=nk();return Zd.DOMImplementation=s.DOMImplementation,Zd.XMLSerializer=s.XMLSerializer,Zd.DOMParser=X3().DOMParser,Zd}var Z3=Q3();const D2=s=>!!s&&typeof s=="object",An=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):D2(e[i])&&D2(t[i])?e[i]=An(e[i],t[i]):e[i]=t[i]}),e),{}),rk=s=>Object.keys(s).map(e=>s[e]),J3=(s,e)=>{const t=[];for(let i=s;is.reduce((e,t)=>e.concat(t),[]),ak=s=>{if(!s.length)return[];const e=[];for(let t=0;ts.reduce((t,i,n)=>(i[e]&&t.push(n),t),[]),tP=(s,e)=>rk(s.reduce((t,i)=>(i.forEach(n=>{t[e(n)]=n}),t),{}));var Mc={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const Ih=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const n={uri:e,resolvedUri:op(s||"",e)};if(t||i){const a=(t||i).split("-");let u=de.BigInt?de.BigInt(a[0]):parseInt(a[0],10),c=de.BigInt?de.BigInt(a[1]):parseInt(a[1],10);u{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=de.BigInt(s.offset)+de.BigInt(s.length)-de.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},L2=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),sP={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:n}=s,r=L2(s.endNumber),a=e/t;return typeof r=="number"?{start:0,end:r}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:i/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:n=1,duration:r,periodStart:a=0,minimumUpdatePeriod:u=0,timeShiftBufferDepth:c=1/0}=s,d=L2(s.endNumber),f=(e+t)/1e3,p=i+a,v=f+u-p,b=Math.ceil(v*n/r),T=Math.floor((f-p-c)*n/r),E=Math.floor((f-p)*n/r);return{start:Math.max(0,T),end:typeof d=="number"?d:Math.min(b,E)}}},nP=s=>e=>{const{duration:t,timescale:i=1,periodStart:n,startNumber:r=1}=s;return{number:r+e,duration:t/i,timeline:n,time:e*t}},fb=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:n,sourceDuration:r}=s,{start:a,end:u}=sP[e](s),c=J3(a,u).map(nP(s));if(e==="static"){const d=c.length-1,f=typeof n=="number"?n:r;c[d].duration=f-t/i*d}return c},ok=s=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:n="",periodStart:r,presentationTime:a,number:u=0,duration:c}=s;if(!e)throw new Error(Mc.NO_BASE_URL);const d=Ih({baseUrl:e,source:t.sourceURL,range:t.range}),f=Ih({baseUrl:e,source:e,indexRange:n});if(f.map=d,c){const p=fb(s);p.length&&(f.duration=p[0].duration,f.timeline=p[0].timeline)}else i&&(f.duration=i,f.timeline=r);return f.presentationTime=a||r,f.number=u,[f]},mb=(s,e,t)=>{const i=s.sidx.map?s.sidx.map:null,n=s.sidx.duration,r=s.timeline||0,a=s.sidx.byterange,u=a.offset+a.length,c=e.timescale,d=e.references.filter(E=>E.referenceType!==1),f=[],p=s.endList?"static":"dynamic",y=s.sidx.timeline;let v=y,b=s.mediaSequence||0,T;typeof e.firstOffset=="bigint"?T=de.BigInt(u)+e.firstOffset:T=u+e.firstOffset;for(let E=0;EtP(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),oP=(s,e)=>{for(let t=0;t{let e=[];return K3(s,rP,(t,i,n,r)=>{e=e.concat(t.playlists||[])}),e},I2=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},lP=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:c}){return c===i.timeline});const n=oP(s,i.attributes.NAME);if(!n||i.sidx)return;const r=i.segments[0],a=n.segments.findIndex(function(c){return Math.abs(c.presentationTime-r.presentationTime)n.timeline||n.segments.length&&i.timeline>n.segments[n.segments.length-1].timeline)&&i.discontinuitySequence--;return}n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),I2({playlist:i,mediaSequence:n.segments[a].number})})},uP=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(R2(s)),i=e.playlists.concat(R2(e));return e.timelineStarts=lk([s.timelineStarts,e.timelineStarts]),lP({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},up=s=>s&&s.uri+"-"+iP(s.byterange),Jy=s=>{const e=s.reduce(function(i,n){return i[n.attributes.baseUrl]||(i[n.attributes.baseUrl]=[]),i[n.attributes.baseUrl].push(n),i},{});let t=[];return Object.values(e).forEach(i=>{const n=rk(i.reduce((r,a)=>{const u=a.attributes.id+(a.attributes.lang||"");return r[u]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),r[u].segments.push(...a.segments)),a.attributes.contentProtection&&(r[u].attributes.contentProtection=a.attributes.contentProtection)):(r[u]=a,r[u].attributes.timelineStarts=[]),r[u].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),r},{}));t=t.concat(n)}),t.map(i=>(i.discontinuityStarts=eP(i.segments||[],"discontinuity"),i))},pb=(s,e)=>{const t=up(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&mb(s,i,s.sidx.resolvedUri),s},cP=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=pb(s[t],e);return s},dP=({attributes:s,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:n,discontinuityStarts:r},a)=>{const u={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:n,discontinuityStarts:r,timelineStarts:s.timelineStarts,mediaSequence:i,segments:e};return s.contentProtection&&(u.contentProtection=s.contentProtection),s.serviceLocation&&(u.attributes.serviceLocation=s.serviceLocation),t&&(u.sidx=t),a&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u},hP=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const r={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(r.CODECS=s.codecs);const a={attributes:r,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:i,discontinuitySequence:n,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},fP=(s,e={},t=!1)=>{let i;const n=s.reduce((r,a)=>{const u=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let d=a.attributes.label||"main";if(c&&!a.attributes.label){const p=u?` (${u})`:"";d=`${a.attributes.lang}${p}`}r[d]||(r[d]={language:c,autoselect:!0,default:u==="main",playlists:[],uri:""});const f=pb(dP(a,t),e);return r[d].playlists.push(f),typeof i>"u"&&u==="main"&&(i=a,i.default=!0),r},{});if(!i){const r=Object.keys(n)[0];n[r].default=!0}return n},mP=(s,e={})=>s.reduce((t,i)=>{const n=i.attributes.label||i.attributes.lang||"text",r=i.attributes.lang||"und";return t[n]||(t[n]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(pb(hP(i),e)),t},{}),pP=s=>s.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:n,language:r}=i;e[r]={autoselect:!1,default:!1,instreamId:n,language:r},i.hasOwnProperty("aspectRatio")&&(e[r].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[r].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[r]["3D"]=i["3D"])}),e),{}),gP=({attributes:s,segments:e,sidx:t,discontinuityStarts:i})=>{const n={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:i,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(n.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(n.contentProtection=s.contentProtection),s.serviceLocation&&(n.attributes.serviceLocation=s.serviceLocation),t&&(n.sidx=t),n},yP=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",vP=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",xP=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",bP=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,n)=>{i.number=n})})},N2=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],TP=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:n,eventStream:r})=>{if(!s.length)return{};const{sourceDuration:a,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:d}=s[0].attributes,f=Jy(s.filter(yP)).map(gP),p=Jy(s.filter(vP)),y=Jy(s.filter(xP)),v=s.map(j=>j.attributes.captionServices).filter(Boolean),b={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:cP(f,i)};d>=0&&(b.minimumUpdatePeriod=d*1e3),e&&(b.locations=e),t&&(b.contentSteering=t),u==="dynamic"&&(b.suggestedPresentationDelay=c),r&&r.length>0&&(b.eventStream=r);const T=b.playlists.length===0,E=p.length?fP(p,i,T):null,D=y.length?mP(y,i):null,O=f.concat(N2(E),N2(D)),R=O.map(({timelineStarts:j})=>j);return b.timelineStarts=lk(R),bP(O,b.timelineStarts),E&&(b.mediaGroups.AUDIO.audio=E),D&&(b.mediaGroups.SUBTITLES.subs=D),v.length&&(b.mediaGroups["CLOSED-CAPTIONS"].cc=pP(v)),n?uP({oldManifest:n,newManifest:b}):b},SP=(s,e,t)=>{const{NOW:i,clientOffset:n,availabilityStartTime:r,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:c=0}=s,d=(i+n)/1e3,f=r+u,y=d+c-f;return Math.ceil((y*a-e)/t)},uk=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:n="",sourceDuration:r,timescale:a=1,startNumber:u=1,periodStart:c}=s,d=[];let f=-1;for(let p=0;pf&&(f=T);let E;if(b<0){const R=p+1;R===e.length?t==="dynamic"&&i>0&&n.indexOf("$Number$")>0?E=SP(s,f,v):E=(r*a-f)/v:E=(e[R].t-f)/v}else E=b+1;const D=u+d.length+E;let O=u+d.length;for(;O(e,t,i,n)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const r=""+s[t];return t==="RepresentationID"||(i?n=parseInt(n,10):n=1,r.length>=n)?r:`${new Array(n-r.length+1).join("0")}${r}`},O2=(s,e)=>s.replace(_P,EP(e)),wP=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?fb(s):uk(s,e),AP=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,n=Ih({baseUrl:s.baseUrl,source:O2(i.sourceURL,t),range:i.range});return wP(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=O2(s.media||"",t),c=s.timescale||1,d=s.presentationTimeOffset||0,f=s.periodStart+(a.time-d)/c;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:op(s.baseUrl||"",u),map:n,number:a.number,presentationTime:f}})},kP=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,n=Ih({baseUrl:t,source:i.sourceURL,range:i.range}),r=Ih({baseUrl:t,source:e.media,range:e.mediaRange});return r.map=n,r},CP=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=s;if(!t&&!e||t&&e)throw new Error(Mc.SEGMENT_TIME_UNSPECIFIED);const r=i.map(c=>kP(s,c));let a;return t&&(a=fb(s)),e&&(a=uk(s,e)),a.map((c,d)=>{if(r[d]){const f=r[d],p=s.timescale||1,y=s.presentationTimeOffset||0;return f.timeline=c.timeline,f.duration=c.duration,f.number=c.number,f.presentationTime=n+(c.time-y)/p,f}}).filter(c=>c)},DP=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=AP,t=An(s,e.template)):e.base?(i=ok,t=An(s,e.base)):e.list&&(i=CP,t=An(s,e.list));const n={attributes:s};if(!i)return n;const r=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:u=1}=t;t.duration=a/u}else r.length?t.duration=r.reduce((a,u)=>Math.max(a,Math.ceil(u.duration)),0):t.duration=0;return n.attributes=t,n.segments=r,e.base&&t.indexRange&&(n.sidx=r[0],n.segments=[]),n},LP=s=>s.map(DP),Ms=(s,e)=>ak(s.childNodes).filter(({tagName:t})=>t===e),Wh=s=>s.textContent.trim(),RP=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Ju=s=>{const u=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!u)return 0;const[c,d,f,p,y,v]=u.slice(1);return parseFloat(c||0)*31536e3+parseFloat(d||0)*2592e3+parseFloat(f||0)*86400+parseFloat(p||0)*3600+parseFloat(y||0)*60+parseFloat(v||0)},IP=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),M2={mediaPresentationDuration(s){return Ju(s)},availabilityStartTime(s){return IP(s)/1e3},minimumUpdatePeriod(s){return Ju(s)},suggestedPresentationDelay(s){return Ju(s)},type(s){return s},timeShiftBufferDepth(s){return Ju(s)},start(s){return Ju(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return RP(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Ju(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},dn=s=>s&&s.attributes?ak(s.attributes).reduce((e,t)=>{const i=M2[t.name]||M2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},NP={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},cp=(s,e)=>e.length?Oc(s.map(function(t){return e.map(function(i){const n=Wh(i),r=op(t.baseUrl,n),a=An(dn(i),{baseUrl:r});return r!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,gb=s=>{const e=Ms(s,"SegmentTemplate")[0],t=Ms(s,"SegmentList")[0],i=t&&Ms(t,"SegmentURL").map(p=>An({tag:"SegmentURL"},dn(p))),n=Ms(s,"SegmentBase")[0],r=t||e,a=r&&Ms(r,"SegmentTimeline")[0],u=t||n||e,c=u&&Ms(u,"Initialization")[0],d=e&&dn(e);d&&c?d.initialization=c&&dn(c):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});const f={template:d,segmentTimeline:a&&Ms(a,"S").map(p=>dn(p)),list:t&&An(dn(t),{segmentUrls:i,initialization:dn(c)}),base:n&&An(dn(n),{initialization:dn(c)})};return Object.keys(f).forEach(p=>{f[p]||delete f[p]}),f},OP=(s,e,t)=>i=>{const n=Ms(i,"BaseURL"),r=cp(e,n),a=An(s,dn(i)),u=gb(i);return r.map(c=>({segmentInfo:An(t,u),attributes:An(a,c)}))},MP=s=>s.reduce((e,t)=>{const i=dn(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const n=NP[i.schemeIdUri];if(n){e[n]={attributes:i};const r=Ms(t,"cenc:pssh")[0];if(r){const a=Wh(r);e[n].pssh=a&&ZA(a)}}return e},{}),PP=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{let i,n;return n=t,/^CC\d=/.test(t)?[i,n]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[n,r=""]=t.split("=");i.channel=n,i.language=t,r.split(",").forEach(a=>{const[u,c]=a.split(":");u==="lang"?i.language=c:u==="er"?i.easyReader=Number(c):u==="war"?i.aspectRatio=Number(c):u==="3D"&&(i["3D"]=Number(c))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},BP=s=>Oc(Ms(s.node,"EventStream").map(e=>{const t=dn(e),i=t.schemeIdUri;return Ms(e,"Event").map(n=>{const r=dn(n),a=r.presentationTime||0,u=t.timescale||1,c=r.duration||0,d=a/u+s.attributes.start;return{schemeIdUri:i,value:t.value,id:r.id,start:d,end:d+c/u,messageData:Wh(n)||r.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),FP=(s,e,t)=>i=>{const n=dn(i),r=cp(e,Ms(i,"BaseURL")),a=Ms(i,"Role")[0],u={role:dn(a)};let c=An(s,n,u);const d=Ms(i,"Accessibility")[0],f=PP(dn(d));f&&(c=An(c,{captionServices:f}));const p=Ms(i,"Label")[0];if(p&&p.childNodes.length){const E=p.childNodes[0].nodeValue.trim();c=An(c,{label:E})}const y=MP(Ms(i,"ContentProtection"));Object.keys(y).length&&(c=An(c,{contentProtection:y}));const v=gb(i),b=Ms(i,"Representation"),T=An(t,v);return Oc(b.map(OP(c,r,T)))},UP=(s,e)=>(t,i)=>{const n=cp(e,Ms(t.node,"BaseURL")),r=An(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(r.periodDuration=t.attributes.duration);const a=Ms(t.node,"AdaptationSet"),u=gb(t.node);return Oc(a.map(FP(r,n,u)))},jP=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const t=An({serverURL:Wh(s[0])},dn(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},$P=({attributes:s,priorPeriodAttributes:e,mpdType:t})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,HP=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:n=0,eventHandler:r=function(){}}=e,a=Ms(s,"Period");if(!a.length)throw new Error(Mc.INVALID_NUMBER_OF_PERIOD);const u=Ms(s,"Location"),c=dn(s),d=cp([{baseUrl:t}],Ms(s,"BaseURL")),f=Ms(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=i,c.clientOffset=n,u.length&&(c.locations=u.map(Wh));const p=[];return a.forEach((y,v)=>{const b=dn(y),T=p[v-1];b.start=$P({attributes:b,priorPeriodAttributes:T?T.attributes:null,mpdType:c.type}),p.push({node:y,attributes:b})}),{locations:c.locations,contentSteeringInfo:jP(f,r),representationInfo:Oc(p.map(UP(c,d))),eventStream:Oc(p.map(BP))}},ck=s=>{if(s==="")throw new Error(Mc.DASH_EMPTY_MANIFEST);const e=new Z3.DOMParser;let t,i;try{t=e.parseFromString(s,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Mc.DASH_INVALID_XML);return i},zP=s=>{const e=Ms(s,"UTCTiming")[0];if(!e)return null;const t=dn(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Mc.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},VP=(s,e={})=>{const t=HP(ck(s),e),i=LP(t.representationInfo);return TP({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},GP=s=>zP(ck(s));var ev,P2;function qP(){if(P2)return ev;P2=1;var s=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),n;return i.getBigUint64?(n=i.getBigUint64(0),n0;r+=12,a--)n.references.push({referenceType:(t[r]&128)>>>7,referencedSize:i.getUint32(r)&2147483647,subsegmentDuration:i.getUint32(r+4),startsWithSap:!!(t[r+8]&128),sapType:(t[r+8]&112)>>>4,sapDeltaTime:i.getUint32(r+8)&268435455});return n};return tv=e,tv}var WP=KP();const YP=Vc(WP);var XP=ii([73,68,51]),QP=function(e,t){t===void 0&&(t=0),e=ii(e);var i=e[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(i&16)>>4;return r?n+20:n+10},dh=function s(e,t){return t===void 0&&(t=0),e=ii(e),e.length-t<10||!Os(e,XP,{offset:t})?t:(t+=QP(e,t),s(e,t))},F2=function(e){return typeof e=="string"?sk(e):e},ZP=function(e){return Array.isArray(e)?e.map(function(t){return F2(t)}):[F2(e)]},JP=function s(e,t,i){i===void 0&&(i=!1),t=ZP(t),e=ii(e);var n=[];if(!t.length)return n;for(var r=0;r>>0,u=e.subarray(r+4,r+8);if(a===0)break;var c=r+a;if(c>e.length){if(i)break;c=e.length}var d=e.subarray(r+8,c);Os(u,t[0])&&(t.length===1?n.push(d):n.push.apply(n,s(d,t.slice(1),i))),r=c}return n},Em={EBML:ii([26,69,223,163]),DocType:ii([66,130]),Segment:ii([24,83,128,103]),SegmentInfo:ii([21,73,169,102]),Tracks:ii([22,84,174,107]),Track:ii([174]),TrackNumber:ii([215]),DefaultDuration:ii([35,227,131]),TrackEntry:ii([174]),TrackType:ii([131]),FlagDefault:ii([136]),CodecID:ii([134]),CodecPrivate:ii([99,162]),VideoTrack:ii([224]),AudioTrack:ii([225]),Cluster:ii([31,67,182,117]),Timestamp:ii([231]),TimestampScale:ii([42,215,177]),BlockGroup:ii([160]),BlockDuration:ii([155]),Block:ii([161]),SimpleBlock:ii([163])},cx=[128,64,32,16,8,4,2,1],e4=function(e){for(var t=1,i=0;i=t.length)return t.length;var n=y0(t,i,!1);if(Os(e.bytes,n.bytes))return i;var r=y0(t,i+n.length);return s(e,t,i+r.length+r.value+n.length)},j2=function s(e,t){t=t4(t),e=ii(e);var i=[];if(!t.length)return i;for(var n=0;ne.length?e.length:u+a.value,d=e.subarray(u,c);Os(t[0],r.bytes)&&(t.length===1?i.push(d):i=i.concat(s(d,t.slice(1))));var f=r.length+a.length+d.length;n+=f}return i},s4=ii([0,0,0,1]),n4=ii([0,0,1]),r4=ii([0,0,3]),a4=function(e){for(var t=[],i=1;i>1&63),i.indexOf(d)!==-1&&(a=r+c),r+=c+(t==="h264"?1:2)}return e.subarray(0,0)},o4=function(e,t,i){return dk(e,"h264",t,i)},l4=function(e,t,i){return dk(e,"h265",t,i)},Wn={webm:ii([119,101,98,109]),matroska:ii([109,97,116,114,111,115,107,97]),flac:ii([102,76,97,67]),ogg:ii([79,103,103,83]),ac3:ii([11,119]),riff:ii([82,73,70,70]),avi:ii([65,86,73]),wav:ii([87,65,86,69]),"3gp":ii([102,116,121,112,51,103]),mp4:ii([102,116,121,112]),fmp4:ii([115,116,121,112]),mov:ii([102,116,121,112,113,116]),moov:ii([109,111,111,118]),moof:ii([109,111,111,102])},Pc={aac:function(e){var t=dh(e);return Os(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=dh(e);return Os(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=j2(e,[Em.EBML,Em.DocType])[0];return Os(t,Wn.webm)},mkv:function(e){var t=j2(e,[Em.EBML,Em.DocType])[0];return Os(t,Wn.matroska)},mp4:function(e){if(Pc["3gp"](e)||Pc.mov(e))return!1;if(Os(e,Wn.mp4,{offset:4})||Os(e,Wn.fmp4,{offset:4})||Os(e,Wn.moof,{offset:4})||Os(e,Wn.moov,{offset:4}))return!0},mov:function(e){return Os(e,Wn.mov,{offset:4})},"3gp":function(e){return Os(e,Wn["3gp"],{offset:4})},ac3:function(e){var t=dh(e);return Os(e,Wn.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},iv,$2;function d4(){if($2)return iv;$2=1;var s=9e4,e,t,i,n,r,a,u;return e=function(c){return c*s},t=function(c,d){return c*d},i=function(c){return c/s},n=function(c,d){return c/d},r=function(c,d){return e(n(c,d))},a=function(c,d){return t(i(c),d)},u=function(c,d,f){return i(f?c:c-d)},iv={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:n,audioTsToVideoTs:r,videoTsToAudioTs:a,metadataTsToSeconds:u},iv}var cu=d4();var hx="8.23.4";const To={},wl=function(s,e){return To[s]=To[s]||[],e&&(To[s]=To[s].concat(e)),To[s]},h4=function(s,e){wl(s,e)},hk=function(s,e){const t=wl(s).indexOf(e);return t<=-1?!1:(To[s]=To[s].slice(),To[s].splice(t,1),!0)},f4=function(s,e){wl(s,[].concat(e).map(t=>{const i=(...n)=>(hk(s,i),t(...n));return i}))},v0={prefixed:!0},Ym=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H2=Ym[0];let hh;for(let s=0;s(i,n,r)=>{const a=e.levels[n],u=new RegExp(`^(${a})$`);let c=s;if(i!=="log"&&r.unshift(i.toUpperCase()+":"),t&&(c=`%c${s}`,r.unshift(t)),r.unshift(c+":"),hr){hr.push([].concat(r));const f=hr.length-1e3;hr.splice(0,f>0?f:0)}if(!de.console)return;let d=de.console[i];!d&&i==="debug"&&(d=de.console.info||de.console.log),!(!d||!a||!u.test(i))&&d[Array.isArray(r)?"apply":"call"](de.console,r)};function fx(s,e=":",t=""){let i="info",n;function r(...a){n("log",i,a)}return n=m4(s,r,t),r.createLogger=(a,u,c)=>{const d=u!==void 0?u:e,f=c!==void 0?c:t,p=`${s} ${d} ${a}`;return fx(p,d,f)},r.createNewLogger=(a,u,c)=>fx(a,u,c),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},r.level=a=>{if(typeof a=="string"){if(!r.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},r.history=()=>hr?[].concat(hr):[],r.history.filter=a=>(hr||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),r.history.clear=()=>{hr&&(hr.length=0)},r.history.disable=()=>{hr!==null&&(hr.length=0,hr=null)},r.history.enable=()=>{hr===null&&(hr=[])},r.error=(...a)=>n("error",i,a),r.warn=(...a)=>n("warn",i,a),r.debug=(...a)=>n("debug",i,a),r}const Oi=fx("VIDEOJS"),fk=Oi.createLogger,p4=Object.prototype.toString,mk=function(s){return Ha(s)?Object.keys(s):[]};function yc(s,e){mk(s).forEach(t=>e(s[t],t))}function pk(s,e,t=0){return mk(s).reduce((i,n)=>e(i,s[n],n),t)}function Ha(s){return!!s&&typeof s=="object"}function Bc(s){return Ha(s)&&p4.call(s)==="[object Object]"&&s.constructor===Object}function ps(...s){const e={};return s.forEach(t=>{t&&yc(t,(i,n)=>{if(!Bc(i)){e[n]=i;return}Bc(e[n])||(e[n]={}),e[n]=ps(e[n],i)})}),e}function gk(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function dp(s,e,t,i=!0){const n=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return i&&(r.set=n),Object.defineProperty(s,e,r)}var g4=Object.freeze({__proto__:null,each:yc,reduce:pk,isObject:Ha,isPlain:Bc,merge:ps,values:gk,defineLazyProperty:dp});let vb=!1,yk=null,ha=!1,vk,xk=!1,vc=!1,xc=!1,za=!1,xb=null,hp=null;const y4=!!(de.cast&&de.cast.framework&&de.cast.framework.CastReceiverContext);let bk=null,x0=!1,fp=!1,b0=!1,mp=!1,T0=!1,S0=!1,_0=!1;const Nh=!!(Gc()&&("ontouchstart"in de||de.navigator.maxTouchPoints||de.DocumentTouch&&de.document instanceof de.DocumentTouch)),cl=de.navigator&&de.navigator.userAgentData;cl&&cl.platform&&cl.brands&&(ha=cl.platform==="Android",vc=!!cl.brands.find(s=>s.brand==="Microsoft Edge"),xc=!!cl.brands.find(s=>s.brand==="Chromium"),za=!vc&&xc,xb=hp=(cl.brands.find(s=>s.brand==="Chromium")||{}).version||null,fp=cl.platform==="Windows");if(!xc){const s=de.navigator&&de.navigator.userAgent||"";vb=/iPod/i.test(s),yk=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),ha=/Android/i.test(s),vk=(function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),xk=/Firefox/i.test(s),vc=/Edg/i.test(s),xc=/Chrome/i.test(s)||/CriOS/i.test(s),za=!vc&&xc,xb=hp=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),bk=(function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t})(),T0=/Tizen/i.test(s),S0=/Web0S/i.test(s),_0=T0||S0,x0=/Safari/i.test(s)&&!za&&!ha&&!vc&&!_0,fp=/Windows/i.test(s),b0=/iPad/i.test(s)||x0&&Nh&&!/iPhone/i.test(s),mp=/iPhone/i.test(s)&&!b0}const jn=mp||b0||vb,pp=(x0||jn)&&!za;var Tk=Object.freeze({__proto__:null,get IS_IPOD(){return vb},get IOS_VERSION(){return yk},get IS_ANDROID(){return ha},get ANDROID_VERSION(){return vk},get IS_FIREFOX(){return xk},get IS_EDGE(){return vc},get IS_CHROMIUM(){return xc},get IS_CHROME(){return za},get CHROMIUM_VERSION(){return xb},get CHROME_VERSION(){return hp},IS_CHROMECAST_RECEIVER:y4,get IE_VERSION(){return bk},get IS_SAFARI(){return x0},get IS_WINDOWS(){return fp},get IS_IPAD(){return b0},get IS_IPHONE(){return mp},get IS_TIZEN(){return T0},get IS_WEBOS(){return S0},get IS_SMART_TV(){return _0},TOUCH_ENABLED:Nh,IS_IOS:jn,IS_ANY_SAFARI:pp});function z2(s){return typeof s=="string"&&!!s.trim()}function v4(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Gc(){return yt===de.document}function qc(s){return Ha(s)&&s.nodeType===1}function Sk(){try{return de.parent!==de.self}catch{return!0}}function _k(s){return function(e,t){if(!z2(e))return yt[s](null);z2(t)&&(t=yt.querySelector(t));const i=qc(t)?t:yt;return i[s]&&i[s](e)}}function li(s="div",e={},t={},i){const n=yt.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(r){const a=e[r];r==="textContent"?Dl(n,a):(n[r]!==a||r==="tabIndex")&&(n[r]=a)}),Object.getOwnPropertyNames(t).forEach(function(r){n.setAttribute(r,t[r])}),i&&bb(n,i),n}function Dl(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function mx(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function _h(s,e){return v4(e),s.classList.contains(e)}function fu(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function gp(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(Oi.warn("removeClass was called with an element that doesn't exist"),null)}function Ek(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function wk(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function gl(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;let a=i[n].value;t.includes(r)&&(a=a!==null),e[r]=a}}return e}function Ak(s,e){return s.getAttribute(e)}function Fc(s,e,t){s.setAttribute(e,t)}function yp(s,e){s.removeAttribute(e)}function kk(){yt.body.focus(),yt.onselectstart=function(){return!1}}function Ck(){yt.onselectstart=function(){return!0}}function Uc(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(jc(s,"height"))),t.width||(t.width=parseFloat(jc(s,"width"))),t}}function Oh(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,n=0;for(;s.offsetParent&&s!==yt[v0.fullscreenElement];)i+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent;return{left:i,top:n,width:e,height:t}}function vp(s,e){const t={x:0,y:0};if(jn){let f=s;for(;f&&f.nodeName.toLowerCase()!=="html";){const p=jc(f,"transform");if(/^matrix/.test(p)){const y=p.slice(7,-1).split(/,\s/).map(Number);t.x+=y[4],t.y+=y[5]}else if(/^matrix3d/.test(p)){const y=p.slice(9,-1).split(/,\s/).map(Number);t.x+=y[12],t.y+=y[13]}if(f.assignedSlot&&f.assignedSlot.parentElement&&de.WebKitCSSMatrix){const y=de.getComputedStyle(f.assignedSlot.parentElement).transform,v=new de.WebKitCSSMatrix(y);t.x+=v.m41,t.y+=v.m42}f=f.parentNode||f.host}}const i={},n=Oh(e.target),r=Oh(s),a=r.width,u=r.height;let c=e.offsetY-(r.top-n.top),d=e.offsetX-(r.left-n.left);return e.changedTouches&&(d=e.changedTouches[0].pageX-r.left,c=e.changedTouches[0].pageY+r.top,jn&&(d-=t.x,c-=t.y)),i.y=1-Math.max(0,Math.min(1,c/u)),i.x=Math.max(0,Math.min(1,d/a)),i}function Dk(s){return Ha(s)&&s.nodeType===3}function xp(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Lk(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),qc(e)||Dk(e))return e;if(typeof e=="string"&&/\S/.test(e))return yt.createTextNode(e)}).filter(e=>e)}function bb(s,e){return Lk(e).forEach(t=>s.appendChild(t)),s}function Rk(s,e){return bb(xp(s),e)}function Mh(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const Al=_k("querySelector"),Ik=_k("querySelectorAll");function jc(s,e){if(!s||!e)return"";if(typeof de.getComputedStyle=="function"){let t;try{t=de.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Nk(s){[...yt.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),i=yt.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=yt.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var Ok=Object.freeze({__proto__:null,isReal:Gc,isEl:qc,isInFrame:Sk,createEl:li,textContent:Dl,prependTo:mx,hasClass:_h,addClass:fu,removeClass:gp,toggleClass:Ek,setAttributes:wk,getAttributes:gl,getAttribute:Ak,setAttribute:Fc,removeAttribute:yp,blockTextSelection:kk,unblockTextSelection:Ck,getBoundingClientRect:Uc,findPosition:Oh,getPointerPosition:vp,isTextNode:Dk,emptyEl:xp,normalizeContent:Lk,appendContent:bb,insertContent:Rk,isSingleLeftClick:Mh,$:Al,$$:Ik,computedStyle:jc,copyStyleSheetsToWindow:Nk});let Mk=!1,px;const x4=function(){if(px.options.autoSetup===!1)return;const s=Array.prototype.slice.call(yt.getElementsByTagName("video")),e=Array.prototype.slice.call(yt.getElementsByTagName("audio")),t=Array.prototype.slice.call(yt.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let n=0,r=i.length;n-1&&(n={passive:!0}),s.addEventListener(e,i.dispatcher,n)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function $n(s,e,t){if(!Xn.has(s))return;const i=Xn.get(s);if(!i.handlers)return;if(Array.isArray(e))return Tb($n,s,e,t);const n=function(a,u){i.handlers[u]=[],V2(a,u)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&n(s,a);return}const r=i.handlers[e];if(r){if(!t){n(s,e);return}if(t.guid)for(let a=0;a=e&&(s(...n),t=r)}},Fk=function(s,e,t,i=de){let n;const r=()=>{i.clearTimeout(n),n=null},a=function(){const u=this,c=arguments;let d=function(){n=null,d=null,t||s.apply(u,c)};!n&&t&&s.apply(u,c),i.clearTimeout(n),n=i.setTimeout(d,e)};return a.cancel=r,a};var w4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Yr,bind_:ks,throttle:Va,debounce:Fk});let eh;class Fr{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Br(this,e,t),this.addEventListener=i}off(e,t){$n(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Tp(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Sb(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=bp(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Kc(this,e)}queueTrigger(e){eh||(eh=new Map);const t=e.type||e;let i=eh.get(this);i||(i=new Map,eh.set(this,i));const n=i.get(t);i.delete(t),de.clearTimeout(n);const r=de.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,eh.delete(this)),this.trigger(e)},0);i.set(t,r)}}Fr.prototype.allowedEvents_={};Fr.prototype.addEventListener=Fr.prototype.on;Fr.prototype.removeEventListener=Fr.prototype.off;Fr.prototype.dispatchEvent=Fr.prototype.trigger;const Sp=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,wo=s=>s instanceof Fr||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),A4=(s,e)=>{wo(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},vx=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,E0=(s,e,t)=>{if(!s||!s.nodeName&&!wo(s))throw new Error(`Invalid target for ${Sp(e)}#${t}; must be a DOM node or evented object.`)},Uk=(s,e,t)=>{if(!vx(s))throw new Error(`Invalid event type for ${Sp(e)}#${t}; must be a non-empty string or array.`)},jk=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Sp(e)}#${t}; must be a function.`)},sv=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let n,r,a;return i?(n=s.eventBusEl_,e.length>=3&&e.shift(),[r,a]=e):(n=e[0],r=e[1],a=e[2]),E0(n,s,t),Uk(r,s,t),jk(a,s,t),a=ks(s,a),{isTargetingSelf:i,target:n,type:r,listener:a}},Zl=(s,e,t,i)=>{E0(s,s,e),s.nodeName?E4[e](s,t,i):s[e](t,i)},k4={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=sv(this,s,"on");if(Zl(t,"on",i,n),!e){const r=()=>this.off(t,i,n);r.guid=n.guid;const a=()=>this.off("dispose",r);a.guid=n.guid,Zl(this,"on","dispose",r),Zl(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=sv(this,s,"one");if(e)Zl(t,"one",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Zl(t,"one",i,r)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=sv(this,s,"any");if(e)Zl(t,"any",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Zl(t,"any",i,r)}},off(s,e,t){if(!s||vx(s))$n(this.eventBusEl_,s,e);else{const i=s,n=e;E0(i,this,"off"),Uk(n,this,"off"),jk(t,this,"off"),t=ks(this,t),this.off("dispose",t),i.nodeName?($n(i,n,t),$n(i,"dispose",t)):wo(i)&&(i.off(n,t),i.off("dispose",t))}},trigger(s,e){E0(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!vx(t))throw new Error(`Invalid event type for ${Sp(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Kc(this.eventBusEl_,s,e)}};function _b(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=li("span",{className:"vjs-event-bus"});return Object.assign(s,k4),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&Xn.has(i)&&Xn.delete(i)}),de.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const C4={state:{},setState(s){typeof s=="function"&&(s=s());let e;return yc(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&wo(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function $k(s,e){return Object.assign(s,C4),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&wo(s)&&s.on("statechanged",s.handleStateChanged),s}const Eh=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},Xs=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Hk=function(s,e){return Xs(s)===Xs(e)};var D4=Object.freeze({__proto__:null,toLowerCase:Eh,toTitleCase:Xs,titleCaseEquals:Hk});class Xe{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ps({},this.options_),t=this.options_=ps(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${Wr()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(_b(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),$k(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=ps(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return li(e,t,i)}localize(e,t,i=e){const n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],u=n&&n.split("-")[0],c=r&&r[u];let d=i;return a&&a[e]?d=a[e]:c&&c[e]&&(d=c[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(f,p){const y=t[p-1];let v=y;return typeof y>"u"&&(v=f),v})),d}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,n)=>i.concat(n),[]);let t=this;for(let i=0;i=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Xs(e.name())]=null,this.childNameIndex_[Eh(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const u=a.name;let c=a.opts;if(t[u]!==void 0&&(c=t[u]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const d=this.addChild(u,c);d&&(this[u]=d)};let n;const r=Xe.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(u){return typeof u=="string"?a===u:a===u.name})})).map(a=>{let u,c;return typeof a=="string"?(u=a,c=e[u]||this.options_[u]||{}):(u=a.name,c=a),{name:u,opts:c}}).filter(a=>{const u=Xe.getComponent(a.opts.componentClass||Xs(a.name));return u&&!r.isTech(u)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Al(e,t||this.contentEl())}$$(e,t){return Ik(e,t||this.contentEl())}hasClass(e){return _h(this.el_,e)}addClass(...e){fu(this.el_,...e)}removeClass(...e){gp(this.el_,...e)}toggleClass(e,t){Ek(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Ak(this.el_,e)}setAttribute(e,t){Fc(this.el_,e,t)}removeAttribute(e){yp(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],r=n.indexOf("px");return parseInt(r!==-1?n.slice(0,r):this.el_["offset"+Xs(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=jc(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${Xs(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,n=200;let r;this.on("touchstart",function(u){u.touches.length===1&&(t={pageX:u.touches[0].pageX,pageY:u.touches[0].pageY},e=de.performance.now(),r=!0)}),this.on("touchmove",function(u){if(u.touches.length>1)r=!1;else if(t){const c=u.touches[0].pageX-t.pageX,d=u.touches[0].pageY-t.pageY;Math.sqrt(c*c+d*d)>i&&(r=!1)}});const a=function(){r=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(u){t=null,r===!0&&de.performance.now()-e{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),de.clearTimeout(e)),e}setInterval(e,t){e=ks(this,e),this.clearTimersOnDispose_();const i=de.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),de.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=ks(this,e),t=de.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=ks(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),de.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(r){const a=de.getComputedStyle(r,null),u=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(u)}function i(r){return!(!t(r.parentElement)||!t(r)||r.style.opacity==="0"||de.getComputedStyle(r).height==="0px"||de.getComputedStyle(r).width==="0px")}function n(r){if(r.offsetWidth+r.offsetHeight+r.getBoundingClientRect().height+r.getBoundingClientRect().width===0)return!1;const a={x:r.getBoundingClientRect().left+r.offsetWidth/2,y:r.getBoundingClientRect().top+r.offsetHeight/2};if(a.x<0||a.x>(yt.documentElement.clientWidth||de.innerWidth)||a.y<0||a.y>(yt.documentElement.clientHeight||de.innerHeight))return!1;let u=yt.elementFromPoint(a.x,a.y);for(;u;){if(u===r)return!0;if(u.parentNode)u=u.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=Xe.getComponent("Tech"),n=i&&i.isTech(t),r=Xe===t||Xe.prototype.isPrototypeOf(t.prototype);if(n||!r){let u;throw n?u="techs must be registered using Tech.registerTech()":u="must be a Component subclass",new Error(`Illegal component, "${e}"; ${u}.`)}e=Xs(e),Xe.components_||(Xe.components_={});const a=Xe.getComponent("Player");if(e==="Player"&&a&&a.players){const u=a.players,c=Object.keys(u);if(u&&c.length>0){for(let d=0;dt)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function G2(s,e,t,i){return L4(s,i,t.length-1),t[i][e]}function nv(s){let e;return s===void 0||s.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:s.length,start:G2.bind(null,"start",0,s),end:G2.bind(null,"end",1,s)},de.Symbol&&de.Symbol.iterator&&(e[de.Symbol.iterator]=()=>(s||[]).values()),e}function da(s,e){return Array.isArray(s)?nv(s):s===void 0||e===void 0?nv():nv([[s,e]])}const zk=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),n=Math.floor(s/3600);const r=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(n=i=t="-"),n=n>0||a>0?n+":":"",i=((n||r>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,n+i+t};let Eb=zk;function Vk(s){Eb=s}function Gk(){Eb=zk}function Tu(s,e=s){return Eb(s,e)}var R4=Object.freeze({__proto__:null,createTimeRanges:da,createTimeRange:da,setFormatTime:Vk,resetFormatTime:Gk,formatTime:Tu});function qk(s,e){let t=0,i,n;if(!e)return 0;(!s||!s.length)&&(s=da(0,0));for(let r=0;re&&(n=e),t+=n-i;return t/e}function js(s){if(s instanceof js)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Ha(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=js.defaultMessages[this.code]||"")}js.prototype.code=0;js.prototype.message="";js.prototype.status=null;js.prototype.metadata=null;js.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];js.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};js.MEDIA_ERR_CUSTOM=0;js.prototype.MEDIA_ERR_CUSTOM=0;js.MEDIA_ERR_ABORTED=1;js.prototype.MEDIA_ERR_ABORTED=1;js.MEDIA_ERR_NETWORK=2;js.prototype.MEDIA_ERR_NETWORK=2;js.MEDIA_ERR_DECODE=3;js.prototype.MEDIA_ERR_DECODE=3;js.MEDIA_ERR_SRC_NOT_SUPPORTED=4;js.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;js.MEDIA_ERR_ENCRYPTED=5;js.prototype.MEDIA_ERR_ENCRYPTED=5;function wh(s){return s!=null&&typeof s.then=="function"}function Na(s){wh(s)&&s.then(null,e=>{})}const xx=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,n)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},I4=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=xx(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(xx))},N4=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>i.addCue(n))}),e.textTracks()};var bx={textTracksToJson:I4,jsonToTextTracks:N4,trackToJson:xx};const rv="vjs-modal-dialog";class Wc extends Xe{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=li("div",{className:`${rv}-content`},{role:"document"}),this.descEl_=li("p",{className:`${rv}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Dl(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${rv} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Rk(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),xp(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=yt.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let n;for(let r=0;r(t instanceof de.HTMLAnchorElement||t instanceof de.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof de.HTMLInputElement||t instanceof de.HTMLSelectElement||t instanceof de.HTMLTextAreaElement||t instanceof de.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof de.HTMLIFrameElement||t instanceof de.HTMLObjectElement||t instanceof de.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Wc.prototype.options_={pauseOnOpen:!0,temporary:!0};Xe.registerComponent("ModalDialog",Wc);class Su extends Fr{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},wo(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,n=this.length;i=0;t--)if(e[t].enabled){av(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&av(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,av(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const ov=function(s,e){for(let t=0;t=0;t--)if(e[t].selected){ov(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,ov(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class wb extends Su{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class O4{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t0&&(de.console&&de.console.groupCollapsed&&de.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(n=>Oi.error(n)),de.console&&de.console.groupEnd&&de.console.groupEnd()),t.flush()},W2=function(s,e){const t={uri:s},i=_p(s);i&&(t.cors=i);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),QA(t,ks(this,function(r,a,u){if(r)return Oi.error(r,a);e.loaded_=!0,typeof de.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){Oi.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return K2(u,e)}):K2(u,e)}))};class Yh extends Ab{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=ps(e,{kind:B4[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=q2[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const r=new w0(this.cues_),a=new w0(this.activeCues_);let u=!1;this.timeupdateHandler=ks(this,function(d={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return i},set(d){q2[d]&&i!==d&&(i=d,!this.preload_&&i!=="disabled"&&this.cues.length===0&&W2(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const d=this.tech_.currentTime(),f=[];for(let p=0,y=this.cues.length;p=d&&f.push(v)}if(u=!1,f.length!==this.activeCues_.length)u=!0;else for(let p=0;p{t=ko.LOADED,this.trigger({type:"load",target:this})})}}ko.prototype.allowedEvents_={load:"load"};ko.NONE=0;ko.LOADING=1;ko.LOADED=2;ko.ERROR=3;const Kr={audio:{ListClass:Kk,TrackClass:Xk,capitalName:"Audio"},video:{ListClass:Wk,TrackClass:Qk,capitalName:"Video"},text:{ListClass:wb,TrackClass:Yh,capitalName:"Text"}};Object.keys(Kr).forEach(function(s){Kr[s].getterName=`${s}Tracks`,Kr[s].privateName=`${s}Tracks_`});const $c={remoteText:{ListClass:wb,TrackClass:Yh,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:O4,TrackClass:ko,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Yn=Object.assign({},Kr,$c);$c.names=Object.keys($c);Kr.names=Object.keys(Kr);Yn.names=[].concat($c.names).concat(Kr.names);function U4(s,e,t,i,n={}){const r=s.textTracks();n.kind=e,t&&(n.label=t),i&&(n.language=i),n.tech=s;const a=new Yn.text.TrackClass(n);return r.addTrack(a),a}class ki extends Xe{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Yn.names.forEach(i=>{const n=Yn[i];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Yn.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(ks(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return da(0,0)}bufferedPercent(){return qk(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Kr.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let n=i.length;for(;n--;){const r=i[n];t==="text"&&this.removeRemoteTextTrack(r),i.removeTrack(r)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new js(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?da(0,0):da()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Kr.names.forEach(e=>{const t=Kr[e],i=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),this.on("dispose",()=>{n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!de.WebVTT)if(yt.body.contains(this.el())){if(!this.options_["vtt.js"]&&Bc(v2)&&Object.keys(v2).length>0){this.trigger("vttjsloaded");return}const e=yt.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),de.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=u=>e.addTrack(u.track),n=u=>e.removeTrack(u.track);t.on("addtrack",i),t.on("removetrack",n),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),a=()=>{r();for(let u=0;uthis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Wr();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return ki.canPlayType(e.type)}static isTech(e){return e.prototype instanceof ki||e instanceof ki||e===ki}static registerTech(e,t){if(ki.techs_||(ki.techs_={}),!ki.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!ki.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!ki.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Xs(e),ki.techs_[e]=t,ki.techs_[Eh(e)]=t,e!=="Tech"&&ki.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(ki.techs_&&ki.techs_[e])return ki.techs_[e];if(e=Xs(e),de&&de.videojs&&de.videojs[e])return Oi.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),de.videojs[e]}}}Yn.names.forEach(function(s){const e=Yn[s];ki.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ki.prototype.featuresVolumeControl=!0;ki.prototype.featuresMuteControl=!0;ki.prototype.featuresFullscreenResize=!1;ki.prototype.featuresPlaybackRate=!1;ki.prototype.featuresProgressEvents=!1;ki.prototype.featuresSourceset=!1;ki.prototype.featuresTimeupdateEvents=!1;ki.prototype.featuresNativeTextTracks=!1;ki.prototype.featuresVideoFrameCallback=!1;ki.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),i===void 0&&(i=n.length),n.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let n;for(let r=0;rnu(e,mu[e.type],t,s),1)}function H4(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function z4(s,e,t){return s.reduceRight(Db(t),e[t]())}function V4(s,e,t,i){return e[t](s.reduce(Db(t),i))}function Y2(s,e,t,i=null){const n="call"+Xs(t),r=s.reduce(Db(n),i),a=r===k0,u=a?null:e[t](r);return K4(s,t,u,a),u}const G4={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},q4={setCurrentTime:1,setMuted:1,setVolume:1},X2={play:1,pause:1};function Db(s){return(e,t)=>e===k0?k0:t[s]?t[s](e):e}function K4(s,e,t,i){for(let n=s.length-1;n>=0;n--){const r=s[n];r[e]&&r[e](i,t)}}function W4(s){A0.hasOwnProperty(s.id())&&delete A0[s.id()]}function Y4(s,e){const t=A0[s.id()];let i=null;if(t==null)return i=e(s),A0[s.id()]=[[e,i]],i;for(let n=0;n{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let n=0;n +`)}function d(E){this.options=E||{locator:{}}}d.prototype.parseFromString=function(E,D){var O=this.options,R=new u,j=O.domBuilder||new g,F=O.errorHandler,G=O.locator,L=O.xmlns||{},W=/\/x?html?$/.test(D),I=W?t.HTML_ENTITIES:t.XML_ENTITIES;G&&j.setDocumentLocator(G),R.errorHandler=f(F,j,G),R.domBuilder=O.domBuilder||j,W&&(L[""]=r.HTML),L.xml=L.xml||r.XML;var N=O.normalizeLineEndings||c;return E&&typeof E=="string"?R.parse(N(E),L,I):R.errorHandler.error("invalid doc source"),j.doc};function f(E,D,O){if(!E){if(D instanceof g)return D;E=D}var R={},j=E instanceof Function;O=O||{};function F(G){var L=E[G];!L&&j&&(L=E.length==2?function(W){E(G,W)}:E),R[G]=L&&function(W){L("[xmldom "+G+"] "+W+v(O))}||function(){}}return F("warning"),F("error"),F("fatalError"),R}function g(){this.cdata=!1}function y(E,D){D.lineNumber=E.lineNumber,D.columnNumber=E.columnNumber}g.prototype={startDocument:function(){this.doc=new n().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(E,D,O,R){var j=this.doc,F=j.createElementNS(E,O||D),G=R.length;T(this,F),this.currentElement=F,this.locator&&y(this.locator,F);for(var L=0;L=D+O||D?new java.lang.String(E,D,O)+"":E}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(E){g.prototype[E]=function(){return null}});function T(E,D){E.currentElement?E.currentElement.appendChild(D):E.doc.appendChild(D)}return eh.__DOMHandler=g,eh.normalizeLineEndings=c,eh.DOMParser=d,eh}var M2;function hP(){if(M2)return Jd;M2=1;var s=fk();return Jd.DOMImplementation=s.DOMImplementation,Jd.XMLSerializer=s.XMLSerializer,Jd.DOMParser=dP().DOMParser,Jd}var fP=hP();const P2=s=>!!s&&typeof s=="object",kn=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):P2(e[i])&&P2(t[i])?e[i]=kn(e[i],t[i]):e[i]=t[i]}),e),{}),mk=s=>Object.keys(s).map(e=>s[e]),mP=(s,e)=>{const t=[];for(let i=s;is.reduce((e,t)=>e.concat(t),[]),pk=s=>{if(!s.length)return[];const e=[];for(let t=0;ts.reduce((t,i,n)=>(i[e]&&t.push(n),t),[]),gP=(s,e)=>mk(s.reduce((t,i)=>(i.forEach(n=>{t[e(n)]=n}),t),{}));var Fc={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const Oh=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const n={uri:e,resolvedUri:dp(s||"",e)};if(t||i){const a=(t||i).split("-");let u=he.BigInt?he.BigInt(a[0]):parseInt(a[0],10),c=he.BigInt?he.BigInt(a[1]):parseInt(a[1],10);u{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=he.BigInt(s.offset)+he.BigInt(s.length)-he.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},F2=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),vP={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:n}=s,r=F2(s.endNumber),a=e/t;return typeof r=="number"?{start:0,end:r}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:i/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:n=1,duration:r,periodStart:a=0,minimumUpdatePeriod:u=0,timeShiftBufferDepth:c=1/0}=s,d=F2(s.endNumber),f=(e+t)/1e3,g=i+a,v=f+u-g,b=Math.ceil(v*n/r),T=Math.floor((f-g-c)*n/r),E=Math.floor((f-g)*n/r);return{start:Math.max(0,T),end:typeof d=="number"?d:Math.min(b,E)}}},xP=s=>e=>{const{duration:t,timescale:i=1,periodStart:n,startNumber:r=1}=s;return{number:r+e,duration:t/i,timeline:n,time:e*t}},gb=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:n,sourceDuration:r}=s,{start:a,end:u}=vP[e](s),c=mP(a,u).map(xP(s));if(e==="static"){const d=c.length-1,f=typeof n=="number"?n:r;c[d].duration=f-t/i*d}return c},gk=s=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:n="",periodStart:r,presentationTime:a,number:u=0,duration:c}=s;if(!e)throw new Error(Fc.NO_BASE_URL);const d=Oh({baseUrl:e,source:t.sourceURL,range:t.range}),f=Oh({baseUrl:e,source:e,indexRange:n});if(f.map=d,c){const g=gb(s);g.length&&(f.duration=g[0].duration,f.timeline=g[0].timeline)}else i&&(f.duration=i,f.timeline=r);return f.presentationTime=a||r,f.number=u,[f]},yb=(s,e,t)=>{const i=s.sidx.map?s.sidx.map:null,n=s.sidx.duration,r=s.timeline||0,a=s.sidx.byterange,u=a.offset+a.length,c=e.timescale,d=e.references.filter(E=>E.referenceType!==1),f=[],g=s.endList?"static":"dynamic",y=s.sidx.timeline;let v=y,b=s.mediaSequence||0,T;typeof e.firstOffset=="bigint"?T=he.BigInt(u)+e.firstOffset:T=u+e.firstOffset;for(let E=0;EgP(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),SP=(s,e)=>{for(let t=0;t{let e=[];return lP(s,bP,(t,i,n,r)=>{e=e.concat(t.playlists||[])}),e},U2=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},_P=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:c}){return c===i.timeline});const n=SP(s,i.attributes.NAME);if(!n||i.sidx)return;const r=i.segments[0],a=n.segments.findIndex(function(c){return Math.abs(c.presentationTime-r.presentationTime)n.timeline||n.segments.length&&i.timeline>n.segments[n.segments.length-1].timeline)&&i.discontinuitySequence--;return}n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),U2({playlist:i,mediaSequence:n.segments[a].number})})},EP=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(B2(s)),i=e.playlists.concat(B2(e));return e.timelineStarts=yk([s.timelineStarts,e.timelineStarts]),_P({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},fp=s=>s&&s.uri+"-"+yP(s.byterange),sv=s=>{const e=s.reduce(function(i,n){return i[n.attributes.baseUrl]||(i[n.attributes.baseUrl]=[]),i[n.attributes.baseUrl].push(n),i},{});let t=[];return Object.values(e).forEach(i=>{const n=mk(i.reduce((r,a)=>{const u=a.attributes.id+(a.attributes.lang||"");return r[u]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),r[u].segments.push(...a.segments)),a.attributes.contentProtection&&(r[u].attributes.contentProtection=a.attributes.contentProtection)):(r[u]=a,r[u].attributes.timelineStarts=[]),r[u].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),r},{}));t=t.concat(n)}),t.map(i=>(i.discontinuityStarts=pP(i.segments||[],"discontinuity"),i))},vb=(s,e)=>{const t=fp(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&yb(s,i,s.sidx.resolvedUri),s},wP=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=vb(s[t],e);return s},AP=({attributes:s,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:n,discontinuityStarts:r},a)=>{const u={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:n,discontinuityStarts:r,timelineStarts:s.timelineStarts,mediaSequence:i,segments:e};return s.contentProtection&&(u.contentProtection=s.contentProtection),s.serviceLocation&&(u.attributes.serviceLocation=s.serviceLocation),t&&(u.sidx=t),a&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u},kP=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const r={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(r.CODECS=s.codecs);const a={attributes:r,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:i,discontinuitySequence:n,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},CP=(s,e={},t=!1)=>{let i;const n=s.reduce((r,a)=>{const u=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let d=a.attributes.label||"main";if(c&&!a.attributes.label){const g=u?` (${u})`:"";d=`${a.attributes.lang}${g}`}r[d]||(r[d]={language:c,autoselect:!0,default:u==="main",playlists:[],uri:""});const f=vb(AP(a,t),e);return r[d].playlists.push(f),typeof i>"u"&&u==="main"&&(i=a,i.default=!0),r},{});if(!i){const r=Object.keys(n)[0];n[r].default=!0}return n},DP=(s,e={})=>s.reduce((t,i)=>{const n=i.attributes.label||i.attributes.lang||"text",r=i.attributes.lang||"und";return t[n]||(t[n]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(vb(kP(i),e)),t},{}),LP=s=>s.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:n,language:r}=i;e[r]={autoselect:!1,default:!1,instreamId:n,language:r},i.hasOwnProperty("aspectRatio")&&(e[r].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[r].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[r]["3D"]=i["3D"])}),e),{}),RP=({attributes:s,segments:e,sidx:t,discontinuityStarts:i})=>{const n={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:i,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(n.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(n.contentProtection=s.contentProtection),s.serviceLocation&&(n.attributes.serviceLocation=s.serviceLocation),t&&(n.sidx=t),n},IP=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",NP=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",OP=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",MP=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,n)=>{i.number=n})})},j2=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],PP=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:n,eventStream:r})=>{if(!s.length)return{};const{sourceDuration:a,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:d}=s[0].attributes,f=sv(s.filter(IP)).map(RP),g=sv(s.filter(NP)),y=sv(s.filter(OP)),v=s.map(j=>j.attributes.captionServices).filter(Boolean),b={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:wP(f,i)};d>=0&&(b.minimumUpdatePeriod=d*1e3),e&&(b.locations=e),t&&(b.contentSteering=t),u==="dynamic"&&(b.suggestedPresentationDelay=c),r&&r.length>0&&(b.eventStream=r);const T=b.playlists.length===0,E=g.length?CP(g,i,T):null,D=y.length?DP(y,i):null,O=f.concat(j2(E),j2(D)),R=O.map(({timelineStarts:j})=>j);return b.timelineStarts=yk(R),MP(O,b.timelineStarts),E&&(b.mediaGroups.AUDIO.audio=E),D&&(b.mediaGroups.SUBTITLES.subs=D),v.length&&(b.mediaGroups["CLOSED-CAPTIONS"].cc=LP(v)),n?EP({oldManifest:n,newManifest:b}):b},FP=(s,e,t)=>{const{NOW:i,clientOffset:n,availabilityStartTime:r,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:c=0}=s,d=(i+n)/1e3,f=r+u,y=d+c-f;return Math.ceil((y*a-e)/t)},vk=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:n="",sourceDuration:r,timescale:a=1,startNumber:u=1,periodStart:c}=s,d=[];let f=-1;for(let g=0;gf&&(f=T);let E;if(b<0){const R=g+1;R===e.length?t==="dynamic"&&i>0&&n.indexOf("$Number$")>0?E=FP(s,f,v):E=(r*a-f)/v:E=(e[R].t-f)/v}else E=b+1;const D=u+d.length+E;let O=u+d.length;for(;O(e,t,i,n)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const r=""+s[t];return t==="RepresentationID"||(i?n=parseInt(n,10):n=1,r.length>=n)?r:`${new Array(n-r.length+1).join("0")}${r}`},$2=(s,e)=>s.replace(BP,UP(e)),jP=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?gb(s):vk(s,e),$P=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,n=Oh({baseUrl:s.baseUrl,source:$2(i.sourceURL,t),range:i.range});return jP(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=$2(s.media||"",t),c=s.timescale||1,d=s.presentationTimeOffset||0,f=s.periodStart+(a.time-d)/c;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:dp(s.baseUrl||"",u),map:n,number:a.number,presentationTime:f}})},HP=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,n=Oh({baseUrl:t,source:i.sourceURL,range:i.range}),r=Oh({baseUrl:t,source:e.media,range:e.mediaRange});return r.map=n,r},zP=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=s;if(!t&&!e||t&&e)throw new Error(Fc.SEGMENT_TIME_UNSPECIFIED);const r=i.map(c=>HP(s,c));let a;return t&&(a=gb(s)),e&&(a=vk(s,e)),a.map((c,d)=>{if(r[d]){const f=r[d],g=s.timescale||1,y=s.presentationTimeOffset||0;return f.timeline=c.timeline,f.duration=c.duration,f.number=c.number,f.presentationTime=n+(c.time-y)/g,f}}).filter(c=>c)},VP=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=$P,t=kn(s,e.template)):e.base?(i=gk,t=kn(s,e.base)):e.list&&(i=zP,t=kn(s,e.list));const n={attributes:s};if(!i)return n;const r=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:u=1}=t;t.duration=a/u}else r.length?t.duration=r.reduce((a,u)=>Math.max(a,Math.ceil(u.duration)),0):t.duration=0;return n.attributes=t,n.segments=r,e.base&&t.indexRange&&(n.sidx=r[0],n.segments=[]),n},GP=s=>s.map(VP),$s=(s,e)=>pk(s.childNodes).filter(({tagName:t})=>t===e),Xh=s=>s.textContent.trim(),qP=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),tc=s=>{const u=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!u)return 0;const[c,d,f,g,y,v]=u.slice(1);return parseFloat(c||0)*31536e3+parseFloat(d||0)*2592e3+parseFloat(f||0)*86400+parseFloat(g||0)*3600+parseFloat(y||0)*60+parseFloat(v||0)},KP=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),H2={mediaPresentationDuration(s){return tc(s)},availabilityStartTime(s){return KP(s)/1e3},minimumUpdatePeriod(s){return tc(s)},suggestedPresentationDelay(s){return tc(s)},type(s){return s},timeShiftBufferDepth(s){return tc(s)},start(s){return tc(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return qP(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?tc(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},gn=s=>s&&s.attributes?pk(s.attributes).reduce((e,t)=>{const i=H2[t.name]||H2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},WP={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},mp=(s,e)=>e.length?Pc(s.map(function(t){return e.map(function(i){const n=Xh(i),r=dp(t.baseUrl,n),a=kn(gn(i),{baseUrl:r});return r!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,xb=s=>{const e=$s(s,"SegmentTemplate")[0],t=$s(s,"SegmentList")[0],i=t&&$s(t,"SegmentURL").map(g=>kn({tag:"SegmentURL"},gn(g))),n=$s(s,"SegmentBase")[0],r=t||e,a=r&&$s(r,"SegmentTimeline")[0],u=t||n||e,c=u&&$s(u,"Initialization")[0],d=e&&gn(e);d&&c?d.initialization=c&&gn(c):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});const f={template:d,segmentTimeline:a&&$s(a,"S").map(g=>gn(g)),list:t&&kn(gn(t),{segmentUrls:i,initialization:gn(c)}),base:n&&kn(gn(n),{initialization:gn(c)})};return Object.keys(f).forEach(g=>{f[g]||delete f[g]}),f},YP=(s,e,t)=>i=>{const n=$s(i,"BaseURL"),r=mp(e,n),a=kn(s,gn(i)),u=xb(i);return r.map(c=>({segmentInfo:kn(t,u),attributes:kn(a,c)}))},XP=s=>s.reduce((e,t)=>{const i=gn(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const n=WP[i.schemeIdUri];if(n){e[n]={attributes:i};const r=$s(t,"cenc:pssh")[0];if(r){const a=Xh(r);e[n].pssh=a&&ok(a)}}return e},{}),QP=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{let i,n;return n=t,/^CC\d=/.test(t)?[i,n]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[n,r=""]=t.split("=");i.channel=n,i.language=t,r.split(",").forEach(a=>{const[u,c]=a.split(":");u==="lang"?i.language=c:u==="er"?i.easyReader=Number(c):u==="war"?i.aspectRatio=Number(c):u==="3D"&&(i["3D"]=Number(c))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},ZP=s=>Pc($s(s.node,"EventStream").map(e=>{const t=gn(e),i=t.schemeIdUri;return $s(e,"Event").map(n=>{const r=gn(n),a=r.presentationTime||0,u=t.timescale||1,c=r.duration||0,d=a/u+s.attributes.start;return{schemeIdUri:i,value:t.value,id:r.id,start:d,end:d+c/u,messageData:Xh(n)||r.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),JP=(s,e,t)=>i=>{const n=gn(i),r=mp(e,$s(i,"BaseURL")),a=$s(i,"Role")[0],u={role:gn(a)};let c=kn(s,n,u);const d=$s(i,"Accessibility")[0],f=QP(gn(d));f&&(c=kn(c,{captionServices:f}));const g=$s(i,"Label")[0];if(g&&g.childNodes.length){const E=g.childNodes[0].nodeValue.trim();c=kn(c,{label:E})}const y=XP($s(i,"ContentProtection"));Object.keys(y).length&&(c=kn(c,{contentProtection:y}));const v=xb(i),b=$s(i,"Representation"),T=kn(t,v);return Pc(b.map(YP(c,r,T)))},e4=(s,e)=>(t,i)=>{const n=mp(e,$s(t.node,"BaseURL")),r=kn(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(r.periodDuration=t.attributes.duration);const a=$s(t.node,"AdaptationSet"),u=xb(t.node);return Pc(a.map(JP(r,n,u)))},t4=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const t=kn({serverURL:Xh(s[0])},gn(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},i4=({attributes:s,priorPeriodAttributes:e,mpdType:t})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,s4=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:n=0,eventHandler:r=function(){}}=e,a=$s(s,"Period");if(!a.length)throw new Error(Fc.INVALID_NUMBER_OF_PERIOD);const u=$s(s,"Location"),c=gn(s),d=mp([{baseUrl:t}],$s(s,"BaseURL")),f=$s(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=i,c.clientOffset=n,u.length&&(c.locations=u.map(Xh));const g=[];return a.forEach((y,v)=>{const b=gn(y),T=g[v-1];b.start=i4({attributes:b,priorPeriodAttributes:T?T.attributes:null,mpdType:c.type}),g.push({node:y,attributes:b})}),{locations:c.locations,contentSteeringInfo:t4(f,r),representationInfo:Pc(g.map(e4(c,d))),eventStream:Pc(g.map(ZP))}},xk=s=>{if(s==="")throw new Error(Fc.DASH_EMPTY_MANIFEST);const e=new fP.DOMParser;let t,i;try{t=e.parseFromString(s,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Fc.DASH_INVALID_XML);return i},n4=s=>{const e=$s(s,"UTCTiming")[0];if(!e)return null;const t=gn(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Fc.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},r4=(s,e={})=>{const t=s4(xk(s),e),i=GP(t.representationInfo);return PP({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},a4=s=>n4(xk(s));var nv,z2;function o4(){if(z2)return nv;z2=1;var s=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),n;return i.getBigUint64?(n=i.getBigUint64(0),n0;r+=12,a--)n.references.push({referenceType:(t[r]&128)>>>7,referencedSize:i.getUint32(r)&2147483647,subsegmentDuration:i.getUint32(r+4),startsWithSap:!!(t[r+8]&128),sapType:(t[r+8]&112)>>>4,sapDeltaTime:i.getUint32(r+8)&268435455});return n};return rv=e,rv}var u4=l4();const c4=qc(u4);var d4=di([73,68,51]),h4=function(e,t){t===void 0&&(t=0),e=di(e);var i=e[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(i&16)>>4;return r?n+20:n+10},hh=function s(e,t){return t===void 0&&(t=0),e=di(e),e.length-t<10||!js(e,d4,{offset:t})?t:(t+=h4(e,t),s(e,t))},G2=function(e){return typeof e=="string"?hk(e):e},f4=function(e){return Array.isArray(e)?e.map(function(t){return G2(t)}):[G2(e)]},m4=function s(e,t,i){i===void 0&&(i=!1),t=f4(t),e=di(e);var n=[];if(!t.length)return n;for(var r=0;r>>0,u=e.subarray(r+4,r+8);if(a===0)break;var c=r+a;if(c>e.length){if(i)break;c=e.length}var d=e.subarray(r+8,c);js(u,t[0])&&(t.length===1?n.push(d):n.push.apply(n,s(d,t.slice(1),i))),r=c}return n},km={EBML:di([26,69,223,163]),DocType:di([66,130]),Segment:di([24,83,128,103]),SegmentInfo:di([21,73,169,102]),Tracks:di([22,84,174,107]),Track:di([174]),TrackNumber:di([215]),DefaultDuration:di([35,227,131]),TrackEntry:di([174]),TrackType:di([131]),FlagDefault:di([136]),CodecID:di([134]),CodecPrivate:di([99,162]),VideoTrack:di([224]),AudioTrack:di([225]),Cluster:di([31,67,182,117]),Timestamp:di([231]),TimestampScale:di([42,215,177]),BlockGroup:di([160]),BlockDuration:di([155]),Block:di([161]),SimpleBlock:di([163])},fx=[128,64,32,16,8,4,2,1],p4=function(e){for(var t=1,i=0;i=t.length)return t.length;var n=T0(t,i,!1);if(js(e.bytes,n.bytes))return i;var r=T0(t,i+n.length);return s(e,t,i+r.length+r.value+n.length)},K2=function s(e,t){t=g4(t),e=di(e);var i=[];if(!t.length)return i;for(var n=0;ne.length?e.length:u+a.value,d=e.subarray(u,c);js(t[0],r.bytes)&&(t.length===1?i.push(d):i=i.concat(s(d,t.slice(1))));var f=r.length+a.length+d.length;n+=f}return i},v4=di([0,0,0,1]),x4=di([0,0,1]),b4=di([0,0,3]),T4=function(e){for(var t=[],i=1;i>1&63),i.indexOf(d)!==-1&&(a=r+c),r+=c+(t==="h264"?1:2)}return e.subarray(0,0)},S4=function(e,t,i){return bk(e,"h264",t,i)},_4=function(e,t,i){return bk(e,"h265",t,i)},Qn={webm:di([119,101,98,109]),matroska:di([109,97,116,114,111,115,107,97]),flac:di([102,76,97,67]),ogg:di([79,103,103,83]),ac3:di([11,119]),riff:di([82,73,70,70]),avi:di([65,86,73]),wav:di([87,65,86,69]),"3gp":di([102,116,121,112,51,103]),mp4:di([102,116,121,112]),fmp4:di([115,116,121,112]),mov:di([102,116,121,112,113,116]),moov:di([109,111,111,118]),moof:di([109,111,111,102])},Bc={aac:function(e){var t=hh(e);return js(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=hh(e);return js(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=K2(e,[km.EBML,km.DocType])[0];return js(t,Qn.webm)},mkv:function(e){var t=K2(e,[km.EBML,km.DocType])[0];return js(t,Qn.matroska)},mp4:function(e){if(Bc["3gp"](e)||Bc.mov(e))return!1;if(js(e,Qn.mp4,{offset:4})||js(e,Qn.fmp4,{offset:4})||js(e,Qn.moof,{offset:4})||js(e,Qn.moov,{offset:4}))return!0},mov:function(e){return js(e,Qn.mov,{offset:4})},"3gp":function(e){return js(e,Qn["3gp"],{offset:4})},ac3:function(e){var t=hh(e);return js(e,Qn.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},av,W2;function A4(){if(W2)return av;W2=1;var s=9e4,e,t,i,n,r,a,u;return e=function(c){return c*s},t=function(c,d){return c*d},i=function(c){return c/s},n=function(c,d){return c/d},r=function(c,d){return e(n(c,d))},a=function(c,d){return t(i(c),d)},u=function(c,d,f){return i(f?c:c-d)},av={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:n,audioTsToVideoTs:r,videoTsToAudioTs:a,metadataTsToSeconds:u},av}var du=A4();var px="8.23.4";const _o={},Al=function(s,e){return _o[s]=_o[s]||[],e&&(_o[s]=_o[s].concat(e)),_o[s]},k4=function(s,e){Al(s,e)},Tk=function(s,e){const t=Al(s).indexOf(e);return t<=-1?!1:(_o[s]=_o[s].slice(),_o[s].splice(t,1),!0)},C4=function(s,e){Al(s,[].concat(e).map(t=>{const i=(...n)=>(Tk(s,i),t(...n));return i}))},S0={prefixed:!0},e0=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Y2=e0[0];let fh;for(let s=0;s(i,n,r)=>{const a=e.levels[n],u=new RegExp(`^(${a})$`);let c=s;if(i!=="log"&&r.unshift(i.toUpperCase()+":"),t&&(c=`%c${s}`,r.unshift(t)),r.unshift(c+":"),mr){mr.push([].concat(r));const f=mr.length-1e3;mr.splice(0,f>0?f:0)}if(!he.console)return;let d=he.console[i];!d&&i==="debug"&&(d=he.console.info||he.console.log),!(!d||!a||!u.test(i))&&d[Array.isArray(r)?"apply":"call"](he.console,r)};function gx(s,e=":",t=""){let i="info",n;function r(...a){n("log",i,a)}return n=D4(s,r,t),r.createLogger=(a,u,c)=>{const d=u!==void 0?u:e,f=c!==void 0?c:t,g=`${s} ${d} ${a}`;return gx(g,d,f)},r.createNewLogger=(a,u,c)=>gx(a,u,c),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},r.level=a=>{if(typeof a=="string"){if(!r.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},r.history=()=>mr?[].concat(mr):[],r.history.filter=a=>(mr||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),r.history.clear=()=>{mr&&(mr.length=0)},r.history.disable=()=>{mr!==null&&(mr.length=0,mr=null)},r.history.enable=()=>{mr===null&&(mr=[])},r.error=(...a)=>n("error",i,a),r.warn=(...a)=>n("warn",i,a),r.debug=(...a)=>n("debug",i,a),r}const Fi=gx("VIDEOJS"),Sk=Fi.createLogger,L4=Object.prototype.toString,_k=function(s){return Ga(s)?Object.keys(s):[]};function xc(s,e){_k(s).forEach(t=>e(s[t],t))}function Ek(s,e,t=0){return _k(s).reduce((i,n)=>e(i,s[n],n),t)}function Ga(s){return!!s&&typeof s=="object"}function Uc(s){return Ga(s)&&L4.call(s)==="[object Object]"&&s.constructor===Object}function Ts(...s){const e={};return s.forEach(t=>{t&&xc(t,(i,n)=>{if(!Uc(i)){e[n]=i;return}Uc(e[n])||(e[n]={}),e[n]=Ts(e[n],i)})}),e}function wk(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function pp(s,e,t,i=!0){const n=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return i&&(r.set=n),Object.defineProperty(s,e,r)}var R4=Object.freeze({__proto__:null,each:xc,reduce:Ek,isObject:Ga,isPlain:Uc,merge:Ts,values:wk,defineLazyProperty:pp});let Tb=!1,Ak=null,ya=!1,kk,Ck=!1,bc=!1,Tc=!1,qa=!1,Sb=null,gp=null;const I4=!!(he.cast&&he.cast.framework&&he.cast.framework.CastReceiverContext);let Dk=null,_0=!1,yp=!1,E0=!1,vp=!1,w0=!1,A0=!1,k0=!1;const Mh=!!(Kc()&&("ontouchstart"in he||he.navigator.maxTouchPoints||he.DocumentTouch&&he.document instanceof he.DocumentTouch)),dl=he.navigator&&he.navigator.userAgentData;dl&&dl.platform&&dl.brands&&(ya=dl.platform==="Android",bc=!!dl.brands.find(s=>s.brand==="Microsoft Edge"),Tc=!!dl.brands.find(s=>s.brand==="Chromium"),qa=!bc&&Tc,Sb=gp=(dl.brands.find(s=>s.brand==="Chromium")||{}).version||null,yp=dl.platform==="Windows");if(!Tc){const s=he.navigator&&he.navigator.userAgent||"";Tb=/iPod/i.test(s),Ak=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),ya=/Android/i.test(s),kk=(function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),Ck=/Firefox/i.test(s),bc=/Edg/i.test(s),Tc=/Chrome/i.test(s)||/CriOS/i.test(s),qa=!bc&&Tc,Sb=gp=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),Dk=(function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t})(),w0=/Tizen/i.test(s),A0=/Web0S/i.test(s),k0=w0||A0,_0=/Safari/i.test(s)&&!qa&&!ya&&!bc&&!k0,yp=/Windows/i.test(s),E0=/iPad/i.test(s)||_0&&Mh&&!/iPhone/i.test(s),vp=/iPhone/i.test(s)&&!E0}const Gn=vp||E0||Tb,xp=(_0||Gn)&&!qa;var Lk=Object.freeze({__proto__:null,get IS_IPOD(){return Tb},get IOS_VERSION(){return Ak},get IS_ANDROID(){return ya},get ANDROID_VERSION(){return kk},get IS_FIREFOX(){return Ck},get IS_EDGE(){return bc},get IS_CHROMIUM(){return Tc},get IS_CHROME(){return qa},get CHROMIUM_VERSION(){return Sb},get CHROME_VERSION(){return gp},IS_CHROMECAST_RECEIVER:I4,get IE_VERSION(){return Dk},get IS_SAFARI(){return _0},get IS_WINDOWS(){return yp},get IS_IPAD(){return E0},get IS_IPHONE(){return vp},get IS_TIZEN(){return w0},get IS_WEBOS(){return A0},get IS_SMART_TV(){return k0},TOUCH_ENABLED:Mh,IS_IOS:Gn,IS_ANY_SAFARI:xp});function X2(s){return typeof s=="string"&&!!s.trim()}function N4(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Kc(){return _t===he.document}function Wc(s){return Ga(s)&&s.nodeType===1}function Rk(){try{return he.parent!==he.self}catch{return!0}}function Ik(s){return function(e,t){if(!X2(e))return _t[s](null);X2(t)&&(t=_t.querySelector(t));const i=Wc(t)?t:_t;return i[s]&&i[s](e)}}function pi(s="div",e={},t={},i){const n=_t.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(r){const a=e[r];r==="textContent"?Ll(n,a):(n[r]!==a||r==="tabIndex")&&(n[r]=a)}),Object.getOwnPropertyNames(t).forEach(function(r){n.setAttribute(r,t[r])}),i&&_b(n,i),n}function Ll(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function yx(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function Eh(s,e){return N4(e),s.classList.contains(e)}function mu(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function bp(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(Fi.warn("removeClass was called with an element that doesn't exist"),null)}function Nk(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function Ok(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function yl(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;let a=i[n].value;t.includes(r)&&(a=a!==null),e[r]=a}}return e}function Mk(s,e){return s.getAttribute(e)}function jc(s,e,t){s.setAttribute(e,t)}function Tp(s,e){s.removeAttribute(e)}function Pk(){_t.body.focus(),_t.onselectstart=function(){return!1}}function Fk(){_t.onselectstart=function(){return!0}}function $c(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Hc(s,"height"))),t.width||(t.width=parseFloat(Hc(s,"width"))),t}}function Ph(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,n=0;for(;s.offsetParent&&s!==_t[S0.fullscreenElement];)i+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent;return{left:i,top:n,width:e,height:t}}function Sp(s,e){const t={x:0,y:0};if(Gn){let f=s;for(;f&&f.nodeName.toLowerCase()!=="html";){const g=Hc(f,"transform");if(/^matrix/.test(g)){const y=g.slice(7,-1).split(/,\s/).map(Number);t.x+=y[4],t.y+=y[5]}else if(/^matrix3d/.test(g)){const y=g.slice(9,-1).split(/,\s/).map(Number);t.x+=y[12],t.y+=y[13]}if(f.assignedSlot&&f.assignedSlot.parentElement&&he.WebKitCSSMatrix){const y=he.getComputedStyle(f.assignedSlot.parentElement).transform,v=new he.WebKitCSSMatrix(y);t.x+=v.m41,t.y+=v.m42}f=f.parentNode||f.host}}const i={},n=Ph(e.target),r=Ph(s),a=r.width,u=r.height;let c=e.offsetY-(r.top-n.top),d=e.offsetX-(r.left-n.left);return e.changedTouches&&(d=e.changedTouches[0].pageX-r.left,c=e.changedTouches[0].pageY+r.top,Gn&&(d-=t.x,c-=t.y)),i.y=1-Math.max(0,Math.min(1,c/u)),i.x=Math.max(0,Math.min(1,d/a)),i}function Bk(s){return Ga(s)&&s.nodeType===3}function _p(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Uk(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),Wc(e)||Bk(e))return e;if(typeof e=="string"&&/\S/.test(e))return _t.createTextNode(e)}).filter(e=>e)}function _b(s,e){return Uk(e).forEach(t=>s.appendChild(t)),s}function jk(s,e){return _b(_p(s),e)}function Fh(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const kl=Ik("querySelector"),$k=Ik("querySelectorAll");function Hc(s,e){if(!s||!e)return"";if(typeof he.getComputedStyle=="function"){let t;try{t=he.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Hk(s){[..._t.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),i=_t.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=_t.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var zk=Object.freeze({__proto__:null,isReal:Kc,isEl:Wc,isInFrame:Rk,createEl:pi,textContent:Ll,prependTo:yx,hasClass:Eh,addClass:mu,removeClass:bp,toggleClass:Nk,setAttributes:Ok,getAttributes:yl,getAttribute:Mk,setAttribute:jc,removeAttribute:Tp,blockTextSelection:Pk,unblockTextSelection:Fk,getBoundingClientRect:$c,findPosition:Ph,getPointerPosition:Sp,isTextNode:Bk,emptyEl:_p,normalizeContent:Uk,appendContent:_b,insertContent:jk,isSingleLeftClick:Fh,$:kl,$$:$k,computedStyle:Hc,copyStyleSheetsToWindow:Hk});let Vk=!1,vx;const O4=function(){if(vx.options.autoSetup===!1)return;const s=Array.prototype.slice.call(_t.getElementsByTagName("video")),e=Array.prototype.slice.call(_t.getElementsByTagName("audio")),t=Array.prototype.slice.call(_t.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let n=0,r=i.length;n-1&&(n={passive:!0}),s.addEventListener(e,i.dispatcher,n)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function qn(s,e,t){if(!Jn.has(s))return;const i=Jn.get(s);if(!i.handlers)return;if(Array.isArray(e))return Eb(qn,s,e,t);const n=function(a,u){i.handlers[u]=[],Q2(a,u)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&n(s,a);return}const r=i.handlers[e];if(r){if(!t){n(s,e);return}if(t.guid)for(let a=0;a=e&&(s(...n),t=r)}},Kk=function(s,e,t,i=he){let n;const r=()=>{i.clearTimeout(n),n=null},a=function(){const u=this,c=arguments;let d=function(){n=null,d=null,t||s.apply(u,c)};!n&&t&&s.apply(u,c),i.clearTimeout(n),n=i.setTimeout(d,e)};return a.cancel=r,a};var j4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Jr,bind_:Rs,throttle:Ka,debounce:Kk});let th;class Hr{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},$r(this,e,t),this.addEventListener=i}off(e,t){qn(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},wp(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},wb(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Ep(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Yc(this,e)}queueTrigger(e){th||(th=new Map);const t=e.type||e;let i=th.get(this);i||(i=new Map,th.set(this,i));const n=i.get(t);i.delete(t),he.clearTimeout(n);const r=he.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,th.delete(this)),this.trigger(e)},0);i.set(t,r)}}Hr.prototype.allowedEvents_={};Hr.prototype.addEventListener=Hr.prototype.on;Hr.prototype.removeEventListener=Hr.prototype.off;Hr.prototype.dispatchEvent=Hr.prototype.trigger;const Ap=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,Ao=s=>s instanceof Hr||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),$4=(s,e)=>{Ao(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},Tx=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,C0=(s,e,t)=>{if(!s||!s.nodeName&&!Ao(s))throw new Error(`Invalid target for ${Ap(e)}#${t}; must be a DOM node or evented object.`)},Wk=(s,e,t)=>{if(!Tx(s))throw new Error(`Invalid event type for ${Ap(e)}#${t}; must be a non-empty string or array.`)},Yk=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Ap(e)}#${t}; must be a function.`)},ov=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let n,r,a;return i?(n=s.eventBusEl_,e.length>=3&&e.shift(),[r,a]=e):(n=e[0],r=e[1],a=e[2]),C0(n,s,t),Wk(r,s,t),Yk(a,s,t),a=Rs(s,a),{isTargetingSelf:i,target:n,type:r,listener:a}},Jl=(s,e,t,i)=>{C0(s,s,e),s.nodeName?U4[e](s,t,i):s[e](t,i)},H4={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=ov(this,s,"on");if(Jl(t,"on",i,n),!e){const r=()=>this.off(t,i,n);r.guid=n.guid;const a=()=>this.off("dispose",r);a.guid=n.guid,Jl(this,"on","dispose",r),Jl(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=ov(this,s,"one");if(e)Jl(t,"one",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Jl(t,"one",i,r)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=ov(this,s,"any");if(e)Jl(t,"any",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Jl(t,"any",i,r)}},off(s,e,t){if(!s||Tx(s))qn(this.eventBusEl_,s,e);else{const i=s,n=e;C0(i,this,"off"),Wk(n,this,"off"),Yk(t,this,"off"),t=Rs(this,t),this.off("dispose",t),i.nodeName?(qn(i,n,t),qn(i,"dispose",t)):Ao(i)&&(i.off(n,t),i.off("dispose",t))}},trigger(s,e){C0(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!Tx(t))throw new Error(`Invalid event type for ${Ap(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Yc(this.eventBusEl_,s,e)}};function Ab(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=pi("span",{className:"vjs-event-bus"});return Object.assign(s,H4),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&Jn.has(i)&&Jn.delete(i)}),he.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const z4={state:{},setState(s){typeof s=="function"&&(s=s());let e;return xc(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Ao(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Xk(s,e){return Object.assign(s,z4),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&Ao(s)&&s.on("statechanged",s.handleStateChanged),s}const wh=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},en=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Qk=function(s,e){return en(s)===en(e)};var V4=Object.freeze({__proto__:null,toLowerCase:wh,toTitleCase:en,titleCaseEquals:Qk});class it{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ts({},this.options_),t=this.options_=Ts(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${Zr()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(Ab(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Xk(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ts(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return pi(e,t,i)}localize(e,t,i=e){const n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],u=n&&n.split("-")[0],c=r&&r[u];let d=i;return a&&a[e]?d=a[e]:c&&c[e]&&(d=c[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(f,g){const y=t[g-1];let v=y;return typeof y>"u"&&(v=f),v})),d}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,n)=>i.concat(n),[]);let t=this;for(let i=0;i=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[en(e.name())]=null,this.childNameIndex_[wh(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const u=a.name;let c=a.opts;if(t[u]!==void 0&&(c=t[u]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const d=this.addChild(u,c);d&&(this[u]=d)};let n;const r=it.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(u){return typeof u=="string"?a===u:a===u.name})})).map(a=>{let u,c;return typeof a=="string"?(u=a,c=e[u]||this.options_[u]||{}):(u=a.name,c=a),{name:u,opts:c}}).filter(a=>{const u=it.getComponent(a.opts.componentClass||en(a.name));return u&&!r.isTech(u)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return kl(e,t||this.contentEl())}$$(e,t){return $k(e,t||this.contentEl())}hasClass(e){return Eh(this.el_,e)}addClass(...e){mu(this.el_,...e)}removeClass(...e){bp(this.el_,...e)}toggleClass(e,t){Nk(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Mk(this.el_,e)}setAttribute(e,t){jc(this.el_,e,t)}removeAttribute(e){Tp(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],r=n.indexOf("px");return parseInt(r!==-1?n.slice(0,r):this.el_["offset"+en(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Hc(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${en(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,n=200;let r;this.on("touchstart",function(u){u.touches.length===1&&(t={pageX:u.touches[0].pageX,pageY:u.touches[0].pageY},e=he.performance.now(),r=!0)}),this.on("touchmove",function(u){if(u.touches.length>1)r=!1;else if(t){const c=u.touches[0].pageX-t.pageX,d=u.touches[0].pageY-t.pageY;Math.sqrt(c*c+d*d)>i&&(r=!1)}});const a=function(){r=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(u){t=null,r===!0&&he.performance.now()-e{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),he.clearTimeout(e)),e}setInterval(e,t){e=Rs(this,e),this.clearTimersOnDispose_();const i=he.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),he.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Rs(this,e),t=he.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Rs(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),he.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(r){const a=he.getComputedStyle(r,null),u=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(u)}function i(r){return!(!t(r.parentElement)||!t(r)||r.style.opacity==="0"||he.getComputedStyle(r).height==="0px"||he.getComputedStyle(r).width==="0px")}function n(r){if(r.offsetWidth+r.offsetHeight+r.getBoundingClientRect().height+r.getBoundingClientRect().width===0)return!1;const a={x:r.getBoundingClientRect().left+r.offsetWidth/2,y:r.getBoundingClientRect().top+r.offsetHeight/2};if(a.x<0||a.x>(_t.documentElement.clientWidth||he.innerWidth)||a.y<0||a.y>(_t.documentElement.clientHeight||he.innerHeight))return!1;let u=_t.elementFromPoint(a.x,a.y);for(;u;){if(u===r)return!0;if(u.parentNode)u=u.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=it.getComponent("Tech"),n=i&&i.isTech(t),r=it===t||it.prototype.isPrototypeOf(t.prototype);if(n||!r){let u;throw n?u="techs must be registered using Tech.registerTech()":u="must be a Component subclass",new Error(`Illegal component, "${e}"; ${u}.`)}e=en(e),it.components_||(it.components_={});const a=it.getComponent("Player");if(e==="Player"&&a&&a.players){const u=a.players,c=Object.keys(u);if(u&&c.length>0){for(let d=0;dt)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Z2(s,e,t,i){return G4(s,i,t.length-1),t[i][e]}function lv(s){let e;return s===void 0||s.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:s.length,start:Z2.bind(null,"start",0,s),end:Z2.bind(null,"end",1,s)},he.Symbol&&he.Symbol.iterator&&(e[he.Symbol.iterator]=()=>(s||[]).values()),e}function ga(s,e){return Array.isArray(s)?lv(s):s===void 0||e===void 0?lv():lv([[s,e]])}const Zk=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),n=Math.floor(s/3600);const r=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(n=i=t="-"),n=n>0||a>0?n+":":"",i=((n||r>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,n+i+t};let kb=Zk;function Jk(s){kb=s}function eC(){kb=Zk}function Su(s,e=s){return kb(s,e)}var q4=Object.freeze({__proto__:null,createTimeRanges:ga,createTimeRange:ga,setFormatTime:Jk,resetFormatTime:eC,formatTime:Su});function tC(s,e){let t=0,i,n;if(!e)return 0;(!s||!s.length)&&(s=ga(0,0));for(let r=0;re&&(n=e),t+=n-i;return t/e}function qs(s){if(s instanceof qs)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Ga(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=qs.defaultMessages[this.code]||"")}qs.prototype.code=0;qs.prototype.message="";qs.prototype.status=null;qs.prototype.metadata=null;qs.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];qs.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};qs.MEDIA_ERR_CUSTOM=0;qs.prototype.MEDIA_ERR_CUSTOM=0;qs.MEDIA_ERR_ABORTED=1;qs.prototype.MEDIA_ERR_ABORTED=1;qs.MEDIA_ERR_NETWORK=2;qs.prototype.MEDIA_ERR_NETWORK=2;qs.MEDIA_ERR_DECODE=3;qs.prototype.MEDIA_ERR_DECODE=3;qs.MEDIA_ERR_SRC_NOT_SUPPORTED=4;qs.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;qs.MEDIA_ERR_ENCRYPTED=5;qs.prototype.MEDIA_ERR_ENCRYPTED=5;function Ah(s){return s!=null&&typeof s.then=="function"}function Ba(s){Ah(s)&&s.then(null,e=>{})}const Sx=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,n)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},K4=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=Sx(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(Sx))},W4=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>i.addCue(n))}),e.textTracks()};var _x={textTracksToJson:K4,jsonToTextTracks:W4,trackToJson:Sx};const uv="vjs-modal-dialog";class Xc extends it{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=pi("div",{className:`${uv}-content`},{role:"document"}),this.descEl_=pi("p",{className:`${uv}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ll(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${uv} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),jk(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),_p(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=_t.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let n;for(let r=0;r(t instanceof he.HTMLAnchorElement||t instanceof he.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof he.HTMLInputElement||t instanceof he.HTMLSelectElement||t instanceof he.HTMLTextAreaElement||t instanceof he.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof he.HTMLIFrameElement||t instanceof he.HTMLObjectElement||t instanceof he.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Xc.prototype.options_={pauseOnOpen:!0,temporary:!0};it.registerComponent("ModalDialog",Xc);class _u extends Hr{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},Ao(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,n=this.length;i=0;t--)if(e[t].enabled){cv(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&cv(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,cv(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const dv=function(s,e){for(let t=0;t=0;t--)if(e[t].selected){dv(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,dv(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Cb extends _u{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class Y4{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t0&&(he.console&&he.console.groupCollapsed&&he.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(n=>Fi.error(n)),he.console&&he.console.groupEnd&&he.console.groupEnd()),t.flush()},tE=function(s,e){const t={uri:s},i=kp(s);i&&(t.cors=i);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),ak(t,Rs(this,function(r,a,u){if(r)return Fi.error(r,a);e.loaded_=!0,typeof he.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){Fi.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return eE(u,e)}):eE(u,e)}))};class Qh extends Db{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ts(e,{kind:Z4[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=J2[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const r=new D0(this.cues_),a=new D0(this.activeCues_);let u=!1;this.timeupdateHandler=Rs(this,function(d={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return i},set(d){J2[d]&&i!==d&&(i=d,!this.preload_&&i!=="disabled"&&this.cues.length===0&&tE(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const d=this.tech_.currentTime(),f=[];for(let g=0,y=this.cues.length;g=d&&f.push(v)}if(u=!1,f.length!==this.activeCues_.length)u=!0;else for(let g=0;g{t=Co.LOADED,this.trigger({type:"load",target:this})})}}Co.prototype.allowedEvents_={load:"load"};Co.NONE=0;Co.LOADING=1;Co.LOADED=2;Co.ERROR=3;const Qr={audio:{ListClass:iC,TrackClass:rC,capitalName:"Audio"},video:{ListClass:sC,TrackClass:aC,capitalName:"Video"},text:{ListClass:Cb,TrackClass:Qh,capitalName:"Text"}};Object.keys(Qr).forEach(function(s){Qr[s].getterName=`${s}Tracks`,Qr[s].privateName=`${s}Tracks_`});const zc={remoteText:{ListClass:Cb,TrackClass:Qh,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Y4,TrackClass:Co,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Zn=Object.assign({},Qr,zc);zc.names=Object.keys(zc);Qr.names=Object.keys(Qr);Zn.names=[].concat(zc.names).concat(Qr.names);function eF(s,e,t,i,n={}){const r=s.textTracks();n.kind=e,t&&(n.label=t),i&&(n.language=i),n.tech=s;const a=new Zn.text.TrackClass(n);return r.addTrack(a),a}class Ci extends it{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Zn.names.forEach(i=>{const n=Zn[i];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Zn.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Rs(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return ga(0,0)}bufferedPercent(){return tC(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Qr.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let n=i.length;for(;n--;){const r=i[n];t==="text"&&this.removeRemoteTextTrack(r),i.removeTrack(r)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new qs(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?ga(0,0):ga()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Qr.names.forEach(e=>{const t=Qr[e],i=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),this.on("dispose",()=>{n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!he.WebVTT)if(_t.body.contains(this.el())){if(!this.options_["vtt.js"]&&Uc(w2)&&Object.keys(w2).length>0){this.trigger("vttjsloaded");return}const e=_t.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),he.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=u=>e.addTrack(u.track),n=u=>e.removeTrack(u.track);t.on("addtrack",i),t.on("removetrack",n),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),a=()=>{r();for(let u=0;uthis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Zr();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Ci.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Ci||e instanceof Ci||e===Ci}static registerTech(e,t){if(Ci.techs_||(Ci.techs_={}),!Ci.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Ci.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Ci.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=en(e),Ci.techs_[e]=t,Ci.techs_[wh(e)]=t,e!=="Tech"&&Ci.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(Ci.techs_&&Ci.techs_[e])return Ci.techs_[e];if(e=en(e),he&&he.videojs&&he.videojs[e])return Fi.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),he.videojs[e]}}}Zn.names.forEach(function(s){const e=Zn[s];Ci.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});Ci.prototype.featuresVolumeControl=!0;Ci.prototype.featuresMuteControl=!0;Ci.prototype.featuresFullscreenResize=!1;Ci.prototype.featuresPlaybackRate=!1;Ci.prototype.featuresProgressEvents=!1;Ci.prototype.featuresSourceset=!1;Ci.prototype.featuresTimeupdateEvents=!1;Ci.prototype.featuresNativeTextTracks=!1;Ci.prototype.featuresVideoFrameCallback=!1;Ci.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),i===void 0&&(i=n.length),n.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let n;for(let r=0;rru(e,pu[e.type],t,s),1)}function sF(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function nF(s,e,t){return s.reduceRight(Ib(t),e[t]())}function rF(s,e,t,i){return e[t](s.reduce(Ib(t),i))}function iE(s,e,t,i=null){const n="call"+en(t),r=s.reduce(Ib(n),i),a=r===R0,u=a?null:e[t](r);return lF(s,t,u,a),u}const aF={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},oF={setCurrentTime:1,setMuted:1,setVolume:1},sE={play:1,pause:1};function Ib(s){return(e,t)=>e===R0?R0:t[s]?t[s](e):e}function lF(s,e,t,i){for(let n=s.length-1;n>=0;n--){const r=s[n];r[e]&&r[e](i,t)}}function uF(s){L0.hasOwnProperty(s.id())&&delete L0[s.id()]}function cF(s,e){const t=L0[s.id()];let i=null;if(t==null)return i=e(s),L0[s.id()]=[[e,i]],i;for(let n=0;n{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let n=0;n @@ -213,8 +213,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho -`;const Z2=T0?10009:S0?461:8,ec={codes:{play:415,pause:19,ff:417,rw:412,back:Z2},names:{415:"play",19:"pause",417:"ff",412:"rw",[Z2]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},J2=5;class J4 extends Fr{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(ec.isEventKey(t,"play")||ec.isEventKey(t,"pause")||ec.isEventKey(t,"ff")||ec.isEventKey(t,"rw")){t.preventDefault();const i=ec.getEventName(t);this.performMediaAction_(i)}else ec.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+J2);break;case"rw":this.userSeek_(this.player_.currentTime()-J2);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const n=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(n){for(const r of n)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&i(r.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?i(n.children_):n.hasOwnProperty("items")&&n.items.length>0?i(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const r=n.el_.querySelector(".vjs-errors-ok-button-container");r&&r.querySelectorAll("button").forEach((u,c)=>{t.push({name:()=>"ModalButton"+(c+1),el:()=>u,getPositions:()=>{const d=u.getBoundingClientRect(),f={x:d.x,y:d.y,width:d.width,height:d.height,top:d.top,right:d.right,bottom:d.bottom,left:d.left},p={x:d.left+d.width/2,y:d.top+d.height/2,width:0,height:0,top:d.top+d.height/2,right:d.left+d.width/2,bottom:d.top+d.height/2,left:d.left+d.width/2};return{boundingClientRect:f,center:p}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:d=>!0,focus:()=>u.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let n=0;n0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,n,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let n=1/0,r=null;for(const a of t){const u=a.getPositions().center,c=this.calculateDistance_(e,u,i);c=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Oi.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const n=li(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(li("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=li("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Dl(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Xe.registerComponent("ClickableComponent",Ep);class Tx extends Ep{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return li("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(li("picture",{className:"vjs-poster",tabIndex:-1},{},li("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Na(this.player_.play()):this.player_.pause())}}Tx.prototype.crossorigin=Tx.prototype.crossOrigin;Xe.registerComponent("PosterImage",Tx);const Vr="#222",eE="#ccc",tB={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function lv(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function wa(s,e,t){try{s.style[e]=t}catch{return}}function tE(s){return s?`${s}px`:""}class iB extends Xe{constructor(e,t,i){super(e,t,i);const n=a=>this.updateDisplay(a),r=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",n),e.on("userinactive",n),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(ks(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);const a=de.screen.orientation||de,u=de.screen.orientation?"change":"orientationchange";a.addEventListener(u,r),e.on("dispose",()=>a.removeEventListener(u,r));const c=this.options_.playerOptions.tracks||[];for(let d=0;d0&&u.forEach(f=>{if(f.style.inset){const p=f.style.inset.split(" ");p.length===3&&Object.assign(f.style,{top:p[0],right:p[1],bottom:p[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!de.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let r=0,a=0;Math.abs(i-n)>.1&&(i>n?r=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),wa(this.el_,"insetInline",tE(r)),wa(this.el_,"insetBlock",tE(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let n=i.length;for(;n--;){const r=i[n];if(!r)continue;const a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&wa(a.firstChild,"color",lv(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&wa(a.firstChild,"backgroundColor",lv(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?wa(a,"backgroundColor",lv(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Vr}, 2px 2px 4px ${Vr}, 2px 2px 5px ${Vr}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Vr}, 2px 2px ${Vr}, 3px 3px ${Vr}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${eE}, 0 1px ${eE}, -1px -1px ${Vr}, 0 -1px ${Vr}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Vr}, 0 0 4px ${Vr}, 0 0 4px ${Vr}, 0 0 4px ${Vr}`)),t.fontPercent&&t.fontPercent!==1){const u=de.parseFloat(a.style.fontSize);a.style.fontSize=u*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=tB[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof de.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;ithis.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Na(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const r=()=>n.focus();wh(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Jk.prototype.controlText_="Play Video";Xe.registerComponent("BigPlayButton",Jk);class nB extends Hn{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}Xe.registerComponent("CloseButton",nB);class eC extends Hn{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Na(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}eC.prototype.controlText_="Play";Xe.registerComponent("PlayToggle",eC);class Yc extends Xe{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=li("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=li("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Tu(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Oi.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=yt.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Yc.prototype.labelText_="Time";Yc.prototype.controlText_="Time";Xe.registerComponent("TimeDisplay",Yc);class Lb extends Yc{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Lb.prototype.labelText_="Current Time";Lb.prototype.controlText_="Current Time";Xe.registerComponent("CurrentTimeDisplay",Lb);class Rb extends Yc{constructor(e,t){super(e,t);const i=n=>this.updateContent(n);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Rb.prototype.labelText_="Duration";Rb.prototype.controlText_="Duration";Xe.registerComponent("DurationDisplay",Rb);class rB extends Xe{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}Xe.registerComponent("TimeDivider",rB);class Ib extends Yc{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(li("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Ib.prototype.labelText_="Remaining Time";Ib.prototype.controlText_="Remaining Time";Xe.registerComponent("RemainingTimeDisplay",Ib);class aB extends Xe{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=li("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(li("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(yt.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}Xe.registerComponent("LiveDisplay",aB);class tC extends Hn{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=li("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}tC.prototype.controlText_="Seek to live, currently playing live";Xe.registerComponent("SeekToLive",tC);function Xh(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var oB=Object.freeze({__proto__:null,clamp:Xh});class Nb extends Xe{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!za&&e.preventDefault(),kk(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Ck(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Xh(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=vp(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,n=t&&t.horizontalSeek;i?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}Xe.registerComponent("Slider",Nb);const uv=(s,e)=>Xh(s/e*100,0,100).toFixed(2)+"%";class lB extends Xe{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=li("span",{className:"vjs-control-text"}),i=li("span",{textContent:this.localize("Loaded")}),n=yt.createTextNode(": ");return this.percentageEl_=li("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,u=uv(r,n);this.percent_!==u&&(this.el_.style.width=u,Dl(this.percentageEl_,u),this.percent_=u);for(let c=0;ci.length;c--)this.el_.removeChild(a[c-1]);a.length=i.length})}}Xe.registerComponent("LoadProgressBar",lB);class uB extends Xe{constructor(e,t){super(e,t),this.update=Va(ks(this,this.update),Yr)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const n=Oh(this.el_),r=Uc(this.player_.el()),a=e.width*t;if(!r||!n)return;let u=e.left-r.left+a,c=e.width-a+(r.right-e.right);c||(c=e.width-a,u=a);let d=n.width/2;un.width&&(d=n.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(i)}write(e){Dl(this.el_,e)}updateTime(e,t,i,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const u=this.player_.liveTracker.liveWindow(),c=u-t*u;r=(c<1?"":"-")+Tu(c,u)}else r=Tu(i,a);this.update(e,t,r),n&&n()})}}Xe.registerComponent("TimeTooltip",uB);class Ob extends Xe{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Va(ks(this,this.update),Yr)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const n=this.getChild("timeTooltip");if(!n)return;const r=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}Ob.prototype.options_={children:[]};!jn&&!ha&&Ob.prototype.options_.children.push("timeTooltip");Xe.registerComponent("PlayProgressBar",Ob);class iC extends Xe{constructor(e,t){super(e,t),this.update=Va(ks(this,this.update),Yr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}iC.prototype.options_={children:["timeTooltip"]};Xe.registerComponent("MouseTimeDisplay",iC);class wp extends Nb{constructor(e,t){t=ps(wp.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(jn||ha)||e.options_.disableSeekWhileScrubbingOnSTV;(!jn&&!ha||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=ks(this,this.update),this.update=Va(this.update_,Yr),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in yt&&"visibilityState"in yt&&this.on(yt,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){yt.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Yr))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(yt.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let r=this.player_.duration();n&&n.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Tu(i,r),Tu(r,r)],"{1} of {2}")),this.currentTime_=i,this.duration_=r),this.bar&&this.bar.update(Uc(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Mh(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Mh(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const n=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive())i=n*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(n>=.99){r.seekToLiveEdge();return}const a=r.seekableStart(),u=r.liveCurrentTime();if(i=a+n*r.liveWindow(),i>=u&&(i=u),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Na(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in yt&&"visibilityState"in yt&&this.off(yt,"visibilitychange",this.toggleVisibility_),super.dispose()}}wp.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};Xe.registerComponent("SeekBar",wp);class sC extends Xe{constructor(e,t){super(e,t),this.handleMouseMove=Va(ks(this,this.handleMouseMove),Yr),this.throttledHandleMouseSeek=Va(ks(this,this.handleMouseSeek),Yr),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!i&&!n)return;const r=t.el(),a=Oh(r);let u=vp(r,e).x;u=Xh(u,0,1),n&&n.update(a,u),i&&i.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Na(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}sC.prototype.options_={children:["seekBar"]};Xe.registerComponent("ProgressControl",sC);class nC extends Hn{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){yt.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in de?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof yt.exitPictureInPicture=="function"&&super.show()}}nC.prototype.controlText_="Picture-in-Picture";Xe.registerComponent("PictureInPictureToggle",nC);class rC extends Hn{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),yt[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}rC.prototype.controlText_="Fullscreen";Xe.registerComponent("FullscreenToggle",rC);const cB=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class dB extends Xe{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}Xe.registerComponent("VolumeLevel",dB);class hB extends Xe{constructor(e,t){super(e,t),this.update=Va(ks(this,this.update),Yr)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,n){if(!i){const r=Uc(this.el_),a=Uc(this.player_.el()),u=e.width*t;if(!a||!r)return;const c=e.left-a.left+u,d=e.width-u+(a.right-e.right);let f=r.width/2;cr.width&&(f=r.width),this.el_.style.right=`-${f}px`}this.write(`${n}%`)}write(e){Dl(this.el_,e)}updateVolume(e,t,i,n,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,n.toFixed(0)),r&&r()})}}Xe.registerComponent("VolumeLevelTooltip",hB);class aC extends Xe{constructor(e,t){super(e,t),this.update=Va(ks(this,this.update),Yr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,n,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}aC.prototype.options_={children:["volumeLevelTooltip"]};Xe.registerComponent("MouseVolumeLevelDisplay",aC);class Ap extends Nb{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Mh(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),n=Uc(i),r=this.vertical();let a=vp(i,e);a=r?a.y:a.x,a=Xh(a,0,1),t.update(n,a,r)}Mh(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Ap.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!jn&&!ha&&Ap.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Ap.prototype.playerEvent="volumechange";Xe.registerComponent("VolumeBar",Ap);class oC extends Xe{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Bc(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),cB(this,e),this.throttledHandleMouseMove=Va(ks(this,this.handleMouseMove),Yr),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}oC.prototype.options_={children:["volumeBar"]};Xe.registerComponent("VolumeControl",oC);const fB=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class lC extends Hn{constructor(e,t){super(e,t),fB(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),jn&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),gp(this.el_,[0,1,2,3].reduce((i,n)=>i+`${n?" ":""}vjs-vol-${n}`,"")),fu(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}lC.prototype.controlText_="Mute";Xe.registerComponent("MuteToggle",lC);class uC extends Xe{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Bc(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Br(yt,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),$n(yt,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}uC.prototype.options_={children:["muteToggle","volumeControl"]};Xe.registerComponent("VolumePanel",uC);class cC extends Hn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;t+this.skipTime<=n?r=t+this.skipTime:r=n,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}cC.prototype.controlText_="Skip Forward";Xe.registerComponent("SkipForward",cC);class dC extends Hn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()&&i.seekableStart();let r;n&&t-this.skipTime<=n?r=n:t>=this.skipTime?r=t-this.skipTime:r=0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}dC.prototype.controlText_="Skip Backward";Xe.registerComponent("SkipBackward",dC);class hC extends Xe{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof Xe&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Xe&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=li(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),Br(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||yt.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(n=>n.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}Xe.registerComponent("Menu",hC);class Mb extends Xe{constructor(e,t={}){super(e,t),this.menuButton_=new Hn(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Hn.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=r=>this.handleClick(r);this.handleMenuKeyUp_=r=>this.handleMenuKeyUp(r),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",r=>this.handleKeyDown(r)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Br(yt,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",r=>this.handleMouseLeave(r)),this.on("keydown",r=>this.handleSubmenuKeyDown(r))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new hC(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=li("li",{className:"vjs-menu-title",textContent:Xs(this.options_.title),tabIndex:-1}),i=new Xe(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,u)},a=(...u)=>{this.handleSelectedLanguageChange.apply(this,u)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let u;this.on(["tap","click"],function(){if(typeof de.Event!="object")try{u=new de.Event("change")}catch{}u||(u=yt.createEvent("Event"),u.initEvent("change",!0,!0)),n.dispatchEvent(u)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let n=0;n-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}Xe.registerComponent("OffTextTrackMenuItem",fC);class Xc extends Pb{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Zh){let i;this.label_&&(i=`${this.label_} off`),e.push(new fC(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r-1){const u=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});u.addClass(`vjs-${a.kind}-menu-item`),e.push(u)}}return e}}Xe.registerComponent("TextTrackButton",Xc);class mC extends Qh{constructor(e,t){const i=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Xs(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,n=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Xs(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new jb(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,pC),e}}Hb.prototype.kinds_=["captions","subtitles"];Hb.prototype.controlText_="Subtitles";Xe.registerComponent("SubsCapsButton",Hb);class gC extends Qh{constructor(e,t){const i=t.track,n=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",r),this.on("dispose",()=>{n.removeEventListener("change",r)})}createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(li("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(li("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;ithis.update(r))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}zb.prototype.contentElType="button";Xe.registerComponent("PlaybackRateMenuItem",zb);class vC extends Mb{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=li("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new zb(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}vC.prototype.controlText_="Playback Rate";Xe.registerComponent("PlaybackRateMenuButton",vC);class xC extends Xe{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Xe.registerComponent("Spacer",xC);class mB extends xC{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Xe.registerComponent("CustomControlSpacer",mB);class bC extends Xe{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}bC.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};Xe.registerComponent("ControlBar",bC);class TC extends Wc{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}TC.prototype.options_=Object.assign({},Wc.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Xe.registerComponent("ErrorDisplay",TC);class SC extends Xe{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),li("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Wr()}`)+"-"+t[1].replace(/\W+/g,""),n=li("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),n}))}}Xe.registerComponent("TextTrackSelect",SC);class pu extends Xe{constructor(e,t={}){super(e,t);const i=li("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const n=this.options_.selects;for(const r of n){const a=this.options_.selectConfigs[r],u=a.className,c=a.id.replace("%s",this.options_.id_);let d=null;const f=`vjs_select_${Wr()}`;if(this.options_.type==="colors"){d=li("span",{className:u});const y=li("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});y.setAttribute("for",f),d.appendChild(y)}const p=new SC(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:f,labelId:c});this.addChild(p),this.options_.type==="colors"&&(d.appendChild(p.el()),this.el().appendChild(d))}}createEl(){return li("fieldset",{className:this.options_.className})}}Xe.registerComponent("TextTrackFieldset",pu);class _C extends Xe{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new pu(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const r=new pu(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const a=new pu(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return li("div",{className:"vjs-track-settings-colors"})}}Xe.registerComponent("TextTrackSettingsColors",_C);class EC extends Xe{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new pu(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const r=new pu(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const a=new pu(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return li("div",{className:"vjs-track-settings-font"})}}Xe.registerComponent("TextTrackSettingsFont",EC);class wC extends Xe{constructor(e,t={}){super(e,t);const i=new Hn(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const n=this.localize("Done"),r=new Hn(e,{controlText:n,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=n,this.addChild(r)}createEl(){return li("div",{className:"vjs-track-settings-controls"})}}Xe.registerComponent("TrackSettingsControls",wC);const cv="vjs-text-track-settings",iE=["#000","Black"],sE=["#00F","Blue"],nE=["#0FF","Cyan"],rE=["#0F0","Green"],aE=["#F0F","Magenta"],oE=["#F00","Red"],lE=["#FFF","White"],uE=["#FF0","Yellow"],dv=["1","Opaque"],hv=["0.5","Semi-Transparent"],cE=["0","Transparent"],yl={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[iE,lE,oE,rE,sE,uE,aE,nE],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[dv,hv,cE],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[lE,iE,oE,rE,sE,uE,aE,nE],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[dv,hv],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[cE,hv,dv],className:"vjs-window-opacity vjs-opacity"}};yl.windowColor.options=yl.backgroundColor.options;function AC(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function pB(s,e){const t=s.options[s.options.selectedIndex].value;return AC(t,e)}function gB(s,e,t){if(e){for(let i=0;i{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),yc(yl,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return pk(yl,(e,t,i)=>{const n=pB(this.$(t.selector),t.parser);return n!==void 0&&(e[i]=n),e},{})}setValues(e){yc(yl,(t,i)=>{gB(this.$(t.selector),e[i],t.parser)})}setDefaults(){yc(yl,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(de.localStorage.getItem(cv))}catch(t){Oi.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?de.localStorage.setItem(cv,JSON.stringify(e)):de.localStorage.removeItem(cv)}catch(t){Oi.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}Xe.registerComponent("TextTrackSettings",yB);class vB extends Xe{constructor(e,t){let i=t.ResizeObserver||de.ResizeObserver;t.ResizeObserver===null&&(i=!1);const n=ps({createEl:!i,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||de.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Fk(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const r=this.debouncedHandler_;let a=this.unloadListener_=function(){$n(this,"resize",r),$n(this,"unload",a),a=null};Br(this.el_.contentWindow,"unload",a),Br(this.el_.contentWindow,"resize",r)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}Xe.registerComponent("ResizeManager",vB);const xB={trackingThreshold:20,liveTolerance:15};class bB extends Xe{constructor(e,t){const i=ps(xB,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(de.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const n=this.liveCurrentTime(),r=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Yr),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}Xe.registerComponent("LiveTracker",bB);class TB extends Xe{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:li("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Wr()}`}),description:li("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Wr()}`})},li("div",{className:"vjs-title-bar"},{},gk(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const r=this.state[n],a=this.els[n],u=i[n];xp(a),r&&Dl(a,r),t&&(t.removeAttribute(u),r&&t.setAttribute(u,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}Xe.registerComponent("TitleBar",TB);const SB={initialDisplay:4e3,position:[],takeFocus:!1};class _B extends Hn{constructor(e,t){t=ps(SB,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=li("button",{},{type:"button",class:this.buildCSSClass()},li("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}Xe.registerComponent("TransientButton",_B);const Sx=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let n="";if(!t.length)return!1;for(let r=0;r{let t={};for(let i=0;ikC([s.el(),de.HTMLMediaElement.prototype,de.Element.prototype,EB],"innerHTML"),dE=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=wB(s),n=r=>(...a)=>{const u=r.apply(e,a);return Sx(s),u};["append","appendChild","insertAdjacentHTML"].forEach(r=>{e[r]&&(t[r]=e[r],e[r]=n(t[r]))}),Object.defineProperty(e,"innerHTML",ps(i,{set:n(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(r=>{e[r]=t[r]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},AB=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Yk(de.Element.prototype.getAttribute.call(this,"src")):""},set(s){return de.Element.prototype.setAttribute.call(this,"src",s),s}}),kB=s=>kC([s.el(),de.HTMLMediaElement.prototype,AB],"src"),CB=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=kB(s),i=e.setAttribute,n=e.load;Object.defineProperty(e,"src",ps(t,{set:r=>{const a=t.set.call(e,r);return s.triggerSourceset(e.src),a}})),e.setAttribute=(r,a)=>{const u=i.call(e,r,a);return/src/i.test(r)&&s.triggerSourceset(e.src),u},e.load=()=>{const r=n.call(e);return Sx(s)||(s.triggerSourceset(""),dE(s)),r},e.currentSrc?s.triggerSourceset(e.currentSrc):Sx(s)||dE(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Rt extends ki{constructor(e,t){super(e,t);const i=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const r=this.el_.childNodes;let a=r.length;const u=[];for(;a--;){const c=r[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!n&&!this.el_.hasAttribute("crossorigin")&&_p(c.src)&&(n=!0)):u.push(c))}for(let c=0;c{t=[];for(let r=0;re.removeEventListener("change",i));const n=()=>{for(let r=0;r{e.removeEventListener("change",i),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(n=>{this.el()[`${i}Tracks`].removeEventListener(n,this[`${i}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Kr[e],i=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:u=>{const c={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(c),e==="text"&&this[$c.remoteText.getterName]().trigger(c)},addtrack(u){n.addTrack(u.track)},removetrack(u){n.removeTrack(u.track)}},a=function(){const u=[];for(let c=0;c{const c=r[u];i.addEventListener(u,c),this.on("dispose",d=>i.removeEventListener(u,c))}),this.on("loadstart",a),this.on("dispose",u=>this.off("loadstart",a))}proxyNativeTracks_(){Kr.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),Rt.disposeMediaElement(e),e=i}else{e=yt.createElement("video");const i=this.options_.tag&&gl(this.options_.tag),n=ps({},i);(!Nh||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,wk(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Fc(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&pp?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Oi(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ha&&za&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Na(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Oi.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const n=li("source",{},i);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return Oi.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Oi.warn(`No matching source element found with src: ${e}`),!1}reset(){Rt.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=yt.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),de.performance&&(e.creationTime=de.performance.now()),e}}dp(Rt,"TEST_VID",function(){if(!Gc())return;const s=yt.createElement("video"),e=yt.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});Rt.isSupported=function(){try{Rt.TEST_VID.volume=.5}catch{return!1}return!!(Rt.TEST_VID&&Rt.TEST_VID.canPlayType)};Rt.canPlayType=function(s){return Rt.TEST_VID.canPlayType(s)};Rt.canPlaySource=function(s,e){return Rt.canPlayType(s.type)};Rt.canControlVolume=function(){try{const s=Rt.TEST_VID.volume;Rt.TEST_VID.volume=s/2+.1;const e=s!==Rt.TEST_VID.volume;return e&&jn?(de.setTimeout(()=>{Rt&&Rt.prototype&&(Rt.prototype.featuresVolumeControl=s!==Rt.TEST_VID.volume)}),!1):e}catch{return!1}};Rt.canMuteVolume=function(){try{const s=Rt.TEST_VID.muted;return Rt.TEST_VID.muted=!s,Rt.TEST_VID.muted?Fc(Rt.TEST_VID,"muted","muted"):yp(Rt.TEST_VID,"muted","muted"),s!==Rt.TEST_VID.muted}catch{return!1}};Rt.canControlPlaybackRate=function(){if(ha&&za&&hp<58)return!1;try{const s=Rt.TEST_VID.playbackRate;return Rt.TEST_VID.playbackRate=s/2+.1,s!==Rt.TEST_VID.playbackRate}catch{return!1}};Rt.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(yt.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(yt.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(yt.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(yt.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};Rt.supportsNativeTextTracks=function(){return pp||jn&&za};Rt.supportsNativeVideoTracks=function(){return!!(Rt.TEST_VID&&Rt.TEST_VID.videoTracks)};Rt.supportsNativeAudioTracks=function(){return!!(Rt.TEST_VID&&Rt.TEST_VID.audioTracks)};Rt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([s,e]){dp(Rt.prototype,s,()=>Rt[e](),!0)});Rt.prototype.featuresVolumeControl=Rt.canControlVolume();Rt.prototype.movingMediaElementInDOM=!jn;Rt.prototype.featuresFullscreenResize=!0;Rt.prototype.featuresProgressEvents=!0;Rt.prototype.featuresTimeupdateEvents=!0;Rt.prototype.featuresVideoFrameCallback=!!(Rt.TEST_VID&&Rt.TEST_VID.requestVideoFrameCallback);Rt.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()}};Rt.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){Rt.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){Rt.prototype["set"+Xs(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){Rt.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){Rt.prototype["set"+Xs(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){Rt.prototype[s]=function(){return this.el_[s]()}});ki.withSourceHandlers(Rt);Rt.nativeSourceHandler={};Rt.nativeSourceHandler.canPlayType=function(s){try{return Rt.TEST_VID.canPlayType(s)}catch{return""}};Rt.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return Rt.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Cb(s.src);return Rt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Rt.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};Rt.nativeSourceHandler.dispose=function(){};Rt.registerSourceHandler(Rt.nativeSourceHandler);ki.registerTech("Html5",Rt);const CC=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],fv={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},_x=["tiny","xsmall","small","medium","large","xlarge","huge"],Xm={};_x.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;Xm[s]=`vjs-layout-${e}`});const DB={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let Ps=class uc extends Xe{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Wr()}`,t=Object.assign(uc.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=fk(this.id_),this.fsApi_=v0,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&gl(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(u){a[u.toLowerCase()]=t.languages[u]}),this.languages_=a}else this.languages_=uc.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),_b(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Br(yt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=ps(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const u=new de.DOMParser().parseFromString(Z4,"image/svg+xml");if(u.querySelector("parsererror"))Oi.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const d=u.documentElement;d.style.display="none",this.el_.appendChild(d),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new J4(this),this.addClass("vjs-spatial-navigation-enabled")),Nh&&this.addClass("vjs-touch-enabled"),jn||this.addClass("vjs-workinghover"),uc.players[this.id_]=this;const r=hx.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),$n(yt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),$n(yt,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),uc.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),W4(this),Yn.names.forEach(e=>{const t=Yn[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const r=gl(e);if(n){for(t=this.el_=e,e=this.tag=yt.createElement("video");t.children.length;)e.appendChild(t.firstChild);_h(t,"video-js")||fu(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),r.tabindex="-1",za&&fp&&(e.setAttribute("role","application"),r.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(c){n&&c==="class"||t.setAttribute(c,r[c]),n&&e.setAttribute(c,r[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>Tk[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),de.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Pk("vjs-styles-dimensions");const c=Al(".vjs-styles-defaults"),d=Al("head");d.insertBefore(this.styleEl_,c?c.nextSibling:d.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const u=e.getElementsByTagName("a");for(let c=0;c"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Oi.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){Oi.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,wo(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),A4(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(de.VIDEOJS_NO_DYNAMIC_STYLE===!0){const u=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(u>=0&&(d.width=u),c>=0&&(d.height=c));return}let e,t,i,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const r=i.split(":"),a=r[1]/r[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),Bk(this.styleEl_,` +`;const rE=w0?10009:A0?461:8,ic={codes:{play:415,pause:19,ff:417,rw:412,back:rE},names:{415:"play",19:"pause",417:"ff",412:"rw",[rE]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},aE=5;class mF extends Hr{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(ic.isEventKey(t,"play")||ic.isEventKey(t,"pause")||ic.isEventKey(t,"ff")||ic.isEventKey(t,"rw")){t.preventDefault();const i=ic.getEventName(t);this.performMediaAction_(i)}else ic.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+aE);break;case"rw":this.userSeek_(this.player_.currentTime()-aE);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const n=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(n){for(const r of n)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&i(r.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?i(n.children_):n.hasOwnProperty("items")&&n.items.length>0?i(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const r=n.el_.querySelector(".vjs-errors-ok-button-container");r&&r.querySelectorAll("button").forEach((u,c)=>{t.push({name:()=>"ModalButton"+(c+1),el:()=>u,getPositions:()=>{const d=u.getBoundingClientRect(),f={x:d.x,y:d.y,width:d.width,height:d.height,top:d.top,right:d.right,bottom:d.bottom,left:d.left},g={x:d.left+d.width/2,y:d.top+d.height/2,width:0,height:0,top:d.top+d.height/2,right:d.left+d.width/2,bottom:d.top+d.height/2,left:d.left+d.width/2};return{boundingClientRect:f,center:g}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:d=>!0,focus:()=>u.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let n=0;n0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,n,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let n=1/0,r=null;for(const a of t){const u=a.getPositions().center,c=this.calculateDistance_(e,u,i);c=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Fi.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const n=pi(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(pi("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=pi("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ll(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}it.registerComponent("ClickableComponent",Cp);class Ex extends Cp{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return pi("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(pi("picture",{className:"vjs-poster",tabIndex:-1},{},pi("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Ba(this.player_.play()):this.player_.pause())}}Ex.prototype.crossorigin=Ex.prototype.crossOrigin;it.registerComponent("PosterImage",Ex);const Wr="#222",oE="#ccc",gF={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function hv(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function La(s,e,t){try{s.style[e]=t}catch{return}}function lE(s){return s?`${s}px`:""}class yF extends it{constructor(e,t,i){super(e,t,i);const n=a=>this.updateDisplay(a),r=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",n),e.on("userinactive",n),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Rs(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);const a=he.screen.orientation||he,u=he.screen.orientation?"change":"orientationchange";a.addEventListener(u,r),e.on("dispose",()=>a.removeEventListener(u,r));const c=this.options_.playerOptions.tracks||[];for(let d=0;d0&&u.forEach(f=>{if(f.style.inset){const g=f.style.inset.split(" ");g.length===3&&Object.assign(f.style,{top:g[0],right:g[1],bottom:g[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!he.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let r=0,a=0;Math.abs(i-n)>.1&&(i>n?r=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),La(this.el_,"insetInline",lE(r)),La(this.el_,"insetBlock",lE(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let n=i.length;for(;n--;){const r=i[n];if(!r)continue;const a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&La(a.firstChild,"color",hv(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&La(a.firstChild,"backgroundColor",hv(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?La(a,"backgroundColor",hv(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Wr}, 2px 2px 4px ${Wr}, 2px 2px 5px ${Wr}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Wr}, 2px 2px ${Wr}, 3px 3px ${Wr}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${oE}, 0 1px ${oE}, -1px -1px ${Wr}, 0 -1px ${Wr}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Wr}, 0 0 4px ${Wr}, 0 0 4px ${Wr}, 0 0 4px ${Wr}`)),t.fontPercent&&t.fontPercent!==1){const u=he.parseFloat(a.style.fontSize);a.style.fontSize=u*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=gF[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof he.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;ithis.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Ba(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const r=()=>n.focus();Ah(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}lC.prototype.controlText_="Play Video";it.registerComponent("BigPlayButton",lC);class xF extends Kn{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}it.registerComponent("CloseButton",xF);class uC extends Kn{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Ba(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}uC.prototype.controlText_="Play";it.registerComponent("PlayToggle",uC);class Qc extends it{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=pi("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=pi("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Su(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Fi.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=_t.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Qc.prototype.labelText_="Time";Qc.prototype.controlText_="Time";it.registerComponent("TimeDisplay",Qc);class Nb extends Qc{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Nb.prototype.labelText_="Current Time";Nb.prototype.controlText_="Current Time";it.registerComponent("CurrentTimeDisplay",Nb);class Ob extends Qc{constructor(e,t){super(e,t);const i=n=>this.updateContent(n);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Ob.prototype.labelText_="Duration";Ob.prototype.controlText_="Duration";it.registerComponent("DurationDisplay",Ob);class bF extends it{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}it.registerComponent("TimeDivider",bF);class Mb extends Qc{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(pi("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Mb.prototype.labelText_="Remaining Time";Mb.prototype.controlText_="Remaining Time";it.registerComponent("RemainingTimeDisplay",Mb);class TF extends it{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=pi("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(pi("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(_t.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}it.registerComponent("LiveDisplay",TF);class cC extends Kn{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=pi("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}cC.prototype.controlText_="Seek to live, currently playing live";it.registerComponent("SeekToLive",cC);function Zh(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var SF=Object.freeze({__proto__:null,clamp:Zh});class Pb extends it{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!qa&&e.preventDefault(),Pk(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Fk(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Zh(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Sp(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,n=t&&t.horizontalSeek;i?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}it.registerComponent("Slider",Pb);const fv=(s,e)=>Zh(s/e*100,0,100).toFixed(2)+"%";class _F extends it{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=pi("span",{className:"vjs-control-text"}),i=pi("span",{textContent:this.localize("Loaded")}),n=_t.createTextNode(": ");return this.percentageEl_=pi("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,u=fv(r,n);this.percent_!==u&&(this.el_.style.width=u,Ll(this.percentageEl_,u),this.percent_=u);for(let c=0;ci.length;c--)this.el_.removeChild(a[c-1]);a.length=i.length})}}it.registerComponent("LoadProgressBar",_F);class EF extends it{constructor(e,t){super(e,t),this.update=Ka(Rs(this,this.update),Jr)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const n=Ph(this.el_),r=$c(this.player_.el()),a=e.width*t;if(!r||!n)return;let u=e.left-r.left+a,c=e.width-a+(r.right-e.right);c||(c=e.width-a,u=a);let d=n.width/2;un.width&&(d=n.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(i)}write(e){Ll(this.el_,e)}updateTime(e,t,i,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const u=this.player_.liveTracker.liveWindow(),c=u-t*u;r=(c<1?"":"-")+Su(c,u)}else r=Su(i,a);this.update(e,t,r),n&&n()})}}it.registerComponent("TimeTooltip",EF);class Fb extends it{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Ka(Rs(this,this.update),Jr)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const n=this.getChild("timeTooltip");if(!n)return;const r=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}Fb.prototype.options_={children:[]};!Gn&&!ya&&Fb.prototype.options_.children.push("timeTooltip");it.registerComponent("PlayProgressBar",Fb);class dC extends it{constructor(e,t){super(e,t),this.update=Ka(Rs(this,this.update),Jr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}dC.prototype.options_={children:["timeTooltip"]};it.registerComponent("MouseTimeDisplay",dC);class Dp extends Pb{constructor(e,t){t=Ts(Dp.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(Gn||ya)||e.options_.disableSeekWhileScrubbingOnSTV;(!Gn&&!ya||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Rs(this,this.update),this.update=Ka(this.update_,Jr),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in _t&&"visibilityState"in _t&&this.on(_t,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){_t.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Jr))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(_t.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let r=this.player_.duration();n&&n.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Su(i,r),Su(r,r)],"{1} of {2}")),this.currentTime_=i,this.duration_=r),this.bar&&this.bar.update($c(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Fh(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Fh(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const n=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive())i=n*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(n>=.99){r.seekToLiveEdge();return}const a=r.seekableStart(),u=r.liveCurrentTime();if(i=a+n*r.liveWindow(),i>=u&&(i=u),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Ba(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in _t&&"visibilityState"in _t&&this.off(_t,"visibilitychange",this.toggleVisibility_),super.dispose()}}Dp.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};it.registerComponent("SeekBar",Dp);class hC extends it{constructor(e,t){super(e,t),this.handleMouseMove=Ka(Rs(this,this.handleMouseMove),Jr),this.throttledHandleMouseSeek=Ka(Rs(this,this.handleMouseSeek),Jr),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!i&&!n)return;const r=t.el(),a=Ph(r);let u=Sp(r,e).x;u=Zh(u,0,1),n&&n.update(a,u),i&&i.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Ba(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}hC.prototype.options_={children:["seekBar"]};it.registerComponent("ProgressControl",hC);class fC extends Kn{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){_t.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in he?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof _t.exitPictureInPicture=="function"&&super.show()}}fC.prototype.controlText_="Picture-in-Picture";it.registerComponent("PictureInPictureToggle",fC);class mC extends Kn{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),_t[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}mC.prototype.controlText_="Fullscreen";it.registerComponent("FullscreenToggle",mC);const wF=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class AF extends it{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}it.registerComponent("VolumeLevel",AF);class kF extends it{constructor(e,t){super(e,t),this.update=Ka(Rs(this,this.update),Jr)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,n){if(!i){const r=$c(this.el_),a=$c(this.player_.el()),u=e.width*t;if(!a||!r)return;const c=e.left-a.left+u,d=e.width-u+(a.right-e.right);let f=r.width/2;cr.width&&(f=r.width),this.el_.style.right=`-${f}px`}this.write(`${n}%`)}write(e){Ll(this.el_,e)}updateVolume(e,t,i,n,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,n.toFixed(0)),r&&r()})}}it.registerComponent("VolumeLevelTooltip",kF);class pC extends it{constructor(e,t){super(e,t),this.update=Ka(Rs(this,this.update),Jr)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,n,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}pC.prototype.options_={children:["volumeLevelTooltip"]};it.registerComponent("MouseVolumeLevelDisplay",pC);class Lp extends Pb{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Fh(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),n=$c(i),r=this.vertical();let a=Sp(i,e);a=r?a.y:a.x,a=Zh(a,0,1),t.update(n,a,r)}Fh(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Lp.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Gn&&!ya&&Lp.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Lp.prototype.playerEvent="volumechange";it.registerComponent("VolumeBar",Lp);class gC extends it{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Uc(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),wF(this,e),this.throttledHandleMouseMove=Ka(Rs(this,this.handleMouseMove),Jr),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gC.prototype.options_={children:["volumeBar"]};it.registerComponent("VolumeControl",gC);const CF=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class yC extends Kn{constructor(e,t){super(e,t),CF(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),Gn&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),bp(this.el_,[0,1,2,3].reduce((i,n)=>i+`${n?" ":""}vjs-vol-${n}`,"")),mu(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}yC.prototype.controlText_="Mute";it.registerComponent("MuteToggle",yC);class vC extends it{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Uc(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),$r(_t,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),qn(_t,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}vC.prototype.options_={children:["muteToggle","volumeControl"]};it.registerComponent("VolumePanel",vC);class xC extends Kn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;t+this.skipTime<=n?r=t+this.skipTime:r=n,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}xC.prototype.controlText_="Skip Forward";it.registerComponent("SkipForward",xC);class bC extends Kn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()&&i.seekableStart();let r;n&&t-this.skipTime<=n?r=n:t>=this.skipTime?r=t-this.skipTime:r=0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}bC.prototype.controlText_="Skip Backward";it.registerComponent("SkipBackward",bC);class TC extends it{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof it&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof it&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=pi(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),$r(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||_t.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(n=>n.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}it.registerComponent("Menu",TC);class Bb extends it{constructor(e,t={}){super(e,t),this.menuButton_=new Kn(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Kn.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=r=>this.handleClick(r);this.handleMenuKeyUp_=r=>this.handleMenuKeyUp(r),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",r=>this.handleKeyDown(r)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),$r(_t,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",r=>this.handleMouseLeave(r)),this.on("keydown",r=>this.handleSubmenuKeyDown(r))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new TC(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=pi("li",{className:"vjs-menu-title",textContent:en(this.options_.title),tabIndex:-1}),i=new it(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,u)},a=(...u)=>{this.handleSelectedLanguageChange.apply(this,u)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let u;this.on(["tap","click"],function(){if(typeof he.Event!="object")try{u=new he.Event("change")}catch{}u||(u=_t.createEvent("Event"),u.initEvent("change",!0,!0)),n.dispatchEvent(u)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let n=0;n-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}it.registerComponent("OffTextTrackMenuItem",SC);class Zc extends Ub{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=ef){let i;this.label_&&(i=`${this.label_} off`),e.push(new SC(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r-1){const u=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});u.addClass(`vjs-${a.kind}-menu-item`),e.push(u)}}return e}}it.registerComponent("TextTrackButton",Zc);class _C extends Jh{constructor(e,t){const i=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(en(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,n=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(en(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new zb(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,EC),e}}Gb.prototype.kinds_=["captions","subtitles"];Gb.prototype.controlText_="Subtitles";it.registerComponent("SubsCapsButton",Gb);class wC extends Jh{constructor(e,t){const i=t.track,n=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",r),this.on("dispose",()=>{n.removeEventListener("change",r)})}createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(pi("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(pi("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;ithis.update(r))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}qb.prototype.contentElType="button";it.registerComponent("PlaybackRateMenuItem",qb);class kC extends Bb{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=pi("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new qb(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}kC.prototype.controlText_="Playback Rate";it.registerComponent("PlaybackRateMenuButton",kC);class CC extends it{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}it.registerComponent("Spacer",CC);class DF extends CC{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}it.registerComponent("CustomControlSpacer",DF);class DC extends it{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}DC.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};it.registerComponent("ControlBar",DC);class LC extends Xc{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}LC.prototype.options_=Object.assign({},Xc.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});it.registerComponent("ErrorDisplay",LC);class RC extends it{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),pi("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Zr()}`)+"-"+t[1].replace(/\W+/g,""),n=pi("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),n}))}}it.registerComponent("TextTrackSelect",RC);class gu extends it{constructor(e,t={}){super(e,t);const i=pi("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const n=this.options_.selects;for(const r of n){const a=this.options_.selectConfigs[r],u=a.className,c=a.id.replace("%s",this.options_.id_);let d=null;const f=`vjs_select_${Zr()}`;if(this.options_.type==="colors"){d=pi("span",{className:u});const y=pi("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});y.setAttribute("for",f),d.appendChild(y)}const g=new RC(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:f,labelId:c});this.addChild(g),this.options_.type==="colors"&&(d.appendChild(g.el()),this.el().appendChild(d))}}createEl(){return pi("fieldset",{className:this.options_.className})}}it.registerComponent("TextTrackFieldset",gu);class IC extends it{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new gu(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const r=new gu(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const a=new gu(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return pi("div",{className:"vjs-track-settings-colors"})}}it.registerComponent("TextTrackSettingsColors",IC);class NC extends it{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new gu(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const r=new gu(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const a=new gu(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return pi("div",{className:"vjs-track-settings-font"})}}it.registerComponent("TextTrackSettingsFont",NC);class OC extends it{constructor(e,t={}){super(e,t);const i=new Kn(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const n=this.localize("Done"),r=new Kn(e,{controlText:n,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=n,this.addChild(r)}createEl(){return pi("div",{className:"vjs-track-settings-controls"})}}it.registerComponent("TrackSettingsControls",OC);const mv="vjs-text-track-settings",uE=["#000","Black"],cE=["#00F","Blue"],dE=["#0FF","Cyan"],hE=["#0F0","Green"],fE=["#F0F","Magenta"],mE=["#F00","Red"],pE=["#FFF","White"],gE=["#FF0","Yellow"],pv=["1","Opaque"],gv=["0.5","Semi-Transparent"],yE=["0","Transparent"],vl={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[uE,pE,mE,hE,cE,gE,fE,dE],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[pv,gv,yE],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[pE,uE,mE,hE,cE,gE,fE,dE],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[pv,gv],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[yE,gv,pv],className:"vjs-window-opacity vjs-opacity"}};vl.windowColor.options=vl.backgroundColor.options;function MC(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function LF(s,e){const t=s.options[s.options.selectedIndex].value;return MC(t,e)}function RF(s,e,t){if(e){for(let i=0;i{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),xc(vl,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Ek(vl,(e,t,i)=>{const n=LF(this.$(t.selector),t.parser);return n!==void 0&&(e[i]=n),e},{})}setValues(e){xc(vl,(t,i)=>{RF(this.$(t.selector),e[i],t.parser)})}setDefaults(){xc(vl,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(he.localStorage.getItem(mv))}catch(t){Fi.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?he.localStorage.setItem(mv,JSON.stringify(e)):he.localStorage.removeItem(mv)}catch(t){Fi.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}it.registerComponent("TextTrackSettings",IF);class NF extends it{constructor(e,t){let i=t.ResizeObserver||he.ResizeObserver;t.ResizeObserver===null&&(i=!1);const n=Ts({createEl:!i,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||he.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Kk(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const r=this.debouncedHandler_;let a=this.unloadListener_=function(){qn(this,"resize",r),qn(this,"unload",a),a=null};$r(this.el_.contentWindow,"unload",a),$r(this.el_.contentWindow,"resize",r)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}it.registerComponent("ResizeManager",NF);const OF={trackingThreshold:20,liveTolerance:15};class MF extends it{constructor(e,t){const i=Ts(OF,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(he.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const n=this.liveCurrentTime(),r=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Jr),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}it.registerComponent("LiveTracker",MF);class PF extends it{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:pi("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Zr()}`}),description:pi("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Zr()}`})},pi("div",{className:"vjs-title-bar"},{},wk(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const r=this.state[n],a=this.els[n],u=i[n];_p(a),r&&Ll(a,r),t&&(t.removeAttribute(u),r&&t.setAttribute(u,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}it.registerComponent("TitleBar",PF);const FF={initialDisplay:4e3,position:[],takeFocus:!1};class BF extends Kn{constructor(e,t){t=Ts(FF,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=pi("button",{},{type:"button",class:this.buildCSSClass()},pi("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}it.registerComponent("TransientButton",BF);const wx=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let n="";if(!t.length)return!1;for(let r=0;r{let t={};for(let i=0;iPC([s.el(),he.HTMLMediaElement.prototype,he.Element.prototype,UF],"innerHTML"),vE=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=jF(s),n=r=>(...a)=>{const u=r.apply(e,a);return wx(s),u};["append","appendChild","insertAdjacentHTML"].forEach(r=>{e[r]&&(t[r]=e[r],e[r]=n(t[r]))}),Object.defineProperty(e,"innerHTML",Ts(i,{set:n(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(r=>{e[r]=t[r]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},$F=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?nC(he.Element.prototype.getAttribute.call(this,"src")):""},set(s){return he.Element.prototype.setAttribute.call(this,"src",s),s}}),HF=s=>PC([s.el(),he.HTMLMediaElement.prototype,$F],"src"),zF=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=HF(s),i=e.setAttribute,n=e.load;Object.defineProperty(e,"src",Ts(t,{set:r=>{const a=t.set.call(e,r);return s.triggerSourceset(e.src),a}})),e.setAttribute=(r,a)=>{const u=i.call(e,r,a);return/src/i.test(r)&&s.triggerSourceset(e.src),u},e.load=()=>{const r=n.call(e);return wx(s)||(s.triggerSourceset(""),vE(s)),r},e.currentSrc?s.triggerSourceset(e.currentSrc):wx(s)||vE(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Ut extends Ci{constructor(e,t){super(e,t);const i=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const r=this.el_.childNodes;let a=r.length;const u=[];for(;a--;){const c=r[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!n&&!this.el_.hasAttribute("crossorigin")&&kp(c.src)&&(n=!0)):u.push(c))}for(let c=0;c{t=[];for(let r=0;re.removeEventListener("change",i));const n=()=>{for(let r=0;r{e.removeEventListener("change",i),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(n=>{this.el()[`${i}Tracks`].removeEventListener(n,this[`${i}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Qr[e],i=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:u=>{const c={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(c),e==="text"&&this[zc.remoteText.getterName]().trigger(c)},addtrack(u){n.addTrack(u.track)},removetrack(u){n.removeTrack(u.track)}},a=function(){const u=[];for(let c=0;c{const c=r[u];i.addEventListener(u,c),this.on("dispose",d=>i.removeEventListener(u,c))}),this.on("loadstart",a),this.on("dispose",u=>this.off("loadstart",a))}proxyNativeTracks_(){Qr.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),Ut.disposeMediaElement(e),e=i}else{e=_t.createElement("video");const i=this.options_.tag&&yl(this.options_.tag),n=Ts({},i);(!Mh||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,Ok(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&jc(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&xp?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Fi(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ya&&qa&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Ba(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Fi.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const n=pi("source",{},i);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return Fi.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Fi.warn(`No matching source element found with src: ${e}`),!1}reset(){Ut.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=_t.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),he.performance&&(e.creationTime=he.performance.now()),e}}pp(Ut,"TEST_VID",function(){if(!Kc())return;const s=_t.createElement("video"),e=_t.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});Ut.isSupported=function(){try{Ut.TEST_VID.volume=.5}catch{return!1}return!!(Ut.TEST_VID&&Ut.TEST_VID.canPlayType)};Ut.canPlayType=function(s){return Ut.TEST_VID.canPlayType(s)};Ut.canPlaySource=function(s,e){return Ut.canPlayType(s.type)};Ut.canControlVolume=function(){try{const s=Ut.TEST_VID.volume;Ut.TEST_VID.volume=s/2+.1;const e=s!==Ut.TEST_VID.volume;return e&&Gn?(he.setTimeout(()=>{Ut&&Ut.prototype&&(Ut.prototype.featuresVolumeControl=s!==Ut.TEST_VID.volume)}),!1):e}catch{return!1}};Ut.canMuteVolume=function(){try{const s=Ut.TEST_VID.muted;return Ut.TEST_VID.muted=!s,Ut.TEST_VID.muted?jc(Ut.TEST_VID,"muted","muted"):Tp(Ut.TEST_VID,"muted","muted"),s!==Ut.TEST_VID.muted}catch{return!1}};Ut.canControlPlaybackRate=function(){if(ya&&qa&&gp<58)return!1;try{const s=Ut.TEST_VID.playbackRate;return Ut.TEST_VID.playbackRate=s/2+.1,s!==Ut.TEST_VID.playbackRate}catch{return!1}};Ut.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(_t.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(_t.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(_t.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(_t.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};Ut.supportsNativeTextTracks=function(){return xp||Gn&&qa};Ut.supportsNativeVideoTracks=function(){return!!(Ut.TEST_VID&&Ut.TEST_VID.videoTracks)};Ut.supportsNativeAudioTracks=function(){return!!(Ut.TEST_VID&&Ut.TEST_VID.audioTracks)};Ut.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([s,e]){pp(Ut.prototype,s,()=>Ut[e](),!0)});Ut.prototype.featuresVolumeControl=Ut.canControlVolume();Ut.prototype.movingMediaElementInDOM=!Gn;Ut.prototype.featuresFullscreenResize=!0;Ut.prototype.featuresProgressEvents=!0;Ut.prototype.featuresTimeupdateEvents=!0;Ut.prototype.featuresVideoFrameCallback=!!(Ut.TEST_VID&&Ut.TEST_VID.requestVideoFrameCallback);Ut.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()}};Ut.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){Ut.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){Ut.prototype["set"+en(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){Ut.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){Ut.prototype["set"+en(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){Ut.prototype[s]=function(){return this.el_[s]()}});Ci.withSourceHandlers(Ut);Ut.nativeSourceHandler={};Ut.nativeSourceHandler.canPlayType=function(s){try{return Ut.TEST_VID.canPlayType(s)}catch{return""}};Ut.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return Ut.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Rb(s.src);return Ut.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Ut.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};Ut.nativeSourceHandler.dispose=function(){};Ut.registerSourceHandler(Ut.nativeSourceHandler);Ci.registerTech("Html5",Ut);const FC=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],yv={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ax=["tiny","xsmall","small","medium","large","xlarge","huge"],t0={};Ax.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;t0[s]=`vjs-layout-${e}`});const VF={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let Hs=class dc extends it{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Zr()}`,t=Object.assign(dc.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Sk(this.id_),this.fsApi_=S0,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&yl(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(u){a[u.toLowerCase()]=t.languages[u]}),this.languages_=a}else this.languages_=dc.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Ab(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&($r(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=Ts(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const u=new he.DOMParser().parseFromString(fF,"image/svg+xml");if(u.querySelector("parsererror"))Fi.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const d=u.documentElement;d.style.display="none",this.el_.appendChild(d),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new mF(this),this.addClass("vjs-spatial-navigation-enabled")),Mh&&this.addClass("vjs-touch-enabled"),Gn||this.addClass("vjs-workinghover"),dc.players[this.id_]=this;const r=px.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),qn(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),qn(_t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),dc.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),uF(this),Zn.names.forEach(e=>{const t=Zn[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const r=yl(e);if(n){for(t=this.el_=e,e=this.tag=_t.createElement("video");t.children.length;)e.appendChild(t.firstChild);Eh(t,"video-js")||mu(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),r.tabindex="-1",qa&&yp&&(e.setAttribute("role","application"),r.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(c){n&&c==="class"||t.setAttribute(c,r[c]),n&&e.setAttribute(c,r[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>Lk[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),he.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Gk("vjs-styles-dimensions");const c=kl(".vjs-styles-defaults"),d=kl("head");d.insertBefore(this.styleEl_,c?c.nextSibling:d.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const u=e.getElementsByTagName("a");for(let c=0;c"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Fi.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){Fi.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ao(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),$4(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(he.VIDEOJS_NO_DYNAMIC_STYLE===!0){const u=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(u>=0&&(d.width=u),c>=0&&(d.height=c));return}let e,t,i,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const r=i.split(":"),a=r[1]/r[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),qk(this.styleEl_,` .${n} { width: ${e}px; height: ${t}px; @@ -223,9 +223,9 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati .${n}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${a*100}%; } - `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=Xs(e),n=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(ki.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(r=!1);const a={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Yn.names.forEach(c=>{const d=Yn[c];a[d.getterName]=this[d.privateName]}),Object.assign(a,this.options_[i]),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const u=ki.getTech(e);if(!u)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new u(a),this.tech_.ready(ks(this,this.handleTechReady_),!0),bx.jsonToTextTracks(this.textTracksJson_||[],this.tech_),CC.forEach(c=>{this.on(this.tech_,c,d=>this[`handleTech${Xs(c)}_`](d))}),Object.keys(fv).forEach(c=>{this.on(this.tech_,c,d=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${fv[c]}_`].bind(this),event:d});return}this[`handleTech${fv[c]}_`](d)})}),this.on(this.tech_,"loadstart",c=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",c=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",c=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",c=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",c=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",c=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",c=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",c=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,d)=>this.handleTechFullscreenChange_(c,d)),this.on(this.tech_,"fullscreenerror",(c,d)=>this.handleTechFullscreenError_(c,d)),this.on(this.tech_,"enterpictureinpicture",c=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",c=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",c=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",c=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",c=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",c=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&mx(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Yn.names.forEach(e=>{const t=Yn[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=bx.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Oi.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. + `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=en(e),n=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(Ci.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(r=!1);const a={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Zn.names.forEach(c=>{const d=Zn[c];a[d.getterName]=this[d.privateName]}),Object.assign(a,this.options_[i]),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const u=Ci.getTech(e);if(!u)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new u(a),this.tech_.ready(Rs(this,this.handleTechReady_),!0),_x.jsonToTextTracks(this.textTracksJson_||[],this.tech_),FC.forEach(c=>{this.on(this.tech_,c,d=>this[`handleTech${en(c)}_`](d))}),Object.keys(yv).forEach(c=>{this.on(this.tech_,c,d=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${yv[c]}_`].bind(this),event:d});return}this[`handleTech${yv[c]}_`](d)})}),this.on(this.tech_,"loadstart",c=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",c=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",c=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",c=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",c=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",c=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",c=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",c=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,d)=>this.handleTechFullscreenChange_(c,d)),this.on(this.tech_,"fullscreenerror",(c,d)=>this.handleTechFullscreenError_(c,d)),this.on(this.tech_,"enterpictureinpicture",c=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",c=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",c=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",c=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",c=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",c=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&yx(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Zn.names.forEach(e=>{const t=Zn[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=_x.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Fi.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. -`),this.tech_}version(){return{"video.js":hx}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const r=()=>{this.muted(n)};this.playTerminatedQueue_.push(r);const a=this.play();if(wh(a))return a.catch(u=>{throw r(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${u||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),wh(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!wh(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=Q4(this,t)),this.cache_.source=ps({},e,{src:t,type:i});const n=this.cache_.sources.filter(c=>c.src&&c.src===t),r=[],a=this.$$("source"),u=[];for(let c=0;cthis.updateSourceCaches_(r);const i=this.currentSource().src,n=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==i)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],r=>{if(r.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Na(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!yt.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let n=yt[this.fsApi_.fullscreenElement]===i;!n&&i.matches&&(n=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in q4)return V4(this.middleware_,this.tech_,e,t);if(e in X2)return Y2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Oi(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in G4)return z4(this.middleware_,this.tech_,e);if(e in X2)return Y2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Oi(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Oi(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Oi(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Na){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(pp||jn);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const n=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||da(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=da(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=da(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return qk(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,n)=>{function r(){t.off("fullscreenerror",u),t.off("fullscreenchange",a)}function a(){r(),i()}function u(d,f){r(),n(f)}t.one("fullscreenchange",a),t.one("fullscreenerror",u);const c=t.requestFullscreenHelper_(e);c&&(c.then(r,r),c.then(i,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){n(),t()}function a(c,d){n(),i(d)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);const u=e.exitFullscreenHelper_();u&&(u.then(n,n),u.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=yt[this.fsApi_.exitFullscreen]();return e&&Na(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=yt.documentElement.style.overflow,Br(yt,"keydown",this.boundFullWindowOnEscKey_),yt.documentElement.style.overflow="hidden",fu(yt.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,$n(yt,"keydown",this.boundFullWindowOnEscKey_),yt.documentElement.style.overflow=this.docOrigOverflow,gp(yt.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&de.documentPictureInPicture){const e=yt.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(li("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),de.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Nk(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const n=i.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in yt&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(de.documentPictureInPicture&&de.documentPictureInPicture.window)return de.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in yt)return yt.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();if(n.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return r==="input"?a.indexOf(n.type)===-1:["textarea"].indexOf(r)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:r=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=Xe.getComponent("FullscreenToggle");yt[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),Xe.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Xe.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,n=this.options_.techOrder;i[u,ki.getTech(u)]).filter(([u,c])=>c?c.isSupported():(Oi.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,c,d){let f;return u.some(p=>c.some(y=>{if(f=d(p,y),f)return!0})),f};let n;const r=u=>(c,d)=>u(d,c),a=([u,c],d)=>{if(c.canPlaySource(d,this.options_[u.toLowerCase()]))return{source:d,tech:u}};return this.options_.sourceOrder?n=i(e,t,r(a)):n=i(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Zk(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),$4(this,i[0],(n,r)=>{if(this.middleware_=r,t||(this.cache_.sources=i),this.updateSourceCaches_(n),this.src_(n)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}H4(r,this.tech_)}),i.length>1){const n=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},r=()=>{this.off("error",n)};this.one("error",n),this.one("playing",r),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",r)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Hk(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Na(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),wo(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(wl("beforeerror").forEach(t=>{const i=t(this,e);if(!(Ha(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new js(e),this.addClass("vjs-error"),Oi.error(`(CODE:${this.error_.code} ${js.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),wl("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const n=ks(this,this.reportUserActivity),r=function(p){(p.screenX!==t||p.screenY!==i)&&(t=p.screenX,i=p.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},u=function(p){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",r),this.on("mouseup",u),this.on("mouseleave",u);const c=this.getChild("controlBar");c&&!jn&&!ha&&(c.on("mouseenter",function(p){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(p){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let d;const f=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(d);const p=this.options_.inactivityTimeout;p<=0||(d=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},p))};this.setInterval(f,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),wo(this)&&this.trigger("languagechange"))}languages(){return ps(uc.prototype.options_.languages,this.languages_)}toJSON(){const e=ps(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<_x.length;i++){const n=_x[i],r=this.breakpoints_[n];if(t<=r){if(e===n)return;e&&this.removeClass(Xm[e]),this.addClass(Xm[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},DB,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Xm[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=ps(e);const{artist:n,artwork:r,description:a,poster:u,src:c,textTracks:d,title:f}=this.cache_.media;!r&&u&&(this.cache_.media.artwork=[{src:u,type:C0(u)}]),i&&this.crossOrigin(i),c&&this.src(c),u&&this.poster(u),Array.isArray(d)&&d.forEach(p=>this.addRemoteTextTrack(p,!1)),this.titleBar&&this.titleBar.update({title:f,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),r=>({kind:r.kind,label:r.label,language:r.language,src:r.src})),n={src:t,textTracks:i};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:C0(n.poster)}]),n}return ps(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=gl(e),n=i["data-setup"];if(_h(e,"vjs-fill")&&(i.fill=!0),_h(e,"vjs-fluid")&&(i.fluid=!0),n!==null)try{Object.assign(i,JSON.parse(n||"{}"))}catch(r){Oi.error("data-setup",r)}if(Object.assign(t,i),e.hasChildNodes()){const r=e.childNodes;for(let a=0,u=r.length;atypeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};Ps.prototype.videoTracks=()=>{};Ps.prototype.audioTracks=()=>{};Ps.prototype.textTracks=()=>{};Ps.prototype.remoteTextTracks=()=>{};Ps.prototype.remoteTextTrackEls=()=>{};Yn.names.forEach(function(s){const e=Yn[s];Ps.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ps.prototype.crossorigin=Ps.prototype.crossOrigin;Ps.players={};const th=de.navigator;Ps.prototype.options_={techOrder:ki.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:th&&(th.languages&&th.languages[0]||th.userLanguage||th.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};CC.forEach(function(s){Ps.prototype[`handleTech${Xs(s)}_`]=function(){return this.trigger(s)}});Xe.registerComponent("Player",Ps);const D0="plugin",bc="activePlugins_",dc={},L0=s=>dc.hasOwnProperty(s),Qm=s=>L0(s)?dc[s]:void 0,DC=(s,e)=>{s[bc]=s[bc]||{},s[bc][e]=!0},R0=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},LB=function(s,e){const t=function(){R0(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return DC(this,s),R0(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},hE=(s,e)=>(e.prototype.name=s,function(...t){R0(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,R0(this,i.getEventHash()),i});class yr{constructor(e){if(this.constructor===yr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),_b(this),delete this.trigger,$k(this,this.constructor.defaultState),DC(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Kc(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[bc][e]=!1,this.player=this.state=null,t[e]=hE(e,dc[e])}static isBasic(e){const t=typeof e=="string"?Qm(e):e;return typeof t=="function"&&!yr.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(L0(e))Oi.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ps.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return dc[e]=t,e!==D0&&(yr.isBasic(t)?Ps.prototype[e]=LB(e,t):Ps.prototype[e]=hE(e,t)),t}static deregisterPlugin(e){if(e===D0)throw new Error("Cannot de-register base plugin.");L0(e)&&(delete dc[e],delete Ps.prototype[e])}static getPlugins(e=Object.keys(dc)){let t;return e.forEach(i=>{const n=Qm(i);n&&(t=t||{},t[i]=n)}),t}static getPluginVersion(e){const t=Qm(e);return t&&t.VERSION||""}}yr.getPlugin=Qm;yr.BASE_PLUGIN_NAME=D0;yr.registerPlugin(D0,yr);Ps.prototype.usingPlugin=function(s){return!!this[bc]&&this[bc][s]===!0};Ps.prototype.hasPlugin=function(s){return!!L0(s)};function RB(s,e){let t=!1;return function(...i){return t||Oi.warn(s),t=!0,e.apply(this,i)}}function fa(s,e,t,i){return RB(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var IB={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const LC=s=>s.indexOf("#")===0?s.slice(1):s;function Be(s,e,t){let i=Be.getPlayer(s);if(i)return e&&Oi.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const n=typeof s=="string"?Al("#"+LC(s)):s;if(!qc(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in n?n.getRootNode()instanceof de.ShadowRoot:!1)?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!a.contains(n))&&Oi.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),wl("beforesetup").forEach(c=>{const d=c(n,ps(e));if(!Ha(d)||Array.isArray(d)){Oi.error("please return an object in beforesetup hooks");return}e=ps(e,d)});const u=Xe.getComponent("Player");return i=new u(n,e,t),wl("setup").forEach(c=>c(i)),i}Be.hooks_=To;Be.hooks=wl;Be.hook=h4;Be.hookOnce=f4;Be.removeHook=hk;if(de.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Gc()){let s=Al(".vjs-styles-defaults");if(!s){s=Pk("vjs-styles-defaults");const e=Al("head");e&&e.insertBefore(s,e.firstChild),Bk(s,` +`),this.tech_}version(){return{"video.js":px}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const r=()=>{this.muted(n)};this.playTerminatedQueue_.push(r);const a=this.play();if(Ah(a))return a.catch(u=>{throw r(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${u||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),Ah(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!Ah(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=hF(this,t)),this.cache_.source=Ts({},e,{src:t,type:i});const n=this.cache_.sources.filter(c=>c.src&&c.src===t),r=[],a=this.$$("source"),u=[];for(let c=0;cthis.updateSourceCaches_(r);const i=this.currentSource().src,n=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==i)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],r=>{if(r.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Ba(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!_t.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let n=_t[this.fsApi_.fullscreenElement]===i;!n&&i.matches&&(n=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in oF)return rF(this.middleware_,this.tech_,e,t);if(e in sE)return iE(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Fi(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in aF)return nF(this.middleware_,this.tech_,e);if(e in sE)return iE(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Fi(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Fi(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Fi(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Ba){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(xp||Gn);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const n=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||ga(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=ga(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=ga(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return tC(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,n)=>{function r(){t.off("fullscreenerror",u),t.off("fullscreenchange",a)}function a(){r(),i()}function u(d,f){r(),n(f)}t.one("fullscreenchange",a),t.one("fullscreenerror",u);const c=t.requestFullscreenHelper_(e);c&&(c.then(r,r),c.then(i,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){n(),t()}function a(c,d){n(),i(d)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);const u=e.exitFullscreenHelper_();u&&(u.then(n,n),u.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=_t[this.fsApi_.exitFullscreen]();return e&&Ba(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=_t.documentElement.style.overflow,$r(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow="hidden",mu(_t.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,qn(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow=this.docOrigOverflow,bp(_t.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&he.documentPictureInPicture){const e=_t.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(pi("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),he.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Hk(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const n=i.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in _t&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(he.documentPictureInPicture&&he.documentPictureInPicture.window)return he.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in _t)return _t.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();if(n.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return r==="input"?a.indexOf(n.type)===-1:["textarea"].indexOf(r)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:r=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=it.getComponent("FullscreenToggle");_t[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),it.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),it.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,n=this.options_.techOrder;i[u,Ci.getTech(u)]).filter(([u,c])=>c?c.isSupported():(Fi.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,c,d){let f;return u.some(g=>c.some(y=>{if(f=d(g,y),f)return!0})),f};let n;const r=u=>(c,d)=>u(d,c),a=([u,c],d)=>{if(c.canPlaySource(d,this.options_[u.toLowerCase()]))return{source:d,tech:u}};return this.options_.sourceOrder?n=i(e,t,r(a)):n=i(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=oC(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),iF(this,i[0],(n,r)=>{if(this.middleware_=r,t||(this.cache_.sources=i),this.updateSourceCaches_(n),this.src_(n)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}sF(r,this.tech_)}),i.length>1){const n=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},r=()=>{this.off("error",n)};this.one("error",n),this.one("playing",r),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",r)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Qk(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Ba(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Ao(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Al("beforeerror").forEach(t=>{const i=t(this,e);if(!(Ga(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new qs(e),this.addClass("vjs-error"),Fi.error(`(CODE:${this.error_.code} ${qs.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Al("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const n=Rs(this,this.reportUserActivity),r=function(g){(g.screenX!==t||g.screenY!==i)&&(t=g.screenX,i=g.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},u=function(g){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",r),this.on("mouseup",u),this.on("mouseleave",u);const c=this.getChild("controlBar");c&&!Gn&&!ya&&(c.on("mouseenter",function(g){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(g){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let d;const f=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(d);const g=this.options_.inactivityTimeout;g<=0||(d=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},g))};this.setInterval(f,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Ao(this)&&this.trigger("languagechange"))}languages(){return Ts(dc.prototype.options_.languages,this.languages_)}toJSON(){const e=Ts(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(g,!1)),this.titleBar&&this.titleBar.update({title:f,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),r=>({kind:r.kind,label:r.label,language:r.language,src:r.src})),n={src:t,textTracks:i};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:I0(n.poster)}]),n}return Ts(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=yl(e),n=i["data-setup"];if(Eh(e,"vjs-fill")&&(i.fill=!0),Eh(e,"vjs-fluid")&&(i.fluid=!0),n!==null)try{Object.assign(i,JSON.parse(n||"{}"))}catch(r){Fi.error("data-setup",r)}if(Object.assign(t,i),e.hasChildNodes()){const r=e.childNodes;for(let a=0,u=r.length;atypeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};Hs.prototype.videoTracks=()=>{};Hs.prototype.audioTracks=()=>{};Hs.prototype.textTracks=()=>{};Hs.prototype.remoteTextTracks=()=>{};Hs.prototype.remoteTextTrackEls=()=>{};Zn.names.forEach(function(s){const e=Zn[s];Hs.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Hs.prototype.crossorigin=Hs.prototype.crossOrigin;Hs.players={};const ih=he.navigator;Hs.prototype.options_={techOrder:Ci.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ih&&(ih.languages&&ih.languages[0]||ih.userLanguage||ih.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};FC.forEach(function(s){Hs.prototype[`handleTech${en(s)}_`]=function(){return this.trigger(s)}});it.registerComponent("Player",Hs);const N0="plugin",Sc="activePlugins_",fc={},O0=s=>fc.hasOwnProperty(s),i0=s=>O0(s)?fc[s]:void 0,BC=(s,e)=>{s[Sc]=s[Sc]||{},s[Sc][e]=!0},M0=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},GF=function(s,e){const t=function(){M0(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return BC(this,s),M0(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},xE=(s,e)=>(e.prototype.name=s,function(...t){M0(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,M0(this,i.getEventHash()),i});class br{constructor(e){if(this.constructor===br)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ab(this),delete this.trigger,Xk(this,this.constructor.defaultState),BC(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Yc(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Sc][e]=!1,this.player=this.state=null,t[e]=xE(e,fc[e])}static isBasic(e){const t=typeof e=="string"?i0(e):e;return typeof t=="function"&&!br.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(O0(e))Fi.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Hs.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return fc[e]=t,e!==N0&&(br.isBasic(t)?Hs.prototype[e]=GF(e,t):Hs.prototype[e]=xE(e,t)),t}static deregisterPlugin(e){if(e===N0)throw new Error("Cannot de-register base plugin.");O0(e)&&(delete fc[e],delete Hs.prototype[e])}static getPlugins(e=Object.keys(fc)){let t;return e.forEach(i=>{const n=i0(i);n&&(t=t||{},t[i]=n)}),t}static getPluginVersion(e){const t=i0(e);return t&&t.VERSION||""}}br.getPlugin=i0;br.BASE_PLUGIN_NAME=N0;br.registerPlugin(N0,br);Hs.prototype.usingPlugin=function(s){return!!this[Sc]&&this[Sc][s]===!0};Hs.prototype.hasPlugin=function(s){return!!O0(s)};function qF(s,e){let t=!1;return function(...i){return t||Fi.warn(s),t=!0,e.apply(this,i)}}function va(s,e,t,i){return qF(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var KF={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const UC=s=>s.indexOf("#")===0?s.slice(1):s;function Pe(s,e,t){let i=Pe.getPlayer(s);if(i)return e&&Fi.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const n=typeof s=="string"?kl("#"+UC(s)):s;if(!Wc(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in n?n.getRootNode()instanceof he.ShadowRoot:!1)?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!a.contains(n))&&Fi.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),Al("beforesetup").forEach(c=>{const d=c(n,Ts(e));if(!Ga(d)||Array.isArray(d)){Fi.error("please return an object in beforesetup hooks");return}e=Ts(e,d)});const u=it.getComponent("Player");return i=new u(n,e,t),Al("setup").forEach(c=>c(i)),i}Pe.hooks_=_o;Pe.hooks=Al;Pe.hook=k4;Pe.hookOnce=C4;Pe.removeHook=Tk;if(he.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Kc()){let s=kl(".vjs-styles-defaults");if(!s){s=Gk("vjs-styles-defaults");const e=kl("head");e&&e.insertBefore(s,e.firstChild),qk(s,` .video-js { width: 300px; height: 150px; @@ -234,69 +234,69 @@ See https://github.com/videojs/video.js/issues/2617 for more info. .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } - `)}}gx(1,Be);Be.VERSION=hx;Be.options=Ps.prototype.options_;Be.getPlayers=()=>Ps.players;Be.getPlayer=s=>{const e=Ps.players;let t;if(typeof s=="string"){const i=LC(s),n=e[i];if(n)return n;t=Al("#"+i)}else t=s;if(qc(t)){const{player:i,playerId:n}=t;if(i||e[n])return i||e[n]}};Be.getAllPlayers=()=>Object.keys(Ps.players).map(s=>Ps.players[s]).filter(Boolean);Be.players=Ps.players;Be.getComponent=Xe.getComponent;Be.registerComponent=(s,e)=>(ki.isTech(e)&&Oi.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Xe.registerComponent.call(Xe,s,e));Be.getTech=ki.getTech;Be.registerTech=ki.registerTech;Be.use=j4;Object.defineProperty(Be,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Be.middleware,"TERMINATOR",{value:k0,writeable:!1,enumerable:!0});Be.browser=Tk;Be.obj=g4;Be.mergeOptions=fa(9,"videojs.mergeOptions","videojs.obj.merge",ps);Be.defineLazyProperty=fa(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",dp);Be.bind=fa(9,"videojs.bind","native Function.prototype.bind",ks);Be.registerPlugin=yr.registerPlugin;Be.deregisterPlugin=yr.deregisterPlugin;Be.plugin=(s,e)=>(Oi.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),yr.registerPlugin(s,e));Be.getPlugins=yr.getPlugins;Be.getPlugin=yr.getPlugin;Be.getPluginVersion=yr.getPluginVersion;Be.addLanguage=function(s,e){return s=(""+s).toLowerCase(),Be.options.languages=ps(Be.options.languages,{[s]:e}),Be.options.languages[s]};Be.log=Oi;Be.createLogger=fk;Be.time=R4;Be.createTimeRange=fa(9,"videojs.createTimeRange","videojs.time.createTimeRanges",da);Be.createTimeRanges=fa(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",da);Be.formatTime=fa(9,"videojs.formatTime","videojs.time.formatTime",Tu);Be.setFormatTime=fa(9,"videojs.setFormatTime","videojs.time.setFormatTime",Vk);Be.resetFormatTime=fa(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Gk);Be.parseUrl=fa(9,"videojs.parseUrl","videojs.url.parseUrl",kb);Be.isCrossOrigin=fa(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",_p);Be.EventTarget=Fr;Be.any=Sb;Be.on=Br;Be.one=Tp;Be.off=$n;Be.trigger=Kc;Be.xhr=QA;Be.TrackList=Su;Be.TextTrack=Yh;Be.TextTrackList=wb;Be.AudioTrack=Xk;Be.AudioTrackList=Kk;Be.VideoTrack=Qk;Be.VideoTrackList=Wk;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{Be[s]=function(){return Oi.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Ok[s].apply(null,arguments)}});Be.computedStyle=fa(9,"videojs.computedStyle","videojs.dom.computedStyle",jc);Be.dom=Ok;Be.fn=w4;Be.num=oB;Be.str=D4;Be.url=F4;Be.Error=IB;class NB{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class I0 extends Be.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new NB(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,n=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ti,s.qualityLevels.VERSION=RC,i},IC=function(s){return OB(this,Be.obj.merge({},s))};Be.registerPlugin("qualityLevels",IC);IC.VERSION=RC;const fr=op,N0=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Zr=s=>Be.log.debug?Be.log.debug.bind(Be,"VHS:",`${s} >`):function(){};function rs(...s){const e=Be.obj||Be;return(e.merge||e.mergeOptions).apply(e,s)}function kn(...s){const e=Be.time||Be;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function MB(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: + `)}}xx(1,Pe);Pe.VERSION=px;Pe.options=Hs.prototype.options_;Pe.getPlayers=()=>Hs.players;Pe.getPlayer=s=>{const e=Hs.players;let t;if(typeof s=="string"){const i=UC(s),n=e[i];if(n)return n;t=kl("#"+i)}else t=s;if(Wc(t)){const{player:i,playerId:n}=t;if(i||e[n])return i||e[n]}};Pe.getAllPlayers=()=>Object.keys(Hs.players).map(s=>Hs.players[s]).filter(Boolean);Pe.players=Hs.players;Pe.getComponent=it.getComponent;Pe.registerComponent=(s,e)=>(Ci.isTech(e)&&Fi.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),it.registerComponent.call(it,s,e));Pe.getTech=Ci.getTech;Pe.registerTech=Ci.registerTech;Pe.use=tF;Object.defineProperty(Pe,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Pe.middleware,"TERMINATOR",{value:R0,writeable:!1,enumerable:!0});Pe.browser=Lk;Pe.obj=R4;Pe.mergeOptions=va(9,"videojs.mergeOptions","videojs.obj.merge",Ts);Pe.defineLazyProperty=va(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",pp);Pe.bind=va(9,"videojs.bind","native Function.prototype.bind",Rs);Pe.registerPlugin=br.registerPlugin;Pe.deregisterPlugin=br.deregisterPlugin;Pe.plugin=(s,e)=>(Fi.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),br.registerPlugin(s,e));Pe.getPlugins=br.getPlugins;Pe.getPlugin=br.getPlugin;Pe.getPluginVersion=br.getPluginVersion;Pe.addLanguage=function(s,e){return s=(""+s).toLowerCase(),Pe.options.languages=Ts(Pe.options.languages,{[s]:e}),Pe.options.languages[s]};Pe.log=Fi;Pe.createLogger=Sk;Pe.time=q4;Pe.createTimeRange=va(9,"videojs.createTimeRange","videojs.time.createTimeRanges",ga);Pe.createTimeRanges=va(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",ga);Pe.formatTime=va(9,"videojs.formatTime","videojs.time.formatTime",Su);Pe.setFormatTime=va(9,"videojs.setFormatTime","videojs.time.setFormatTime",Jk);Pe.resetFormatTime=va(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",eC);Pe.parseUrl=va(9,"videojs.parseUrl","videojs.url.parseUrl",Lb);Pe.isCrossOrigin=va(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",kp);Pe.EventTarget=Hr;Pe.any=wb;Pe.on=$r;Pe.one=wp;Pe.off=qn;Pe.trigger=Yc;Pe.xhr=ak;Pe.TrackList=_u;Pe.TextTrack=Qh;Pe.TextTrackList=Cb;Pe.AudioTrack=rC;Pe.AudioTrackList=iC;Pe.VideoTrack=aC;Pe.VideoTrackList=sC;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{Pe[s]=function(){return Fi.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),zk[s].apply(null,arguments)}});Pe.computedStyle=va(9,"videojs.computedStyle","videojs.dom.computedStyle",Hc);Pe.dom=zk;Pe.fn=j4;Pe.num=SF;Pe.str=V4;Pe.url=J4;Pe.Error=KF;class WF{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class P0 extends Pe.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new WF(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,n=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ti,s.qualityLevels.VERSION=jC,i},$C=function(s){return YF(this,Pe.obj.merge({},s))};Pe.registerPlugin("qualityLevels",$C);$C.VERSION=jC;const pr=dp,F0=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,ia=s=>Pe.log.debug?Pe.log.debug.bind(Pe,"VHS:",`${s} >`):function(){};function cs(...s){const e=Pe.obj||Pe;return(e.merge||e.mergeOptions).apply(e,s)}function Cn(...s){const e=Pe.time||Pe;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function XF(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let t=0;t ${n}. Duration (${n-i}) -`}return e}const Oa=1/30,Ma=Oa*3,NC=function(s,e){const t=[];let i;if(s&&s.length)for(i=0;i=e})},Am=function(s,e){return NC(s,function(t){return t-Oa>=e})},PB=function(s){if(s.length<2)return kn();const e=[];for(let t=1;t{const e=[];if(!s||!s.length)return"";for(let t=0;t "+s.end(t));return e.join(", ")},FB=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},du=s=>{const e=[];for(let t=0;tr)){if(e>n&&e<=r){t+=r-e;continue}t+=r-n}}return t},Gb=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},Ex=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),MC=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},PC=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((n,r)=>n+(r.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},BC=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=MC(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},jB=function(s,e){let t=0,i=e-s.mediaSequence,n=s.segments[i];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;i--;){if(n=s.segments[i],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Gb(s,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},$B=function(s,e){let t=0,i,n=e-s.mediaSequence;for(;n"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return de.Infinity}return FC(s,e,t)},Ah=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let n=0;if(t>i&&([t,i]=[i,t]),t<0){for(let r=t;r0)for(let d=c-1;d>=0;d--){const f=u[d];if(a+=f.duration,r){if(a<0)continue}else if(a+Oa<=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n-Ah({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:d})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e}}if(c<0){for(let d=c;d<0;d++)if(a-=s.targetDuration,a<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e};c=0}for(let d=c;dOa,y=a===0,v=p&&a+Oa>=0;if(!((y||v)&&d!==u.length-1)){if(r){if(a>0)continue}else if(a-Oa>=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n+Ah({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:d})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:e}},$C=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},qb=function(s){return s.excludeUntil&&s.excludeUntil===1/0},kp=function(s){const e=$C(s);return!s.disabled&&!e},VB=function(s){return s.disabled},GB=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>kp(i)?(i.attributes.BANDWIDTH||0)!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),fE=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const n in t){for(const r in t[n])if(i=e(t[n][r]),i)break;if(i)break}return!!i},Jh=s=>{if(!s||!s.playlists||!s.playlists.length)return fE(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;eek(r))||fE(s,r=>Kb(t,r))))return!1}return!0};var mr={liveEdgeDelay:BC,duration:UC,seekable:HB,getMediaInfoForTime:zB,isEnabled:kp,isDisabled:VB,isExcluded:$C,isIncompatible:qb,playlistEnd:jC,isAes:GB,hasAttribute:HC,estimateSegmentRequestTime:qB,isLowestEnabledRendition:wx,isAudioOnly:Jh,playlistMatch:Kb,segmentDurationWithParts:Gb};const{log:zC}=Be,Tc=(s,e)=>`${s}-${e}`,VC=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,KB=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:n=[],llhls:r})=>{const a=new O3;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(d=>a.addParser(d)),n.forEach(d=>a.addTagMapper(d)),a.push(t),a.end();const u=a.manifest;if(r||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(d){u.hasOwnProperty(d)&&delete u[d]}),u.segments&&u.segments.forEach(function(d){["parts","preloadHints"].forEach(function(f){d.hasOwnProperty(f)&&delete d[f]})})),!u.targetDuration){let d=10;u.segments&&u.segments.length&&(d=u.segments.reduce((f,p)=>Math.max(f,p.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${d}`}),u.targetDuration=d}const c=MC(u);if(c.length&&!u.partTargetDuration){const d=c.reduce((f,p)=>Math.max(f,p.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${d}`}),zC.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),u.partTargetDuration=d}return u},Qc=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const n in s.mediaGroups[t][i]){const r=s.mediaGroups[t][i][n];e(r,t,i,n)}})},GC=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},WB=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];GC({playlist:t,id:Tc(e,t.uri)}),t.resolvedUri=fr(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||zC.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},YB=s=>{Qc(s,e=>{e.uri&&(e.resolvedUri=fr(s.uri,e.uri))})},XB=(s,e)=>{const t=Tc(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:de.location.href,resolvedUri:de.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},qC=(s,e,t=VC)=>{s.uri=e;for(let n=0;n{if(!n.playlists||!n.playlists.length){if(i&&r==="AUDIO"&&!n.uri)for(let c=0;c(n.set(r.id,r),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const r=e[i.class].push(i);i.classListIndex=r-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const n=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&n[i.classListIndex+1]?i.endTime=n[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,n)=>{i.startDate.getTime(){const n=e.status<200||e.status>299,r=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},u=n&&!r||i;if(t&&r)a.error=nn({},t),a.errorType=Be.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=Be.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=Be.Error.NetworkRequestTimeout;else if(u){const c=i?Be.Error.NetworkBodyParserFailed:Be.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},QB=Zr("CodecUtils"),WC=function(s){const e=s.attributes||{};if(e.CODECS)return La(e.CODECS)},YC=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},ZB=(s,e)=>{if(!YC(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const n in i)if(!i[n].uri&&!i[n].playlists)return!0;return!1},Ph=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:n})=>{e[t]=e[t]||[],e[t].push(JA(`${i}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){QB(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},pE=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},kh=function(s,e){const t=e.attributes||{},i=Ph(WC(e)||[]);if(YC(s,e)&&!i.audio&&!ZB(s,e)){const n=Ph(P3(s,t.AUDIO)||[]);n.audio&&(i.audio=n.audio)}return i},{EventTarget:JB}=Be,eF=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let n=e.mediaSequence+e.segments.length;if(i){const r=i.parts||[],a=PC(e)-1;a>-1&&a!==r.length-1&&(t._HLS_part=a),(a>-1||r.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new de.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&i.searchParams.set(n,t[n])}),s=i.toString()}return s},tF=(s,e)=>{if(!s)return e;const t=rs(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i{const i=s.slice(),n=e.slice();t=t||0;const r=[];let a;for(let u=0;u{!s.resolvedUri&&s.uri&&(s.resolvedUri=fr(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=fr(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=fr(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=fr(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=fr(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=fr(e,t.uri))})},QC=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;is===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Ax=(s,e,t=ZC)=>{const i=rs(s,{}),n=i.playlists[e.id];if(!n||t(n,e))return null;e.segments=QC(e);const r=rs(n,e);if(r.preloadSegment&&!e.preloadSegment&&delete r.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{XC(a,r.resolvedUri)});for(let a=0;a{if(a.playlists)for(let f=0;f{const t=s.segments||[],i=t[t.length-1],n=i&&i.parts&&i.parts[i.parts.length-1],r=n&&n.duration||i&&i.duration;return e&&r?r*1e3:(s.partTargetDuration||s.targetDuration||10)*500},gE=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:r,RESOLUTION:a,CODECS:u}=n.attributes;i.push({id:n.id,bandwidth:r,resolution:a,codecs:u})}),{type:e,isLive:t,renditions:i}};let fc=class extends JB{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Zr("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new mE,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=fr(this.main.uri,e.uri);this.llhls&&(t=eF(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,n)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:n,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:gu({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=KB({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:Be.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const n=i.attributes||{},{width:r,height:a}=n.RESOLUTION||{};if(r&&a)return!0;const u=WC(i)||[];return!!Ph(u).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),GC({playlist:a,uri:i,id:n});const u=Ax(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,u?(this.main=u,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(kx(this.media(),!!u)),r.parsedPlaylist=gE(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),de.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new mE,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(de.clearTimeout(this.finalRenditionTimeout),t){const u=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=de.setTimeout(this.media.bind(this,e,!1),u);return}const i=this.state,n=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(kx(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(u,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=N0(e.resolvedUri,c),u)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=de.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:gu({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=N0(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=gE(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,qC(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=QC(i),i.segments.forEach(n=>{XC(n,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||de.location.href;this.main=XB(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,n=e.ID;let r=i.playlists.length;for(;r--;){const a=i.playlists[r];if(a.attributes["PATHWAY-ID"]===n){const u=a.resolvedUri,c=a.id;if(t){const d=this.createCloneURI_(a.resolvedUri,e),f=Tc(n,d),p=this.createCloneAttributes_(n,a.attributes),y=this.createClonePlaylist_(a,f,e,p);i.playlists[r]=y,i.playlists[f]=y,i.playlists[d]=y}else i.playlists.splice(r,1);delete i.playlists[c],delete i.playlists[u]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!i.mediaGroups[r]||!i.mediaGroups[r][n])){for(const a in i.mediaGroups[r])if(a===n){for(const u in i.mediaGroups[r][a])i.mediaGroups[r][a][u].playlists.forEach((d,f)=>{const p=i.playlists[d.id],y=p.id,v=p.resolvedUri;delete i.playlists[y],delete i.playlists[v]});delete i.mediaGroups[r][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,n=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=Tc(e.ID,r),u=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,u);i.playlists[n]=c,i.playlists[a]=c,i.playlists[r]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!n.mediaGroups[r]||n.mediaGroups[r][t]))for(const a in n.mediaGroups[r]){if(a===i)n.mediaGroups[r][t]={};else continue;for(const u in n.mediaGroups[r][a]){const c=n.mediaGroups[r][a][u];n.mediaGroups[r][t][u]=nn({},c);const d=n.mediaGroups[r][t][u],f=this.createCloneURI_(c.resolvedUri,e);d.resolvedUri=f,d.uri=f,d.playlists=[],c.playlists.forEach((p,y)=>{const v=n.playlists[p.id],b=VC(r,t,u),T=Tc(t,b);if(v&&!n.playlists[T]){const E=this.createClonePlaylist_(v,T,e),D=E.resolvedUri;n.playlists[T]=E,n.playlists[D]=E}d.playlists[y]=this.createClonePlaylist_(p,T,e)})}}})}createClonePlaylist_(e,t,i,n){const r=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),rs(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const r of Object.keys(n))i.searchParams.set(r,n[r]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(i[n]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const n=e.contentProtection[i].attributes.keyId;t.add(n.toLowerCase())}return t}};const Cx=function(s,e,t,i){const n=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(n||s.responseText)))),i(e,s)},sF=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},nF=(s,e,t,i)=>{!s||!s.size||s.forEach(n=>{n(e,t,i)})},JC=function(){const s=function e(t,i){t=rs({timeout:45e3},t);const n=e.beforeRequest||Be.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||Be.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||Be.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(Be.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(n));const u=Be.Vhs.xhr.original===!0?Be.xhr:Be.Vhs.xhr,c=sF(r,t);r.delete(n);const d=u(c||t,function(p,y){return nF(a,d,p,y),Cx(d,p,y,i)}),f=d.abort;return d.abort=function(){return d.aborted=!0,f.apply(d,arguments)},d.uri=t.uri,d.requestType=t.requestType,d.requestTime=Date.now(),d};return s.original=!0,s},rF=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=de.BigInt(s.offset)+de.BigInt(s.length)-de.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Dx=function(s){const e={};return s.byterange&&(e.Range=rF(s.byterange)),e},aF=function(s,e){return s.start(e)+"-"+s.end(e)},oF=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},lF=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},eD=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];ik(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},O0=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},tD=function(s){return s.resolvedUri},iD=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",n,r;for(let a=0;aiD(s),cF=s=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},fF=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,mF=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(tu?null:(t>new Date(r)&&(i=n),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:mr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},pF=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let r=0;rt){if(s>t+n.duration*sD)return null;i=n}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},gF=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const n=t.getTime();return(i.getTime()-n)/1e3},yF=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=pF(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const n={mediaSeconds:e},r=hF(e,i.segment);return r&&(n.programDateTime=r.toISOString()),t(null,n)},nD=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:n=!0,tech:r,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!yF(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=mF(s,e);if(!u)return a({message:`${s} was not found in the stream`});const c=u.segment,d=gF(c.dateTimeObject,s);if(u.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(u.estimatedStart+d),r.one("seeked",()=>{nD({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:n,tech:r,callback:a})});return}const f=c.start+d,p=()=>a(null,r.currentTime());r.one("seeked",p),n&&r.pause(),i(f)},pv=(s,e)=>{if(s.readyState===4)return e()},xF=(s,e,t,i)=>{let n=[],r,a=!1;const u=function(p,y,v,b){return y.abort(),a=!0,t(p,y,v,b)},c=function(p,y){if(a)return;if(p)return p.metadata=gu({requestType:i,request:y,error:p}),u(p,y,"",n);const v=y.responseText.substring(n&&n.byteLength||0,y.responseText.length);if(n=q3(n,sk(v,!0)),r=r||dh(n),n.length<10||r&&n.lengthu(p,y,"",n));const b=yb(n);return b==="ts"&&n.length<188?pv(y,()=>u(p,y,"",n)):!b&&n.length<376?pv(y,()=>u(p,y,"",n)):u(null,y,b,n)},f=e({uri:s,beforeSend(p){p.overrideMimeType("text/plain; charset=x-user-defined"),p.addEventListener("progress",function({total:y,loaded:v}){return Cx(p,null,{statusCode:p.status},c)})}},function(p,y){return Cx(f,p,y,c)});return f},{EventTarget:bF}=Be,yE=function(s,e){if(!ZC(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t{const n=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${n}`},SF=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:n})=>{const r=VP(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:n});return qC(r,e,TF),r},_F=(s,e)=>{Qc(s,(t,i,n,r)=>{(!e.mediaGroups[i][n]||!(r in e.mediaGroups[i][n]))&&delete s.mediaGroups[i][n][r]})},EF=(s,e,t)=>{let i=!0,n=rs(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let r=0;r{if(r.playlists&&r.playlists.length){const d=r.playlists[0].id,f=Ax(n,r.playlists[0],yE);f&&(n=f,c in n.mediaGroups[a][u]||(n.mediaGroups[a][u][c]=r),n.mediaGroups[a][u][c].playlists[0]=n.playlists[d],i=!1)}}),_F(n,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:n},wF=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,vE=(s,e)=>{const t={};for(const i in s){const r=s[i].sidx;if(r){const a=up(r);if(!e[a])break;const u=e[a].sidxInfo;wF(u,r)&&(t[a]=e[a])}}return t},AF=(s,e)=>{let i=vE(s.playlists,e);return Qc(s,(n,r,a,u)=>{if(n.playlists&&n.playlists.length){const c=n.playlists;i=rs(i,vE(c,e))}}),i};class Lx extends bF{constructor(e,t,i={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Zr("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const n=e.sidx&&up(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>i(!1),0);return}const r=N0(e.sidx.resolvedUri),a=(c,d)=>{if(this.requestErrored_(c,d,t))return;const f=this.mainPlaylistLoader_.sidxMapping_,{requestType:p}=d;let y;try{y=YP(ii(d.response).subarray(8))}catch(v){v.metadata=gu({requestType:p,request:d,parseFailure:!0}),this.requestErrored_(v,d,t);return}return f[n]={sidxInfo:e.sidx,sidx:y},mb(e,y,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=xF(r,this.vhs_.xhr,(c,d,f,p)=>{if(c)return a(c,d);if(!f||f!=="mp4"){const b=f||"unknown";return a({status:d.status,message:`Unsupported ${b} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},d)}const{offset:y,length:v}=e.sidx.byterange;if(p.length>=v+y)return a(c,{response:p.subarray(y,y+v),status:d.status,uri:d.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:Dx({byterange:e.sidx.byterange})},a)},u)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},de.clearTimeout(this.minimumUpdatePeriodTimeout_),de.clearTimeout(this.mediaRequest_),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(de.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,n)=>{if(i){const{requestType:a}=n;i.metadata=gu({requestType:a,request:n,error:i})}if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=N0(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const t=GP(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:fr(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,n)=>{if(!this.request)return;if(i){const{requestType:a}=n;return this.error.metadata=gu({requestType:a,request:n,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let r;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?r=this.mainLoaded_:r=Date.parse(n.responseHeaders.date):r=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=SF({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(r){this.error=r,this.error.metadata={errorType:Be.Error.StreamingDashManifestParserError,error:r},this.trigger("error")}e&&(i=EF(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:r,endList:a}=i,u=[];i.playlists.forEach(d=>{u.push({id:d.id,bandwidth:d.attributes.BANDWIDTH,resolution:d.attributes.RESOLUTION,codecs:d.attributes.CODECS})});const c={duration:r,isLive:!a,renditions:u};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(de.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=de.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=AF(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=de.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},kx(this.media(),!!i)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const n=e.contentProtection[i].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var wn={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const kF=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t=e})},Dm=function(s,e){return HC(s,function(t){return t-Ua>=e})},QF=function(s){if(s.length<2)return Cn();const e=[];for(let t=1;t{const e=[];if(!s||!s.length)return"";for(let t=0;t "+s.end(t));return e.join(", ")},JF=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},hu=s=>{const e=[];for(let t=0;tr)){if(e>n&&e<=r){t+=r-e;continue}t+=r-n}}return t},Wb=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},kx=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),VC=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},GC=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((n,r)=>n+(r.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},qC=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=VC(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},tB=function(s,e){let t=0,i=e-s.mediaSequence,n=s.segments[i];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;i--;){if(n=s.segments[i],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Wb(s,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},iB=function(s,e){let t=0,i,n=e-s.mediaSequence;for(;n"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return he.Infinity}return KC(s,e,t)},kh=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let n=0;if(t>i&&([t,i]=[i,t]),t<0){for(let r=t;r0)for(let d=c-1;d>=0;d--){const f=u[d];if(a+=f.duration,r){if(a<0)continue}else if(a+Ua<=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n-kh({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:d})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e}}if(c<0){for(let d=c;d<0;d++)if(a-=s.targetDuration,a<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e};c=0}for(let d=c;dUa,y=a===0,v=g&&a+Ua>=0;if(!((y||v)&&d!==u.length-1)){if(r){if(a>0)continue}else if(a-Ua>=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:n+kh({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:d})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:e}},XC=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},Yb=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Rp=function(s){const e=XC(s);return!s.disabled&&!e},rB=function(s){return s.disabled},aB=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>Rp(i)?(i.attributes.BANDWIDTH||0)!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),bE=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const n in t){for(const r in t[n])if(i=e(t[n][r]),i)break;if(i)break}return!!i},tf=s=>{if(!s||!s.playlists||!s.playlists.length)return bE(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;euk(r))||bE(s,r=>Xb(t,r))))return!1}return!0};var yr={liveEdgeDelay:qC,duration:WC,seekable:sB,getMediaInfoForTime:nB,isEnabled:Rp,isDisabled:rB,isExcluded:XC,isIncompatible:Yb,playlistEnd:YC,isAes:aB,hasAttribute:QC,estimateSegmentRequestTime:oB,isLowestEnabledRendition:Cx,isAudioOnly:tf,playlistMatch:Xb,segmentDurationWithParts:Wb};const{log:ZC}=Pe,_c=(s,e)=>`${s}-${e}`,JC=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,lB=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:n=[],llhls:r})=>{const a=new Y3;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(d=>a.addParser(d)),n.forEach(d=>a.addTagMapper(d)),a.push(t),a.end();const u=a.manifest;if(r||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(d){u.hasOwnProperty(d)&&delete u[d]}),u.segments&&u.segments.forEach(function(d){["parts","preloadHints"].forEach(function(f){d.hasOwnProperty(f)&&delete d[f]})})),!u.targetDuration){let d=10;u.segments&&u.segments.length&&(d=u.segments.reduce((f,g)=>Math.max(f,g.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${d}`}),u.targetDuration=d}const c=VC(u);if(c.length&&!u.partTargetDuration){const d=c.reduce((f,g)=>Math.max(f,g.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${d}`}),ZC.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),u.partTargetDuration=d}return u},Jc=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const n in s.mediaGroups[t][i]){const r=s.mediaGroups[t][i][n];e(r,t,i,n)}})},eD=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},uB=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];eD({playlist:t,id:_c(e,t.uri)}),t.resolvedUri=pr(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||ZC.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},cB=s=>{Jc(s,e=>{e.uri&&(e.resolvedUri=pr(s.uri,e.uri))})},dB=(s,e)=>{const t=_c(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:he.location.href,resolvedUri:he.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},tD=(s,e,t=JC)=>{s.uri=e;for(let n=0;n{if(!n.playlists||!n.playlists.length){if(i&&r==="AUDIO"&&!n.uri)for(let c=0;c(n.set(r.id,r),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const r=e[i.class].push(i);i.classListIndex=r-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const n=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&n[i.classListIndex+1]?i.endTime=n[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,n)=>{i.startDate.getTime(){const n=e.status<200||e.status>299,r=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},u=n&&!r||i;if(t&&r)a.error=cn({},t),a.errorType=Pe.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=Pe.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=Pe.Error.NetworkRequestTimeout;else if(u){const c=i?Pe.Error.NetworkBodyParserFailed:Pe.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},hB=ia("CodecUtils"),sD=function(s){const e=s.attributes||{};if(e.CODECS)return Ma(e.CODECS)},nD=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},fB=(s,e)=>{if(!nD(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const n in i)if(!i[n].uri&&!i[n].playlists)return!0;return!1},Bh=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:n})=>{e[t]=e[t]||[],e[t].push(lk(`${i}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){hB(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},SE=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},Ch=function(s,e){const t=e.attributes||{},i=Bh(sD(e)||[]);if(nD(s,e)&&!i.audio&&!fB(s,e)){const n=Bh(Q3(s,t.AUDIO)||[]);n.audio&&(i.audio=n.audio)}return i},{EventTarget:mB}=Pe,pB=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let n=e.mediaSequence+e.segments.length;if(i){const r=i.parts||[],a=GC(e)-1;a>-1&&a!==r.length-1&&(t._HLS_part=a),(a>-1||r.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new he.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&i.searchParams.set(n,t[n])}),s=i.toString()}return s},gB=(s,e)=>{if(!s)return e;const t=cs(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i{const i=s.slice(),n=e.slice();t=t||0;const r=[];let a;for(let u=0;u{!s.resolvedUri&&s.uri&&(s.resolvedUri=pr(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=pr(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=pr(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=pr(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=pr(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=pr(e,t.uri))})},aD=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;is===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Dx=(s,e,t=oD)=>{const i=cs(s,{}),n=i.playlists[e.id];if(!n||t(n,e))return null;e.segments=aD(e);const r=cs(n,e);if(r.preloadSegment&&!e.preloadSegment&&delete r.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{rD(a,r.resolvedUri)});for(let a=0;a{if(a.playlists)for(let f=0;f{const t=s.segments||[],i=t[t.length-1],n=i&&i.parts&&i.parts[i.parts.length-1],r=n&&n.duration||i&&i.duration;return e&&r?r*1e3:(s.partTargetDuration||s.targetDuration||10)*500},_E=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:r,RESOLUTION:a,CODECS:u}=n.attributes;i.push({id:n.id,bandwidth:r,resolution:a,codecs:u})}),{type:e,isLive:t,renditions:i}};let pc=class extends mB{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=ia("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new TE,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=pr(this.main.uri,e.uri);this.llhls&&(t=pB(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,n)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:n,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:yu({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=lB({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:Pe.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const n=i.attributes||{},{width:r,height:a}=n.RESOLUTION||{};if(r&&a)return!0;const u=sD(i)||[];return!!Bh(u).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),eD({playlist:a,uri:i,id:n});const u=Dx(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,u?(this.main=u,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Lx(this.media(),!!u)),r.parsedPlaylist=_E(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),he.clearTimeout(this.mediaUpdateTimeout),he.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new TE,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(he.clearTimeout(this.finalRenditionTimeout),t){const u=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=he.setTimeout(this.media.bind(this,e,!1),u);return}const i=this.state,n=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(Lx(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(u,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=F0(e.resolvedUri,c),u)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=he.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=he.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=he.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:yu({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=F0(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=_E(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,tD(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=aD(i),i.segments.forEach(n=>{rD(n,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||he.location.href;this.main=dB(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,n=e.ID;let r=i.playlists.length;for(;r--;){const a=i.playlists[r];if(a.attributes["PATHWAY-ID"]===n){const u=a.resolvedUri,c=a.id;if(t){const d=this.createCloneURI_(a.resolvedUri,e),f=_c(n,d),g=this.createCloneAttributes_(n,a.attributes),y=this.createClonePlaylist_(a,f,e,g);i.playlists[r]=y,i.playlists[f]=y,i.playlists[d]=y}else i.playlists.splice(r,1);delete i.playlists[c],delete i.playlists[u]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!i.mediaGroups[r]||!i.mediaGroups[r][n])){for(const a in i.mediaGroups[r])if(a===n){for(const u in i.mediaGroups[r][a])i.mediaGroups[r][a][u].playlists.forEach((d,f)=>{const g=i.playlists[d.id],y=g.id,v=g.resolvedUri;delete i.playlists[y],delete i.playlists[v]});delete i.mediaGroups[r][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,n=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=_c(e.ID,r),u=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,u);i.playlists[n]=c,i.playlists[a]=c,i.playlists[r]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!n.mediaGroups[r]||n.mediaGroups[r][t]))for(const a in n.mediaGroups[r]){if(a===i)n.mediaGroups[r][t]={};else continue;for(const u in n.mediaGroups[r][a]){const c=n.mediaGroups[r][a][u];n.mediaGroups[r][t][u]=cn({},c);const d=n.mediaGroups[r][t][u],f=this.createCloneURI_(c.resolvedUri,e);d.resolvedUri=f,d.uri=f,d.playlists=[],c.playlists.forEach((g,y)=>{const v=n.playlists[g.id],b=JC(r,t,u),T=_c(t,b);if(v&&!n.playlists[T]){const E=this.createClonePlaylist_(v,T,e),D=E.resolvedUri;n.playlists[T]=E,n.playlists[D]=E}d.playlists[y]=this.createClonePlaylist_(g,T,e)})}}})}createClonePlaylist_(e,t,i,n){const r=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),cs(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const r of Object.keys(n))i.searchParams.set(r,n[r]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(i[n]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const n=e.contentProtection[i].attributes.keyId;t.add(n.toLowerCase())}return t}};const Rx=function(s,e,t,i){const n=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(n||s.responseText)))),i(e,s)},vB=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},xB=(s,e,t,i)=>{!s||!s.size||s.forEach(n=>{n(e,t,i)})},lD=function(){const s=function e(t,i){t=cs({timeout:45e3},t);const n=e.beforeRequest||Pe.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||Pe.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||Pe.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(Pe.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(n));const u=Pe.Vhs.xhr.original===!0?Pe.xhr:Pe.Vhs.xhr,c=vB(r,t);r.delete(n);const d=u(c||t,function(g,y){return xB(a,d,g,y),Rx(d,g,y,i)}),f=d.abort;return d.abort=function(){return d.aborted=!0,f.apply(d,arguments)},d.uri=t.uri,d.requestType=t.requestType,d.requestTime=Date.now(),d};return s.original=!0,s},bB=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=he.BigInt(s.offset)+he.BigInt(s.length)-he.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Ix=function(s){const e={};return s.byterange&&(e.Range=bB(s.byterange)),e},TB=function(s,e){return s.start(e)+"-"+s.end(e)},SB=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},_B=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},uD=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];dk(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},B0=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},cD=function(s){return s.resolvedUri},dD=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",n,r;for(let a=0;adD(s),wB=s=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},CB=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,DB=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(tu?null:(t>new Date(r)&&(i=n),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:yr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},LB=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let r=0;rt){if(s>t+n.duration*hD)return null;i=n}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},RB=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const n=t.getTime();return(i.getTime()-n)/1e3},IB=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=LB(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const n={mediaSeconds:e},r=kB(e,i.segment);return r&&(n.programDateTime=r.toISOString()),t(null,n)},fD=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:n=!0,tech:r,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!IB(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=DB(s,e);if(!u)return a({message:`${s} was not found in the stream`});const c=u.segment,d=RB(c.dateTimeObject,s);if(u.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(u.estimatedStart+d),r.one("seeked",()=>{fD({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:n,tech:r,callback:a})});return}const f=c.start+d,g=()=>a(null,r.currentTime());r.one("seeked",g),n&&r.pause(),i(f)},xv=(s,e)=>{if(s.readyState===4)return e()},OB=(s,e,t,i)=>{let n=[],r,a=!1;const u=function(g,y,v,b){return y.abort(),a=!0,t(g,y,v,b)},c=function(g,y){if(a)return;if(g)return g.metadata=yu({requestType:i,request:y,error:g}),u(g,y,"",n);const v=y.responseText.substring(n&&n.byteLength||0,y.responseText.length);if(n=oP(n,hk(v,!0)),r=r||hh(n),n.length<10||r&&n.lengthu(g,y,"",n));const b=bb(n);return b==="ts"&&n.length<188?xv(y,()=>u(g,y,"",n)):!b&&n.length<376?xv(y,()=>u(g,y,"",n)):u(null,y,b,n)},f=e({uri:s,beforeSend(g){g.overrideMimeType("text/plain; charset=x-user-defined"),g.addEventListener("progress",function({total:y,loaded:v}){return Rx(g,null,{statusCode:g.status},c)})}},function(g,y){return Rx(f,g,y,c)});return f},{EventTarget:MB}=Pe,EE=function(s,e){if(!oD(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t{const n=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${n}`},FB=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:n})=>{const r=r4(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:n});return tD(r,e,PB),r},BB=(s,e)=>{Jc(s,(t,i,n,r)=>{(!e.mediaGroups[i][n]||!(r in e.mediaGroups[i][n]))&&delete s.mediaGroups[i][n][r]})},UB=(s,e,t)=>{let i=!0,n=cs(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let r=0;r{if(r.playlists&&r.playlists.length){const d=r.playlists[0].id,f=Dx(n,r.playlists[0],EE);f&&(n=f,c in n.mediaGroups[a][u]||(n.mediaGroups[a][u][c]=r),n.mediaGroups[a][u][c].playlists[0]=n.playlists[d],i=!1)}}),BB(n,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:n},jB=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,wE=(s,e)=>{const t={};for(const i in s){const r=s[i].sidx;if(r){const a=fp(r);if(!e[a])break;const u=e[a].sidxInfo;jB(u,r)&&(t[a]=e[a])}}return t},$B=(s,e)=>{let i=wE(s.playlists,e);return Jc(s,(n,r,a,u)=>{if(n.playlists&&n.playlists.length){const c=n.playlists;i=cs(i,wE(c,e))}}),i};class Nx extends MB{constructor(e,t,i={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=ia("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const n=e.sidx&&fp(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){he.clearTimeout(this.mediaRequest_),this.mediaRequest_=he.setTimeout(()=>i(!1),0);return}const r=F0(e.sidx.resolvedUri),a=(c,d)=>{if(this.requestErrored_(c,d,t))return;const f=this.mainPlaylistLoader_.sidxMapping_,{requestType:g}=d;let y;try{y=c4(di(d.response).subarray(8))}catch(v){v.metadata=yu({requestType:g,request:d,parseFailure:!0}),this.requestErrored_(v,d,t);return}return f[n]={sidxInfo:e.sidx,sidx:y},yb(e,y,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=OB(r,this.vhs_.xhr,(c,d,f,g)=>{if(c)return a(c,d);if(!f||f!=="mp4"){const b=f||"unknown";return a({status:d.status,message:`Unsupported ${b} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},d)}const{offset:y,length:v}=e.sidx.byterange;if(g.length>=v+y)return a(c,{response:g.subarray(y,y+v),status:d.status,uri:d.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ix({byterange:e.sidx.byterange})},a)},u)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},he.clearTimeout(this.minimumUpdatePeriodTimeout_),he.clearTimeout(this.mediaRequest_),he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,he.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(he.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=he.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){he.clearTimeout(this.mediaRequest_),this.mediaRequest_=he.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,n)=>{if(i){const{requestType:a}=n;i.metadata=yu({requestType:a,request:n,error:i})}if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=F0(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const t=a4(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:pr(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,n)=>{if(!this.request)return;if(i){const{requestType:a}=n;return this.error.metadata=yu({requestType:a,request:n,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let r;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?r=this.mainLoaded_:r=Date.parse(n.responseHeaders.date):r=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){he.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=FB({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(r){this.error=r,this.error.metadata={errorType:Pe.Error.StreamingDashManifestParserError,error:r},this.trigger("error")}e&&(i=UB(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:r,endList:a}=i,u=[];i.playlists.forEach(d=>{u.push({id:d.id,bandwidth:d.attributes.BANDWIDTH,resolution:d.attributes.RESOLUTION,codecs:d.attributes.CODECS})});const c={duration:r,isLive:!a,renditions:u};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(he.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=he.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=$B(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=he.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},Lx(this.media(),!!i)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const n=e.contentProtection[i].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var An={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const HB=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t-1):!1},this.trigger=function(A){var C,k,M,P;if(C=x[A],!!C)if(arguments.length===2)for(M=C.length,k=0;k"u")){for(x in q)q.hasOwnProperty(x)&&(q[x]=[x.charCodeAt(0),x.charCodeAt(1),x.charCodeAt(2),x.charCodeAt(3)]);ae=new Uint8Array([105,115,111,109]),W=new Uint8Array([97,118,99,49]),ie=new Uint8Array([0,0,0,1]),K=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Q=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),te={video:K,audio:Q},ne=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),U=new Uint8Array([0,0,0,0,0,0,0,0]),Z=new Uint8Array([0,0,0,0,0,0,0,0]),fe=Z,xe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ge=Z,re=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(x){var A=[],C=0,k,M,P;for(k=1;k>>1,x.samplingfrequencyindex<<7|x.channelcount<<3,6,1,2]))},f=function(){return u(q.ftyp,ae,ie,ae,W)},z=function(x){return u(q.hdlr,te[x])},p=function(x){return u(q.mdat,x)},F=function(x){var A=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,x.duration>>>24&255,x.duration>>>16&255,x.duration>>>8&255,x.duration&255,85,196,0,0]);return x.samplerate&&(A[12]=x.samplerate>>>24&255,A[13]=x.samplerate>>>16&255,A[14]=x.samplerate>>>8&255,A[15]=x.samplerate&255),u(q.mdhd,A)},j=function(x){return u(q.mdia,F(x),z(x.type),v(x))},y=function(x){return u(q.mfhd,new Uint8Array([0,0,0,0,(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255]))},v=function(x){return u(q.minf,x.type==="video"?u(q.vmhd,re):u(q.smhd,U),c(),Y(x))},b=function(x,A){for(var C=[],k=A.length;k--;)C[k]=I(A[k]);return u.apply(null,[q.moof,y(x)].concat(C))},T=function(x){for(var A=x.length,C=[];A--;)C[A]=O(x[A]);return u.apply(null,[q.moov,D(4294967295)].concat(C).concat(E(x)))},E=function(x){for(var A=x.length,C=[];A--;)C[A]=X(x[A]);return u.apply(null,[q.mvex].concat(C))},D=function(x){var A=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return u(q.mvhd,A)},N=function(x){var A=x.samples||[],C=new Uint8Array(4+A.length),k,M;for(M=0;M>>8),P.push(k[oe].byteLength&255),P=P.concat(Array.prototype.slice.call(k[oe]));for(oe=0;oe>>8),se.push(M[oe].byteLength&255),se=se.concat(Array.prototype.slice.call(M[oe]));if(ue=[q.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(C.width&65280)>>8,C.width&255,(C.height&65280)>>8,C.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u(q.avcC,new Uint8Array([1,C.profileIdc,C.profileCompatibility,C.levelIdc,255].concat([k.length],P,[M.length],se))),u(q.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],C.sarRatio){var he=C.sarRatio[0],Ee=C.sarRatio[1];ue.push(u(q.pasp,new Uint8Array([(he&4278190080)>>24,(he&16711680)>>16,(he&65280)>>8,he&255,(Ee&4278190080)>>24,(Ee&16711680)>>16,(Ee&65280)>>8,Ee&255])))}return u.apply(null,ue)},A=function(C){return u(q.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(C.channelcount&65280)>>8,C.channelcount&255,(C.samplesize&65280)>>8,C.samplesize&255,0,0,0,0,(C.samplerate&65280)>>8,C.samplerate&255,0,0]),d(C))}})(),R=function(x){var A=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,0,(x.duration&4278190080)>>24,(x.duration&16711680)>>16,(x.duration&65280)>>8,x.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(x.width&65280)>>8,x.width&255,0,0,(x.height&65280)>>8,x.height&255,0,0]);return u(q.tkhd,A)},I=function(x){var A,C,k,M,P,se,oe;return A=u(q.tfhd,new Uint8Array([0,0,0,58,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),se=Math.floor(x.baseMediaDecodeTime/a),oe=Math.floor(x.baseMediaDecodeTime%a),C=u(q.tfdt,new Uint8Array([1,0,0,0,se>>>24&255,se>>>16&255,se>>>8&255,se&255,oe>>>24&255,oe>>>16&255,oe>>>8&255,oe&255])),P=92,x.type==="audio"?(k=G(x,P),u(q.traf,A,C,k)):(M=N(x),k=G(x,M.length+P),u(q.traf,A,C,k,M))},O=function(x){return x.duration=x.duration||4294967295,u(q.trak,R(x),j(x))},X=function(x){var A=new Uint8Array([0,0,0,0,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return x.type!=="video"&&(A[A.length-1]=0),u(q.trex,A)},(function(){var x,A,C;C=function(k,M){var P=0,se=0,oe=0,ue=0;return k.length&&(k[0].duration!==void 0&&(P=1),k[0].size!==void 0&&(se=2),k[0].flags!==void 0&&(oe=4),k[0].compositionTimeOffset!==void 0&&(ue=8)),[0,0,P|se|oe|ue,1,(k.length&4278190080)>>>24,(k.length&16711680)>>>16,(k.length&65280)>>>8,k.length&255,(M&4278190080)>>>24,(M&16711680)>>>16,(M&65280)>>>8,M&255]},A=function(k,M){var P,se,oe,ue,he,Ee;for(ue=k.samples||[],M+=20+16*ue.length,oe=C(ue,M),se=new Uint8Array(oe.length+ue.length*16),se.set(oe),P=oe.length,Ee=0;Ee>>24,se[P++]=(he.duration&16711680)>>>16,se[P++]=(he.duration&65280)>>>8,se[P++]=he.duration&255,se[P++]=(he.size&4278190080)>>>24,se[P++]=(he.size&16711680)>>>16,se[P++]=(he.size&65280)>>>8,se[P++]=he.size&255,se[P++]=he.flags.isLeading<<2|he.flags.dependsOn,se[P++]=he.flags.isDependedOn<<6|he.flags.hasRedundancy<<4|he.flags.paddingValue<<1|he.flags.isNonSyncSample,se[P++]=he.flags.degradationPriority&61440,se[P++]=he.flags.degradationPriority&15,se[P++]=(he.compositionTimeOffset&4278190080)>>>24,se[P++]=(he.compositionTimeOffset&16711680)>>>16,se[P++]=(he.compositionTimeOffset&65280)>>>8,se[P++]=he.compositionTimeOffset&255;return u(q.trun,se)},x=function(k,M){var P,se,oe,ue,he,Ee;for(ue=k.samples||[],M+=20+8*ue.length,oe=C(ue,M),P=new Uint8Array(oe.length+ue.length*8),P.set(oe),se=oe.length,Ee=0;Ee>>24,P[se++]=(he.duration&16711680)>>>16,P[se++]=(he.duration&65280)>>>8,P[se++]=he.duration&255,P[se++]=(he.size&4278190080)>>>24,P[se++]=(he.size&16711680)>>>16,P[se++]=(he.size&65280)>>>8,P[se++]=he.size&255;return u(q.trun,P)},G=function(k,M){return k.type==="audio"?x(k,M):A(k,M)}})();var Ce={ftyp:f,mdat:p,moof:b,moov:T,initSegment:function(x){var A=f(),C=T(x),k;return k=new Uint8Array(A.byteLength+C.byteLength),k.set(A),k.set(C,A.byteLength),k}},Me=function(x){var A,C,k=[],M=[];for(M.byteLength=0,M.nalCount=0,M.duration=0,k.byteLength=0,A=0;A1&&(A=x.shift(),x.byteLength-=A.byteLength,x.nalCount-=A.nalCount,x[0][0].dts=A.dts,x[0][0].pts=A.pts,x[0][0].duration+=A.duration),x},be=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Pe=function(x,A){var C=be();return C.dataOffset=A,C.compositionTimeOffset=x.pts-x.dts,C.duration=x.duration,C.size=4*x.length,C.size+=x.byteLength,x.keyFrame&&(C.flags.dependsOn=2,C.flags.isNonSyncSample=0),C},gt=function(x,A){var C,k,M,P,se,oe=A||0,ue=[];for(C=0;Cxt.ONE_SECOND_IN_TS/2))){for(he=ui()[x.samplerate],he||(he=A[0].data),Ee=0;Ee=C?x:(A.minSegmentDts=1/0,x.filter(function(k){return k.dts>=C?(A.minSegmentDts=Math.min(A.minSegmentDts,k.dts),A.minSegmentPts=A.minSegmentDts,!0):!1}))},Gt=function(x){var A,C,k=[];for(A=0;A=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(x),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},wi.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},wi.prototype.addText=function(x){this.rows[this.rowIdx]+=x},wi.prototype.backspace=function(){if(!this.isEmpty()){var x=this.rows[this.rowIdx];this.rows[this.rowIdx]=x.substr(0,x.length-1)}};var Jt=function(x,A,C){this.serviceNum=x,this.text="",this.currentWindow=new wi(-1),this.windows=[],this.stream=C,typeof A=="string"&&this.createTextDecoder(A)};Jt.prototype.init=function(x,A){this.startPts=x;for(var C=0;C<8;C++)this.windows[C]=new wi(C),typeof A=="function"&&(this.windows[C].beforeRowOverflow=A)},Jt.prototype.setCurrentWindow=function(x){this.currentWindow=this.windows[x]},Jt.prototype.createTextDecoder=function(x){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(x)}catch(A){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+x+" encoding. "+A})}};var ei=function(x){x=x||{},ei.prototype.init.call(this);var A=this,C=x.captionServices||{},k={},M;Object.keys(C).forEach(P=>{M=C[P],/^SERVICE/.test(P)&&(k[P]=M.encoding)}),this.serviceEncodings=k,this.current708Packet=null,this.services={},this.push=function(P){P.type===3?(A.new708Packet(),A.add708Bytes(P)):(A.current708Packet===null&&A.new708Packet(),A.add708Bytes(P))}};ei.prototype=new Ei,ei.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ei.prototype.add708Bytes=function(x){var A=x.ccData,C=A>>>8,k=A&255;this.current708Packet.ptsVals.push(x.pts),this.current708Packet.data.push(C),this.current708Packet.data.push(k)},ei.prototype.push708Packet=function(){var x=this.current708Packet,A=x.data,C=null,k=null,M=0,P=A[M++];for(x.seq=P>>6,x.sizeCode=P&63;M>5,k=P&31,C===7&&k>0&&(P=A[M++],C=P),this.pushServiceBlock(C,M,k),k>0&&(M+=k-1)},ei.prototype.pushServiceBlock=function(x,A,C){var k,M=A,P=this.current708Packet.data,se=this.services[x];for(se||(se=this.initService(x,M));M("0"+(Lt&255).toString(16)).slice(-2)).join("")}if(M?(ze=[oe,ue],x++):ze=[oe],A.textDecoder_&&!k)Ee=A.textDecoder_.decode(new Uint8Array(ze));else if(M){const Qe=Tt(ze);Ee=String.fromCharCode(parseInt(Qe,16))}else Ee=ns(se|oe);return he.pendingNewLine&&!he.isEmpty()&&he.newLine(this.getPts(x)),he.pendingNewLine=!1,he.addText(Ee),x},ei.prototype.multiByteCharacter=function(x,A){var C=this.current708Packet.data,k=C[x+1],M=C[x+2];return Xi(k)&&Xi(M)&&(x=this.handleText(++x,A,{isMultiByte:!0})),x},ei.prototype.setCurrentWindow=function(x,A){var C=this.current708Packet.data,k=C[x],M=k&7;return A.setCurrentWindow(M),x},ei.prototype.defineWindow=function(x,A){var C=this.current708Packet.data,k=C[x],M=k&7;A.setCurrentWindow(M);var P=A.currentWindow;return k=C[++x],P.visible=(k&32)>>5,P.rowLock=(k&16)>>4,P.columnLock=(k&8)>>3,P.priority=k&7,k=C[++x],P.relativePositioning=(k&128)>>7,P.anchorVertical=k&127,k=C[++x],P.anchorHorizontal=k,k=C[++x],P.anchorPoint=(k&240)>>4,P.rowCount=k&15,k=C[++x],P.columnCount=k&63,k=C[++x],P.windowStyle=(k&56)>>3,P.penStyle=k&7,P.virtualRowCount=P.rowCount+1,x},ei.prototype.setWindowAttributes=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.winAttr;return k=C[++x],M.fillOpacity=(k&192)>>6,M.fillRed=(k&48)>>4,M.fillGreen=(k&12)>>2,M.fillBlue=k&3,k=C[++x],M.borderType=(k&192)>>6,M.borderRed=(k&48)>>4,M.borderGreen=(k&12)>>2,M.borderBlue=k&3,k=C[++x],M.borderType+=(k&128)>>5,M.wordWrap=(k&64)>>6,M.printDirection=(k&48)>>4,M.scrollDirection=(k&12)>>2,M.justify=k&3,k=C[++x],M.effectSpeed=(k&240)>>4,M.effectDirection=(k&12)>>2,M.displayEffect=k&3,x},ei.prototype.flushDisplayed=function(x,A){for(var C=[],k=0;k<8;k++)A.windows[k].visible&&!A.windows[k].isEmpty()&&C.push(A.windows[k].getText());A.endPts=x,A.text=C.join(` +`+s},yD=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},VB=gD(yD(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var x={};this.on=function(A,C){x[A]||(x[A]=[]),x[A]=x[A].concat(C)},this.off=function(A,C){var k;return x[A]?(k=x[A].indexOf(C),x[A]=x[A].slice(),x[A].splice(k,1),k>-1):!1},this.trigger=function(A){var C,k,M,P;if(C=x[A],!!C)if(arguments.length===2)for(M=C.length,k=0;k"u")){for(x in Y)Y.hasOwnProperty(x)&&(Y[x]=[x.charCodeAt(0),x.charCodeAt(1),x.charCodeAt(2),x.charCodeAt(3)]);ne=new Uint8Array([105,115,111,109]),K=new Uint8Array([97,118,99,49]),ie=new Uint8Array([0,0,0,1]),q=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Z=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),te={video:q,audio:Z},re=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),z=new Uint8Array([0,0,0,0,0,0,0,0]),Q=new Uint8Array([0,0,0,0,0,0,0,0]),pe=Q,be=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ve=Q,le=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(x){var A=[],C=0,k,M,P;for(k=1;k>>1,x.samplingfrequencyindex<<7|x.channelcount<<3,6,1,2]))},f=function(){return u(Y.ftyp,ne,ie,ne,K)},G=function(x){return u(Y.hdlr,te[x])},g=function(x){return u(Y.mdat,x)},F=function(x){var A=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,x.duration>>>24&255,x.duration>>>16&255,x.duration>>>8&255,x.duration&255,85,196,0,0]);return x.samplerate&&(A[12]=x.samplerate>>>24&255,A[13]=x.samplerate>>>16&255,A[14]=x.samplerate>>>8&255,A[15]=x.samplerate&255),u(Y.mdhd,A)},j=function(x){return u(Y.mdia,F(x),G(x.type),v(x))},y=function(x){return u(Y.mfhd,new Uint8Array([0,0,0,0,(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255]))},v=function(x){return u(Y.minf,x.type==="video"?u(Y.vmhd,le):u(Y.smhd,z),c(),W(x))},b=function(x,A){for(var C=[],k=A.length;k--;)C[k]=N(A[k]);return u.apply(null,[Y.moof,y(x)].concat(C))},T=function(x){for(var A=x.length,C=[];A--;)C[A]=O(x[A]);return u.apply(null,[Y.moov,D(4294967295)].concat(C).concat(E(x)))},E=function(x){for(var A=x.length,C=[];A--;)C[A]=X(x[A]);return u.apply(null,[Y.mvex].concat(C))},D=function(x){var A=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return u(Y.mvhd,A)},L=function(x){var A=x.samples||[],C=new Uint8Array(4+A.length),k,M;for(M=0;M>>8),P.push(k[ae].byteLength&255),P=P.concat(Array.prototype.slice.call(k[ae]));for(ae=0;ae>>8),se.push(M[ae].byteLength&255),se=se.concat(Array.prototype.slice.call(M[ae]));if(ce=[Y.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(C.width&65280)>>8,C.width&255,(C.height&65280)>>8,C.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u(Y.avcC,new Uint8Array([1,C.profileIdc,C.profileCompatibility,C.levelIdc,255].concat([k.length],P,[M.length],se))),u(Y.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],C.sarRatio){var me=C.sarRatio[0],Ae=C.sarRatio[1];ce.push(u(Y.pasp,new Uint8Array([(me&4278190080)>>24,(me&16711680)>>16,(me&65280)>>8,me&255,(Ae&4278190080)>>24,(Ae&16711680)>>16,(Ae&65280)>>8,Ae&255])))}return u.apply(null,ce)},A=function(C){return u(Y.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(C.channelcount&65280)>>8,C.channelcount&255,(C.samplesize&65280)>>8,C.samplesize&255,0,0,0,0,(C.samplerate&65280)>>8,C.samplerate&255,0,0]),d(C))}})(),R=function(x){var A=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,0,(x.duration&4278190080)>>24,(x.duration&16711680)>>16,(x.duration&65280)>>8,x.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(x.width&65280)>>8,x.width&255,0,0,(x.height&65280)>>8,x.height&255,0,0]);return u(Y.tkhd,A)},N=function(x){var A,C,k,M,P,se,ae;return A=u(Y.tfhd,new Uint8Array([0,0,0,58,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),se=Math.floor(x.baseMediaDecodeTime/a),ae=Math.floor(x.baseMediaDecodeTime%a),C=u(Y.tfdt,new Uint8Array([1,0,0,0,se>>>24&255,se>>>16&255,se>>>8&255,se&255,ae>>>24&255,ae>>>16&255,ae>>>8&255,ae&255])),P=92,x.type==="audio"?(k=V(x,P),u(Y.traf,A,C,k)):(M=L(x),k=V(x,M.length+P),u(Y.traf,A,C,k,M))},O=function(x){return x.duration=x.duration||4294967295,u(Y.trak,R(x),j(x))},X=function(x){var A=new Uint8Array([0,0,0,0,(x.id&4278190080)>>24,(x.id&16711680)>>16,(x.id&65280)>>8,x.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return x.type!=="video"&&(A[A.length-1]=0),u(Y.trex,A)},(function(){var x,A,C;C=function(k,M){var P=0,se=0,ae=0,ce=0;return k.length&&(k[0].duration!==void 0&&(P=1),k[0].size!==void 0&&(se=2),k[0].flags!==void 0&&(ae=4),k[0].compositionTimeOffset!==void 0&&(ce=8)),[0,0,P|se|ae|ce,1,(k.length&4278190080)>>>24,(k.length&16711680)>>>16,(k.length&65280)>>>8,k.length&255,(M&4278190080)>>>24,(M&16711680)>>>16,(M&65280)>>>8,M&255]},A=function(k,M){var P,se,ae,ce,me,Ae;for(ce=k.samples||[],M+=20+16*ce.length,ae=C(ce,M),se=new Uint8Array(ae.length+ce.length*16),se.set(ae),P=ae.length,Ae=0;Ae>>24,se[P++]=(me.duration&16711680)>>>16,se[P++]=(me.duration&65280)>>>8,se[P++]=me.duration&255,se[P++]=(me.size&4278190080)>>>24,se[P++]=(me.size&16711680)>>>16,se[P++]=(me.size&65280)>>>8,se[P++]=me.size&255,se[P++]=me.flags.isLeading<<2|me.flags.dependsOn,se[P++]=me.flags.isDependedOn<<6|me.flags.hasRedundancy<<4|me.flags.paddingValue<<1|me.flags.isNonSyncSample,se[P++]=me.flags.degradationPriority&61440,se[P++]=me.flags.degradationPriority&15,se[P++]=(me.compositionTimeOffset&4278190080)>>>24,se[P++]=(me.compositionTimeOffset&16711680)>>>16,se[P++]=(me.compositionTimeOffset&65280)>>>8,se[P++]=me.compositionTimeOffset&255;return u(Y.trun,se)},x=function(k,M){var P,se,ae,ce,me,Ae;for(ce=k.samples||[],M+=20+8*ce.length,ae=C(ce,M),P=new Uint8Array(ae.length+ce.length*8),P.set(ae),se=ae.length,Ae=0;Ae>>24,P[se++]=(me.duration&16711680)>>>16,P[se++]=(me.duration&65280)>>>8,P[se++]=me.duration&255,P[se++]=(me.size&4278190080)>>>24,P[se++]=(me.size&16711680)>>>16,P[se++]=(me.size&65280)>>>8,P[se++]=me.size&255;return u(Y.trun,P)},V=function(k,M){return k.type==="audio"?x(k,M):A(k,M)}})();var we={ftyp:f,mdat:g,moof:b,moov:T,initSegment:function(x){var A=f(),C=T(x),k;return k=new Uint8Array(A.byteLength+C.byteLength),k.set(A),k.set(C,A.byteLength),k}},He=function(x){var A,C,k=[],M=[];for(M.byteLength=0,M.nalCount=0,M.duration=0,k.byteLength=0,A=0;A1&&(A=x.shift(),x.byteLength-=A.byteLength,x.nalCount-=A.nalCount,x[0][0].dts=A.dts,x[0][0].pts=A.pts,x[0][0].duration+=A.duration),x},De=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ye=function(x,A){var C=De();return C.dataOffset=A,C.compositionTimeOffset=x.pts-x.dts,C.duration=x.duration,C.size=4*x.length,C.size+=x.byteLength,x.keyFrame&&(C.flags.dependsOn=2,C.flags.isNonSyncSample=0),C},wt=function(x,A){var C,k,M,P,se,ae=A||0,ce=[];for(C=0;CWt.ONE_SECOND_IN_TS/2))){for(me=qt()[x.samplerate],me||(me=A[0].data),Ae=0;Ae=C?x:(A.minSegmentDts=1/0,x.filter(function(k){return k.dts>=C?(A.minSegmentDts=Math.min(A.minSegmentDts,k.dts),A.minSegmentPts=A.minSegmentDts,!0):!1}))},oi=function(x){var A,C,k=[];for(A=0;A=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(x),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ui.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},ui.prototype.addText=function(x){this.rows[this.rowIdx]+=x},ui.prototype.backspace=function(){if(!this.isEmpty()){var x=this.rows[this.rowIdx];this.rows[this.rowIdx]=x.substr(0,x.length-1)}};var ei=function(x,A,C){this.serviceNum=x,this.text="",this.currentWindow=new ui(-1),this.windows=[],this.stream=C,typeof A=="string"&&this.createTextDecoder(A)};ei.prototype.init=function(x,A){this.startPts=x;for(var C=0;C<8;C++)this.windows[C]=new ui(C),typeof A=="function"&&(this.windows[C].beforeRowOverflow=A)},ei.prototype.setCurrentWindow=function(x){this.currentWindow=this.windows[x]},ei.prototype.createTextDecoder=function(x){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(x)}catch(A){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+x+" encoding. "+A})}};var ti=function(x){x=x||{},ti.prototype.init.call(this);var A=this,C=x.captionServices||{},k={},M;Object.keys(C).forEach(P=>{M=C[P],/^SERVICE/.test(P)&&(k[P]=M.encoding)}),this.serviceEncodings=k,this.current708Packet=null,this.services={},this.push=function(P){P.type===3?(A.new708Packet(),A.add708Bytes(P)):(A.current708Packet===null&&A.new708Packet(),A.add708Bytes(P))}};ti.prototype=new Ri,ti.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ti.prototype.add708Bytes=function(x){var A=x.ccData,C=A>>>8,k=A&255;this.current708Packet.ptsVals.push(x.pts),this.current708Packet.data.push(C),this.current708Packet.data.push(k)},ti.prototype.push708Packet=function(){var x=this.current708Packet,A=x.data,C=null,k=null,M=0,P=A[M++];for(x.seq=P>>6,x.sizeCode=P&63;M>5,k=P&31,C===7&&k>0&&(P=A[M++],C=P),this.pushServiceBlock(C,M,k),k>0&&(M+=k-1)},ti.prototype.pushServiceBlock=function(x,A,C){var k,M=A,P=this.current708Packet.data,se=this.services[x];for(se||(se=this.initService(x,M));M("0"+(Bt&255).toString(16)).slice(-2)).join("")}if(M?(Ke=[ae,ce],x++):Ke=[ae],A.textDecoder_&&!k)Ae=A.textDecoder_.decode(new Uint8Array(Ke));else if(M){const st=kt(Ke);Ae=String.fromCharCode(parseInt(st,16))}else Ae=Si(se|ae);return me.pendingNewLine&&!me.isEmpty()&&me.newLine(this.getPts(x)),me.pendingNewLine=!1,me.addText(Ae),x},ti.prototype.multiByteCharacter=function(x,A){var C=this.current708Packet.data,k=C[x+1],M=C[x+2];return jt(k)&&jt(M)&&(x=this.handleText(++x,A,{isMultiByte:!0})),x},ti.prototype.setCurrentWindow=function(x,A){var C=this.current708Packet.data,k=C[x],M=k&7;return A.setCurrentWindow(M),x},ti.prototype.defineWindow=function(x,A){var C=this.current708Packet.data,k=C[x],M=k&7;A.setCurrentWindow(M);var P=A.currentWindow;return k=C[++x],P.visible=(k&32)>>5,P.rowLock=(k&16)>>4,P.columnLock=(k&8)>>3,P.priority=k&7,k=C[++x],P.relativePositioning=(k&128)>>7,P.anchorVertical=k&127,k=C[++x],P.anchorHorizontal=k,k=C[++x],P.anchorPoint=(k&240)>>4,P.rowCount=k&15,k=C[++x],P.columnCount=k&63,k=C[++x],P.windowStyle=(k&56)>>3,P.penStyle=k&7,P.virtualRowCount=P.rowCount+1,x},ti.prototype.setWindowAttributes=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.winAttr;return k=C[++x],M.fillOpacity=(k&192)>>6,M.fillRed=(k&48)>>4,M.fillGreen=(k&12)>>2,M.fillBlue=k&3,k=C[++x],M.borderType=(k&192)>>6,M.borderRed=(k&48)>>4,M.borderGreen=(k&12)>>2,M.borderBlue=k&3,k=C[++x],M.borderType+=(k&128)>>5,M.wordWrap=(k&64)>>6,M.printDirection=(k&48)>>4,M.scrollDirection=(k&12)>>2,M.justify=k&3,k=C[++x],M.effectSpeed=(k&240)>>4,M.effectDirection=(k&12)>>2,M.displayEffect=k&3,x},ti.prototype.flushDisplayed=function(x,A){for(var C=[],k=0;k<8;k++)A.windows[k].visible&&!A.windows[k].isEmpty()&&C.push(A.windows[k].getText());A.endPts=x,A.text=C.join(` -`),this.pushCaption(A),A.startPts=x},ei.prototype.pushCaption=function(x){x.text!==""&&(this.trigger("data",{startPts:x.startPts,endPts:x.endPts,text:x.text,stream:"cc708_"+x.serviceNum}),x.text="",x.startPts=x.endPts)},ei.prototype.displayWindows=function(x,A){var C=this.current708Packet.data,k=C[++x],M=this.getPts(x);this.flushDisplayed(M,A);for(var P=0;P<8;P++)k&1<>4,M.offset=(k&12)>>2,M.penSize=k&3,k=C[++x],M.italics=(k&128)>>7,M.underline=(k&64)>>6,M.edgeType=(k&56)>>3,M.fontStyle=k&7,x},ei.prototype.setPenColor=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.penColor;return k=C[++x],M.fgOpacity=(k&192)>>6,M.fgRed=(k&48)>>4,M.fgGreen=(k&12)>>2,M.fgBlue=k&3,k=C[++x],M.bgOpacity=(k&192)>>6,M.bgRed=(k&48)>>4,M.bgGreen=(k&12)>>2,M.bgBlue=k&3,k=C[++x],M.edgeRed=(k&48)>>4,M.edgeGreen=(k&12)>>2,M.edgeBlue=k&3,x},ei.prototype.setPenLocation=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.penLoc;return A.currentWindow.pendingNewLine=!0,k=C[++x],M.row=k&15,k=C[++x],M.column=k&63,x},ei.prototype.reset=function(x,A){var C=this.getPts(x);return this.flushDisplayed(C,A),this.initService(A.serviceNum,x)};var Qi={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Ls=function(x){return x===null?"":(x=Qi[x]||x,String.fromCharCode(x))},Hs=14,rn=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ys=function(){for(var x=[],A=Hs+1;A--;)x.push({text:"",indent:0,offset:0});return x},xi=function(x,A){xi.prototype.init.call(this),this.field_=x||0,this.dataChannel_=A||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(C){var k,M,P,se,oe;if(k=C.ccData&32639,k===this.lastControlCode_){this.lastControlCode_=null;return}if((k&61440)===4096?this.lastControlCode_=k:k!==this.PADDING_&&(this.lastControlCode_=null),P=k>>>8,se=k&255,k!==this.PADDING_)if(k===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(k===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(C.pts),this.flushDisplayed(C.pts),M=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=M,this.startPts_=C.pts;else if(k===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(C.pts);else if(k===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(C.pts);else if(k===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(C.pts);else if(k===this.CARRIAGE_RETURN_)this.clearFormatting(C.pts),this.flushDisplayed(C.pts),this.shiftRowsUp_(),this.startPts_=C.pts;else if(k===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(k===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(C.pts),this.displayed_=ys();else if(k===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ys();else if(k===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(C.pts),this.displayed_=ys()),this.mode_="paintOn",this.startPts_=C.pts;else if(this.isSpecialCharacter(P,se))P=(P&3)<<8,oe=Ls(P|se),this[this.mode_](C.pts,oe),this.column_++;else if(this.isExtCharacter(P,se))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),P=(P&3)<<8,oe=Ls(P|se),this[this.mode_](C.pts,oe),this.column_++;else if(this.isMidRowCode(P,se))this.clearFormatting(C.pts),this[this.mode_](C.pts," "),this.column_++,(se&14)===14&&this.addFormatting(C.pts,["i"]),(se&1)===1&&this.addFormatting(C.pts,["u"]);else if(this.isOffsetControlCode(P,se)){const he=se&3;this.nonDisplayed_[this.row_].offset=he,this.column_+=he}else if(this.isPAC(P,se)){var ue=rn.indexOf(k&7968);if(this.mode_==="rollUp"&&(ue-this.rollUpRows_+1<0&&(ue=this.rollUpRows_-1),this.setRollUp(C.pts,ue)),ue!==this.row_&&ue>=0&&ue<=14&&(this.clearFormatting(C.pts),this.row_=ue),se&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(C.pts,["u"]),(k&16)===16){const he=(k&14)>>1;this.column_=he*4,this.nonDisplayed_[this.row_].indent+=he}this.isColorPAC(se)&&(se&14)===14&&this.addFormatting(C.pts,["i"])}else this.isNormalChar(P)&&(se===0&&(se=null),oe=Ls(P),oe+=Ls(se),this[this.mode_](C.pts,oe),this.column_+=oe.length)}};xi.prototype=new Ei,xi.prototype.flushDisplayed=function(x){const A=k=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+k+"."})},C=[];this.displayed_.forEach((k,M)=>{if(k&&k.text&&k.text.length){try{k.text=k.text.trim()}catch{A(M)}k.text.length&&C.push({text:k.text,line:M+1,position:10+Math.min(70,k.indent*10)+k.offset*2.5})}else k==null&&A(M)}),C.length&&this.trigger("data",{startPts:this.startPts_,endPts:x,content:C,stream:this.name_})},xi.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ys(),this.nonDisplayed_=ys(),this.lastControlCode_=null,this.column_=0,this.row_=Hs,this.rollUpRows_=2,this.formatting_=[]},xi.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},xi.prototype.isSpecialCharacter=function(x,A){return x===this.EXT_&&A>=48&&A<=63},xi.prototype.isExtCharacter=function(x,A){return(x===this.EXT_+1||x===this.EXT_+2)&&A>=32&&A<=63},xi.prototype.isMidRowCode=function(x,A){return x===this.EXT_&&A>=32&&A<=47},xi.prototype.isOffsetControlCode=function(x,A){return x===this.OFFSET_&&A>=33&&A<=35},xi.prototype.isPAC=function(x,A){return x>=this.BASE_&&x=64&&A<=127},xi.prototype.isColorPAC=function(x){return x>=64&&x<=79||x>=96&&x<=127},xi.prototype.isNormalChar=function(x){return x>=32&&x<=127},xi.prototype.setRollUp=function(x,A){if(this.mode_!=="rollUp"&&(this.row_=Hs,this.mode_="rollUp",this.flushDisplayed(x),this.nonDisplayed_=ys(),this.displayed_=ys()),A!==void 0&&A!==this.row_)for(var C=0;C"},"");this[this.mode_](x,C)},xi.prototype.clearFormatting=function(x){if(this.formatting_.length){var A=this.formatting_.reverse().reduce(function(C,k){return C+""},"");this.formatting_=[],this[this.mode_](x,A)}},xi.prototype.popOn=function(x,A){var C=this.nonDisplayed_[this.row_].text;C+=A,this.nonDisplayed_[this.row_].text=C},xi.prototype.rollUp=function(x,A){var C=this.displayed_[this.row_].text;C+=A,this.displayed_[this.row_].text=C},xi.prototype.shiftRowsUp_=function(){var x;for(x=0;xA&&(C=-1);Math.abs(A-x)>Ai;)x+=C*Ji;return x},$e=function(x){var A,C;$e.prototype.init.call(this),this.type_=x||hn,this.push=function(k){if(k.type==="metadata"){this.trigger("data",k);return}this.type_!==hn&&k.type!==this.type_||(C===void 0&&(C=k.dts),k.dts=_s(k.dts,C),k.pts=_s(k.pts,C),A=k.dts,this.trigger("data",k))},this.flush=function(){C=A,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){C=void 0,A=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};$e.prototype=new Rs;var Mt={TimestampRolloverStream:$e,handleRollover:_s},Nt=(x,A,C)=>{if(!x)return-1;for(var k=C;k";x.data[0]===bi.Utf8&&(C=Wt(x.data,0,A),!(C<0)&&(x.mimeType=qi(x.data,A,C),A=C+1,x.pictureType=x.data[A],A++,k=Wt(x.data,0,A),!(k<0)&&(x.description=Bi(x.data,A,k),A=k+1,x.mimeType===M?x.url=qi(x.data,A,x.data.length):x.pictureData=x.data.subarray(A,x.data.length))))},"T*":function(x){x.data[0]===bi.Utf8&&(x.value=Bi(x.data,1,x.data.length).replace(/\0*$/,""),x.values=x.value.split("\0"))},TXXX:function(x){var A;x.data[0]===bi.Utf8&&(A=Wt(x.data,0,1),A!==-1&&(x.description=Bi(x.data,1,A),x.value=Bi(x.data,A+1,x.data.length).replace(/\0*$/,""),x.data=x.value))},"W*":function(x){x.url=qi(x.data,0,x.data.length).replace(/\0.*$/,"")},WXXX:function(x){var A;x.data[0]===bi.Utf8&&(A=Wt(x.data,0,1),A!==-1&&(x.description=Bi(x.data,1,A),x.url=qi(x.data,A+1,x.data.length).replace(/\0.*$/,"")))},PRIV:function(x){var A;for(A=0;A>>2;Lt*=4,Lt+=Qe[7]&3,Ee.timeStamp=Lt,oe.pts===void 0&&oe.dts===void 0&&(oe.pts=Ee.timeStamp,oe.dts=Ee.timeStamp),this.trigger("timestamp",Ee)}oe.frames.push(Ee),ue+=10,ue+=he}while(ue>>4>1&&(se+=M[se]+1),P.pid===0)P.type="pat",x(M.subarray(se),P),this.trigger("data",P);else if(P.pid===this.pmtPid)for(P.type="pmt",x(M.subarray(se),P),this.trigger("data",P);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([M,se,P]):this.processPes_(M,se,P)},this.processPes_=function(M,P,se){se.pid===this.programMapTable.video?se.streamType=Ii.H264_STREAM_TYPE:se.pid===this.programMapTable.audio?se.streamType=Ii.ADTS_STREAM_TYPE:se.streamType=this.programMapTable["timed-metadata"][se.pid],se.type="pes",se.data=M.subarray(P),this.trigger("data",se)}},Ne.prototype=new an,Ne.STREAM_TYPES={h264:27,adts:15},et=function(){var x=this,A=!1,C={data:[],size:0},k={data:[],size:0},M={data:[],size:0},P,se=function(ue,he){var Ee;const ze=ue[0]<<16|ue[1]<<8|ue[2];he.data=new Uint8Array,ze===1&&(he.packetLength=6+(ue[4]<<8|ue[5]),he.dataAlignmentIndicator=(ue[6]&4)!==0,Ee=ue[7],Ee&192&&(he.pts=(ue[9]&14)<<27|(ue[10]&255)<<20|(ue[11]&254)<<12|(ue[12]&255)<<5|(ue[13]&254)>>>3,he.pts*=4,he.pts+=(ue[13]&6)>>>1,he.dts=he.pts,Ee&64&&(he.dts=(ue[14]&14)<<27|(ue[15]&255)<<20|(ue[16]&254)<<12|(ue[17]&255)<<5|(ue[18]&254)>>>3,he.dts*=4,he.dts+=(ue[18]&6)>>>1)),he.data=ue.subarray(9+ue[8]))},oe=function(ue,he,Ee){var ze=new Uint8Array(ue.size),Tt={type:he},Qe=0,Lt=0,mi=!1,Zs;if(!(!ue.data.length||ue.size<9)){for(Tt.trackId=ue.data[0].pid,Qe=0;Qe>5,ue=((A[M+6]&3)+1)*1024,he=ue*At/ce[(A[M+2]&60)>>>2],A.byteLength-M>>6&3)+1,channelcount:(A[M+2]&1)<<2|(A[M+3]&192)>>>6,samplerate:ce[(A[M+2]&60)>>>2],samplingfrequencyindex:(A[M+2]&60)>>>2,samplesize:16,data:A.subarray(M+7+se,M+P)}),C++,M+=P}typeof Ee=="number"&&(this.skipWarn_(Ee,M),Ee=null),A=A.subarray(M)}},this.flush=function(){C=0,this.trigger("done")},this.reset=function(){A=void 0,this.trigger("reset")},this.endTimeline=function(){A=void 0,this.trigger("endedtimeline")}},Ct.prototype=new ut;var ye=Ct,ve;ve=function(x){var A=x.byteLength,C=0,k=0;this.length=function(){return 8*A},this.bitsAvailable=function(){return 8*A+k},this.loadWord=function(){var M=x.byteLength-A,P=new Uint8Array(4),se=Math.min(4,A);if(se===0)throw new Error("no bytes available");P.set(x.subarray(M,M+se)),C=new DataView(P.buffer).getUint32(0),k=se*8,A-=se},this.skipBits=function(M){var P;k>M?(C<<=M,k-=M):(M-=k,P=Math.floor(M/8),M-=P*8,A-=P,this.loadWord(),C<<=M,k-=M)},this.readBits=function(M){var P=Math.min(k,M),se=C>>>32-P;return k-=P,k>0?C<<=P:A>0&&this.loadWord(),P=M-P,P>0?se<>>M)!==0)return C<<=M,k-=M,M;return this.loadWord(),M+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var M=this.skipLeadingZeros();return this.readBits(M+1)-1},this.readExpGolomb=function(){var M=this.readUnsignedExpGolomb();return 1&M?1+M>>>1:-1*(M>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Ge=ve,De=t,rt=Ge,dt,at,wt;at=function(){var x=0,A,C;at.prototype.init.call(this),this.push=function(k){var M;C?(M=new Uint8Array(C.byteLength+k.data.byteLength),M.set(C),M.set(k.data,C.byteLength),C=M):C=k.data;for(var P=C.byteLength;x3&&this.trigger("data",C.subarray(x+3)),C=null,x=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},at.prototype=new De,wt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},dt=function(){var x=new at,A,C,k,M,P,se,oe;dt.prototype.init.call(this),A=this,this.push=function(ue){ue.type==="video"&&(C=ue.trackId,k=ue.pts,M=ue.dts,x.push(ue))},x.on("data",function(ue){var he={trackId:C,pts:k,dts:M,data:ue,nalUnitTypeCode:ue[0]&31};switch(he.nalUnitTypeCode){case 5:he.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:he.nalUnitType="sei_rbsp",he.escapedRBSP=P(ue.subarray(1));break;case 7:he.nalUnitType="seq_parameter_set_rbsp",he.escapedRBSP=P(ue.subarray(1)),he.config=se(he.escapedRBSP);break;case 8:he.nalUnitType="pic_parameter_set_rbsp";break;case 9:he.nalUnitType="access_unit_delimiter_rbsp";break}A.trigger("data",he)}),x.on("done",function(){A.trigger("done")}),x.on("partialdone",function(){A.trigger("partialdone")}),x.on("reset",function(){A.trigger("reset")}),x.on("endedtimeline",function(){A.trigger("endedtimeline")}),this.flush=function(){x.flush()},this.partialFlush=function(){x.partialFlush()},this.reset=function(){x.reset()},this.endTimeline=function(){x.endTimeline()},oe=function(ue,he){var Ee=8,ze=8,Tt,Qe;for(Tt=0;Tt>4;return C=C>=0?C:0,M?C+20:C+10},pt=function(x,A){return x.length-A<10||x[A]!==73||x[A+1]!==68||x[A+2]!==51?A:(A+=mt(x,A),pt(x,A))},Bt=function(x){var A=pt(x,0);return x.length>=A+2&&(x[A]&255)===255&&(x[A+1]&240)===240&&(x[A+1]&22)===16},oi=function(x){return x[0]<<21|x[1]<<14|x[2]<<7|x[3]},qt=function(x,A,C){var k,M="";for(k=A;k>5,k=x[A+4]<<3,M=x[A+3]&6144;return M|k|C},zs=function(x,A){return x[A]===73&&x[A+1]===68&&x[A+2]===51?"timed-metadata":x[A]&!0&&(x[A+1]&240)===240?"audio":null},Hi=function(x){for(var A=0;A+5>>2]}return null},ws=function(x){var A,C,k,M;A=10,x[5]&64&&(A+=4,A+=oi(x.subarray(10,14)));do{if(C=oi(x.subarray(A+4,A+8)),C<1)return null;if(M=String.fromCharCode(x[A],x[A+1],x[A+2],x[A+3]),M==="PRIV"){k=x.subarray(A+10,A+C+10);for(var P=0;P>>2;return ue*=4,ue+=oe[7]&3,ue}break}}A+=10,A+=C}while(A=3;){if(x[M]===73&&x[M+1]===68&&x[M+2]===51){if(x.length-M<10||(k=Do.parseId3TagSize(x,M),M+k>x.length))break;se={type:"timed-metadata",data:x.subarray(M,M+k)},this.trigger("data",se),M+=k;continue}else if((x[M]&255)===255&&(x[M+1]&240)===240){if(x.length-M<7||(k=Do.parseAdtsSize(x,M),M+k>x.length))break;oe={type:"audio",data:x.subarray(M,M+k),pts:A,dts:A},this.trigger("data",oe),M+=k;continue}M++}P=x.length-M,P>0?x=x.subarray(M):x=new Uint8Array},this.reset=function(){x=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){x=new Uint8Array,this.trigger("endedtimeline")}},zn.prototype=new ea;var Wa=zn,Zc=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Jc=Zc,Rp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ip=Rp,Lo=t,Ll=Ce,Rl=ht,wu=Ri,xr=ee,ta=we,Il=Ht,ef=ye,Np=It.H264Stream,Op=Wa,Mp=Jn.isLikelyAacData,ed=Ht.ONE_SECOND_IN_TS,tf=Jc,sf=Ip,Au,Ro,ku,Ya,Pp=function(x,A){A.stream=x,this.trigger("log",A)},nf=function(x,A){for(var C=Object.keys(A),k=0;k=-1e4&&Ee<=ue&&(!ze||he>Ee)&&(ze=Qe,he=Ee)));return ze?ze.gop:null},this.alignGopsAtStart_=function(oe){var ue,he,Ee,ze,Tt,Qe,Lt,mi;for(Tt=oe.byteLength,Qe=oe.nalCount,Lt=oe.duration,ue=he=0;ueEe.pts){ue++;continue}he++,Tt-=ze.byteLength,Qe-=ze.nalCount,Lt-=ze.duration}return he===0?oe:he===oe.length?null:(mi=oe.slice(he),mi.byteLength=Tt,mi.duration=Lt,mi.nalCount=Qe,mi.pts=mi[0].pts,mi.dts=mi[0].dts,mi)},this.alignGopsAtEnd_=function(oe){var ue,he,Ee,ze,Tt,Qe;for(ue=M.length-1,he=oe.length-1,Tt=null,Qe=!1;ue>=0&&he>=0;){if(Ee=M[ue],ze=oe[he],Ee.pts===ze.pts){Qe=!0;break}if(Ee.pts>ze.pts){ue--;continue}ue===M.length-1&&(Tt=he),he--}if(!Qe&&Tt===null)return null;var Lt;if(Qe?Lt=he:Lt=Tt,Lt===0)return oe;var mi=oe.slice(Lt),Zs=mi.reduce(function(Vn,Ta){return Vn.byteLength+=Ta.byteLength,Vn.duration+=Ta.duration,Vn.nalCount+=Ta.nalCount,Vn},{byteLength:0,duration:0,nalCount:0});return mi.byteLength=Zs.byteLength,mi.duration=Zs.duration,mi.nalCount=Zs.nalCount,mi.pts=mi[0].pts,mi.dts=mi[0].dts,mi},this.alignGopsWith=function(oe){M=oe}},Au.prototype=new Lo,Ya=function(x,A){this.numberOfTracks=0,this.metadataStream=A,x=x||{},typeof x.remux<"u"?this.remuxTracks=!!x.remux:this.remuxTracks=!0,typeof x.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=x.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ya.prototype.init.call(this),this.push=function(C){if(C.content||C.text)return this.pendingCaptions.push(C);if(C.frames)return this.pendingMetadata.push(C);this.pendingTracks.push(C.track),this.pendingBytes+=C.boxes.byteLength,C.track.type==="video"&&(this.videoTrack=C.track,this.pendingBoxes.push(C.boxes)),C.track.type==="audio"&&(this.audioTrack=C.track,this.pendingBoxes.unshift(C.boxes))}},Ya.prototype=new Lo,Ya.prototype.flush=function(x){var A=0,C={captions:[],captionStreams:{},metadata:[],info:{}},k,M,P,se=0,oe;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(se=this.videoTrack.timelineStartInfo.pts,sf.forEach(function(ue){C.info[ue]=this.videoTrack[ue]},this)):this.audioTrack&&(se=this.audioTrack.timelineStartInfo.pts,tf.forEach(function(ue){C.info[ue]=this.audioTrack[ue]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?C.type=this.pendingTracks[0].type:C.type="combined",this.emittedTracks+=this.pendingTracks.length,P=Ll.initSegment(this.pendingTracks),C.initSegment=new Uint8Array(P.byteLength),C.initSegment.set(P),C.data=new Uint8Array(this.pendingBytes),oe=0;oe=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ya.prototype.setRemux=function(x){this.remuxTracks=x},ku=function(x){var A=this,C=!0,k,M;ku.prototype.init.call(this),x=x||{},this.baseMediaDecodeTime=x.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var P={};this.transmuxPipeline_=P,P.type="aac",P.metadataStream=new ta.MetadataStream,P.aacStream=new Op,P.audioTimestampRolloverStream=new ta.TimestampRolloverStream("audio"),P.timedMetadataTimestampRolloverStream=new ta.TimestampRolloverStream("timed-metadata"),P.adtsStream=new ef,P.coalesceStream=new Ya(x,P.metadataStream),P.headOfPipeline=P.aacStream,P.aacStream.pipe(P.audioTimestampRolloverStream).pipe(P.adtsStream),P.aacStream.pipe(P.timedMetadataTimestampRolloverStream).pipe(P.metadataStream).pipe(P.coalesceStream),P.metadataStream.on("timestamp",function(se){P.aacStream.setTimestamp(se.timeStamp)}),P.aacStream.on("data",function(se){se.type!=="timed-metadata"&&se.type!=="audio"||P.audioSegmentStream||(M=M||{timelineStartInfo:{baseMediaDecodeTime:A.baseMediaDecodeTime},codec:"adts",type:"audio"},P.coalesceStream.numberOfTracks++,P.audioSegmentStream=new Ro(M,x),P.audioSegmentStream.on("log",A.getLogTrigger_("audioSegmentStream")),P.audioSegmentStream.on("timingInfo",A.trigger.bind(A,"audioTimingInfo")),P.adtsStream.pipe(P.audioSegmentStream).pipe(P.coalesceStream),A.trigger("trackinfo",{hasAudio:!!M,hasVideo:!!k}))}),P.coalesceStream.on("data",this.trigger.bind(this,"data")),P.coalesceStream.on("done",this.trigger.bind(this,"done")),nf(this,P)},this.setupTsPipeline=function(){var P={};this.transmuxPipeline_=P,P.type="ts",P.metadataStream=new ta.MetadataStream,P.packetStream=new ta.TransportPacketStream,P.parseStream=new ta.TransportParseStream,P.elementaryStream=new ta.ElementaryStream,P.timestampRolloverStream=new ta.TimestampRolloverStream,P.adtsStream=new ef,P.h264Stream=new Np,P.captionStream=new ta.CaptionStream(x),P.coalesceStream=new Ya(x,P.metadataStream),P.headOfPipeline=P.packetStream,P.packetStream.pipe(P.parseStream).pipe(P.elementaryStream).pipe(P.timestampRolloverStream),P.timestampRolloverStream.pipe(P.h264Stream),P.timestampRolloverStream.pipe(P.adtsStream),P.timestampRolloverStream.pipe(P.metadataStream).pipe(P.coalesceStream),P.h264Stream.pipe(P.captionStream).pipe(P.coalesceStream),P.elementaryStream.on("data",function(se){var oe;if(se.type==="metadata"){for(oe=se.tracks.length;oe--;)!k&&se.tracks[oe].type==="video"?(k=se.tracks[oe],k.timelineStartInfo.baseMediaDecodeTime=A.baseMediaDecodeTime):!M&&se.tracks[oe].type==="audio"&&(M=se.tracks[oe],M.timelineStartInfo.baseMediaDecodeTime=A.baseMediaDecodeTime);k&&!P.videoSegmentStream&&(P.coalesceStream.numberOfTracks++,P.videoSegmentStream=new Au(k,x),P.videoSegmentStream.on("log",A.getLogTrigger_("videoSegmentStream")),P.videoSegmentStream.on("timelineStartInfo",function(ue){M&&!x.keepOriginalTimestamps&&(M.timelineStartInfo=ue,P.audioSegmentStream.setEarliestDts(ue.dts-A.baseMediaDecodeTime))}),P.videoSegmentStream.on("processedGopsInfo",A.trigger.bind(A,"gopInfo")),P.videoSegmentStream.on("segmentTimingInfo",A.trigger.bind(A,"videoSegmentTimingInfo")),P.videoSegmentStream.on("baseMediaDecodeTime",function(ue){M&&P.audioSegmentStream.setVideoBaseMediaDecodeTime(ue)}),P.videoSegmentStream.on("timingInfo",A.trigger.bind(A,"videoTimingInfo")),P.h264Stream.pipe(P.videoSegmentStream).pipe(P.coalesceStream)),M&&!P.audioSegmentStream&&(P.coalesceStream.numberOfTracks++,P.audioSegmentStream=new Ro(M,x),P.audioSegmentStream.on("log",A.getLogTrigger_("audioSegmentStream")),P.audioSegmentStream.on("timingInfo",A.trigger.bind(A,"audioTimingInfo")),P.audioSegmentStream.on("segmentTimingInfo",A.trigger.bind(A,"audioSegmentTimingInfo")),P.adtsStream.pipe(P.audioSegmentStream).pipe(P.coalesceStream)),A.trigger("trackinfo",{hasAudio:!!M,hasVideo:!!k})}}),P.coalesceStream.on("data",this.trigger.bind(this,"data")),P.coalesceStream.on("id3Frame",function(se){se.dispatchType=P.metadataStream.dispatchType,A.trigger("id3Frame",se)}),P.coalesceStream.on("caption",this.trigger.bind(this,"caption")),P.coalesceStream.on("done",this.trigger.bind(this,"done")),nf(this,P)},this.setBaseMediaDecodeTime=function(P){var se=this.transmuxPipeline_;x.keepOriginalTimestamps||(this.baseMediaDecodeTime=P),M&&(M.timelineStartInfo.dts=void 0,M.timelineStartInfo.pts=void 0,xr.clearDtsInfo(M),se.audioTimestampRolloverStream&&se.audioTimestampRolloverStream.discontinuity()),k&&(se.videoSegmentStream&&(se.videoSegmentStream.gopCache_=[]),k.timelineStartInfo.dts=void 0,k.timelineStartInfo.pts=void 0,xr.clearDtsInfo(k),se.captionStream.reset()),se.timestampRolloverStream&&se.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(P){M&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(P)},this.setRemux=function(P){var se=this.transmuxPipeline_;x.remux=P,se&&se.coalesceStream&&se.coalesceStream.setRemux(P)},this.alignGopsWith=function(P){k&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(P)},this.getLogTrigger_=function(P){var se=this;return function(oe){oe.stream=P,se.trigger("log",oe)}},this.push=function(P){if(C){var se=Mp(P);se&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!se&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),C=!1}this.transmuxPipeline_.headOfPipeline.push(P)},this.flush=function(){C=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},ku.prototype=new Lo;var Bp={Transmuxer:ku},Fp=function(x){return x>>>0},Up=function(x){return("00"+x.toString(16)).slice(-2)},Io={toUnsigned:Fp,toHexString:Up},Nl=function(x){var A="";return A+=String.fromCharCode(x[0]),A+=String.fromCharCode(x[1]),A+=String.fromCharCode(x[2]),A+=String.fromCharCode(x[3]),A},of=Nl,lf=Io.toUnsigned,uf=of,td=function(x,A){var C=[],k,M,P,se,oe;if(!A.length)return null;for(k=0;k1?k+M:x.byteLength,P===A[0]&&(A.length===1?C.push(x.subarray(k+8,se)):(oe=td(x.subarray(k+8,se),A.slice(1)),oe.length&&(C=C.concat(oe)))),k=se;return C},Cu=td,cf=Io.toUnsigned,No=r.getUint64,jp=function(x){var A={version:x[0],flags:new Uint8Array(x.subarray(1,4))};return A.version===1?A.baseMediaDecodeTime=No(x.subarray(4)):A.baseMediaDecodeTime=cf(x[4]<<24|x[5]<<16|x[6]<<8|x[7]),A},id=jp,$p=function(x){var A=new DataView(x.buffer,x.byteOffset,x.byteLength),C={version:x[0],flags:new Uint8Array(x.subarray(1,4)),trackId:A.getUint32(4)},k=C.flags[2]&1,M=C.flags[2]&2,P=C.flags[2]&8,se=C.flags[2]&16,oe=C.flags[2]&32,ue=C.flags[0]&65536,he=C.flags[0]&131072,Ee;return Ee=8,k&&(Ee+=4,C.baseDataOffset=A.getUint32(12),Ee+=4),M&&(C.sampleDescriptionIndex=A.getUint32(Ee),Ee+=4),P&&(C.defaultSampleDuration=A.getUint32(Ee),Ee+=4),se&&(C.defaultSampleSize=A.getUint32(Ee),Ee+=4),oe&&(C.defaultSampleFlags=A.getUint32(Ee)),ue&&(C.durationIsEmpty=!0),!k&&he&&(C.baseDataOffsetIsMoof=!0),C},sd=$p,df=function(x){return{isLeading:(x[0]&12)>>>2,dependsOn:x[0]&3,isDependedOn:(x[1]&192)>>>6,hasRedundancy:(x[1]&48)>>>4,paddingValue:(x[1]&14)>>>1,isNonSyncSample:x[1]&1,degradationPriority:x[2]<<8|x[3]}},Ol=df,Oo=Ol,Hp=function(x){var A={version:x[0],flags:new Uint8Array(x.subarray(1,4)),samples:[]},C=new DataView(x.buffer,x.byteOffset,x.byteLength),k=A.flags[2]&1,M=A.flags[2]&4,P=A.flags[1]&1,se=A.flags[1]&2,oe=A.flags[1]&4,ue=A.flags[1]&8,he=C.getUint32(4),Ee=8,ze;for(k&&(A.dataOffset=C.getInt32(Ee),Ee+=4),M&&he&&(ze={flags:Oo(x.subarray(Ee,Ee+4))},Ee+=4,P&&(ze.duration=C.getUint32(Ee),Ee+=4),se&&(ze.size=C.getUint32(Ee),Ee+=4),ue&&(A.version===1?ze.compositionTimeOffset=C.getInt32(Ee):ze.compositionTimeOffset=C.getUint32(Ee),Ee+=4),A.samples.push(ze),he--);he--;)ze={},P&&(ze.duration=C.getUint32(Ee),Ee+=4),se&&(ze.size=C.getUint32(Ee),Ee+=4),oe&&(ze.flags=Oo(x.subarray(Ee,Ee+4)),Ee+=4),ue&&(A.version===1?ze.compositionTimeOffset=C.getInt32(Ee):ze.compositionTimeOffset=C.getUint32(Ee),Ee+=4),A.samples.push(ze);return A},Ml=Hp,nd={tfdt:id,trun:Ml},rd={parseTfdt:nd.tfdt,parseTrun:nd.trun},ad=function(x){for(var A=0,C=String.fromCharCode(x[A]),k="";C!=="\0";)k+=C,A++,C=String.fromCharCode(x[A]);return k+=C,k},od={uint8ToCString:ad},Pl=od.uint8ToCString,hf=r.getUint64,ff=function(x){var A=4,C=x[0],k,M,P,se,oe,ue,he,Ee;if(C===0){k=Pl(x.subarray(A)),A+=k.length,M=Pl(x.subarray(A)),A+=M.length;var ze=new DataView(x.buffer);P=ze.getUint32(A),A+=4,oe=ze.getUint32(A),A+=4,ue=ze.getUint32(A),A+=4,he=ze.getUint32(A),A+=4}else if(C===1){var ze=new DataView(x.buffer);P=ze.getUint32(A),A+=4,se=hf(x.subarray(A)),A+=8,ue=ze.getUint32(A),A+=4,he=ze.getUint32(A),A+=4,k=Pl(x.subarray(A)),A+=k.length,M=Pl(x.subarray(A)),A+=M.length}Ee=new Uint8Array(x.subarray(A,x.byteLength));var Tt={scheme_id_uri:k,value:M,timescale:P||1,presentation_time:se,presentation_time_delta:oe,event_duration:ue,id:he,message_data:Ee};return Vp(C,Tt)?Tt:void 0},zp=function(x,A,C,k){return x||x===0?x/A:k+C/A},Vp=function(x,A){var C=A.scheme_id_uri!=="\0",k=x===0&&mf(A.presentation_time_delta)&&C,M=x===1&&mf(A.presentation_time)&&C;return!(x>1)&&k||M},mf=function(x){return x!==void 0||x!==null},Gp={parseEmsgBox:ff,scaleTime:zp},Bl;typeof window<"u"?Bl=window:typeof s<"u"?Bl=s:typeof self<"u"?Bl=self:Bl={};var Bn=Bl,ma=Io.toUnsigned,Mo=Io.toHexString,Is=Cu,Xa=of,Du=Gp,ld=sd,qp=Ml,Po=id,ud=r.getUint64,Bo,Lu,cd,pa,Qa,Fl,dd,ia=Bn,pf=fn.parseId3Frames;Bo=function(x){var A={},C=Is(x,["moov","trak"]);return C.reduce(function(k,M){var P,se,oe,ue,he;return P=Is(M,["tkhd"])[0],!P||(se=P[0],oe=se===0?12:20,ue=ma(P[oe]<<24|P[oe+1]<<16|P[oe+2]<<8|P[oe+3]),he=Is(M,["mdia","mdhd"])[0],!he)?null:(se=he[0],oe=se===0?12:20,k[ue]=ma(he[oe]<<24|he[oe+1]<<16|he[oe+2]<<8|he[oe+3]),k)},A)},Lu=function(x,A){var C;C=Is(A,["moof","traf"]);var k=C.reduce(function(M,P){var se=Is(P,["tfhd"])[0],oe=ma(se[4]<<24|se[5]<<16|se[6]<<8|se[7]),ue=x[oe]||9e4,he=Is(P,["tfdt"])[0],Ee=new DataView(he.buffer,he.byteOffset,he.byteLength),ze;he[0]===1?ze=ud(he.subarray(4,12)):ze=Ee.getUint32(4);let Tt;return typeof ze=="bigint"?Tt=ze/ia.BigInt(ue):typeof ze=="number"&&!isNaN(ze)&&(Tt=ze/ue),Tt11?(M.codec+=".",M.codec+=Mo(Qe[9]),M.codec+=Mo(Qe[10]),M.codec+=Mo(Qe[11])):M.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(M.codec)?(Qe=Tt.subarray(28),Lt=Xa(Qe.subarray(4,8)),Lt==="esds"&&Qe.length>20&&Qe[19]!==0?(M.codec+="."+Mo(Qe[19]),M.codec+="."+Mo(Qe[20]>>>2&63).replace(/^0/,"")):M.codec="mp4a.40.2"):M.codec=M.codec.toLowerCase())}var mi=Is(k,["mdia","mdhd"])[0];mi&&(M.timescale=Fl(mi)),C.push(M)}),C},dd=function(x,A=0){var C=Is(x,["emsg"]);return C.map(k=>{var M=Du.parseEmsgBox(new Uint8Array(k)),P=pf(M.message_data);return{cueTime:Du.scaleTime(M.presentation_time,M.timescale,M.presentation_time_delta,A),duration:Du.scaleTime(M.event_duration,M.timescale),frames:P}})};var Fo={findBox:Is,parseType:Xa,timescale:Bo,startTime:Lu,compositionStartTime:cd,videoTrackIds:pa,tracks:Qa,getTimescaleFromMediaHeader:Fl,getEmsgID3:dd};const{parseTrun:gf}=rd,{findBox:yf}=Fo;var vf=Bn,Kp=function(x){var A=yf(x,["moof","traf"]),C=yf(x,["mdat"]),k=[];return C.forEach(function(M,P){var se=A[P];k.push({mdat:M,traf:se})}),k},xf=function(x,A,C){var k=A,M=C.defaultSampleDuration||0,P=C.defaultSampleSize||0,se=C.trackId,oe=[];return x.forEach(function(ue){var he=gf(ue),Ee=he.samples;Ee.forEach(function(ze){ze.duration===void 0&&(ze.duration=M),ze.size===void 0&&(ze.size=P),ze.trackId=se,ze.dts=k,ze.compositionTimeOffset===void 0&&(ze.compositionTimeOffset=0),typeof k=="bigint"?(ze.pts=k+vf.BigInt(ze.compositionTimeOffset),k+=vf.BigInt(ze.duration)):(ze.pts=k+ze.compositionTimeOffset,k+=ze.duration)}),oe=oe.concat(Ee)}),oe},hd={getMdatTrafPairs:Kp,parseSamples:xf},fd=_i.discardEmulationPreventionBytes,br=Cs.CaptionStream,Uo=Cu,er=id,jo=sd,{getMdatTrafPairs:md,parseSamples:Ru}=hd,Iu=function(x,A){for(var C=x,k=0;k0?er(Ee[0]).baseMediaDecodeTime:0,Tt=Uo(se,["trun"]),Qe,Lt;A===he&&Tt.length>0&&(Qe=Ru(Tt,ze,ue),Lt=pd(P,Qe,he),C[he]||(C[he]={seiNals:[],logs:[]}),C[he].seiNals=C[he].seiNals.concat(Lt.seiNals),C[he].logs=C[he].logs.concat(Lt.logs))}),C},bf=function(x,A,C){var k;if(A===null)return null;k=Za(x,A);var M=k[A]||{};return{seiNals:M.seiNals,logs:M.logs,timescale:C}},Nu=function(){var x=!1,A,C,k,M,P,se;this.isInitialized=function(){return x},this.init=function(oe){A=new br,x=!0,se=oe?oe.isPartial:!1,A.on("data",function(ue){ue.startTime=ue.startPts/M,ue.endTime=ue.endPts/M,P.captions.push(ue),P.captionStreams[ue.stream]=!0}),A.on("log",function(ue){P.logs.push(ue)})},this.isNewInit=function(oe,ue){return oe&&oe.length===0||ue&&typeof ue=="object"&&Object.keys(ue).length===0?!1:k!==oe[0]||M!==ue[k]},this.parse=function(oe,ue,he){var Ee;if(this.isInitialized()){if(!ue||!he)return null;if(this.isNewInit(ue,he))k=ue[0],M=he[k];else if(k===null||!M)return C.push(oe),null}else return null;for(;C.length>0;){var ze=C.shift();this.parse(ze,ue,he)}return Ee=bf(oe,k,M),Ee&&Ee.logs&&(P.logs=P.logs.concat(Ee.logs)),Ee===null||!Ee.seiNals?P.logs.length?{logs:P.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ee.seiNals),this.flushStream(),P)},this.pushNals=function(oe){if(!this.isInitialized()||!oe||oe.length===0)return null;oe.forEach(function(ue){A.push(ue)})},this.flushStream=function(){if(!this.isInitialized())return null;se?A.partialFlush():A.flush()},this.clearParsedCaptions=function(){P.captions=[],P.captionStreams={},P.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;A.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){C=[],k=null,M=null,P?this.clearParsedCaptions():P={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},$o=Nu;const{parseTfdt:Wp}=rd,Vs=Cu,{getTimescaleFromMediaHeader:gd}=Fo,{parseSamples:sa,getMdatTrafPairs:Tf}=hd;var ga=function(){let x=9e4;this.init=function(A){const C=Vs(A,["moov","trak","mdia","mdhd"])[0];C&&(x=gd(C))},this.parseSegment=function(A){const C=[],k=Tf(A);let M=0;return k.forEach(function(P){const se=P.mdat,oe=P.traf,ue=Vs(oe,["tfdt"])[0],he=Vs(oe,["tfhd"])[0],Ee=Vs(oe,["trun"]);if(ue&&(M=Wp(ue).baseMediaDecodeTime),Ee.length&&he){const ze=sa(Ee,M,he);let Tt=0;ze.forEach(function(Qe){const Lt="utf-8",mi=new TextDecoder(Lt),Zs=se.slice(Tt,Tt+Qe.size);if(Vs(Zs,["vtte"])[0]){Tt+=Qe.size;return}Vs(Zs,["vttc"]).forEach(function(Hl){const As=Vs(Hl,["payl"])[0],Ja=Vs(Hl,["sttg"])[0],na=Qe.pts/x,Sa=(Qe.pts+Qe.duration)/x;let as,Ur;if(As)try{as=mi.decode(As)}catch(Tn){console.error(Tn)}if(Ja)try{Ur=mi.decode(Ja)}catch(Tn){console.error(Tn)}Qe.duration&&as&&C.push({cueText:as,start:na,end:Sa,settings:Ur})}),Tt+=Qe.size})}}),C}},Ul=$i,vd=function(x){var A=x[1]&31;return A<<=8,A|=x[2],A},Ho=function(x){return!!(x[1]&64)},jl=function(x){var A=0;return(x[3]&48)>>>4>1&&(A+=x[4]+1),A},tr=function(x,A){var C=vd(x);return C===0?"pat":C===A?"pmt":A?"pes":null},zo=function(x){var A=Ho(x),C=4+jl(x);return A&&(C+=x[C]+1),(x[C+10]&31)<<8|x[C+11]},Vo=function(x){var A={},C=Ho(x),k=4+jl(x);if(C&&(k+=x[k]+1),!!(x[k+5]&1)){var M,P,se;M=(x[k+1]&15)<<8|x[k+2],P=3+M-4,se=(x[k+10]&15)<<8|x[k+11];for(var oe=12+se;oe=x.byteLength)return null;var k=null,M;return M=x[C+7],M&192&&(k={},k.pts=(x[C+9]&14)<<27|(x[C+10]&255)<<20|(x[C+11]&254)<<12|(x[C+12]&255)<<5|(x[C+13]&254)>>>3,k.pts*=4,k.pts+=(x[C+13]&6)>>>1,k.dts=k.pts,M&64&&(k.dts=(x[C+14]&14)<<27|(x[C+15]&255)<<20|(x[C+16]&254)<<12|(x[C+17]&255)<<5|(x[C+18]&254)>>>3,k.dts*=4,k.dts+=(x[C+18]&6)>>>1)),k},Fn=function(x){switch(x){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},ir=function(x){for(var A=4+jl(x),C=x.subarray(A),k=0,M=0,P=!1,se;M3&&(se=Fn(C[M+3]&31),se==="slice_layer_without_partitioning_rbsp_idr"&&(P=!0)),P},ya={parseType:tr,parsePat:zo,parsePmt:Vo,parsePayloadUnitStartIndicator:Ho,parsePesType:Ou,parsePesTime:$l,videoPacketContainsKeyFrame:ir},Tr=$i,Cn=Mt.handleRollover,Ni={};Ni.ts=ya,Ni.aac=Jn;var va=Ht.ONE_SECOND_IN_TS,pn=188,sr=71,Sf=function(x,A){for(var C=0,k=pn,M,P;k=0;){if(x[k]===sr&&(x[M]===sr||M===x.byteLength)){if(P=x.subarray(k,M),se=Ni.ts.parseType(P,A.pid),se==="pes"&&(oe=Ni.ts.parsePesType(P,A.table),ue=Ni.ts.parsePayloadUnitStartIndicator(P),oe==="audio"&&ue&&(he=Ni.ts.parsePesTime(P),he&&(he.type="audio",C.audio.push(he),Ee=!0))),Ee)break;k-=pn,M-=pn;continue}k--,M--}},vs=function(x,A,C){for(var k=0,M=pn,P,se,oe,ue,he,Ee,ze,Tt,Qe=!1,Lt={data:[],size:0};M=0;){if(x[k]===sr&&x[M]===sr){if(P=x.subarray(k,M),se=Ni.ts.parseType(P,A.pid),se==="pes"&&(oe=Ni.ts.parsePesType(P,A.table),ue=Ni.ts.parsePayloadUnitStartIndicator(P),oe==="video"&&ue&&(he=Ni.ts.parsePesTime(P),he&&(he.type="video",C.video.push(he),Qe=!0))),Qe)break;k-=pn,M-=pn;continue}k--,M--}},zi=function(x,A){if(x.audio&&x.audio.length){var C=A;(typeof C>"u"||isNaN(C))&&(C=x.audio[0].dts),x.audio.forEach(function(P){P.dts=Cn(P.dts,C),P.pts=Cn(P.pts,C),P.dtsTime=P.dts/va,P.ptsTime=P.pts/va})}if(x.video&&x.video.length){var k=A;if((typeof k>"u"||isNaN(k))&&(k=x.video[0].dts),x.video.forEach(function(P){P.dts=Cn(P.dts,k),P.pts=Cn(P.pts,k),P.dtsTime=P.dts/va,P.ptsTime=P.pts/va}),x.firstKeyFrame){var M=x.firstKeyFrame;M.dts=Cn(M.dts,k),M.pts=Cn(M.pts,k),M.dtsTime=M.dts/va,M.ptsTime=M.pts/va}}},xa=function(x){for(var A=!1,C=0,k=null,M=null,P=0,se=0,oe;x.length-se>=3;){var ue=Ni.aac.parseType(x,se);switch(ue){case"timed-metadata":if(x.length-se<10){A=!0;break}if(P=Ni.aac.parseId3TagSize(x,se),P>x.length){A=!0;break}M===null&&(oe=x.subarray(se,se+P),M=Ni.aac.parseAacTimestamp(oe)),se+=P;break;case"audio":if(x.length-se<7){A=!0;break}if(P=Ni.aac.parseAdtsSize(x,se),P>x.length){A=!0;break}k===null&&(oe=x.subarray(se,se+P),k=Ni.aac.parseSampleRate(oe)),C++,se+=P;break;default:se++;break}if(A)return null}if(k===null||M===null)return null;var he=va/k,Ee={audio:[{type:"audio",dts:M,pts:M},{type:"audio",dts:M+C*1024*he,pts:M+C*1024*he}]};return Ee},nr=function(x){var A={pid:null,table:null},C={};Sf(x,A);for(var k in A.table)if(A.table.hasOwnProperty(k)){var M=A.table[k];switch(M){case Tr.H264_STREAM_TYPE:C.video=[],vs(x,A,C),C.video.length===0&&delete C.video;break;case Tr.ADTS_STREAM_TYPE:C.audio=[],on(x,A,C),C.audio.length===0&&delete C.audio;break}}return C},xd=function(x,A){var C=Ni.aac.isLikelyAacData(x),k;return C?k=xa(x):k=nr(x),!k||!k.audio&&!k.video?null:(zi(k,A),k)},ba={inspect:xd,parseAudioPes_:on};const _f=function(x,A){A.on("data",function(C){const k=C.initSegment;C.initSegment={data:k.buffer,byteOffset:k.byteOffset,byteLength:k.byteLength};const M=C.data;C.data=M.buffer,x.postMessage({action:"data",segment:C,byteOffset:M.byteOffset,byteLength:M.byteLength},[C.data])}),A.on("done",function(C){x.postMessage({action:"done"})}),A.on("gopInfo",function(C){x.postMessage({action:"gopInfo",gopInfo:C})}),A.on("videoSegmentTimingInfo",function(C){const k={start:{decode:Ht.videoTsToSeconds(C.start.dts),presentation:Ht.videoTsToSeconds(C.start.pts)},end:{decode:Ht.videoTsToSeconds(C.end.dts),presentation:Ht.videoTsToSeconds(C.end.pts)},baseMediaDecodeTime:Ht.videoTsToSeconds(C.baseMediaDecodeTime)};C.prependedContentDuration&&(k.prependedContentDuration=Ht.videoTsToSeconds(C.prependedContentDuration)),x.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:k})}),A.on("audioSegmentTimingInfo",function(C){const k={start:{decode:Ht.videoTsToSeconds(C.start.dts),presentation:Ht.videoTsToSeconds(C.start.pts)},end:{decode:Ht.videoTsToSeconds(C.end.dts),presentation:Ht.videoTsToSeconds(C.end.pts)},baseMediaDecodeTime:Ht.videoTsToSeconds(C.baseMediaDecodeTime)};C.prependedContentDuration&&(k.prependedContentDuration=Ht.videoTsToSeconds(C.prependedContentDuration)),x.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:k})}),A.on("id3Frame",function(C){x.postMessage({action:"id3Frame",id3Frame:C})}),A.on("caption",function(C){x.postMessage({action:"caption",caption:C})}),A.on("trackinfo",function(C){x.postMessage({action:"trackinfo",trackInfo:C})}),A.on("audioTimingInfo",function(C){x.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Ht.videoTsToSeconds(C.start),end:Ht.videoTsToSeconds(C.end)}})}),A.on("videoTimingInfo",function(C){x.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Ht.videoTsToSeconds(C.start),end:Ht.videoTsToSeconds(C.end)}})}),A.on("log",function(C){x.postMessage({action:"log",log:C})})};class bd{constructor(A,C){this.options=C||{},this.self=A,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Bp.Transmuxer(this.options),_f(this.self,this.transmuxer)}pushMp4Captions(A){this.captionParser||(this.captionParser=new $o,this.captionParser.init());const C=new Uint8Array(A.data,A.byteOffset,A.byteLength),k=this.captionParser.parse(C,A.trackIds,A.timescales);this.self.postMessage({action:"mp4Captions",captions:k&&k.captions||[],logs:k&&k.logs||[],data:C.buffer},[C.buffer])}initMp4WebVttParser(A){this.webVttParser||(this.webVttParser=new ga);const C=new Uint8Array(A.data,A.byteOffset,A.byteLength);this.webVttParser.init(C)}getMp4WebVttText(A){this.webVttParser||(this.webVttParser=new ga);const C=new Uint8Array(A.data,A.byteOffset,A.byteLength),k=this.webVttParser.parseSegment(C);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:k||[],data:C.buffer},[C.buffer])}probeMp4StartTime({timescales:A,data:C}){const k=Fo.startTime(A,C);this.self.postMessage({action:"probeMp4StartTime",startTime:k,data:C},[C.buffer])}probeMp4Tracks({data:A}){const C=Fo.tracks(A);this.self.postMessage({action:"probeMp4Tracks",tracks:C,data:A},[A.buffer])}probeEmsgID3({data:A,offset:C}){const k=Fo.getEmsgID3(A,C);this.self.postMessage({action:"probeEmsgID3",id3Frames:k,emsgData:A},[A.buffer])}probeTs({data:A,baseStartTime:C}){const k=typeof C=="number"&&!isNaN(C)?C*Ht.ONE_SECOND_IN_TS:void 0,M=ba.inspect(A,k);let P=null;M&&(P={hasVideo:M.video&&M.video.length===2||!1,hasAudio:M.audio&&M.audio.length===2||!1},P.hasVideo&&(P.videoStart=M.video[0].ptsTime),P.hasAudio&&(P.audioStart=M.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:P,data:A},[A.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(A){const C=new Uint8Array(A.data,A.byteOffset,A.byteLength);this.transmuxer.push(C)}reset(){this.transmuxer.reset()}setTimestampOffset(A){const C=A.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Ht.secondsToVideoTs(C)))}setAudioAppendStart(A){this.transmuxer.setAudioAppendStart(Math.ceil(Ht.secondsToVideoTs(A.appendStart)))}setRemux(A){this.transmuxer.setRemux(A.remux)}flush(A){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(A){this.transmuxer.alignGopsWith(A.gopsToAlignWith.slice())}}self.onmessage=function(x){if(x.data.action==="init"&&x.data.options){this.messageHandlers=new bd(self,x.data.options);return}this.messageHandlers||(this.messageHandlers=new bd(self)),x.data&&x.data.action&&x.data.action!=="init"&&this.messageHandlers[x.data.action]&&this.messageHandlers[x.data.action](x.data)}}));var LF=aD(DF);const RF=(s,e,t)=>{const{type:i,initSegment:n,captions:r,captionStreams:a,metadata:u,videoFrameDtsTime:c,videoFramePtsTime:d}=s.data.segment;e.buffer.push({captions:r,captionStreams:a,metadata:u});const f=s.data.segment.boxes||{data:s.data.segment.data},p={type:i,data:new Uint8Array(f.data,f.data.byteOffset,f.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof c<"u"&&(p.videoFrameDtsTime=c),typeof d<"u"&&(p.videoFramePtsTime=d),t(p)},IF=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},NF=(s,e)=>{e.gopInfo=s.data.gopInfo},uD=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:n,remux:r,onData:a,onTrackInfo:u,onAudioTimingInfo:c,onVideoTimingInfo:d,onVideoSegmentTimingInfo:f,onAudioSegmentTimingInfo:p,onId3:y,onCaptions:v,onDone:b,onEndedTimeline:T,onTransmuxerLog:E,isEndOfTimeline:D,segment:O,triggerSegmentEventFn:R}=s,j={buffer:[]};let F=D;const z=Y=>{e.currentTransmux===s&&(Y.data.action==="data"&&RF(Y,j,a),Y.data.action==="trackinfo"&&u(Y.data.trackInfo),Y.data.action==="gopInfo"&&NF(Y,j),Y.data.action==="audioTimingInfo"&&c(Y.data.audioTimingInfo),Y.data.action==="videoTimingInfo"&&d(Y.data.videoTimingInfo),Y.data.action==="videoSegmentTimingInfo"&&f(Y.data.videoSegmentTimingInfo),Y.data.action==="audioSegmentTimingInfo"&&p(Y.data.audioSegmentTimingInfo),Y.data.action==="id3Frame"&&y([Y.data.id3Frame],Y.data.id3Frame.dispatchType),Y.data.action==="caption"&&v(Y.data.caption),Y.data.action==="endedtimeline"&&(F=!1,T()),Y.data.action==="log"&&E(Y.data.log),Y.data.type==="transmuxed"&&(F||(e.onmessage=null,IF({transmuxedData:j,callback:b}),cD(e))))},N=()=>{const Y={message:"Received an error message from the transmuxer worker",metadata:{errorType:Be.Error.StreamingFailedToTransmuxSegment,segmentInfo:lu({segment:O})}};b(null,Y)};if(e.onmessage=z,e.onerror=N,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof r<"u"&&e.postMessage({action:"setRemux",remux:r}),t.byteLength){const Y=t instanceof ArrayBuffer?t:t.buffer,L=t instanceof ArrayBuffer?0:t.byteOffset;R({type:"segmenttransmuxingstart",segment:O}),e.postMessage({action:"push",data:Y,byteOffset:L,byteLength:t.byteLength},[Y])}D&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},cD=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():uD(s.currentTransmux))},xE=(s,e)=>{s.postMessage({action:e}),cD(s)},dD=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,xE(e,s);return}e.transmuxQueue.push(xE.bind(null,e,s))},OF=s=>{dD("reset",s)},MF=s=>{dD("endTimeline",s)},hD=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,uD(s);return}s.transmuxer.transmuxQueue.push(s)},PF=s=>{const e=new LF;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:s}),e};var gv={reset:OF,endTimeline:MF,transmux:hD,createTransmuxer:PF};const Sc=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,n=nn({},s,{endAction:null,transmuxer:null,callback:null}),r=a=>{a.data.action===t&&(e.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",r),s.data){const a=s.data instanceof ArrayBuffer;n.byteOffset=a?0:s.data.byteOffset,n.byteLength=s.data.byteLength;const u=[a?s.data:s.data.buffer];e.postMessage(n,u)}else e.postMessage(n)},Pa={FAILURE:2,TIMEOUT:-101,ABORTED:-102},fD="wvtt",Rx=s=>{s.forEach(e=>{e.abort()})},BF=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),FF=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},Wb=(s,e)=>{const{requestType:t}=e,i=gu({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Pa.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Pa.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Pa.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Pa.FAILURE,xhr:e,metadata:i}:null},bE=(s,e,t,i)=>(n,r)=>{const a=r.response,u=Wb(n,r);if(u)return t(u,s);if(a.byteLength!==16)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Pa.FAILURE,xhr:r},s);const c=new DataView(a),d=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let p=0;p{e===fD&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},jF=(s,e,t)=>{e===fD&&Sc({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:n})=>{s.bytes=i,t(null,s,{mp4VttCues:n})}})},mD=(s,e)=>{const t=yb(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${i}`,code:Pa.FAILURE,metadata:{mediaType:n}})}Sc({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:n})=>(s.map.bytes=n,i.forEach(function(r){s.map.tracks=s.map.tracks||{},!s.map.tracks[r.type]&&(s.map.tracks[r.type]=r,typeof r.id=="number"&&r.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[r.id]=r.timescale),r.type==="text"&&UF(s,r.codec))}),e(null))})},$F=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,n)=>{const r=Wb(i,n);if(r)return e(r,s);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,mD(s,function(u){if(u)return u.xhr=n,u.status=n.status,e(u,s);e(null,s)})},HF=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(n,r)=>{const a=Wb(n,r);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const u=t==="arraybuffer"||!r.responseText?r.response:kF(r.responseText.substring(s.lastReachedChar||0));return s.stats=BF(r),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},zF=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{const b=s.map&&s.map.tracks||{},T=!!(b.audio&&b.video);let E=i.bind(null,s,"audio","start");const D=i.bind(null,s,"audio","end");let O=i.bind(null,s,"video","start");const R=i.bind(null,s,"video","end"),j=()=>hD({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:F=>{F.type=F.type==="combined"?"video":F.type,f(s,F)},onTrackInfo:F=>{t&&(T&&(F.isMuxed=!0),t(s,F))},onAudioTimingInfo:F=>{E&&typeof F.start<"u"&&(E(F.start),E=null),D&&typeof F.end<"u"&&D(F.end)},onVideoTimingInfo:F=>{O&&typeof F.start<"u"&&(O(F.start),O=null),R&&typeof F.end<"u"&&R(F.end)},onVideoSegmentTimingInfo:F=>{const z={pts:{start:F.start.presentation,end:F.end.presentation},dts:{start:F.start.decode,end:F.end.decode}};v({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:z}),n(F)},onAudioSegmentTimingInfo:F=>{const z={pts:{start:F.start.pts,end:F.end.pts},dts:{start:F.start.dts,end:F.end.dts}};v({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:z}),r(F)},onId3:(F,z)=>{a(s,F,z)},onCaptions:F=>{u(s,[F])},isEndOfTimeline:c,onEndedTimeline:()=>{d()},onTransmuxerLog:y,onDone:(F,z)=>{p&&(F.type=F.type==="combined"?"video":F.type,v({type:"segmenttransmuxingcomplete",segment:s}),p(z,s,F))},segment:s,triggerSegmentEventFn:v});Sc({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:F=>{s.bytes=e=F.data;const z=F.result;z&&(t(s,{hasAudio:z.hasAudio,hasVideo:z.hasVideo,isMuxed:T}),t=null),j()}})},pD=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{let b=new Uint8Array(e);if(c4(b)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){f(s,{data:b,type:"text"}),jF(s,T.text.codec,p);return}const D={isFmp4:!0,hasVideo:!!T.video,hasAudio:!!T.audio};T.audio&&T.audio.codec&&T.audio.codec!=="enca"&&(D.audioCodec=T.audio.codec),T.video&&T.video.codec&&T.video.codec!=="encv"&&(D.videoCodec=T.video.codec),T.video&&T.audio&&(D.isMuxed=!0),t(s,D);const O=(R,j)=>{f(s,{data:b,type:D.hasAudio&&!D.isMuxed?"audio":"video"}),j&&j.length&&a(s,j),R&&R.length&&u(s,R),p(null,s,{})};Sc({action:"probeMp4StartTime",timescales:s.map.timescales,data:b,transmuxer:s.transmuxer,callback:({data:R,startTime:j})=>{e=R.buffer,s.bytes=b=R,D.hasAudio&&!D.isMuxed&&i(s,"audio","start",j),D.hasVideo&&i(s,"video","start",j),Sc({action:"probeEmsgID3",data:b,transmuxer:s.transmuxer,offset:j,callback:({emsgData:F,id3Frames:z})=>{if(e=F.buffer,s.bytes=b=F,!T.video||!F.byteLength||!s.transmuxer){O(void 0,z);return}Sc({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:b,timescales:s.map.timescales,trackIds:[T.video.id],callback:N=>{e=N.data.buffer,s.bytes=b=N.data,N.logs.forEach(function(Y){y(rs(Y,{stream:"mp4CaptionParser"}))}),O(N.captions,z)}})}})}});return}if(!s.transmuxer){p(null,s,{});return}if(typeof s.container>"u"&&(s.container=yb(b)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),p(null,s,{});return}zF({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})},gD=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:n,doneFn:r},a){const u=d=>{if(d.data.source===s){i.removeEventListener("message",u);const f=d.data.decrypted;a(new Uint8Array(f.bytes,f.byteOffset,f.byteLength))}};i.onerror=()=>{const d="An error occurred in the decryption worker",f=lu({segment:n}),p={message:d,metadata:{error:new Error(d),errorType:Be.Error.StreamingFailedToDecryptSegment,segmentInfo:f,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};r(p,n)},i.addEventListener("message",u);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(eD({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},VF=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{v({type:"segmentdecryptionstart"}),gD({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:p},b=>{e.bytes=b,v({type:"segmentdecryptioncomplete",segment:e}),pD({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})})},GF=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{let b=0,T=!1;return(E,D)=>{if(!T){if(E)return T=!0,Rx(s),p(E,D);if(b+=1,b===s.length){const O=function(){if(D.encryptedBytes)return VF({decryptionWorker:e,segment:D,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v});pD({segment:D,bytes:D.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:p,onTransmuxerLog:y,triggerSegmentEventFn:v})};if(D.endOfAllRequests=Date.now(),D.map&&D.map.encryptedBytes&&!D.map.bytes)return v({type:"segmentdecryptionstart",segment:D}),gD({decryptionWorker:e,id:D.requestId+"-init",encryptedBytes:D.map.encryptedBytes,key:D.map.key,segment:D,doneFn:p},R=>{D.map.bytes=R,v({type:"segmentdecryptioncomplete",segment:D}),mD(D,j=>{if(j)return Rx(s),p(j,D);O()})});O()}}}},qF=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},KF=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f})=>p=>{if(!p.target.aborted)return s.stats=rs(s.stats,FF(p)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(p,s)},WF=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:n,progressFn:r,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:p,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:D})=>{const O=[],R=GF({activeXhrs:O,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:p,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:D});if(i.key&&!i.key.bytes){const Y=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&Y.push(i.map.key);const L=rs(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),I=bE(i,Y,R,D),X={uri:i.key.resolvedUri};D({type:"segmentkeyloadstart",segment:i,keyInfo:X});const G=s(L,I);O.push(G)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const G=rs(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),q=bE(i,[i.map.key],R,D),ae={uri:i.map.key.resolvedUri};D({type:"segmentkeyloadstart",segment:i,keyInfo:ae});const ie=s(G,q);O.push(ie)}const L=rs(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Dx(i.map),requestType:"segment-media-initialization"}),I=$F({segment:i,finishProcessingFn:R,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:i});const X=s(L,I);O.push(X)}const j=rs(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Dx(i),requestType:"segment"}),F=HF({segment:i,finishProcessingFn:R,responseType:j.responseType,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:i});const z=s(j,F);z.addEventListener("progress",KF({segment:i,progressFn:r,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:p,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b})),O.push(z);const N={};return O.forEach(Y=>{Y.addEventListener("loadend",qF({loadendState:N,abortFn:n}))}),()=>Rx(O)},km=Zr("PlaylistSelector"),TE=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},_c=function(s,e){if(!s)return"";const t=de.getComputedStyle(s);return t?t[e]:""},Ec=function(s,e){const t=s.slice();s.sort(function(i,n){const r=e(i,n);return r===0?t.indexOf(i)-t.indexOf(n):r})},Yb=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||de.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||de.Number.MAX_VALUE,t-i},YF=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||de.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||de.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let yD=function(s){const{main:e,bandwidth:t,playerWidth:i,playerHeight:n,playerObjectFit:r,limitRenditionByPlayerDimensions:a,playlistController:u}=s;if(!e)return;const c={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:a};let d=e.playlists;mr.isAudioOnly(e)&&(d=u.getAudioTrackPlaylists_(),c.audioOnly=!0);let f=d.map(N=>{let Y;const L=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.width,I=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.height;return Y=N.attributes&&N.attributes.BANDWIDTH,Y=Y||de.Number.MAX_VALUE,{bandwidth:Y,width:L,height:I,playlist:N}});Ec(f,(N,Y)=>N.bandwidth-Y.bandwidth),f=f.filter(N=>!mr.isIncompatible(N.playlist));let p=f.filter(N=>mr.isEnabled(N.playlist));p.length||(p=f.filter(N=>!mr.isDisabled(N.playlist)));const y=p.filter(N=>N.bandwidth*wn.BANDWIDTH_VARIANCEN.bandwidth===v.bandwidth)[0];if(a===!1){const N=b||p[0]||f[0];if(N&&N.playlist){let Y="sortedPlaylistReps";return b&&(Y="bandwidthBestRep"),p[0]&&(Y="enabledPlaylistReps"),km(`choosing ${TE(N)} using ${Y} with options`,c),N.playlist}return km("could not choose a playlist with options",c),null}const T=y.filter(N=>N.width&&N.height);Ec(T,(N,Y)=>N.width-Y.width);const E=T.filter(N=>N.width===i&&N.height===n);v=E[E.length-1];const D=E.filter(N=>N.bandwidth===v.bandwidth)[0];let O,R,j;D||(O=T.filter(N=>r==="cover"?N.width>i&&N.height>n:N.width>i||N.height>n),R=O.filter(N=>N.width===O[0].width&&N.height===O[0].height),v=R[R.length-1],j=R.filter(N=>N.bandwidth===v.bandwidth)[0]);let F;if(u.leastPixelDiffSelector){const N=T.map(Y=>(Y.pixelDiff=Math.abs(Y.width-i)+Math.abs(Y.height-n),Y));Ec(N,(Y,L)=>Y.pixelDiff===L.pixelDiff?L.bandwidth-Y.bandwidth:Y.pixelDiff-L.pixelDiff),F=N[0]}const z=F||j||D||b||p[0]||f[0];if(z&&z.playlist){let N="sortedPlaylistReps";return F?N="leastPixelDiffRep":j?N="resolutionPlusOneRep":D?N="resolutionBestRep":b?N="bandwidthBestRep":p[0]&&(N="enabledPlaylistReps"),km(`choosing ${TE(z)} using ${N} with options`,c),z.playlist}return km("could not choose a playlist with options",c),null};const SE=function(){let s=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),yD({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(_c(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(_c(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?_c(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},XF=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),yD({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(_c(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(_c(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?_c(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},QF=function(s){const{main:e,currentTime:t,bandwidth:i,duration:n,segmentDuration:r,timeUntilRebuffer:a,currentTimeline:u,syncController:c}=s,d=e.playlists.filter(b=>!mr.isIncompatible(b));let f=d.filter(mr.isEnabled);f.length||(f=d.filter(b=>!mr.isDisabled(b)));const y=f.filter(mr.hasAttribute.bind(null,"BANDWIDTH")).map(b=>{const E=c.getSyncPoint(b,n,u,t)?1:2,O=mr.estimateSegmentRequestTime(r,i,b)*E-a;return{playlist:b,rebufferingImpact:O}}),v=y.filter(b=>b.rebufferingImpact<=0);return Ec(v,(b,T)=>Yb(T.playlist,b.playlist)),v.length?v[0]:(Ec(y,(b,T)=>b.rebufferingImpact-T.rebufferingImpact),y[0]||null)},ZF=function(){const s=this.playlists.main.playlists.filter(mr.isEnabled);return Ec(s,(t,i)=>Yb(t,i)),s.filter(t=>!!kh(this.playlists.main,t).video)[0]||null},JF=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function vD(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const e8=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(i);if(n)s[t]=n;else{const r=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,u=t,c=!1;const d=r[i];d&&(a=d.label,u=d.language,c=d.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:c,label:a,language:u},!1).track}}},t8=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(n=>{const r=n.stream;n.content?n.content.forEach(a=>{const u=new i(n.startTime+t,n.endTime+t,a.text);u.line=a.line,u.align="left",u.position=a.position,u.positionAlign="line-left",s[r].addCue(u)}):s[r].addCue(new i(n.startTime+t,n.endTime+t,n.text))})},i8=function(s){Object.defineProperties(s.frame,{id:{get(){return Be.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return Be.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return Be.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},s8=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const n=de.WebKitDataCue||de.VTTCue,r=s.metadataTrack_;if(!r||(e.forEach(f=>{const p=f.cueTime+t;typeof p!="number"||de.isNaN(p)||p<0||!(p<1/0)||!f.frames||!f.frames.length||f.frames.forEach(y=>{const v=new n(p,p,y.value||y.url||y.data||"");v.frame=y,v.value=y,i8(v),r.addCue(v)})}),!r.cues||!r.cues.length))return;const a=r.cues,u=[];for(let f=0;f{const y=f[p.startTime]||[];return y.push(p),f[p.startTime]=y,f},{}),d=Object.keys(c).sort((f,p)=>Number(f)-Number(p));d.forEach((f,p)=>{const y=c[f],v=isFinite(i)?i:f,b=Number(d[p+1])||v;y.forEach(T=>{T.endTime=b})})},n8={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},r8=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),a8=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(n=>{for(const r of Object.keys(n)){if(r8.has(r))continue;const a=new i(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:n8[r],data:n[r]},(r==="scte35Out"||r==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},_E=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Be.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},fh=function(s,e,t){let i,n;if(t&&t.cues)for(i=t.cues.length;i--;)n=t.cues[i],n.startTime>=s&&n.endTime<=e&&t.removeCue(n)},o8=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const n=e[i],r=`${n.startTime}-${n.endTime}-${n.text}`;t[r]?s.removeCue(n):t[r]=n}},l8=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*cu.ONE_SECOND_IN_TS);let n;for(n=0;ni);n++);return s.slice(n)},u8=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let n=0;for(n;n=i);n++);return s.slice(0,n).concat(e)},c8=(s,e,t,i)=>{const n=Math.ceil((e-i)*cu.ONE_SECOND_IN_TS),r=Math.ceil((t-i)*cu.ONE_SECOND_IN_TS),a=s.slice();let u=s.length;for(;u--&&!(s[u].pts<=r););if(u===-1)return a;let c=u+1;for(;c--&&!(s[c].pts<=n););return c=Math.max(c,0),a.splice(c,u-c+1),a},d8=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let n=0;nt))return r}return i.length===0?0:i[i.length-1]},ih=1,f8=500,EE=s=>typeof s=="number"&&isFinite(s),Cm=1/60,m8=(s,e,t)=>s!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,p8=(s,e,t)=>{let i=e-wn.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const n=e-t;return Math.min(n,i)},tc=s=>{const{startOfSegment:e,duration:t,segment:i,part:n,playlist:{mediaSequence:r,id:a,segments:u=[]},mediaIndex:c,partIndex:d,timeline:f}=s,p=u.length-1;let y="mediaIndex/partIndex increment";s.getMediaInfoForTime?y=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(y="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(y+=` with independent ${s.independent}`);const v=typeof d=="number",b=s.segment.uri?"segment":"pre-segment",T=v?PC({preloadSegment:i})-1:0;return`${b} [${r+c}/${r+p}]`+(v?` part [${d}/${T}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(v?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${f}] selected by [${y}] playlist [${a}]`},wE=s=>`${s}TimingInfo`,g8=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:n})=>!n&&s===e?null:s{if(e===t)return!1;if(i==="audio"){const r=s.lastTimelineChange({type:"main"});return!r||r.to!==t}if(i==="main"&&n){const r=s.pendingTimelineChange({type:"audio"});return!(r&&r.to===t)}return!1},y8=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,n=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&n)},v8=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to{const e=s.pendingSegment_;if(!e)return;if(Ix({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&y8(s.timelineChangeController_)){if(v8(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},x8=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:n,end:r}=i;let a;typeof n=="bigint"||typeof r=="bigint"?a=de.BigInt(r)-de.BigInt(n):typeof n=="number"&&typeof r=="number"&&(a=r-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&es?Math.round(s)>e+Oa:!1,b8=(s,e)=>{if(e!=="hls")return null;const t=x8({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,n=AE({segmentDuration:t,maxDuration:i*2}),r=AE({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||r?{severity:n?"warn":"info",message:a}:null},lu=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class Nx extends Be.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Zr(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():dl(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(nn({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():dl(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(nn({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():dl(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():dl(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return gv.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,de.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&gv.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return kn();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=O0(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=tD(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: +`),this.pushCaption(A),A.startPts=x},ti.prototype.pushCaption=function(x){x.text!==""&&(this.trigger("data",{startPts:x.startPts,endPts:x.endPts,text:x.text,stream:"cc708_"+x.serviceNum}),x.text="",x.startPts=x.endPts)},ti.prototype.displayWindows=function(x,A){var C=this.current708Packet.data,k=C[++x],M=this.getPts(x);this.flushDisplayed(M,A);for(var P=0;P<8;P++)k&1<>4,M.offset=(k&12)>>2,M.penSize=k&3,k=C[++x],M.italics=(k&128)>>7,M.underline=(k&64)>>6,M.edgeType=(k&56)>>3,M.fontStyle=k&7,x},ti.prototype.setPenColor=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.penColor;return k=C[++x],M.fgOpacity=(k&192)>>6,M.fgRed=(k&48)>>4,M.fgGreen=(k&12)>>2,M.fgBlue=k&3,k=C[++x],M.bgOpacity=(k&192)>>6,M.bgRed=(k&48)>>4,M.bgGreen=(k&12)>>2,M.bgBlue=k&3,k=C[++x],M.edgeRed=(k&48)>>4,M.edgeGreen=(k&12)>>2,M.edgeBlue=k&3,x},ti.prototype.setPenLocation=function(x,A){var C=this.current708Packet.data,k=C[x],M=A.currentWindow.penLoc;return A.currentWindow.pendingNewLine=!0,k=C[++x],M.row=k&15,k=C[++x],M.column=k&63,x},ti.prototype.reset=function(x,A){var C=this.getPts(x);return this.flushDisplayed(C,A),this.initService(A.serviceNum,x)};var Ui={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},rs=function(x){return x===null?"":(x=Ui[x]||x,String.fromCharCode(x))},Ks=14,Is=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],qi=function(){for(var x=[],A=Ks+1;A--;)x.push({text:"",indent:0,offset:0});return x},_i=function(x,A){_i.prototype.init.call(this),this.field_=x||0,this.dataChannel_=A||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(C){var k,M,P,se,ae;if(k=C.ccData&32639,k===this.lastControlCode_){this.lastControlCode_=null;return}if((k&61440)===4096?this.lastControlCode_=k:k!==this.PADDING_&&(this.lastControlCode_=null),P=k>>>8,se=k&255,k!==this.PADDING_)if(k===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(k===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(C.pts),this.flushDisplayed(C.pts),M=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=M,this.startPts_=C.pts;else if(k===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(C.pts);else if(k===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(C.pts);else if(k===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(C.pts);else if(k===this.CARRIAGE_RETURN_)this.clearFormatting(C.pts),this.flushDisplayed(C.pts),this.shiftRowsUp_(),this.startPts_=C.pts;else if(k===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(k===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(C.pts),this.displayed_=qi();else if(k===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=qi();else if(k===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(C.pts),this.displayed_=qi()),this.mode_="paintOn",this.startPts_=C.pts;else if(this.isSpecialCharacter(P,se))P=(P&3)<<8,ae=rs(P|se),this[this.mode_](C.pts,ae),this.column_++;else if(this.isExtCharacter(P,se))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),P=(P&3)<<8,ae=rs(P|se),this[this.mode_](C.pts,ae),this.column_++;else if(this.isMidRowCode(P,se))this.clearFormatting(C.pts),this[this.mode_](C.pts," "),this.column_++,(se&14)===14&&this.addFormatting(C.pts,["i"]),(se&1)===1&&this.addFormatting(C.pts,["u"]);else if(this.isOffsetControlCode(P,se)){const me=se&3;this.nonDisplayed_[this.row_].offset=me,this.column_+=me}else if(this.isPAC(P,se)){var ce=Is.indexOf(k&7968);if(this.mode_==="rollUp"&&(ce-this.rollUpRows_+1<0&&(ce=this.rollUpRows_-1),this.setRollUp(C.pts,ce)),ce!==this.row_&&ce>=0&&ce<=14&&(this.clearFormatting(C.pts),this.row_=ce),se&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(C.pts,["u"]),(k&16)===16){const me=(k&14)>>1;this.column_=me*4,this.nonDisplayed_[this.row_].indent+=me}this.isColorPAC(se)&&(se&14)===14&&this.addFormatting(C.pts,["i"])}else this.isNormalChar(P)&&(se===0&&(se=null),ae=rs(P),ae+=rs(se),this[this.mode_](C.pts,ae),this.column_+=ae.length)}};_i.prototype=new Ri,_i.prototype.flushDisplayed=function(x){const A=k=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+k+"."})},C=[];this.displayed_.forEach((k,M)=>{if(k&&k.text&&k.text.length){try{k.text=k.text.trim()}catch{A(M)}k.text.length&&C.push({text:k.text,line:M+1,position:10+Math.min(70,k.indent*10)+k.offset*2.5})}else k==null&&A(M)}),C.length&&this.trigger("data",{startPts:this.startPts_,endPts:x,content:C,stream:this.name_})},_i.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=qi(),this.nonDisplayed_=qi(),this.lastControlCode_=null,this.column_=0,this.row_=Ks,this.rollUpRows_=2,this.formatting_=[]},_i.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},_i.prototype.isSpecialCharacter=function(x,A){return x===this.EXT_&&A>=48&&A<=63},_i.prototype.isExtCharacter=function(x,A){return(x===this.EXT_+1||x===this.EXT_+2)&&A>=32&&A<=63},_i.prototype.isMidRowCode=function(x,A){return x===this.EXT_&&A>=32&&A<=47},_i.prototype.isOffsetControlCode=function(x,A){return x===this.OFFSET_&&A>=33&&A<=35},_i.prototype.isPAC=function(x,A){return x>=this.BASE_&&x=64&&A<=127},_i.prototype.isColorPAC=function(x){return x>=64&&x<=79||x>=96&&x<=127},_i.prototype.isNormalChar=function(x){return x>=32&&x<=127},_i.prototype.setRollUp=function(x,A){if(this.mode_!=="rollUp"&&(this.row_=Ks,this.mode_="rollUp",this.flushDisplayed(x),this.nonDisplayed_=qi(),this.displayed_=qi()),A!==void 0&&A!==this.row_)for(var C=0;C"},"");this[this.mode_](x,C)},_i.prototype.clearFormatting=function(x){if(this.formatting_.length){var A=this.formatting_.reverse().reduce(function(C,k){return C+""},"");this.formatting_=[],this[this.mode_](x,A)}},_i.prototype.popOn=function(x,A){var C=this.nonDisplayed_[this.row_].text;C+=A,this.nonDisplayed_[this.row_].text=C},_i.prototype.rollUp=function(x,A){var C=this.displayed_[this.row_].text;C+=A,this.displayed_[this.row_].text=C},_i.prototype.shiftRowsUp_=function(){var x;for(x=0;xA&&(C=-1);Math.abs(A-x)>ji;)x+=C*Ms;return x},Mi=function(x){var A,C;Mi.prototype.init.call(this),this.type_=x||ds,this.push=function(k){if(k.type==="metadata"){this.trigger("data",k);return}this.type_!==ds&&k.type!==this.type_||(C===void 0&&(C=k.dts),k.dts=Ki(k.dts,C),k.pts=Ki(k.pts,C),A=k.dts,this.trigger("data",k))},this.flush=function(){C=A,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){C=void 0,A=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Mi.prototype=new as;var ss={TimestampRolloverStream:Mi,handleRollover:Ki},Ps=(x,A,C)=>{if(!x)return-1;for(var k=C;k";x.data[0]===tn.Utf8&&(C=Fs(x.data,0,A),!(C<0)&&(x.mimeType=Ot(x.data,A,C),A=C+1,x.pictureType=x.data[A],A++,k=Fs(x.data,0,A),!(k<0)&&(x.description=Mt(x.data,A,k),A=k+1,x.mimeType===M?x.url=Ot(x.data,A,x.data.length):x.pictureData=x.data.subarray(A,x.data.length))))},"T*":function(x){x.data[0]===tn.Utf8&&(x.value=Mt(x.data,1,x.data.length).replace(/\0*$/,""),x.values=x.value.split("\0"))},TXXX:function(x){var A;x.data[0]===tn.Utf8&&(A=Fs(x.data,0,1),A!==-1&&(x.description=Mt(x.data,1,A),x.value=Mt(x.data,A+1,x.data.length).replace(/\0*$/,""),x.data=x.value))},"W*":function(x){x.url=Ot(x.data,0,x.data.length).replace(/\0.*$/,"")},WXXX:function(x){var A;x.data[0]===tn.Utf8&&(A=Fs(x.data,0,1),A!==-1&&(x.description=Mt(x.data,1,A),x.url=Ot(x.data,A+1,x.data.length).replace(/\0.*$/,"")))},PRIV:function(x){var A;for(A=0;A>>2;Bt*=4,Bt+=st[7]&3,Ae.timeStamp=Bt,ae.pts===void 0&&ae.dts===void 0&&(ae.pts=Ae.timeStamp,ae.dts=Ae.timeStamp),this.trigger("timestamp",Ae)}ae.frames.push(Ae),ce+=10,ce+=me}while(ce>>4>1&&(se+=M[se]+1),P.pid===0)P.type="pat",x(M.subarray(se),P),this.trigger("data",P);else if(P.pid===this.pmtPid)for(P.type="pmt",x(M.subarray(se),P),this.trigger("data",P);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([M,se,P]):this.processPes_(M,se,P)},this.processPes_=function(M,P,se){se.pid===this.programMapTable.video?se.streamType=ls.H264_STREAM_TYPE:se.pid===this.programMapTable.audio?se.streamType=ls.ADTS_STREAM_TYPE:se.streamType=this.programMapTable["timed-metadata"][se.pid],se.type="pes",se.data=M.subarray(P),this.trigger("data",se)}},sn.prototype=new Dn,sn.STREAM_TYPES={h264:27,adts:15},hs=function(){var x=this,A=!1,C={data:[],size:0},k={data:[],size:0},M={data:[],size:0},P,se=function(ce,me){var Ae;const Ke=ce[0]<<16|ce[1]<<8|ce[2];me.data=new Uint8Array,Ke===1&&(me.packetLength=6+(ce[4]<<8|ce[5]),me.dataAlignmentIndicator=(ce[6]&4)!==0,Ae=ce[7],Ae&192&&(me.pts=(ce[9]&14)<<27|(ce[10]&255)<<20|(ce[11]&254)<<12|(ce[12]&255)<<5|(ce[13]&254)>>>3,me.pts*=4,me.pts+=(ce[13]&6)>>>1,me.dts=me.pts,Ae&64&&(me.dts=(ce[14]&14)<<27|(ce[15]&255)<<20|(ce[16]&254)<<12|(ce[17]&255)<<5|(ce[18]&254)>>>3,me.dts*=4,me.dts+=(ce[18]&6)>>>1)),me.data=ce.subarray(9+ce[8]))},ae=function(ce,me,Ae){var Ke=new Uint8Array(ce.size),kt={type:me},st=0,Bt=0,Ei=!1,rn;if(!(!ce.data.length||ce.size<9)){for(kt.trackId=ce.data[0].pid,st=0;st>5,ce=((A[M+6]&3)+1)*1024,me=ce*ii/Se[(A[M+2]&60)>>>2],A.byteLength-M>>6&3)+1,channelcount:(A[M+2]&1)<<2|(A[M+3]&192)>>>6,samplerate:Se[(A[M+2]&60)>>>2],samplingfrequencyindex:(A[M+2]&60)>>>2,samplesize:16,data:A.subarray(M+7+se,M+P)}),C++,M+=P}typeof Ae=="number"&&(this.skipWarn_(Ae,M),Ae=null),A=A.subarray(M)}},this.flush=function(){C=0,this.trigger("done")},this.reset=function(){A=void 0,this.trigger("reset")},this.endTimeline=function(){A=void 0,this.trigger("endedtimeline")}},oe.prototype=new Ft;var ct=oe,ue;ue=function(x){var A=x.byteLength,C=0,k=0;this.length=function(){return 8*A},this.bitsAvailable=function(){return 8*A+k},this.loadWord=function(){var M=x.byteLength-A,P=new Uint8Array(4),se=Math.min(4,A);if(se===0)throw new Error("no bytes available");P.set(x.subarray(M,M+se)),C=new DataView(P.buffer).getUint32(0),k=se*8,A-=se},this.skipBits=function(M){var P;k>M?(C<<=M,k-=M):(M-=k,P=Math.floor(M/8),M-=P*8,A-=P,this.loadWord(),C<<=M,k-=M)},this.readBits=function(M){var P=Math.min(k,M),se=C>>>32-P;return k-=P,k>0?C<<=P:A>0&&this.loadWord(),P=M-P,P>0?se<>>M)!==0)return C<<=M,k-=M,M;return this.loadWord(),M+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var M=this.skipLeadingZeros();return this.readBits(M+1)-1},this.readExpGolomb=function(){var M=this.readUnsignedExpGolomb();return 1&M?1+M>>>1:-1*(M>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var fe=ue,ge=t,Be=fe,Ee,et,pt;et=function(){var x=0,A,C;et.prototype.init.call(this),this.push=function(k){var M;C?(M=new Uint8Array(C.byteLength+k.data.byteLength),M.set(C),M.set(k.data,C.byteLength),C=M):C=k.data;for(var P=C.byteLength;x3&&this.trigger("data",C.subarray(x+3)),C=null,x=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},et.prototype=new ge,pt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ee=function(){var x=new et,A,C,k,M,P,se,ae;Ee.prototype.init.call(this),A=this,this.push=function(ce){ce.type==="video"&&(C=ce.trackId,k=ce.pts,M=ce.dts,x.push(ce))},x.on("data",function(ce){var me={trackId:C,pts:k,dts:M,data:ce,nalUnitTypeCode:ce[0]&31};switch(me.nalUnitTypeCode){case 5:me.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:me.nalUnitType="sei_rbsp",me.escapedRBSP=P(ce.subarray(1));break;case 7:me.nalUnitType="seq_parameter_set_rbsp",me.escapedRBSP=P(ce.subarray(1)),me.config=se(me.escapedRBSP);break;case 8:me.nalUnitType="pic_parameter_set_rbsp";break;case 9:me.nalUnitType="access_unit_delimiter_rbsp";break}A.trigger("data",me)}),x.on("done",function(){A.trigger("done")}),x.on("partialdone",function(){A.trigger("partialdone")}),x.on("reset",function(){A.trigger("reset")}),x.on("endedtimeline",function(){A.trigger("endedtimeline")}),this.flush=function(){x.flush()},this.partialFlush=function(){x.partialFlush()},this.reset=function(){x.reset()},this.endTimeline=function(){x.endTimeline()},ae=function(ce,me){var Ae=8,Ke=8,kt,st;for(kt=0;kt>4;return C=C>=0?C:0,M?C+20:C+10},ri=function(x,A){return x.length-A<10||x[A]!==73||x[A+1]!==68||x[A+2]!==51?A:(A+=Dt(x,A),ri(x,A))},St=function(x){var A=ri(x,0);return x.length>=A+2&&(x[A]&255)===255&&(x[A+1]&240)===240&&(x[A+1]&22)===16},bt=function(x){return x[0]<<21|x[1]<<14|x[2]<<7|x[3]},Ht=function(x,A,C){var k,M="";for(k=A;k>5,k=x[A+4]<<3,M=x[A+3]&6144;return M|k|C},Qt=function(x,A){return x[A]===73&&x[A+1]===68&&x[A+2]===51?"timed-metadata":x[A]&!0&&(x[A+1]&240)===240?"audio":null},Zi=function(x){for(var A=0;A+5>>2]}return null},nn=function(x){var A,C,k,M;A=10,x[5]&64&&(A+=4,A+=bt(x.subarray(10,14)));do{if(C=bt(x.subarray(A+4,A+8)),C<1)return null;if(M=String.fromCharCode(x[A],x[A+1],x[A+2],x[A+3]),M==="PRIV"){k=x.subarray(A+10,A+C+10);for(var P=0;P>>2;return ce*=4,ce+=ae[7]&3,ce}break}}A+=10,A+=C}while(A=3;){if(x[M]===73&&x[M+1]===68&&x[M+2]===51){if(x.length-M<10||(k=_s.parseId3TagSize(x,M),M+k>x.length))break;se={type:"timed-metadata",data:x.subarray(M,M+k)},this.trigger("data",se),M+=k;continue}else if((x[M]&255)===255&&(x[M+1]&240)===240){if(x.length-M<7||(k=_s.parseAdtsSize(x,M),M+k>x.length))break;ae={type:"audio",data:x.subarray(M,M+k),pts:A,dts:A},this.trigger("data",ae),M+=k;continue}M++}P=x.length-M,P>0?x=x.subarray(M):x=new Uint8Array},this.reset=function(){x=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){x=new Uint8Array,this.trigger("endedtimeline")}},us.prototype=new Lo;var $n=us,Sr=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Au=Sr,sf=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ed=sf,Ro=t,Rl=we,Il=ut,ku=Di,_r=ee,na=xt,Nl=Rt,nf=ct,Mp=mt.H264Stream,Pp=$n,Fp=Ln.isLikelyAacData,td=Rt.ONE_SECOND_IN_TS,rf=Au,af=ed,Cu,Io,Du,Qa,Bp=function(x,A){A.stream=x,this.trigger("log",A)},of=function(x,A){for(var C=Object.keys(A),k=0;k=-1e4&&Ae<=ce&&(!Ke||me>Ae)&&(Ke=st,me=Ae)));return Ke?Ke.gop:null},this.alignGopsAtStart_=function(ae){var ce,me,Ae,Ke,kt,st,Bt,Ei;for(kt=ae.byteLength,st=ae.nalCount,Bt=ae.duration,ce=me=0;ceAe.pts){ce++;continue}me++,kt-=Ke.byteLength,st-=Ke.nalCount,Bt-=Ke.duration}return me===0?ae:me===ae.length?null:(Ei=ae.slice(me),Ei.byteLength=kt,Ei.duration=Bt,Ei.nalCount=st,Ei.pts=Ei[0].pts,Ei.dts=Ei[0].dts,Ei)},this.alignGopsAtEnd_=function(ae){var ce,me,Ae,Ke,kt,st;for(ce=M.length-1,me=ae.length-1,kt=null,st=!1;ce>=0&&me>=0;){if(Ae=M[ce],Ke=ae[me],Ae.pts===Ke.pts){st=!0;break}if(Ae.pts>Ke.pts){ce--;continue}ce===M.length-1&&(kt=me),me--}if(!st&&kt===null)return null;var Bt;if(st?Bt=me:Bt=kt,Bt===0)return ae;var Ei=ae.slice(Bt),rn=Ei.reduce(function(Wn,Aa){return Wn.byteLength+=Aa.byteLength,Wn.duration+=Aa.duration,Wn.nalCount+=Aa.nalCount,Wn},{byteLength:0,duration:0,nalCount:0});return Ei.byteLength=rn.byteLength,Ei.duration=rn.duration,Ei.nalCount=rn.nalCount,Ei.pts=Ei[0].pts,Ei.dts=Ei[0].dts,Ei},this.alignGopsWith=function(ae){M=ae}},Cu.prototype=new Ro,Qa=function(x,A){this.numberOfTracks=0,this.metadataStream=A,x=x||{},typeof x.remux<"u"?this.remuxTracks=!!x.remux:this.remuxTracks=!0,typeof x.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=x.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Qa.prototype.init.call(this),this.push=function(C){if(C.content||C.text)return this.pendingCaptions.push(C);if(C.frames)return this.pendingMetadata.push(C);this.pendingTracks.push(C.track),this.pendingBytes+=C.boxes.byteLength,C.track.type==="video"&&(this.videoTrack=C.track,this.pendingBoxes.push(C.boxes)),C.track.type==="audio"&&(this.audioTrack=C.track,this.pendingBoxes.unshift(C.boxes))}},Qa.prototype=new Ro,Qa.prototype.flush=function(x){var A=0,C={captions:[],captionStreams:{},metadata:[],info:{}},k,M,P,se=0,ae;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(se=this.videoTrack.timelineStartInfo.pts,af.forEach(function(ce){C.info[ce]=this.videoTrack[ce]},this)):this.audioTrack&&(se=this.audioTrack.timelineStartInfo.pts,rf.forEach(function(ce){C.info[ce]=this.audioTrack[ce]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?C.type=this.pendingTracks[0].type:C.type="combined",this.emittedTracks+=this.pendingTracks.length,P=Rl.initSegment(this.pendingTracks),C.initSegment=new Uint8Array(P.byteLength),C.initSegment.set(P),C.data=new Uint8Array(this.pendingBytes),ae=0;ae=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Qa.prototype.setRemux=function(x){this.remuxTracks=x},Du=function(x){var A=this,C=!0,k,M;Du.prototype.init.call(this),x=x||{},this.baseMediaDecodeTime=x.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var P={};this.transmuxPipeline_=P,P.type="aac",P.metadataStream=new na.MetadataStream,P.aacStream=new Pp,P.audioTimestampRolloverStream=new na.TimestampRolloverStream("audio"),P.timedMetadataTimestampRolloverStream=new na.TimestampRolloverStream("timed-metadata"),P.adtsStream=new nf,P.coalesceStream=new Qa(x,P.metadataStream),P.headOfPipeline=P.aacStream,P.aacStream.pipe(P.audioTimestampRolloverStream).pipe(P.adtsStream),P.aacStream.pipe(P.timedMetadataTimestampRolloverStream).pipe(P.metadataStream).pipe(P.coalesceStream),P.metadataStream.on("timestamp",function(se){P.aacStream.setTimestamp(se.timeStamp)}),P.aacStream.on("data",function(se){se.type!=="timed-metadata"&&se.type!=="audio"||P.audioSegmentStream||(M=M||{timelineStartInfo:{baseMediaDecodeTime:A.baseMediaDecodeTime},codec:"adts",type:"audio"},P.coalesceStream.numberOfTracks++,P.audioSegmentStream=new Io(M,x),P.audioSegmentStream.on("log",A.getLogTrigger_("audioSegmentStream")),P.audioSegmentStream.on("timingInfo",A.trigger.bind(A,"audioTimingInfo")),P.adtsStream.pipe(P.audioSegmentStream).pipe(P.coalesceStream),A.trigger("trackinfo",{hasAudio:!!M,hasVideo:!!k}))}),P.coalesceStream.on("data",this.trigger.bind(this,"data")),P.coalesceStream.on("done",this.trigger.bind(this,"done")),of(this,P)},this.setupTsPipeline=function(){var P={};this.transmuxPipeline_=P,P.type="ts",P.metadataStream=new na.MetadataStream,P.packetStream=new na.TransportPacketStream,P.parseStream=new na.TransportParseStream,P.elementaryStream=new na.ElementaryStream,P.timestampRolloverStream=new na.TimestampRolloverStream,P.adtsStream=new nf,P.h264Stream=new Mp,P.captionStream=new na.CaptionStream(x),P.coalesceStream=new Qa(x,P.metadataStream),P.headOfPipeline=P.packetStream,P.packetStream.pipe(P.parseStream).pipe(P.elementaryStream).pipe(P.timestampRolloverStream),P.timestampRolloverStream.pipe(P.h264Stream),P.timestampRolloverStream.pipe(P.adtsStream),P.timestampRolloverStream.pipe(P.metadataStream).pipe(P.coalesceStream),P.h264Stream.pipe(P.captionStream).pipe(P.coalesceStream),P.elementaryStream.on("data",function(se){var ae;if(se.type==="metadata"){for(ae=se.tracks.length;ae--;)!k&&se.tracks[ae].type==="video"?(k=se.tracks[ae],k.timelineStartInfo.baseMediaDecodeTime=A.baseMediaDecodeTime):!M&&se.tracks[ae].type==="audio"&&(M=se.tracks[ae],M.timelineStartInfo.baseMediaDecodeTime=A.baseMediaDecodeTime);k&&!P.videoSegmentStream&&(P.coalesceStream.numberOfTracks++,P.videoSegmentStream=new Cu(k,x),P.videoSegmentStream.on("log",A.getLogTrigger_("videoSegmentStream")),P.videoSegmentStream.on("timelineStartInfo",function(ce){M&&!x.keepOriginalTimestamps&&(M.timelineStartInfo=ce,P.audioSegmentStream.setEarliestDts(ce.dts-A.baseMediaDecodeTime))}),P.videoSegmentStream.on("processedGopsInfo",A.trigger.bind(A,"gopInfo")),P.videoSegmentStream.on("segmentTimingInfo",A.trigger.bind(A,"videoSegmentTimingInfo")),P.videoSegmentStream.on("baseMediaDecodeTime",function(ce){M&&P.audioSegmentStream.setVideoBaseMediaDecodeTime(ce)}),P.videoSegmentStream.on("timingInfo",A.trigger.bind(A,"videoTimingInfo")),P.h264Stream.pipe(P.videoSegmentStream).pipe(P.coalesceStream)),M&&!P.audioSegmentStream&&(P.coalesceStream.numberOfTracks++,P.audioSegmentStream=new Io(M,x),P.audioSegmentStream.on("log",A.getLogTrigger_("audioSegmentStream")),P.audioSegmentStream.on("timingInfo",A.trigger.bind(A,"audioTimingInfo")),P.audioSegmentStream.on("segmentTimingInfo",A.trigger.bind(A,"audioSegmentTimingInfo")),P.adtsStream.pipe(P.audioSegmentStream).pipe(P.coalesceStream)),A.trigger("trackinfo",{hasAudio:!!M,hasVideo:!!k})}}),P.coalesceStream.on("data",this.trigger.bind(this,"data")),P.coalesceStream.on("id3Frame",function(se){se.dispatchType=P.metadataStream.dispatchType,A.trigger("id3Frame",se)}),P.coalesceStream.on("caption",this.trigger.bind(this,"caption")),P.coalesceStream.on("done",this.trigger.bind(this,"done")),of(this,P)},this.setBaseMediaDecodeTime=function(P){var se=this.transmuxPipeline_;x.keepOriginalTimestamps||(this.baseMediaDecodeTime=P),M&&(M.timelineStartInfo.dts=void 0,M.timelineStartInfo.pts=void 0,_r.clearDtsInfo(M),se.audioTimestampRolloverStream&&se.audioTimestampRolloverStream.discontinuity()),k&&(se.videoSegmentStream&&(se.videoSegmentStream.gopCache_=[]),k.timelineStartInfo.dts=void 0,k.timelineStartInfo.pts=void 0,_r.clearDtsInfo(k),se.captionStream.reset()),se.timestampRolloverStream&&se.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(P){M&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(P)},this.setRemux=function(P){var se=this.transmuxPipeline_;x.remux=P,se&&se.coalesceStream&&se.coalesceStream.setRemux(P)},this.alignGopsWith=function(P){k&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(P)},this.getLogTrigger_=function(P){var se=this;return function(ae){ae.stream=P,se.trigger("log",ae)}},this.push=function(P){if(C){var se=Fp(P);se&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!se&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),C=!1}this.transmuxPipeline_.headOfPipeline.push(P)},this.flush=function(){C=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Du.prototype=new Ro;var Up={Transmuxer:Du},jp=function(x){return x>>>0},$p=function(x){return("00"+x.toString(16)).slice(-2)},No={toUnsigned:jp,toHexString:$p},Ol=function(x){var A="";return A+=String.fromCharCode(x[0]),A+=String.fromCharCode(x[1]),A+=String.fromCharCode(x[2]),A+=String.fromCharCode(x[3]),A},cf=Ol,df=No.toUnsigned,hf=cf,id=function(x,A){var C=[],k,M,P,se,ae;if(!A.length)return null;for(k=0;k1?k+M:x.byteLength,P===A[0]&&(A.length===1?C.push(x.subarray(k+8,se)):(ae=id(x.subarray(k+8,se),A.slice(1)),ae.length&&(C=C.concat(ae)))),k=se;return C},Lu=id,ff=No.toUnsigned,Oo=r.getUint64,Hp=function(x){var A={version:x[0],flags:new Uint8Array(x.subarray(1,4))};return A.version===1?A.baseMediaDecodeTime=Oo(x.subarray(4)):A.baseMediaDecodeTime=ff(x[4]<<24|x[5]<<16|x[6]<<8|x[7]),A},sd=Hp,zp=function(x){var A=new DataView(x.buffer,x.byteOffset,x.byteLength),C={version:x[0],flags:new Uint8Array(x.subarray(1,4)),trackId:A.getUint32(4)},k=C.flags[2]&1,M=C.flags[2]&2,P=C.flags[2]&8,se=C.flags[2]&16,ae=C.flags[2]&32,ce=C.flags[0]&65536,me=C.flags[0]&131072,Ae;return Ae=8,k&&(Ae+=4,C.baseDataOffset=A.getUint32(12),Ae+=4),M&&(C.sampleDescriptionIndex=A.getUint32(Ae),Ae+=4),P&&(C.defaultSampleDuration=A.getUint32(Ae),Ae+=4),se&&(C.defaultSampleSize=A.getUint32(Ae),Ae+=4),ae&&(C.defaultSampleFlags=A.getUint32(Ae)),ce&&(C.durationIsEmpty=!0),!k&&me&&(C.baseDataOffsetIsMoof=!0),C},nd=zp,mf=function(x){return{isLeading:(x[0]&12)>>>2,dependsOn:x[0]&3,isDependedOn:(x[1]&192)>>>6,hasRedundancy:(x[1]&48)>>>4,paddingValue:(x[1]&14)>>>1,isNonSyncSample:x[1]&1,degradationPriority:x[2]<<8|x[3]}},Ml=mf,Mo=Ml,Vp=function(x){var A={version:x[0],flags:new Uint8Array(x.subarray(1,4)),samples:[]},C=new DataView(x.buffer,x.byteOffset,x.byteLength),k=A.flags[2]&1,M=A.flags[2]&4,P=A.flags[1]&1,se=A.flags[1]&2,ae=A.flags[1]&4,ce=A.flags[1]&8,me=C.getUint32(4),Ae=8,Ke;for(k&&(A.dataOffset=C.getInt32(Ae),Ae+=4),M&&me&&(Ke={flags:Mo(x.subarray(Ae,Ae+4))},Ae+=4,P&&(Ke.duration=C.getUint32(Ae),Ae+=4),se&&(Ke.size=C.getUint32(Ae),Ae+=4),ce&&(A.version===1?Ke.compositionTimeOffset=C.getInt32(Ae):Ke.compositionTimeOffset=C.getUint32(Ae),Ae+=4),A.samples.push(Ke),me--);me--;)Ke={},P&&(Ke.duration=C.getUint32(Ae),Ae+=4),se&&(Ke.size=C.getUint32(Ae),Ae+=4),ae&&(Ke.flags=Mo(x.subarray(Ae,Ae+4)),Ae+=4),ce&&(A.version===1?Ke.compositionTimeOffset=C.getInt32(Ae):Ke.compositionTimeOffset=C.getUint32(Ae),Ae+=4),A.samples.push(Ke);return A},Pl=Vp,rd={tfdt:sd,trun:Pl},ad={parseTfdt:rd.tfdt,parseTrun:rd.trun},od=function(x){for(var A=0,C=String.fromCharCode(x[A]),k="";C!=="\0";)k+=C,A++,C=String.fromCharCode(x[A]);return k+=C,k},ld={uint8ToCString:od},Fl=ld.uint8ToCString,pf=r.getUint64,gf=function(x){var A=4,C=x[0],k,M,P,se,ae,ce,me,Ae;if(C===0){k=Fl(x.subarray(A)),A+=k.length,M=Fl(x.subarray(A)),A+=M.length;var Ke=new DataView(x.buffer);P=Ke.getUint32(A),A+=4,ae=Ke.getUint32(A),A+=4,ce=Ke.getUint32(A),A+=4,me=Ke.getUint32(A),A+=4}else if(C===1){var Ke=new DataView(x.buffer);P=Ke.getUint32(A),A+=4,se=pf(x.subarray(A)),A+=8,ce=Ke.getUint32(A),A+=4,me=Ke.getUint32(A),A+=4,k=Fl(x.subarray(A)),A+=k.length,M=Fl(x.subarray(A)),A+=M.length}Ae=new Uint8Array(x.subarray(A,x.byteLength));var kt={scheme_id_uri:k,value:M,timescale:P||1,presentation_time:se,presentation_time_delta:ae,event_duration:ce,id:me,message_data:Ae};return qp(C,kt)?kt:void 0},Gp=function(x,A,C,k){return x||x===0?x/A:k+C/A},qp=function(x,A){var C=A.scheme_id_uri!=="\0",k=x===0&&yf(A.presentation_time_delta)&&C,M=x===1&&yf(A.presentation_time)&&C;return!(x>1)&&k||M},yf=function(x){return x!==void 0||x!==null},Kp={parseEmsgBox:gf,scaleTime:Gp},Bl;typeof window<"u"?Bl=window:typeof s<"u"?Bl=s:typeof self<"u"?Bl=self:Bl={};var Hn=Bl,xa=No.toUnsigned,Po=No.toHexString,Bs=Lu,Za=cf,Ru=Kp,ud=nd,Wp=Pl,Fo=sd,cd=r.getUint64,Bo,Iu,dd,ba,Ja,Ul,hd,ra=Hn,vf=Ii.parseId3Frames;Bo=function(x){var A={},C=Bs(x,["moov","trak"]);return C.reduce(function(k,M){var P,se,ae,ce,me;return P=Bs(M,["tkhd"])[0],!P||(se=P[0],ae=se===0?12:20,ce=xa(P[ae]<<24|P[ae+1]<<16|P[ae+2]<<8|P[ae+3]),me=Bs(M,["mdia","mdhd"])[0],!me)?null:(se=me[0],ae=se===0?12:20,k[ce]=xa(me[ae]<<24|me[ae+1]<<16|me[ae+2]<<8|me[ae+3]),k)},A)},Iu=function(x,A){var C;C=Bs(A,["moof","traf"]);var k=C.reduce(function(M,P){var se=Bs(P,["tfhd"])[0],ae=xa(se[4]<<24|se[5]<<16|se[6]<<8|se[7]),ce=x[ae]||9e4,me=Bs(P,["tfdt"])[0],Ae=new DataView(me.buffer,me.byteOffset,me.byteLength),Ke;me[0]===1?Ke=cd(me.subarray(4,12)):Ke=Ae.getUint32(4);let kt;return typeof Ke=="bigint"?kt=Ke/ra.BigInt(ce):typeof Ke=="number"&&!isNaN(Ke)&&(kt=Ke/ce),kt11?(M.codec+=".",M.codec+=Po(st[9]),M.codec+=Po(st[10]),M.codec+=Po(st[11])):M.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(M.codec)?(st=kt.subarray(28),Bt=Za(st.subarray(4,8)),Bt==="esds"&&st.length>20&&st[19]!==0?(M.codec+="."+Po(st[19]),M.codec+="."+Po(st[20]>>>2&63).replace(/^0/,"")):M.codec="mp4a.40.2"):M.codec=M.codec.toLowerCase())}var Ei=Bs(k,["mdia","mdhd"])[0];Ei&&(M.timescale=Ul(Ei)),C.push(M)}),C},hd=function(x,A=0){var C=Bs(x,["emsg"]);return C.map(k=>{var M=Ru.parseEmsgBox(new Uint8Array(k)),P=vf(M.message_data);return{cueTime:Ru.scaleTime(M.presentation_time,M.timescale,M.presentation_time_delta,A),duration:Ru.scaleTime(M.event_duration,M.timescale),frames:P}})};var Uo={findBox:Bs,parseType:Za,timescale:Bo,startTime:Iu,compositionStartTime:dd,videoTrackIds:ba,tracks:Ja,getTimescaleFromMediaHeader:Ul,getEmsgID3:hd};const{parseTrun:xf}=ad,{findBox:bf}=Uo;var Tf=Hn,Yp=function(x){var A=bf(x,["moof","traf"]),C=bf(x,["mdat"]),k=[];return C.forEach(function(M,P){var se=A[P];k.push({mdat:M,traf:se})}),k},Sf=function(x,A,C){var k=A,M=C.defaultSampleDuration||0,P=C.defaultSampleSize||0,se=C.trackId,ae=[];return x.forEach(function(ce){var me=xf(ce),Ae=me.samples;Ae.forEach(function(Ke){Ke.duration===void 0&&(Ke.duration=M),Ke.size===void 0&&(Ke.size=P),Ke.trackId=se,Ke.dts=k,Ke.compositionTimeOffset===void 0&&(Ke.compositionTimeOffset=0),typeof k=="bigint"?(Ke.pts=k+Tf.BigInt(Ke.compositionTimeOffset),k+=Tf.BigInt(Ke.duration)):(Ke.pts=k+Ke.compositionTimeOffset,k+=Ke.duration)}),ae=ae.concat(Ae)}),ae},fd={getMdatTrafPairs:Yp,parseSamples:Sf},md=xi.discardEmulationPreventionBytes,Er=Ns.CaptionStream,jo=Lu,ir=sd,$o=nd,{getMdatTrafPairs:pd,parseSamples:Nu}=fd,Ou=function(x,A){for(var C=x,k=0;k0?ir(Ae[0]).baseMediaDecodeTime:0,kt=jo(se,["trun"]),st,Bt;A===me&&kt.length>0&&(st=Nu(kt,Ke,ce),Bt=gd(P,st,me),C[me]||(C[me]={seiNals:[],logs:[]}),C[me].seiNals=C[me].seiNals.concat(Bt.seiNals),C[me].logs=C[me].logs.concat(Bt.logs))}),C},_f=function(x,A,C){var k;if(A===null)return null;k=eo(x,A);var M=k[A]||{};return{seiNals:M.seiNals,logs:M.logs,timescale:C}},Mu=function(){var x=!1,A,C,k,M,P,se;this.isInitialized=function(){return x},this.init=function(ae){A=new Er,x=!0,se=ae?ae.isPartial:!1,A.on("data",function(ce){ce.startTime=ce.startPts/M,ce.endTime=ce.endPts/M,P.captions.push(ce),P.captionStreams[ce.stream]=!0}),A.on("log",function(ce){P.logs.push(ce)})},this.isNewInit=function(ae,ce){return ae&&ae.length===0||ce&&typeof ce=="object"&&Object.keys(ce).length===0?!1:k!==ae[0]||M!==ce[k]},this.parse=function(ae,ce,me){var Ae;if(this.isInitialized()){if(!ce||!me)return null;if(this.isNewInit(ce,me))k=ce[0],M=me[k];else if(k===null||!M)return C.push(ae),null}else return null;for(;C.length>0;){var Ke=C.shift();this.parse(Ke,ce,me)}return Ae=_f(ae,k,M),Ae&&Ae.logs&&(P.logs=P.logs.concat(Ae.logs)),Ae===null||!Ae.seiNals?P.logs.length?{logs:P.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ae.seiNals),this.flushStream(),P)},this.pushNals=function(ae){if(!this.isInitialized()||!ae||ae.length===0)return null;ae.forEach(function(ce){A.push(ce)})},this.flushStream=function(){if(!this.isInitialized())return null;se?A.partialFlush():A.flush()},this.clearParsedCaptions=function(){P.captions=[],P.captionStreams={},P.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;A.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){C=[],k=null,M=null,P?this.clearParsedCaptions():P={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ho=Mu;const{parseTfdt:Xp}=ad,Ws=Lu,{getTimescaleFromMediaHeader:yd}=Uo,{parseSamples:aa,getMdatTrafPairs:Ef}=fd;var Ta=function(){let x=9e4;this.init=function(A){const C=Ws(A,["moov","trak","mdia","mdhd"])[0];C&&(x=yd(C))},this.parseSegment=function(A){const C=[],k=Ef(A);let M=0;return k.forEach(function(P){const se=P.mdat,ae=P.traf,ce=Ws(ae,["tfdt"])[0],me=Ws(ae,["tfhd"])[0],Ae=Ws(ae,["trun"]);if(ce&&(M=Xp(ce).baseMediaDecodeTime),Ae.length&&me){const Ke=aa(Ae,M,me);let kt=0;Ke.forEach(function(st){const Bt="utf-8",Ei=new TextDecoder(Bt),rn=se.slice(kt,kt+st.size);if(Ws(rn,["vtte"])[0]){kt+=st.size;return}Ws(rn,["vttc"]).forEach(function(zl){const Ls=Ws(zl,["payl"])[0],to=Ws(zl,["sttg"])[0],oa=st.pts/x,ka=(st.pts+st.duration)/x;let fs,zr;if(Ls)try{fs=Ei.decode(Ls)}catch(Sn){console.error(Sn)}if(to)try{zr=Ei.decode(to)}catch(Sn){console.error(Sn)}st.duration&&fs&&C.push({cueText:fs,start:oa,end:ka,settings:zr})}),kt+=st.size})}}),C}},jl=Ji,xd=function(x){var A=x[1]&31;return A<<=8,A|=x[2],A},zo=function(x){return!!(x[1]&64)},$l=function(x){var A=0;return(x[3]&48)>>>4>1&&(A+=x[4]+1),A},sr=function(x,A){var C=xd(x);return C===0?"pat":C===A?"pmt":A?"pes":null},Vo=function(x){var A=zo(x),C=4+$l(x);return A&&(C+=x[C]+1),(x[C+10]&31)<<8|x[C+11]},Go=function(x){var A={},C=zo(x),k=4+$l(x);if(C&&(k+=x[k]+1),!!(x[k+5]&1)){var M,P,se;M=(x[k+1]&15)<<8|x[k+2],P=3+M-4,se=(x[k+10]&15)<<8|x[k+11];for(var ae=12+se;ae=x.byteLength)return null;var k=null,M;return M=x[C+7],M&192&&(k={},k.pts=(x[C+9]&14)<<27|(x[C+10]&255)<<20|(x[C+11]&254)<<12|(x[C+12]&255)<<5|(x[C+13]&254)>>>3,k.pts*=4,k.pts+=(x[C+13]&6)>>>1,k.dts=k.pts,M&64&&(k.dts=(x[C+14]&14)<<27|(x[C+15]&255)<<20|(x[C+16]&254)<<12|(x[C+17]&255)<<5|(x[C+18]&254)>>>3,k.dts*=4,k.dts+=(x[C+18]&6)>>>1)),k},zn=function(x){switch(x){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},nr=function(x){for(var A=4+$l(x),C=x.subarray(A),k=0,M=0,P=!1,se;M3&&(se=zn(C[M+3]&31),se==="slice_layer_without_partitioning_rbsp_idr"&&(P=!0)),P},Sa={parseType:sr,parsePat:Vo,parsePmt:Go,parsePayloadUnitStartIndicator:zo,parsePesType:Pu,parsePesTime:Hl,videoPacketContainsKeyFrame:nr},wr=Ji,Rn=ss.handleRollover,Pi={};Pi.ts=Sa,Pi.aac=Ln;var _a=Rt.ONE_SECOND_IN_TS,yn=188,rr=71,wf=function(x,A){for(var C=0,k=yn,M,P;k=0;){if(x[k]===rr&&(x[M]===rr||M===x.byteLength)){if(P=x.subarray(k,M),se=Pi.ts.parseType(P,A.pid),se==="pes"&&(ae=Pi.ts.parsePesType(P,A.table),ce=Pi.ts.parsePayloadUnitStartIndicator(P),ae==="audio"&&ce&&(me=Pi.ts.parsePesTime(P),me&&(me.type="audio",C.audio.push(me),Ae=!0))),Ae)break;k-=yn,M-=yn;continue}k--,M--}},Es=function(x,A,C){for(var k=0,M=yn,P,se,ae,ce,me,Ae,Ke,kt,st=!1,Bt={data:[],size:0};M=0;){if(x[k]===rr&&x[M]===rr){if(P=x.subarray(k,M),se=Pi.ts.parseType(P,A.pid),se==="pes"&&(ae=Pi.ts.parsePesType(P,A.table),ce=Pi.ts.parsePayloadUnitStartIndicator(P),ae==="video"&&ce&&(me=Pi.ts.parsePesTime(P),me&&(me.type="video",C.video.push(me),st=!0))),st)break;k-=yn,M-=yn;continue}k--,M--}},zi=function(x,A){if(x.audio&&x.audio.length){var C=A;(typeof C>"u"||isNaN(C))&&(C=x.audio[0].dts),x.audio.forEach(function(P){P.dts=Rn(P.dts,C),P.pts=Rn(P.pts,C),P.dtsTime=P.dts/_a,P.ptsTime=P.pts/_a})}if(x.video&&x.video.length){var k=A;if((typeof k>"u"||isNaN(k))&&(k=x.video[0].dts),x.video.forEach(function(P){P.dts=Rn(P.dts,k),P.pts=Rn(P.pts,k),P.dtsTime=P.dts/_a,P.ptsTime=P.pts/_a}),x.firstKeyFrame){var M=x.firstKeyFrame;M.dts=Rn(M.dts,k),M.pts=Rn(M.pts,k),M.dtsTime=M.dts/_a,M.ptsTime=M.pts/_a}}},Ea=function(x){for(var A=!1,C=0,k=null,M=null,P=0,se=0,ae;x.length-se>=3;){var ce=Pi.aac.parseType(x,se);switch(ce){case"timed-metadata":if(x.length-se<10){A=!0;break}if(P=Pi.aac.parseId3TagSize(x,se),P>x.length){A=!0;break}M===null&&(ae=x.subarray(se,se+P),M=Pi.aac.parseAacTimestamp(ae)),se+=P;break;case"audio":if(x.length-se<7){A=!0;break}if(P=Pi.aac.parseAdtsSize(x,se),P>x.length){A=!0;break}k===null&&(ae=x.subarray(se,se+P),k=Pi.aac.parseSampleRate(ae)),C++,se+=P;break;default:se++;break}if(A)return null}if(k===null||M===null)return null;var me=_a/k,Ae={audio:[{type:"audio",dts:M,pts:M},{type:"audio",dts:M+C*1024*me,pts:M+C*1024*me}]};return Ae},ar=function(x){var A={pid:null,table:null},C={};wf(x,A);for(var k in A.table)if(A.table.hasOwnProperty(k)){var M=A.table[k];switch(M){case wr.H264_STREAM_TYPE:C.video=[],Es(x,A,C),C.video.length===0&&delete C.video;break;case wr.ADTS_STREAM_TYPE:C.audio=[],hn(x,A,C),C.audio.length===0&&delete C.audio;break}}return C},bd=function(x,A){var C=Pi.aac.isLikelyAacData(x),k;return C?k=Ea(x):k=ar(x),!k||!k.audio&&!k.video?null:(zi(k,A),k)},wa={inspect:bd,parseAudioPes_:hn};const Af=function(x,A){A.on("data",function(C){const k=C.initSegment;C.initSegment={data:k.buffer,byteOffset:k.byteOffset,byteLength:k.byteLength};const M=C.data;C.data=M.buffer,x.postMessage({action:"data",segment:C,byteOffset:M.byteOffset,byteLength:M.byteLength},[C.data])}),A.on("done",function(C){x.postMessage({action:"done"})}),A.on("gopInfo",function(C){x.postMessage({action:"gopInfo",gopInfo:C})}),A.on("videoSegmentTimingInfo",function(C){const k={start:{decode:Rt.videoTsToSeconds(C.start.dts),presentation:Rt.videoTsToSeconds(C.start.pts)},end:{decode:Rt.videoTsToSeconds(C.end.dts),presentation:Rt.videoTsToSeconds(C.end.pts)},baseMediaDecodeTime:Rt.videoTsToSeconds(C.baseMediaDecodeTime)};C.prependedContentDuration&&(k.prependedContentDuration=Rt.videoTsToSeconds(C.prependedContentDuration)),x.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:k})}),A.on("audioSegmentTimingInfo",function(C){const k={start:{decode:Rt.videoTsToSeconds(C.start.dts),presentation:Rt.videoTsToSeconds(C.start.pts)},end:{decode:Rt.videoTsToSeconds(C.end.dts),presentation:Rt.videoTsToSeconds(C.end.pts)},baseMediaDecodeTime:Rt.videoTsToSeconds(C.baseMediaDecodeTime)};C.prependedContentDuration&&(k.prependedContentDuration=Rt.videoTsToSeconds(C.prependedContentDuration)),x.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:k})}),A.on("id3Frame",function(C){x.postMessage({action:"id3Frame",id3Frame:C})}),A.on("caption",function(C){x.postMessage({action:"caption",caption:C})}),A.on("trackinfo",function(C){x.postMessage({action:"trackinfo",trackInfo:C})}),A.on("audioTimingInfo",function(C){x.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Rt.videoTsToSeconds(C.start),end:Rt.videoTsToSeconds(C.end)}})}),A.on("videoTimingInfo",function(C){x.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Rt.videoTsToSeconds(C.start),end:Rt.videoTsToSeconds(C.end)}})}),A.on("log",function(C){x.postMessage({action:"log",log:C})})};class Td{constructor(A,C){this.options=C||{},this.self=A,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Up.Transmuxer(this.options),Af(this.self,this.transmuxer)}pushMp4Captions(A){this.captionParser||(this.captionParser=new Ho,this.captionParser.init());const C=new Uint8Array(A.data,A.byteOffset,A.byteLength),k=this.captionParser.parse(C,A.trackIds,A.timescales);this.self.postMessage({action:"mp4Captions",captions:k&&k.captions||[],logs:k&&k.logs||[],data:C.buffer},[C.buffer])}initMp4WebVttParser(A){this.webVttParser||(this.webVttParser=new Ta);const C=new Uint8Array(A.data,A.byteOffset,A.byteLength);this.webVttParser.init(C)}getMp4WebVttText(A){this.webVttParser||(this.webVttParser=new Ta);const C=new Uint8Array(A.data,A.byteOffset,A.byteLength),k=this.webVttParser.parseSegment(C);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:k||[],data:C.buffer},[C.buffer])}probeMp4StartTime({timescales:A,data:C}){const k=Uo.startTime(A,C);this.self.postMessage({action:"probeMp4StartTime",startTime:k,data:C},[C.buffer])}probeMp4Tracks({data:A}){const C=Uo.tracks(A);this.self.postMessage({action:"probeMp4Tracks",tracks:C,data:A},[A.buffer])}probeEmsgID3({data:A,offset:C}){const k=Uo.getEmsgID3(A,C);this.self.postMessage({action:"probeEmsgID3",id3Frames:k,emsgData:A},[A.buffer])}probeTs({data:A,baseStartTime:C}){const k=typeof C=="number"&&!isNaN(C)?C*Rt.ONE_SECOND_IN_TS:void 0,M=wa.inspect(A,k);let P=null;M&&(P={hasVideo:M.video&&M.video.length===2||!1,hasAudio:M.audio&&M.audio.length===2||!1},P.hasVideo&&(P.videoStart=M.video[0].ptsTime),P.hasAudio&&(P.audioStart=M.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:P,data:A},[A.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(A){const C=new Uint8Array(A.data,A.byteOffset,A.byteLength);this.transmuxer.push(C)}reset(){this.transmuxer.reset()}setTimestampOffset(A){const C=A.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Rt.secondsToVideoTs(C)))}setAudioAppendStart(A){this.transmuxer.setAudioAppendStart(Math.ceil(Rt.secondsToVideoTs(A.appendStart)))}setRemux(A){this.transmuxer.setRemux(A.remux)}flush(A){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(A){this.transmuxer.alignGopsWith(A.gopsToAlignWith.slice())}}self.onmessage=function(x){if(x.data.action==="init"&&x.data.options){this.messageHandlers=new Td(self,x.data.options);return}this.messageHandlers||(this.messageHandlers=new Td(self)),x.data&&x.data.action&&x.data.action!=="init"&&this.messageHandlers[x.data.action]&&this.messageHandlers[x.data.action](x.data)}}));var GB=pD(VB);const qB=(s,e,t)=>{const{type:i,initSegment:n,captions:r,captionStreams:a,metadata:u,videoFrameDtsTime:c,videoFramePtsTime:d}=s.data.segment;e.buffer.push({captions:r,captionStreams:a,metadata:u});const f=s.data.segment.boxes||{data:s.data.segment.data},g={type:i,data:new Uint8Array(f.data,f.data.byteOffset,f.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof c<"u"&&(g.videoFrameDtsTime=c),typeof d<"u"&&(g.videoFramePtsTime=d),t(g)},KB=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},WB=(s,e)=>{e.gopInfo=s.data.gopInfo},vD=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:n,remux:r,onData:a,onTrackInfo:u,onAudioTimingInfo:c,onVideoTimingInfo:d,onVideoSegmentTimingInfo:f,onAudioSegmentTimingInfo:g,onId3:y,onCaptions:v,onDone:b,onEndedTimeline:T,onTransmuxerLog:E,isEndOfTimeline:D,segment:O,triggerSegmentEventFn:R}=s,j={buffer:[]};let F=D;const G=W=>{e.currentTransmux===s&&(W.data.action==="data"&&qB(W,j,a),W.data.action==="trackinfo"&&u(W.data.trackInfo),W.data.action==="gopInfo"&&WB(W,j),W.data.action==="audioTimingInfo"&&c(W.data.audioTimingInfo),W.data.action==="videoTimingInfo"&&d(W.data.videoTimingInfo),W.data.action==="videoSegmentTimingInfo"&&f(W.data.videoSegmentTimingInfo),W.data.action==="audioSegmentTimingInfo"&&g(W.data.audioSegmentTimingInfo),W.data.action==="id3Frame"&&y([W.data.id3Frame],W.data.id3Frame.dispatchType),W.data.action==="caption"&&v(W.data.caption),W.data.action==="endedtimeline"&&(F=!1,T()),W.data.action==="log"&&E(W.data.log),W.data.type==="transmuxed"&&(F||(e.onmessage=null,KB({transmuxedData:j,callback:b}),xD(e))))},L=()=>{const W={message:"Received an error message from the transmuxer worker",metadata:{errorType:Pe.Error.StreamingFailedToTransmuxSegment,segmentInfo:uu({segment:O})}};b(null,W)};if(e.onmessage=G,e.onerror=L,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof r<"u"&&e.postMessage({action:"setRemux",remux:r}),t.byteLength){const W=t instanceof ArrayBuffer?t:t.buffer,I=t instanceof ArrayBuffer?0:t.byteOffset;R({type:"segmenttransmuxingstart",segment:O}),e.postMessage({action:"push",data:W,byteOffset:I,byteLength:t.byteLength},[W])}D&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},xD=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():vD(s.currentTransmux))},AE=(s,e)=>{s.postMessage({action:e}),xD(s)},bD=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,AE(e,s);return}e.transmuxQueue.push(AE.bind(null,e,s))},YB=s=>{bD("reset",s)},XB=s=>{bD("endTimeline",s)},TD=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,vD(s);return}s.transmuxer.transmuxQueue.push(s)},QB=s=>{const e=new GB;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:s}),e};var bv={reset:YB,endTimeline:XB,transmux:TD,createTransmuxer:QB};const Ec=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,n=cn({},s,{endAction:null,transmuxer:null,callback:null}),r=a=>{a.data.action===t&&(e.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",r),s.data){const a=s.data instanceof ArrayBuffer;n.byteOffset=a?0:s.data.byteOffset,n.byteLength=s.data.byteLength;const u=[a?s.data:s.data.buffer];e.postMessage(n,u)}else e.postMessage(n)},$a={FAILURE:2,TIMEOUT:-101,ABORTED:-102},SD="wvtt",Ox=s=>{s.forEach(e=>{e.abort()})},ZB=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),JB=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},Qb=(s,e)=>{const{requestType:t}=e,i=yu({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:$a.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:$a.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:$a.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:$a.FAILURE,xhr:e,metadata:i}:null},kE=(s,e,t,i)=>(n,r)=>{const a=r.response,u=Qb(n,r);if(u)return t(u,s);if(a.byteLength!==16)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:$a.FAILURE,xhr:r},s);const c=new DataView(a),d=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let g=0;g{e===SD&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},t8=(s,e,t)=>{e===SD&&Ec({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:n})=>{s.bytes=i,t(null,s,{mp4VttCues:n})}})},_D=(s,e)=>{const t=bb(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${i}`,code:$a.FAILURE,metadata:{mediaType:n}})}Ec({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:n})=>(s.map.bytes=n,i.forEach(function(r){s.map.tracks=s.map.tracks||{},!s.map.tracks[r.type]&&(s.map.tracks[r.type]=r,typeof r.id=="number"&&r.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[r.id]=r.timescale),r.type==="text"&&e8(s,r.codec))}),e(null))})},i8=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,n)=>{const r=Qb(i,n);if(r)return e(r,s);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,_D(s,function(u){if(u)return u.xhr=n,u.status=n.status,e(u,s);e(null,s)})},s8=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(n,r)=>{const a=Qb(n,r);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const u=t==="arraybuffer"||!r.responseText?r.response:HB(r.responseText.substring(s.lastReachedChar||0));return s.stats=ZB(r),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},n8=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{const b=s.map&&s.map.tracks||{},T=!!(b.audio&&b.video);let E=i.bind(null,s,"audio","start");const D=i.bind(null,s,"audio","end");let O=i.bind(null,s,"video","start");const R=i.bind(null,s,"video","end"),j=()=>TD({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:F=>{F.type=F.type==="combined"?"video":F.type,f(s,F)},onTrackInfo:F=>{t&&(T&&(F.isMuxed=!0),t(s,F))},onAudioTimingInfo:F=>{E&&typeof F.start<"u"&&(E(F.start),E=null),D&&typeof F.end<"u"&&D(F.end)},onVideoTimingInfo:F=>{O&&typeof F.start<"u"&&(O(F.start),O=null),R&&typeof F.end<"u"&&R(F.end)},onVideoSegmentTimingInfo:F=>{const G={pts:{start:F.start.presentation,end:F.end.presentation},dts:{start:F.start.decode,end:F.end.decode}};v({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:G}),n(F)},onAudioSegmentTimingInfo:F=>{const G={pts:{start:F.start.pts,end:F.end.pts},dts:{start:F.start.dts,end:F.end.dts}};v({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:G}),r(F)},onId3:(F,G)=>{a(s,F,G)},onCaptions:F=>{u(s,[F])},isEndOfTimeline:c,onEndedTimeline:()=>{d()},onTransmuxerLog:y,onDone:(F,G)=>{g&&(F.type=F.type==="combined"?"video":F.type,v({type:"segmenttransmuxingcomplete",segment:s}),g(G,s,F))},segment:s,triggerSegmentEventFn:v});Ec({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:F=>{s.bytes=e=F.data;const G=F.result;G&&(t(s,{hasAudio:G.hasAudio,hasVideo:G.hasVideo,isMuxed:T}),t=null),j()}})},ED=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{let b=new Uint8Array(e);if(w4(b)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){f(s,{data:b,type:"text"}),t8(s,T.text.codec,g);return}const D={isFmp4:!0,hasVideo:!!T.video,hasAudio:!!T.audio};T.audio&&T.audio.codec&&T.audio.codec!=="enca"&&(D.audioCodec=T.audio.codec),T.video&&T.video.codec&&T.video.codec!=="encv"&&(D.videoCodec=T.video.codec),T.video&&T.audio&&(D.isMuxed=!0),t(s,D);const O=(R,j)=>{f(s,{data:b,type:D.hasAudio&&!D.isMuxed?"audio":"video"}),j&&j.length&&a(s,j),R&&R.length&&u(s,R),g(null,s,{})};Ec({action:"probeMp4StartTime",timescales:s.map.timescales,data:b,transmuxer:s.transmuxer,callback:({data:R,startTime:j})=>{e=R.buffer,s.bytes=b=R,D.hasAudio&&!D.isMuxed&&i(s,"audio","start",j),D.hasVideo&&i(s,"video","start",j),Ec({action:"probeEmsgID3",data:b,transmuxer:s.transmuxer,offset:j,callback:({emsgData:F,id3Frames:G})=>{if(e=F.buffer,s.bytes=b=F,!T.video||!F.byteLength||!s.transmuxer){O(void 0,G);return}Ec({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:b,timescales:s.map.timescales,trackIds:[T.video.id],callback:L=>{e=L.data.buffer,s.bytes=b=L.data,L.logs.forEach(function(W){y(cs(W,{stream:"mp4CaptionParser"}))}),O(L.captions,G)}})}})}});return}if(!s.transmuxer){g(null,s,{});return}if(typeof s.container>"u"&&(s.container=bb(b)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),g(null,s,{});return}n8({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})},wD=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:n,doneFn:r},a){const u=d=>{if(d.data.source===s){i.removeEventListener("message",u);const f=d.data.decrypted;a(new Uint8Array(f.bytes,f.byteOffset,f.byteLength))}};i.onerror=()=>{const d="An error occurred in the decryption worker",f=uu({segment:n}),g={message:d,metadata:{error:new Error(d),errorType:Pe.Error.StreamingFailedToDecryptSegment,segmentInfo:f,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};r(g,n)},i.addEventListener("message",u);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(uD({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},r8=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{v({type:"segmentdecryptionstart"}),wD({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:g},b=>{e.bytes=b,v({type:"segmentdecryptioncomplete",segment:e}),ED({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})})},a8=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})=>{let b=0,T=!1;return(E,D)=>{if(!T){if(E)return T=!0,Ox(s),g(E,D);if(b+=1,b===s.length){const O=function(){if(D.encryptedBytes)return r8({decryptionWorker:e,segment:D,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v});ED({segment:D,bytes:D.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f,doneFn:g,onTransmuxerLog:y,triggerSegmentEventFn:v})};if(D.endOfAllRequests=Date.now(),D.map&&D.map.encryptedBytes&&!D.map.bytes)return v({type:"segmentdecryptionstart",segment:D}),wD({decryptionWorker:e,id:D.requestId+"-init",encryptedBytes:D.map.encryptedBytes,key:D.map.key,segment:D,doneFn:g},R=>{D.map.bytes=R,v({type:"segmentdecryptioncomplete",segment:D}),_D(D,j=>{if(j)return Ox(s),g(j,D);O()})});O()}}}},o8=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},l8=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:d,dataFn:f})=>g=>{if(!g.target.aborted)return s.stats=cs(s.stats,JB(g)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(g,s)},u8=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:n,progressFn:r,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:g,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:D})=>{const O=[],R=a8({activeXhrs:O,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:g,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:D});if(i.key&&!i.key.bytes){const W=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&W.push(i.map.key);const I=cs(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),N=kE(i,W,R,D),X={uri:i.key.resolvedUri};D({type:"segmentkeyloadstart",segment:i,keyInfo:X});const V=s(I,N);O.push(V)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const V=cs(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Y=kE(i,[i.map.key],R,D),ne={uri:i.map.key.resolvedUri};D({type:"segmentkeyloadstart",segment:i,keyInfo:ne});const ie=s(V,Y);O.push(ie)}const I=cs(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Ix(i.map),requestType:"segment-media-initialization"}),N=i8({segment:i,finishProcessingFn:R,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:i});const X=s(I,N);O.push(X)}const j=cs(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Ix(i),requestType:"segment"}),F=s8({segment:i,finishProcessingFn:R,responseType:j.responseType,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:i});const G=s(j,F);G.addEventListener("progress",l8({segment:i,progressFn:r,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:d,id3Fn:f,captionsFn:g,isEndOfTimeline:y,endedTimelineFn:v,dataFn:b})),O.push(G);const L={};return O.forEach(W=>{W.addEventListener("loadend",o8({loadendState:L,abortFn:n}))}),()=>Ox(O)},Lm=ia("PlaylistSelector"),CE=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},wc=function(s,e){if(!s)return"";const t=he.getComputedStyle(s);return t?t[e]:""},Ac=function(s,e){const t=s.slice();s.sort(function(i,n){const r=e(i,n);return r===0?t.indexOf(i)-t.indexOf(n):r})},Zb=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||he.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||he.Number.MAX_VALUE,t-i},c8=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||he.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||he.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let AD=function(s){const{main:e,bandwidth:t,playerWidth:i,playerHeight:n,playerObjectFit:r,limitRenditionByPlayerDimensions:a,playlistController:u}=s;if(!e)return;const c={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:a};let d=e.playlists;yr.isAudioOnly(e)&&(d=u.getAudioTrackPlaylists_(),c.audioOnly=!0);let f=d.map(L=>{let W;const I=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.width,N=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.height;return W=L.attributes&&L.attributes.BANDWIDTH,W=W||he.Number.MAX_VALUE,{bandwidth:W,width:I,height:N,playlist:L}});Ac(f,(L,W)=>L.bandwidth-W.bandwidth),f=f.filter(L=>!yr.isIncompatible(L.playlist));let g=f.filter(L=>yr.isEnabled(L.playlist));g.length||(g=f.filter(L=>!yr.isDisabled(L.playlist)));const y=g.filter(L=>L.bandwidth*An.BANDWIDTH_VARIANCEL.bandwidth===v.bandwidth)[0];if(a===!1){const L=b||g[0]||f[0];if(L&&L.playlist){let W="sortedPlaylistReps";return b&&(W="bandwidthBestRep"),g[0]&&(W="enabledPlaylistReps"),Lm(`choosing ${CE(L)} using ${W} with options`,c),L.playlist}return Lm("could not choose a playlist with options",c),null}const T=y.filter(L=>L.width&&L.height);Ac(T,(L,W)=>L.width-W.width);const E=T.filter(L=>L.width===i&&L.height===n);v=E[E.length-1];const D=E.filter(L=>L.bandwidth===v.bandwidth)[0];let O,R,j;D||(O=T.filter(L=>r==="cover"?L.width>i&&L.height>n:L.width>i||L.height>n),R=O.filter(L=>L.width===O[0].width&&L.height===O[0].height),v=R[R.length-1],j=R.filter(L=>L.bandwidth===v.bandwidth)[0]);let F;if(u.leastPixelDiffSelector){const L=T.map(W=>(W.pixelDiff=Math.abs(W.width-i)+Math.abs(W.height-n),W));Ac(L,(W,I)=>W.pixelDiff===I.pixelDiff?I.bandwidth-W.bandwidth:W.pixelDiff-I.pixelDiff),F=L[0]}const G=F||j||D||b||g[0]||f[0];if(G&&G.playlist){let L="sortedPlaylistReps";return F?L="leastPixelDiffRep":j?L="resolutionPlusOneRep":D?L="resolutionBestRep":b?L="bandwidthBestRep":g[0]&&(L="enabledPlaylistReps"),Lm(`choosing ${CE(G)} using ${L} with options`,c),G.playlist}return Lm("could not choose a playlist with options",c),null};const DE=function(){let s=this.useDevicePixelRatio&&he.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),AD({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(wc(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(wc(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?wc(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},d8=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&he.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),AD({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(wc(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(wc(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?wc(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},h8=function(s){const{main:e,currentTime:t,bandwidth:i,duration:n,segmentDuration:r,timeUntilRebuffer:a,currentTimeline:u,syncController:c}=s,d=e.playlists.filter(b=>!yr.isIncompatible(b));let f=d.filter(yr.isEnabled);f.length||(f=d.filter(b=>!yr.isDisabled(b)));const y=f.filter(yr.hasAttribute.bind(null,"BANDWIDTH")).map(b=>{const E=c.getSyncPoint(b,n,u,t)?1:2,O=yr.estimateSegmentRequestTime(r,i,b)*E-a;return{playlist:b,rebufferingImpact:O}}),v=y.filter(b=>b.rebufferingImpact<=0);return Ac(v,(b,T)=>Zb(T.playlist,b.playlist)),v.length?v[0]:(Ac(y,(b,T)=>b.rebufferingImpact-T.rebufferingImpact),y[0]||null)},f8=function(){const s=this.playlists.main.playlists.filter(yr.isEnabled);return Ac(s,(t,i)=>Zb(t,i)),s.filter(t=>!!Ch(this.playlists.main,t).video)[0]||null},m8=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function kD(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const p8=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(i);if(n)s[t]=n;else{const r=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,u=t,c=!1;const d=r[i];d&&(a=d.label,u=d.language,c=d.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:c,label:a,language:u},!1).track}}},g8=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=he.WebKitDataCue||he.VTTCue;e.forEach(n=>{const r=n.stream;n.content?n.content.forEach(a=>{const u=new i(n.startTime+t,n.endTime+t,a.text);u.line=a.line,u.align="left",u.position=a.position,u.positionAlign="line-left",s[r].addCue(u)}):s[r].addCue(new i(n.startTime+t,n.endTime+t,n.text))})},y8=function(s){Object.defineProperties(s.frame,{id:{get(){return Pe.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return Pe.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return Pe.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},v8=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const n=he.WebKitDataCue||he.VTTCue,r=s.metadataTrack_;if(!r||(e.forEach(f=>{const g=f.cueTime+t;typeof g!="number"||he.isNaN(g)||g<0||!(g<1/0)||!f.frames||!f.frames.length||f.frames.forEach(y=>{const v=new n(g,g,y.value||y.url||y.data||"");v.frame=y,v.value=y,y8(v),r.addCue(v)})}),!r.cues||!r.cues.length))return;const a=r.cues,u=[];for(let f=0;f{const y=f[g.startTime]||[];return y.push(g),f[g.startTime]=y,f},{}),d=Object.keys(c).sort((f,g)=>Number(f)-Number(g));d.forEach((f,g)=>{const y=c[f],v=isFinite(i)?i:f,b=Number(d[g+1])||v;y.forEach(T=>{T.endTime=b})})},x8={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},b8=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),T8=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=he.WebKitDataCue||he.VTTCue;e.forEach(n=>{for(const r of Object.keys(n)){if(b8.has(r))continue;const a=new i(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:x8[r],data:n[r]},(r==="scte35Out"||r==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},LE=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Pe.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},mh=function(s,e,t){let i,n;if(t&&t.cues)for(i=t.cues.length;i--;)n=t.cues[i],n.startTime>=s&&n.endTime<=e&&t.removeCue(n)},S8=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const n=e[i],r=`${n.startTime}-${n.endTime}-${n.text}`;t[r]?s.removeCue(n):t[r]=n}},_8=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*du.ONE_SECOND_IN_TS);let n;for(n=0;ni);n++);return s.slice(n)},E8=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let n=0;for(n;n=i);n++);return s.slice(0,n).concat(e)},w8=(s,e,t,i)=>{const n=Math.ceil((e-i)*du.ONE_SECOND_IN_TS),r=Math.ceil((t-i)*du.ONE_SECOND_IN_TS),a=s.slice();let u=s.length;for(;u--&&!(s[u].pts<=r););if(u===-1)return a;let c=u+1;for(;c--&&!(s[c].pts<=n););return c=Math.max(c,0),a.splice(c,u-c+1),a},A8=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let n=0;nt))return r}return i.length===0?0:i[i.length-1]},sh=1,C8=500,RE=s=>typeof s=="number"&&isFinite(s),Rm=1/60,D8=(s,e,t)=>s!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,L8=(s,e,t)=>{let i=e-An.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const n=e-t;return Math.min(n,i)},sc=s=>{const{startOfSegment:e,duration:t,segment:i,part:n,playlist:{mediaSequence:r,id:a,segments:u=[]},mediaIndex:c,partIndex:d,timeline:f}=s,g=u.length-1;let y="mediaIndex/partIndex increment";s.getMediaInfoForTime?y=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(y="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(y+=` with independent ${s.independent}`);const v=typeof d=="number",b=s.segment.uri?"segment":"pre-segment",T=v?GC({preloadSegment:i})-1:0;return`${b} [${r+c}/${r+g}]`+(v?` part [${d}/${T}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(v?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${f}] selected by [${y}] playlist [${a}]`},IE=s=>`${s}TimingInfo`,R8=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:n})=>!n&&s===e?null:s{if(e===t)return!1;if(i==="audio"){const r=s.lastTimelineChange({type:"main"});return!r||r.to!==t}if(i==="main"&&n){const r=s.pendingTimelineChange({type:"audio"});return!(r&&r.to===t)}return!1},I8=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,n=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&n)},N8=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to{const e=s.pendingSegment_;if(!e)return;if(Mx({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&I8(s.timelineChangeController_)){if(N8(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},O8=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:n,end:r}=i;let a;typeof n=="bigint"||typeof r=="bigint"?a=he.BigInt(r)-he.BigInt(n):typeof n=="number"&&typeof r=="number"&&(a=r-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&es?Math.round(s)>e+Ua:!1,M8=(s,e)=>{if(e!=="hls")return null;const t=O8({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,n=NE({segmentDuration:t,maxDuration:i*2}),r=NE({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||r?{severity:n?"warn":"info",message:a}:null},uu=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class Px extends Pe.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=ia(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():hl(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(cn({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():hl(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(cn({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():hl(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():hl(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return bv.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&he.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,he.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&bv.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Cn();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=B0(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=cD(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} -bufferedEnd: ${mv(this.buffered_())} -`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const u=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!u.parts||!u.parts.length||!u.parts[this.partIndex])){const c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&gv.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},n=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let r=1;const a=()=>{r--,r===0&&i()};(n||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||this.loaderType_==="main")&&(this.gopBuffer_=c8(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a));for(const u in this.inbandTextTracks_)fh(e,t,this.inbandTextTracks_[u]);fh(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),f8)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:lu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const n=typeof e=="number"&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&r&&a}chooseNextRequest_(){const e=this.buffered_(),t=mv(e)||0,i=Vb(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const u={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(u.isSyncRequest)u.mediaIndex=h8(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${u.mediaIndex}`);else if(this.mediaIndex!==null){const y=a[this.mediaIndex],v=typeof this.partIndex=="number"?this.partIndex:-1;u.startOfSegment=y.end?y.end:t,y.parts&&y.parts[v+1]?(u.mediaIndex=this.mediaIndex,u.partIndex=v+1):u.mediaIndex=this.mediaIndex+1}else{let y,v,b;const T=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: +bufferedEnd: ${vv(this.buffered_())} +`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const u=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!u.parts||!u.parts.length||!u.parts[this.partIndex])){const c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(he.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&bv.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},n=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let r=1;const a=()=>{r--,r===0&&i()};(n||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||this.loaderType_==="main")&&(this.gopBuffer_=w8(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a));for(const u in this.inbandTextTracks_)mh(e,t,this.inbandTextTracks_[u]);mh(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&he.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=he.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&he.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=he.setTimeout(this.monitorBufferTick_.bind(this),C8)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:uu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const n=typeof e=="number"&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&r&&a}chooseNextRequest_(){const e=this.buffered_(),t=vv(e)||0,i=Kb(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const u={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(u.isSyncRequest)u.mediaIndex=k8(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${u.mediaIndex}`);else if(this.mediaIndex!==null){const y=a[this.mediaIndex],v=typeof this.partIndex=="number"?this.partIndex:-1;u.startOfSegment=y.end?y.end:t,y.parts&&y.parts[v+1]?(u.mediaIndex=this.mediaIndex,u.partIndex=v+1):u.mediaIndex=this.mediaIndex+1}else{let y,v,b;const T=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: For TargetTime: ${T}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${t} Fetch At Buffer: ${this.fetchAtBuffer_} -`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const E=this.getSyncInfoFromMediaSequenceSync_(T);if(!E){const D="No sync info found while using media sequence sync";return this.error({message:D,metadata:{errorType:Be.Error.StreamingFailedToSelectNextSegment,error:new Error(D)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${E.start} --> ${E.end})`),y=E.segmentIndex,v=E.partIndex,b=E.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const E=mr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});y=E.segmentIndex,v=E.partIndex,b=E.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=y,u.startOfSegment=b,u.partIndex=v,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${u.mediaIndex} `)}const c=a[u.mediaIndex];let d=c&&typeof u.partIndex=="number"&&c.parts&&c.parts[u.partIndex];if(!c||typeof u.partIndex=="number"&&!d)return null;typeof u.partIndex!="number"&&c.parts&&(u.partIndex=0,d=c.parts[0]);const f=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!f&&!d.independent)if(u.partIndex===0){const y=a[u.mediaIndex-1],v=y.parts&&y.parts.length&&y.parts[y.parts.length-1];v&&v.independent&&(u.mediaIndex-=1,u.partIndex=y.parts.length-1,u.independent="previous segment")}else c.parts[u.partIndex-1].independent&&(u.partIndex-=1,u.independent="previous part");const p=this.mediaSource_&&this.mediaSource_.readyState==="ended";return u.mediaIndex>=a.length-1&&p&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,u.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(u))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const n=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:r,isSyncRequest:a,partIndex:u,forceTimestampOffset:c,getMediaInfoForTime:d}=e,f=i.segments[n],p=typeof u=="number"&&f.parts[u],y={requestId:"segment-loader-"+Math.random(),uri:p&&p.resolvedUri||f.resolvedUri,mediaIndex:n,partIndex:p?u:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:f.timeline,duration:p&&p.duration||f.duration,segment:f,part:p,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},v=typeof c<"u"?c:this.isPendingTimestampOffset_;y.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:f.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:v});const b=mv(this.sourceUpdater_.audioBuffered());return typeof b=="number"&&(y.audioAppendStart=b-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(y.gopsToAlignWith=l8(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),y}timestampOffsetForSegment_(e){return g8(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=mr.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=FB(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return;const u=QF({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!u)return;const d=r-a-u.rebufferingImpact;let f=.5;a<=Oa&&(f=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||d{r[a.stream]=r[a.stream]||{startTime:1/0,captions:[],endTime:0};const u=r[a.stream];u.startTime=Math.min(u.startTime,a.startTime+n),u.endTime=Math.max(u.endTime,a.endTime+n),u.captions.push(a)}),Object.keys(r).forEach(a=>{const{startTime:u,endTime:c,captions:d}=r[a],f=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${c} for ${a}`),e8(f,this.vhs_.tech_,a),fh(u,c,f[a]),t8({captionArray:d,inbandTextTracks:f,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Ix({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:r}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||Ix({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){dl(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[wE(t.type)].start;else{const n=this.getCurrentMediaInfo_(),r=this.loaderType_==="main"&&n&&n.hasVideo;let a;r&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==i.mediaIndex||n.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const r=O0(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const r=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+du(r).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+du(a).join(", "));const u=r.length?r.start(0):0,c=r.length?r.end(r.length-1):0,d=a.length?a.start(0):0,f=a.length?a.end(a.length-1):0;if(c-u<=ih&&f-d<=ih){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${du(r).join(", ")}, video buffer: ${du(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const y=this.currentTime_()-ih;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${y}`),this.remove(0,y,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${ih}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=de.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},ih*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){if(n){if(n.code===KC){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:Be.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:r}){if(!r){const u=[n];let c=n.byteLength;i&&(u.unshift(i),c+=i.byteLength),r=JF({bytes:c,segments:u})}const a={segmentInfo:lu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,r=`${e}TimingInfo`;n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength||i==="audio"&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){dl(this),this.loadQueue_.push(()=>{const t=nn({},e,{forceTimestampOffset:!0});nn(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,r=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&r;this.logger_(`Requesting -${vD(e.uri)} -${tc(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=WF({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:u,level:c,stream:d})=>{this.logger_(`${tc(e)} logged from transmuxer stream ${d} as a ${c}: ${u}`)},triggerSegmentEventFn:({type:u,segment:c,keyInfo:d,trackInfo:f,timingInfo:p})=>{const v={segmentInfo:lu({segment:c})};d&&(v.keyInfo=d),f&&(v.trackInfo=f),p&&(v.timingInfo=p),this.trigger({type:u,metadata:v})}})}trimBackBuffer_(e){const t=p8(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:r},u=e.playlist.segments[e.mediaIndex-1];if(u&&u.timeline===t.timeline&&(u.videoTimingInfo?a.baseStartTime=u.videoTimingInfo.transmuxedDecodeEnd:u.audioTimingInfo&&(a.baseStartTime=u.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e"u"||d.end!==n+r?n:u.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:n,isMuxed:r}=t,a=this.loaderType_==="main"&&n,u=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,u&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),u&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=m8(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const c={segmentInfo:lu({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=b8(e,this.sourceType_);if(t&&(t.severity==="warn"?Be.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${tc(e)}`);return}this.logger_(`Appended ${tc(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(r||a){this.logger_(`bad ${r?"segment":"part"} ${tc(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},T8=["video","audio"],Ox=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},S8=(s,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),wc("audio",e),wc("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Ox(s,e))){if(i.type!==s){if(t=S8(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,wc(s,e);return}}},bD=(s,e)=>{const t=e[`${s}Buffer`],i=xD(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Ra=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Cr={appendBuffer:(s,e,t)=>(i,n)=>{const r=n[`${i}Buffer`];if(Ra(n.mediaSource,r)){n.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{r.appendBuffer(s)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===KC?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),n.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const n=i[`${t}Buffer`];if(Ra(i.mediaSource,n)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{n.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];Ra(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){Be.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){Be.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Ra(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){Be.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=xD(s),n=Nc(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const r=t.mediaSource.addSourceBuffer(n);r.addEventListener("updateend",t[`on${i}UpdateEnd_`]),r.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=r},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(bD(s,e),!!Ra(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Be.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],n=Nc(s);if(!Ra(t.mediaSource,i))return;const r=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===r)return;const c={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:c}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(n),t.codecs[e]=s}catch(d){c.errorType=Be.Error.StreamingCodecsChangeError,c.error=d,d.metadata=c,t.error_=d,t.trigger("error"),Be.log.warn(`Failed to changeType on ${e}Buffer`,d)}}},Dr=({type:s,sourceUpdater:e,action:t,doneFn:i,name:n})=>{e.queue.push({type:s,action:t,doneFn:i,name:n}),wc(s,e)},kE=(s,e)=>t=>{const i=e[`${s}Buffered`](),n=MB(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,n),e.queuePending[s]){const r=e.queuePending[s].doneFn;e.queuePending[s]=null,r&&r(e[`${s}Error_`])}wc(s,e)};class TD extends Be.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>wc("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Zr("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=kE("video",this),this.onAudioUpdateEnd_=kE("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Dr({type:"mediaSource",sourceUpdater:this,action:Cr.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Dr({type:e,sourceUpdater:this,action:Cr.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Be.log.error("removeSourceBuffer is not supported!");return}Dr({type:"mediaSource",sourceUpdater:this,action:Cr.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Be.browser.IS_FIREFOX&&de.MediaSource&&de.MediaSource.prototype&&typeof de.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return de.SourceBuffer&&de.SourceBuffer.prototype&&typeof de.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Be.log.error("changeType is not supported!");return}Dr({type:e,sourceUpdater:this,action:Cr.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:r}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}const a=t;if(Dr({type:n,sourceUpdater:this,action:Cr.appendBuffer(r,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const u=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${u.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,u.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return Ra(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:kn()}videoBuffered(){return Ra(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:kn()}buffered(){const e=Ra(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Ra(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():BB(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=So){Dr({type:"mediaSource",sourceUpdater:this,action:Cr.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=So){typeof e!="string"&&(e=void 0),Dr({type:"mediaSource",sourceUpdater:this,action:Cr.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=So){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}Dr({type:"audio",sourceUpdater:this,action:Cr.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=So){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}Dr({type:"video",sourceUpdater:this,action:Cr.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(Ox("audio",this)||Ox("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Dr({type:"audio",sourceUpdater:this,action:Cr.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Dr({type:"video",sourceUpdater:this,action:Cr.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Dr({type:"audio",sourceUpdater:this,action:Cr.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Dr({type:"video",sourceUpdater:this,action:Cr.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),T8.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>bD(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const CE=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),_8=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},DE=new Uint8Array(` +`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const E=this.getSyncInfoFromMediaSequenceSync_(T);if(!E){const D="No sync info found while using media sequence sync";return this.error({message:D,metadata:{errorType:Pe.Error.StreamingFailedToSelectNextSegment,error:new Error(D)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${E.start} --> ${E.end})`),y=E.segmentIndex,v=E.partIndex,b=E.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const E=yr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});y=E.segmentIndex,v=E.partIndex,b=E.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=y,u.startOfSegment=b,u.partIndex=v,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${u.mediaIndex} `)}const c=a[u.mediaIndex];let d=c&&typeof u.partIndex=="number"&&c.parts&&c.parts[u.partIndex];if(!c||typeof u.partIndex=="number"&&!d)return null;typeof u.partIndex!="number"&&c.parts&&(u.partIndex=0,d=c.parts[0]);const f=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!f&&!d.independent)if(u.partIndex===0){const y=a[u.mediaIndex-1],v=y.parts&&y.parts.length&&y.parts[y.parts.length-1];v&&v.independent&&(u.mediaIndex-=1,u.partIndex=y.parts.length-1,u.independent="previous segment")}else c.parts[u.partIndex-1].independent&&(u.partIndex-=1,u.independent="previous part");const g=this.mediaSource_&&this.mediaSource_.readyState==="ended";return u.mediaIndex>=a.length-1&&g&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,u.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(u))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const n=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:r,isSyncRequest:a,partIndex:u,forceTimestampOffset:c,getMediaInfoForTime:d}=e,f=i.segments[n],g=typeof u=="number"&&f.parts[u],y={requestId:"segment-loader-"+Math.random(),uri:g&&g.resolvedUri||f.resolvedUri,mediaIndex:n,partIndex:g?u:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:f.timeline,duration:g&&g.duration||f.duration,segment:f,part:g,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:d,independent:t},v=typeof c<"u"?c:this.isPendingTimestampOffset_;y.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:f.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:v});const b=vv(this.sourceUpdater_.audioBuffered());return typeof b=="number"&&(y.audioAppendStart=b-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(y.gopsToAlignWith=_8(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),y}timestampOffsetForSegment_(e){return R8(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=yr.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=JF(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return;const u=h8({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!u)return;const d=r-a-u.rebufferingImpact;let f=.5;a<=Ua&&(f=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||d{r[a.stream]=r[a.stream]||{startTime:1/0,captions:[],endTime:0};const u=r[a.stream];u.startTime=Math.min(u.startTime,a.startTime+n),u.endTime=Math.max(u.endTime,a.endTime+n),u.captions.push(a)}),Object.keys(r).forEach(a=>{const{startTime:u,endTime:c,captions:d}=r[a],f=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${c} for ${a}`),p8(f,this.vhs_.tech_,a),mh(u,c,f[a]),g8({captionArray:d,inbandTextTracks:f,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Mx({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:r}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||Mx({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){hl(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[IE(t.type)].start;else{const n=this.getCurrentMediaInfo_(),r=this.loaderType_==="main"&&n&&n.hasVideo;let a;r&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==i.mediaIndex||n.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const r=B0(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const r=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+hu(r).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+hu(a).join(", "));const u=r.length?r.start(0):0,c=r.length?r.end(r.length-1):0,d=a.length?a.start(0):0,f=a.length?a.end(a.length-1):0;if(c-u<=sh&&f-d<=sh){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${hu(r).join(", ")}, video buffer: ${hu(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const y=this.currentTime_()-sh;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${y}`),this.remove(0,y,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${sh}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=he.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},sh*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){if(n){if(n.code===iD){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:Pe.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:r}){if(!r){const u=[n];let c=n.byteLength;i&&(u.unshift(i),c+=i.byteLength),r=m8({bytes:c,segments:u})}const a={segmentInfo:uu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,r=`${e}TimingInfo`;n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength||i==="audio"&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){hl(this),this.loadQueue_.push(()=>{const t=cn({},e,{forceTimestampOffset:!0});cn(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,r=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&r;this.logger_(`Requesting +${kD(e.uri)} +${sc(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=u8({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:u,level:c,stream:d})=>{this.logger_(`${sc(e)} logged from transmuxer stream ${d} as a ${c}: ${u}`)},triggerSegmentEventFn:({type:u,segment:c,keyInfo:d,trackInfo:f,timingInfo:g})=>{const v={segmentInfo:uu({segment:c})};d&&(v.keyInfo=d),f&&(v.trackInfo=f),g&&(v.timingInfo=g),this.trigger({type:u,metadata:v})}})}trimBackBuffer_(e){const t=L8(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:r},u=e.playlist.segments[e.mediaIndex-1];if(u&&u.timeline===t.timeline&&(u.videoTimingInfo?a.baseStartTime=u.videoTimingInfo.transmuxedDecodeEnd:u.audioTimingInfo&&(a.baseStartTime=u.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e"u"||d.end!==n+r?n:u.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:n,isMuxed:r}=t,a=this.loaderType_==="main"&&n,u=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,u&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),u&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=D8(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const c={segmentInfo:uu({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=M8(e,this.sourceType_);if(t&&(t.severity==="warn"?Pe.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${sc(e)}`);return}this.logger_(`Appended ${sc(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(r||a){this.logger_(`bad ${r?"segment":"part"} ${sc(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},P8=["video","audio"],Fx=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},F8=(s,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),kc("audio",e),kc("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Fx(s,e))){if(i.type!==s){if(t=F8(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,kc(s,e);return}}},DD=(s,e)=>{const t=e[`${s}Buffer`],i=CD(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Pa=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Ir={appendBuffer:(s,e,t)=>(i,n)=>{const r=n[`${i}Buffer`];if(Pa(n.mediaSource,r)){n.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{r.appendBuffer(s)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===iD?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),n.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const n=i[`${t}Buffer`];if(Pa(i.mediaSource,n)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{n.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];Pa(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){Pe.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){Pe.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Pa(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){Pe.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=CD(s),n=Mc(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const r=t.mediaSource.addSourceBuffer(n);r.addEventListener("updateend",t[`on${i}UpdateEnd_`]),r.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=r},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(DD(s,e),!!Pa(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Pe.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],n=Mc(s);if(!Pa(t.mediaSource,i))return;const r=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===r)return;const c={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:c}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(n),t.codecs[e]=s}catch(d){c.errorType=Pe.Error.StreamingCodecsChangeError,c.error=d,d.metadata=c,t.error_=d,t.trigger("error"),Pe.log.warn(`Failed to changeType on ${e}Buffer`,d)}}},Nr=({type:s,sourceUpdater:e,action:t,doneFn:i,name:n})=>{e.queue.push({type:s,action:t,doneFn:i,name:n}),kc(s,e)},OE=(s,e)=>t=>{const i=e[`${s}Buffered`](),n=XF(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,n),e.queuePending[s]){const r=e.queuePending[s].doneFn;e.queuePending[s]=null,r&&r(e[`${s}Error_`])}kc(s,e)};class LD extends Pe.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>kc("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=ia("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=OE("video",this),this.onAudioUpdateEnd_=OE("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Nr({type:"mediaSource",sourceUpdater:this,action:Ir.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Nr({type:e,sourceUpdater:this,action:Ir.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Pe.log.error("removeSourceBuffer is not supported!");return}Nr({type:"mediaSource",sourceUpdater:this,action:Ir.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Pe.browser.IS_FIREFOX&&he.MediaSource&&he.MediaSource.prototype&&typeof he.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return he.SourceBuffer&&he.SourceBuffer.prototype&&typeof he.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Pe.log.error("changeType is not supported!");return}Nr({type:e,sourceUpdater:this,action:Ir.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:r}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}const a=t;if(Nr({type:n,sourceUpdater:this,action:Ir.appendBuffer(r,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const u=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${u.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,u.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return Pa(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Cn()}videoBuffered(){return Pa(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Cn()}buffered(){const e=Pa(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Pa(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():ZF(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Eo){Nr({type:"mediaSource",sourceUpdater:this,action:Ir.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Eo){typeof e!="string"&&(e=void 0),Nr({type:"mediaSource",sourceUpdater:this,action:Ir.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Eo){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}Nr({type:"audio",sourceUpdater:this,action:Ir.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Eo){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}Nr({type:"video",sourceUpdater:this,action:Ir.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(Fx("audio",this)||Fx("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Nr({type:"audio",sourceUpdater:this,action:Ir.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Nr({type:"video",sourceUpdater:this,action:Ir.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Nr({type:"audio",sourceUpdater:this,action:Ir.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Nr({type:"video",sourceUpdater:this,action:Ir.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),P8.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>DD(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const ME=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),B8=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},PE=new Uint8Array(` -`.split("").map(s=>s.charCodeAt(0)));class E8 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class w8 extends Nx{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return kn();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return kn([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=O0(e);let n=this.initSegments_[i];if(t&&!n&&e.bytes){const r=DE.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(DE,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){fh(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Pa.TIMEOUT&&this.handleTimeout_(),e.code===Pa.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,r=i.mp4VttCues&&i.mp4VttCues.length;r&&(n.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof de.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(n)}catch(u){this.stopForError({message:u.message,metadata:{errorType:Be.Error.StreamingVttParserError,error:u}});return}if(r||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(u=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new de.VTTCue(u.startTime,u.endTime,u.text):u)}),o8(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",n=t&&t.type==="text";i&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const n=i.start+t,r=i.end+t,a=new de.VTTCue(n,r,i.cueText);i.settings&&i.settings.split(" ").forEach(u=>{const c=u.split(":"),d=c[0],f=c[1];a[d]=isNaN(f)?f:Number(f)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof de.WebVTT!="function")throw new E8;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof de.TextDecoder=="function"?t=new de.TextDecoder("utf8"):(t=de.WebVTT.StringDecoder(),i=!0);const n=new de.WebVTT.Parser(de,de.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{Be.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=CE(a)),n.parse(a)}let r=e.bytes;i&&(r=CE(r)),n.parse(r),n.flush()}updateTimeMapping_(e,t,i){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:r,LOCAL:a}=e.timestampmap,c=r/cu.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(d=>{const f=d.endTime-d.startTime,p=this.handleRollover_(d.startTime+c,t.time);d.startTime=Math.max(p,0),d.endTime=Math.max(p+f,0)}),!i.syncInfo){const d=e.cues[0].startTime,f=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(d,f-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*cu.ONE_SECOND_IN_TS;const n=t*cu.ONE_SECOND_IN_TS;let r;for(n4294967296;)i+=r;return i/cu.ONE_SECOND_IN_TS}}const A8=function(s,e){const t=s.cues;for(let i=0;i=n.adStartTime&&e<=n.adEndTime)return n}return null},k8=function(s,e,t=0){if(!s.segments)return;let i=t,n;for(let r=0;r=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class SD{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:n}=e;if(this.isReliable_=this.isReliablePlaylist_(i,n),!!this.isReliable_)return this.updateStorage_(n,i,this.calculateBaseTime_(i,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const n of i)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const n=new Map;let r=` -`,a=i,u=t;this.start_=a,e.forEach((c,d)=>{const f=this.storage_.get(u),p=a,y=p+c.duration,v=!!(f&&f.segmentSyncInfo&&f.segmentSyncInfo.isAppended),b=new LE({start:p,end:y,appended:v,segmentIndex:d});c.syncInfo=b;let T=a;const E=(c.parts||[]).map((D,O)=>{const R=T,j=T+D.duration,F=!!(f&&f.partsSyncInfo&&f.partsSyncInfo[O]&&f.partsSyncInfo[O].isAppended),z=new LE({start:R,end:j,appended:F,segmentIndex:d,partIndex:O});return T=j,r+=`Media Sequence: ${u}.${O} | Range: ${R} --> ${j} | Appended: ${F} -`,D.syncInfo=z,z});n.set(u,new C8(b,E)),r+=`${vD(c.resolvedUri)} | Media Sequence: ${u} | Range: ${p} --> ${y} | Appended: ${v} -`,u++,a=y}),this.end_=a,this.storage_=n,this.diagnostics_=r}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(et!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,n,r)=>{const a=s.getMediaSequenceSync(r);if(!a||!a.isReliable)return null;const u=a.getSyncInfoForTime(n);return u?{time:u.start,partIndex:u.partIndex,segmentIndex:u.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,n)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let r=null,a=null;const u=Ex(e);n=n||0;for(let c=0;c{let r=null,a=null;n=n||0;const u=Ex(e);for(let c=0;c=v)&&(a=v,r={time:y,segmentIndex:f.segmentIndex,partIndex:f.partIndex})}}return r}},{name:"Discontinuity",run:(s,e,t,i,n)=>{let r=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let u=0;u=p)&&(a=p,r={time:f.time,segmentIndex:c,partIndex:null})}}}return r}},{name:"Playlist",run:(s,e,t,i,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class L8 extends Be.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new SD,i=new RE(t),n=new RE(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:n},this.logger_=Zr("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,n,r){if(t!==1/0)return yv.find(({name:c})=>c==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,n,r);if(!a.length)return null;for(const u of a){const{syncPoint:c,strategy:d}=u,{segmentIndex:f,time:p}=c;if(f<0)continue;const y=e.segments[f],v=p,b=v+y.duration;if(this.logger_(`Strategy: ${d}. Current time: ${n}. selected segment: ${f}. Time: [${v} -> ${b}]}`),n>=v&&n0&&(n.time*=-1),Math.abs(n.time+Ah({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n,r){const a=[];for(let u=0;uD8){Be.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let n=i-1;n>=0;n--){const r=e.segments[n];if(r&&typeof r.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const r=n.dateTimeObject;n.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[n.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,r=e.part;let a=this.timelines[e.timeline],u,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),u=e.startOfSegment,c=t.end+a.mapping;else if(a)u=t.start+a.mapping,c=t.end+a.mapping;else return!1;return r&&(r.start=u,r.end=c),(!n.start||uc){let d;u<0?d=i.start-Ah({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):d=i.end+Ah({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:d,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class R8 extends Be.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const I8=oD(lD(function(){var s=(function(){function T(){this.listeners={}}var E=T.prototype;return E.on=function(O,R){this.listeners[O]||(this.listeners[O]=[]),this.listeners[O].push(R)},E.off=function(O,R){if(!this.listeners[O])return!1;var j=this.listeners[O].indexOf(R);return this.listeners[O]=this.listeners[O].slice(0),this.listeners[O].splice(j,1),j>-1},E.trigger=function(O){var R=this.listeners[O];if(R)if(arguments.length===2)for(var j=R.length,F=0;F>7)*283)^j]=j;for(F=z=0;!O[F];F^=L||1,z=Y[z]||1)for(G=z^z<<1^z<<2^z<<3^z<<4,G=G>>8^G&255^99,O[F]=G,R[G]=F,X=N[I=N[L=N[F]]],ae=X*16843009^I*65537^L*257^F*16843008,q=N[G]*257^G*16843008,j=0;j<4;j++)E[j][F]=q=q<<24^q>>>8,D[j][G]=ae=ae<<24^ae>>>8;for(j=0;j<5;j++)E[j]=E[j].slice(0),D[j]=D[j].slice(0);return T};let i=null;class n{constructor(E){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let D,O,R;const j=this._tables[0][4],F=this._tables[1],z=E.length;let N=1;if(z!==4&&z!==6&&z!==8)throw new Error("Invalid aes key size");const Y=E.slice(0),L=[];for(this._key=[Y,L],D=z;D<4*z+28;D++)R=Y[D-1],(D%z===0||z===8&&D%z===4)&&(R=j[R>>>24]<<24^j[R>>16&255]<<16^j[R>>8&255]<<8^j[R&255],D%z===0&&(R=R<<8^R>>>24^N<<24,N=N<<1^(N>>7)*283)),Y[D]=Y[D-z]^R;for(O=0;D;O++,D--)R=Y[O&3?D:D-4],D<=4||O<4?L[O]=R:L[O]=F[0][j[R>>>24]]^F[1][j[R>>16&255]]^F[2][j[R>>8&255]]^F[3][j[R&255]]}decrypt(E,D,O,R,j,F){const z=this._key[1];let N=E^z[0],Y=R^z[1],L=O^z[2],I=D^z[3],X,G,q;const ae=z.length/4-2;let ie,W=4;const K=this._tables[1],Q=K[0],te=K[1],re=K[2],U=K[3],ne=K[4];for(ie=0;ie>>24]^te[Y>>16&255]^re[L>>8&255]^U[I&255]^z[W],G=Q[Y>>>24]^te[L>>16&255]^re[I>>8&255]^U[N&255]^z[W+1],q=Q[L>>>24]^te[I>>16&255]^re[N>>8&255]^U[Y&255]^z[W+2],I=Q[I>>>24]^te[N>>16&255]^re[Y>>8&255]^U[L&255]^z[W+3],W+=4,N=X,Y=G,L=q;for(ie=0;ie<4;ie++)j[(3&-ie)+F]=ne[N>>>24]<<24^ne[Y>>16&255]<<16^ne[L>>8&255]<<8^ne[I&255]^z[W++],X=N,N=Y,Y=L,L=I,I=X}}class r extends s{constructor(){super(s),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(E){this.jobs.push(E),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(T){return T<<24|(T&65280)<<8|(T&16711680)>>8|T>>>24},u=function(T,E,D){const O=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),R=new n(Array.prototype.slice.call(E)),j=new Uint8Array(T.byteLength),F=new Int32Array(j.buffer);let z,N,Y,L,I,X,G,q,ae;for(z=D[0],N=D[1],Y=D[2],L=D[3],ae=0;ae{const O=T[D];y(O)?E[D]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:E[D]=O}),E};self.onmessage=function(T){const E=T.data,D=new Uint8Array(E.encrypted.bytes,E.encrypted.byteOffset,E.encrypted.byteLength),O=new Uint32Array(E.key.bytes,E.key.byteOffset,E.key.byteLength/4),R=new Uint32Array(E.iv.bytes,E.iv.byteOffset,E.iv.byteLength/4);new c(D,O,R,function(j,F){self.postMessage(b({source:E.source,decrypted:F}),[F.buffer])})}}));var N8=aD(I8);const O8=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},_D=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Mx=(s,e)=>{e.activePlaylistLoader=s,s.load()},M8=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:n}}=e,r=n.activeTrack(),a=n.getActiveGroup(),u=n.activePlaylistLoader,c=n.lastGroup_;if(!(a&&c&&a.id===c.id)&&(n.lastGroup_=a,n.lastTrack_=r,_D(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Mx(a.playlistLoader,n)}},P8=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},B8=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:n},mediaTypes:{[s]:r}}=e,a=r.activeTrack(),u=r.getActiveGroup(),c=r.activePlaylistLoader,d=r.lastTrack_;if(!(d&&a&&d.id===a.id)&&(r.lastGroup_=u,r.lastTrack_=a,_D(i,r),!!u)){if(u.isMainPlaylist){if(!a||!d||a.id===d.id)return;const f=e.vhs.playlistController_,p=f.selectPlaylist();if(f.media()===p)return;r.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),t.pause(),n.resetEverything(),f.fastQualityChange_(p);return}if(s==="AUDIO"){if(!u.playlistLoader){n.setAudio(!0),n.resetEverything();return}i.setAudio(!0),n.setAudio(!1)}if(c===u.playlistLoader){Mx(u.playlistLoader,r);return}i.track&&i.track(a),i.resetEverything(),Mx(u.playlistLoader,r)}},M0={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,n=t.activeTrack(),r=t.activeGroup(),a=(r.filter(c=>c.default)[0]||r[0]).id,u=t.tracks[a];if(n===u){i({error:{message:"Problem encountered loading the default audio track."}});return}Be.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===u;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;Be.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},IE={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:n,segmentLoaders:{[s]:r}}=t;e.on("loadedmetadata",()=>{const a=e.media();r.playlist(a,n),(!i.paused()||a.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",M0[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:n,segmentLoaders:{[s]:r},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const u=e.media();r.playlist(u,n),r.track(a.activeTrack()),(!i.paused()||u.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",M0[s](s,t))}},F8={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[s]:{groups:u,tracks:c,logger_:d}},mainPlaylistLoader:f}=e,p=Jh(f.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},p&&(a[s].main.default.playlists=f.main.playlists));for(const y in a[s]){u[y]||(u[y]=[]);for(const v in a[s][y]){let b=a[s][y][v],T;if(p?(d(`AUDIO group '${y}' label '${v}' is a main playlist`),b.isMainPlaylist=!0,T=null):i==="vhs-json"&&b.playlists?T=new fc(b.playlists[0],t,r):b.resolvedUri?T=new fc(b.resolvedUri,t,r):b.playlists&&i==="dash"?T=new Lx(b.playlists[0],t,r,f):T=null,b=rs({id:v,playlistLoader:T},b),IE[s](s,b.playlistLoader,e),u[y].push(b),typeof c[v]>"u"){const E=new Be.AudioTrack({id:v,kind:O8(b),enabled:!1,language:b.language,default:b.default,label:v});c[v]=E}}}n.on("error",M0[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:n,segmentLoaders:{[s]:r},requestOptions:a,main:{mediaGroups:u},mediaTypes:{[s]:{groups:c,tracks:d}},mainPlaylistLoader:f}=e;for(const p in u[s]){c[p]||(c[p]=[]);for(const y in u[s][p]){if(!i.options_.useForcedSubtitles&&u[s][p][y].forced)continue;let v=u[s][p][y],b;if(n==="hls")b=new fc(v.resolvedUri,i,a);else if(n==="dash"){if(!v.playlists.filter(E=>E.excludeUntil!==1/0).length)return;b=new Lx(v.playlists[0],i,a,f)}else n==="vhs-json"&&(b=new fc(v.playlists?v.playlists[0]:v.resolvedUri,i,a));if(v=rs({id:y,playlistLoader:b},v),IE[s](s,v.playlistLoader,e),c[p].push(v),typeof d[y]>"u"){const T=t.addRemoteTextTrack({id:y,kind:"subtitles",default:v.default&&v.autoselect,language:v.language,label:y},!1).track;d[y]=T}}}r.on("error",M0[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:n,tracks:r}}}=e;for(const a in i[s]){n[a]||(n[a]=[]);for(const u in i[s][a]){const c=i[s][a][u];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const d=t.options_.vhs&&t.options_.vhs.captionServices||{};let f={label:u,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(d[f.instreamId]&&(f=rs(f,d[f.instreamId])),f.default===void 0&&delete f.default,n[a].push(rs({id:u},c)),typeof r[u]>"u"){const p=t.addRemoteTextTrack({id:f.instreamId,kind:"captions",default:f.default,language:f.language,label:f.label},!1).track;r[u]=p}}}}},ED=(s,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:n}}}=e,r=i.media();if(!r)return null;let a=null;r.attributes[s]&&(a=n[r.attributes[s]]);const u=Object.keys(n);if(!a)if(s==="AUDIO"&&u.length>1&&Jh(e.main))for(let c=0;c"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},j8={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},$8=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},H8=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(d=>{F8[d](d,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:n,segmentLoaders:{["AUDIO"]:r,main:a}}=s;["AUDIO","SUBTITLES"].forEach(d=>{e[d].activeGroup=U8(d,s),e[d].activeTrack=j8[d](d,s),e[d].onGroupChanged=M8(d,s),e[d].onGroupChanging=P8(d,s),e[d].onTrackChanged=B8(d,s),e[d].getActiveGroup=$8(d,s)});const u=e.AUDIO.activeGroup();if(u){const d=(u.filter(p=>p.default)[0]||u[0]).id;e.AUDIO.tracks[d].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),r.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const d in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[d])},z8=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:So,activeTrack:So,getActiveGroup:So,onGroupChanged:So,onTrackChanged:So,lastTrack_:null,logger_:Zr(`MediaGroups[${e}]`)}}),s};class NE{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=fr(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}let V8=class extends Be.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new NE,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Zr("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=fr(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(r,a)=>{if(r){if(a.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const d=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${d} seconds.`),this.startTTLTimeout_(parseInt(d,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let u;try{u=JSON.parse(this.request_.responseText)}catch(d){const f={errorType:Be.Error.StreamingContentSteeringParserError,error:d};this.trigger({type:"error",metadata:f})}this.assignSteeringProperties_(u);const c={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new de.URL(e),i=new de.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(de.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new de.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const r=`_${this.manifestType_}_pathway`;t.searchParams.set(r,i)}if(n){const r=`_${this.manifestType_}_throughput`;t.searchParams.set(r,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=de.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){de.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new NE}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(fr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}};const G8=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},q8=10;let hl;const K8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],W8=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},Y8=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:u,log:c}){if(!i)return Be.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return c(`${d} as current playlist is not set`),!0;if(i.id===s.id)return!1;const f=!!hc(e,t).length;if(!s.endList)return!f&&typeof s.partTargetDuration=="number"?(c(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${d} as current playlist is live`),!0);const p=Vb(e,t),y=u?wn.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:wn.MAX_BUFFER_LOW_WATER_LINE;if(ab)&&p>=n){let T=`${d} as forwardBuffer >= bufferLowWaterLine (${p} >= ${n})`;return u&&(T+=` and next bandwidth > current bandwidth (${v} > ${b})`),c(T),!0}return c(`not ${d} as no switching criteria met`),!1};class X8 extends Be.EventTarget{constructor(e){super(),this.fastQualityChange_=G8(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:a,useCueTags:u,playlistExclusionDuration:c,enableLowInitialPlaylist:d,sourceType:f,cacheEncryptionKeys:p,bufferBasedABR:y,leastPixelDiffSelector:v,captionServices:b,experimentalUseMMS:T}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:E}=e;(E===null||typeof E>"u")&&(E=1/0),hl=a,this.bufferBasedABR=!!y,this.leastPixelDiffSelector=!!v,this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=f,this.useCueTags_=u,this.playlistExclusionDuration=c,this.maxPlaylistRetries=E,this.enableLowInitialPlaylist=d,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:E,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=z8(),T&&de.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new de.ManagedMediaSource,this.usingManagedMediaSource_=!0,Be.log("Using ManagedMediaSource")):de.MediaSource&&(this.mediaSource=new de.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=kn(),this.hasPlayed_=!1,this.syncController_=new L8(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new N8,this.sourceUpdater_=new TD(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new R8,this.keyStatusMap_=new Map;const D={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:b,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Lx(t,this.vhs_,rs(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new fc(t,this.vhs_,rs(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Nx(rs(D,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Nx(rs(D,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new w8(rs(D,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((j,F)=>{function z(){n.off("vttjserror",N),j()}function N(){n.off("vttjsloaded",z),F()}n.one("vttjsloaded",z),n.one("vttjserror",N),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new V8(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),K8.forEach(j=>{this[j+"_"]=W8.bind(this,j)}),this.logger_=Zr("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const R=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(R,()=>{const j=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-j,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),r=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_(`switch media ${r} -> ${a} from ${t}`);const u={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:u}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(i&&n){const a=(i.length?i[0].playlists:i.playlists).filter(u=>u.attributes.serviceLocation===n);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=de.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(de.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const u=i.main||n.length&&i[n[0]];for(const c in u)if(u[c].default){r={label:c};break}}if(!r)return t;const a=[];for(const u in i)if(i[u][r.label]){const c=i[u][r.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let d=0;d{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;wx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),H8({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;wx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(nn({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const r=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const u in i.AUDIO[a])i.AUDIO[a][u].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),hl.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return Y8({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const n=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:q8}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,n=>{this.player_.trigger(nn({},n))}),this.audioSegmentLoader_.on(i,n=>{this.player_.trigger(nn({},n))}),this.subtitleSegmentLoader_.on(i,n=>{this.player_.trigger(nn({},n))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const n=hl.Playlist.playlistEnd(e,i),r=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return n-r<=Ma;const u=a.end(a.length-1);return u-r<=Ma&&n-u<=Ma}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,r=n.filter(kp),a=r.length===1&&r[0]===e;if(n.length===1&&i!==1/0)return Be.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const b=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(b),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(b)},T);return}let v=!1;n.forEach(b=>{if(b===e)return;const T=b.excludeUntil;typeof T<"u"&&T!==1/0&&(v=!0,delete b.excludeUntil)}),v&&(Be.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let u;e.playlistErrors_>this.maxPlaylistRetries?u=1/0:u=Date.now()+i*1e3,e.excludeUntil=u,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const d=t.internal?this.logger_:Be.log.warn,f=t.message?" "+t.message:"";d(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${f} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const p=c.targetDuration/2*1e3||5*1e3,y=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=p;return this.switchMedia_(c,"exclude",a||y)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n=e==="all";(n||e==="main")&&i.push(this.mainPlaylistLoader_);const r=[];(n||e==="audio")&&r.push("AUDIO"),(n||e==="subtitle")&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(a=>{const u=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;u&&i.push(u)}),["main","audio","subtitle"].forEach(a=>{const u=this[`${a}SegmentLoader_`];u&&(e===a||e==="all")&&i.push(u)}),i.forEach(a=>t.forEach(u=>{typeof a[u]=="function"&&a[u]()}))}setCurrentTime(e){const t=hc(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:hl.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const u=n.start,c=n.end;if(!isFinite(u)||!isFinite(c))return null;const d=hl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),f=Math.max(u,c-d);return kn([[u,f]])}const r=this.syncController_.getExpiredTime(i,this.duration());if(r===null)return null;const a=hl.Playlist.seekable(i,r,hl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),n=e.end(0),r=t.start(0),a=t.end(0);return r>n||i>a?e:kn([[Math.max(i,r),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${OC(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=kh(this.main(),t),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||F3),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||S2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||S2,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(d,f)=>d?Sh(f,this.usingManagedMediaSource_):Qy(f),u={};let c;if(["video","audio"].forEach(function(d){if(n.hasOwnProperty(d)&&!a(e[d].isFmp4,n[d])){const f=e[d].isFmp4?"browser":"muxer";u[f]=u[f]||[],u[f].push(n[d]),d==="audio"&&(c=f)}}),r&&c&&t.attributes.AUDIO){const d=t.attributes.AUDIO;this.main().playlists.forEach(f=>{(f.attributes&&f.attributes.AUDIO)===d&&f!==t&&(f.excludeUntil=1/0)}),this.logger_(`excluding audio group ${d} as ${c} does not support codec(s): "${n.audio}"`)}if(Object.keys(u).length){const d=Object.keys(u).reduce((f,p)=>(f&&(f+=", "),f+=`${p} does not support codec(s): "${u[p].join(",")}"`,f),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:d},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const d=[];if(["video","audio"].forEach(f=>{const p=(La(this.sourceUpdater_.codecs[f]||"")[0]||{}).type,y=(La(n[f]||"")[0]||{}).type;p&&y&&p.toLowerCase()!==y.toLowerCase()&&d.push(`"${this.sourceUpdater_.codecs[f]}" -> "${n[f]}"`)}),d.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${d.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const n=e[i];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const r=kh(this.main,n),a=[];r.audio&&!Qy(r.audio)&&!Sh(r.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${r.audio}`),r.video&&!Qy(r.video)&&!Sh(r.video,this.usingManagedMediaSource_)&&a.push(`video codec ${r.video}`),r.text&&r.text==="stpp.ttml.im1t"&&a.push(`text codec ${r.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=Ph(La(e)),r=pE(n),a=n.video&&La(n.video)[0]||null,u=n.audio&&La(n.audio)[0]||null;Object.keys(i).forEach(c=>{const d=i[c];if(t.indexOf(d.id)!==-1||d.excludeUntil===1/0)return;t.push(d.id);const f=[],p=kh(this.mainPlaylistLoader_.main,d),y=pE(p);if(!(!p.audio&&!p.video)){if(y!==r&&f.push(`codec count "${y}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const v=p.video&&La(p.video)[0]||null,b=p.audio&&La(p.audio)[0]||null;v&&a&&v.type.toLowerCase()!==a.type.toLowerCase()&&f.push(`video codec "${v.type}" !== "${a.type}"`),b&&u&&b.type.toLowerCase()!==u.type.toLowerCase()&&f.push(`audio codec "${b.type}" !== "${u.type}"`)}f.length&&(d.excludeUntil=1/0,this.logger_(`excluding ${d.id}: ${f.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),k8(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=wn.GOAL_BUFFER_LENGTH,i=wn.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,wn.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=wn.BUFFER_LOW_WATER_LINE,i=wn.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,wn.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,wn.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:n)}bufferHighWaterLine(){return wn.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){_E(this.inbandTextTracks_,"com.apple.streaming",this.tech_),a8({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();_E(this.inbandTextTracks_,e,this.tech_),s8({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(nn({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const r=this.contentSteeringController_.getAvailablePathways(),a=[];for(const u of t.playlists){const c=u.attributes.serviceLocation;if(c&&(a.push(c),!r.has(c)))return!0}return!!(!a.length&&r.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,n=new Set;let r=!1;Object.keys(i).forEach(a=>{const u=i[a],c=this.pathwayAttribute_(u),d=c&&e!==c;u.excludeUntil===1/0&&u.lastExcludeReason_==="content-steering"&&!d&&(delete u.excludeUntil,delete u.lastExcludeReason_,r=!0);const p=!u.excludeUntil&&u.excludeUntil!==1/0;!n.has(u.id)&&d&&p&&(n.add(u.id),u.excludeUntil=1/0,u.lastExcludeReason_="content-steering",this.logger_(`excluding ${u.id} for ${u.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const u=this.mediaTypes_[a];if(u.activePlaylistLoader){const c=u.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||n&&n.size){for(const[a,u]of i.entries())n.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(a));for(const[a,u]of n.entries()){const c=i.get(a);if(!c){t.filter(f=>f.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(f=>{this.mainPlaylistLoader_.addClonePathway(u,f)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(c,u)||(this.mainPlaylistLoader_.updateOrDeleteClone(u,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const r in i)if(i[r]!==n[r])return!1;for(const r in n)if(i[r]!==n[r])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=this.mainPlaylistLoader_.getKeyIdSet(i);!n||!n.size||n.forEach(r=>{const a="usable",u=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===a,c=i.lastExcludeReason_===t&&i.excludeUntil===1/0;u?u&&c&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,r=i.excludeUntil===1/0&&i.lastExcludeReason_===t;n&&r&&(delete i.excludeUntil,Be.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:_8(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const Q8=(s,e,t)=>i=>{const n=s.main.playlists[e],r=qb(n),a=kp(n);if(typeof i>"u")return a;i?delete n.disabled:n.disabled=!0;const u={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return i!==a&&!r&&(i?(t(n),s.trigger({type:"renditionenabled",metadata:u})):s.trigger({type:"renditiondisabled",metadata:u})),i};class Z8{constructor(e,t,i){const{playlistController_:n}=e,r=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=kh(n.main(),t),this.playlist=t,this.id=i,this.enabled=Q8(e.playlists,t.id,r)}}const J8=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Jh(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!qb(i)).map((i,n)=>new Z8(s,i,i.id)):[]}},OE=["seeking","seeked","pause","playing","error"];class e6 extends Be.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Zr("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,u=["main","subtitle","audio"],c={};u.forEach(f=>{c[f]={reset:()=>this.resetSegmentDownloads_(f),updateend:()=>this.checkSegmentDownloads_(f)},a[`${f}SegmentLoader_`].on("appendsdone",c[f].updateend),a[`${f}SegmentLoader_`].on("playlistupdate",c[f].reset),this.tech_.on(["seeked","seeking"],c[f].reset)});const d=f=>{["main","audio"].forEach(p=>{a[`${p}SegmentLoader_`][f]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(OE,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(OE,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),u.forEach(f=>{a[`${f}SegmentLoader_`].off("appendsdone",c[f].updateend),a[`${f}SegmentLoader_`].off("playlistupdate",c[f].reset),this.tech_.off(["seeked","seeking"],c[f].reset)}),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=de.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),r=UB(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,r){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:du(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Ma>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(kn([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const b=t.start(0);r=b+(b===t.end(0)?0:Ma)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${OC(t)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const a=this.playlistController_.sourceUpdater_,u=this.tech_.buffered(),c=a.audioBuffer?a.audioBuffered():null,d=a.videoBuffer?a.videoBuffered():null,f=this.media(),p=f.partTargetDuration?f.partTargetDuration:(f.targetDuration-Oa)*2,y=[c,d];for(let b=0;b ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const u=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${u}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(u),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=Am(n,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let r=e.end(e.length-1)+Ma;const a=!i.endList,u=typeof i.partTargetDuration=="number";return a&&(u||n)&&(r=e.end(e.length-1)+i.targetDuration*3),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null}}const t6={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},wD=function(s,e){let t=0,i=0;const n=rs(t6,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const r=function(){i&&s.currentTime(i)},a=function(f){f!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",r),s.src(f),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},u=function(){if(Date.now()-t{Object.defineProperty(Us,s,{get(){return Be.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),wn[s]},set(e){if(Be.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Be.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}wn[s]=e}})});const kD="videojs-vhs",CD=function(s,e){const t=e.media();let i=-1;for(let n=0;n{s.addQualityLevel(t)}),CD(s,e.playlists)};Us.canPlaySource=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const l6=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Ph(La(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const n=Nc(i.video),r=Nc(i.audio),a={};for(const u in s)a[u]={},r&&(a[u].audioContentType=r),n&&(a[u].videoContentType=n),e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(a[u].pssh=e.contentProtection[u].pssh),typeof s[u]=="string"&&(a[u].url=s[u]);return rs(s,a)},u6=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const n=e.reduce((r,a)=>{const u=i.contentProtection[a];return u&&u.pssh&&(r[a]={pssh:u.pssh}),r},{});return Object.keys(n).length&&t.push(n),t},[]),c6=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const n=t?i.concat([t]):i,r=u6(n,Object.keys(e)),a=[],u=[];return r.forEach(c=>{u.push(new Promise((d,f)=>{s.tech_.one("keysessioncreated",d)})),a.push(new Promise((d,f)=>{s.eme.initializeMediaKeys({keySystems:c},p=>{if(p){f(p);return}d()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},d6=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const n=l6(e,t,i);return n?(s.currentSource().keySystems=n,n&&!s.eme?(Be.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},DD=()=>{if(!de.localStorage)return null;const s=de.localStorage.getItem(kD);if(!s)return null;try{return JSON.parse(s)}catch{return null}},h6=s=>{if(!de.localStorage)return!1;let e=DD();e=e?rs(e,s):s;try{de.localStorage.setItem(kD,JSON.stringify(e))}catch{return!1}return e},f6=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,LD=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},RD=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},ID=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},ND=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Us.supportsNativeHls=(function(){if(!yt||!yt.createElement)return!1;const s=yt.createElement("video");return Be.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(s.canPlayType(t))}):!1})();Us.supportsNativeDash=(function(){return!yt||!yt.createElement||!Be.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(yt.createElement("video").canPlayType("application/dash+xml"))})();Us.supportsTypeNatively=s=>s==="hls"?Us.supportsNativeHls:s==="dash"?Us.supportsNativeDash:!1;Us.isSupported=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Us.xhr.onRequest=function(s){LD(Us.xhr,s)};Us.xhr.onResponse=function(s){RD(Us.xhr,s)};Us.xhr.offRequest=function(s){ID(Us.xhr,s)};Us.xhr.offResponse=function(s){ND(Us.xhr,s)};const m6=Be.getComponent("Component");class OD extends m6{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Zr("VhsHandler"),t.options_&&t.options_.playerId){const n=Be.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(yt,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const r=yt.fullscreenElement||yt.webkitFullscreenElement||yt.mozFullScreenElement||yt.msFullscreenElement;r&&r.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=rs(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=DD();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=wn.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===wn.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=f6(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Us,this.options_.sourceType=tk(t),this.options_.seekTo=r=>{this.tech_.setCurrentTime(r)},this.options_.player_=this.player_,this.playlistController_=new X8(this.options_);const i=rs({liveRangeSafeTimeDelta:Ma},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new e6(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const r=Be.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),r.error(a)});const n=this.options_.bufferBasedABR?Us.movingAverageBandwidthSelector(.55):Us.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Us.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(r){this.playlistController_.selectPlaylist=r.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(r){this.playlistController_.mainSegmentLoader_.throughput.rate=r,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let r=this.playlistController_.mainSegmentLoader_.bandwidth;const a=de.navigator.connection||de.navigator.mozConnection||de.navigator.webkitConnection,u=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=u&&r>=u?r=Math.max(r,c):r=c}return r},set(r){this.playlistController_.mainSegmentLoader_.bandwidth=r,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const r=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(r+a))},set(){Be.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>du(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>du(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&h6({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{J8(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=de.URL.createObjectURL(this.playlistController_.mediaSource),(Be.browser.IS_ANY_SAFARI||Be.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),c6({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=d6({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Be.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{o6(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{CD(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":AD,"mux.js":s6,"mpd-parser":n6,"m3u8-parser":r6,"aes-decrypter":a6}}version(){return this.constructor.version()}canChangeType(){return TD.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&de.URL.revokeObjectURL&&(de.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return vF({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return nD({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{LD(this.xhr,e)},this.xhr.onResponse=e=>{RD(this.xhr,e)},this.xhr.offRequest=e=>{ID(this.xhr,e)},this.xhr.offResponse=e=>{ND(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,n=>{this.player_.trigger(nn({},n))})}),t.forEach(i=>{this.playbackWatcher_.on(i,n=>{this.player_.trigger(nn({},n))})})}}const P0={name:"videojs-http-streaming",VERSION:AD,canHandleSource(s,e={}){const t=rs(Be.options,e);return!t.vhs.experimentalUseMMS&&!Sh("avc1.4d400d,mp4a.40.2",!1)?!1:P0.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=rs(Be.options,t);return e.vhs=new OD(s,e,i),e.vhs.xhr=JC(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=tk(s);if(!t)return"";const i=P0.getOverrideNative(e);return!Us.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(Be.browser.IS_ANY_SAFARI||Be.browser.IS_IOS),{overrideNative:i=t}=e;return i}},p6=()=>Sh("avc1.4d400d,mp4a.40.2",!0);p6()&&Be.getTech("Html5").registerSourceHandler(P0,0);Be.VhsHandler=OD;Be.VhsSourceHandler=P0;Be.Vhs=Us;Be.use||Be.registerComponent("Vhs",Us);Be.options.vhs=Be.options.vhs||{};(!Be.getPlugin||!Be.getPlugin("reloadSourceOnError"))&&Be.registerPlugin("reloadSourceOnError",i6);const g6="",ru=s=>{const e=s.startsWith("/")?s:`/${s}`;return`${g6}${e}`};async function vv(s,e){const t=await fetch(ru(s),{...e,credentials:"include",headers:{...e?.headers??{},"Content-Type":e?.headers?.["Content-Type"]??"application/json"}});return t.status===401&&(location.pathname.startsWith("/login")||(location.href="/login")),t}const Dt=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},y6=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=v6},v6=Number.MAX_SAFE_INTEGER||9007199254740991;let jt=(function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s})({}),Oe=(function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",s.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",s.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.ASSET_LIST_LOAD_ERROR="assetListLoadError",s.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",s.ASSET_LIST_PARSING_ERROR="assetListParsingError",s.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.ATTACH_MEDIA_ERROR="attachMediaError",s.UNKNOWN="unknown",s})({}),$=(function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.MEDIA_ENDED="hlsMediaEnded",s.STALL_RESOLVED="hlsStallResolved",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFERED_TO_END="hlsBufferedToEnd",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s.ASSET_LIST_LOADING="hlsAssetListLoading",s.ASSET_LIST_LOADED="hlsAssetListLoaded",s.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",s.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",s.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",s.INTERSTITIAL_STARTED="hlsInterstitialStarted",s.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",s.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",s.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",s.INTERSTITIAL_ENDED="hlsInterstitialEnded",s.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",s.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",s.EVENT_CUE_ENTER="hlsEventCueEnter",s})({});var ji={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ot={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ic{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class x6{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ic(e),this.fast_=new ic(t),this.defaultTTFB_=n,this.ttfb_=new ic(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new ic(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new ic(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new ic(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,r=i/n;this.fast_.sample(n,r),this.slow_.sample(n,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function b6(s,e,t){return(e=S6(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function gs(){return gs=Object.assign?Object.assign.bind():function(s){for(var e=1;e`):vl}function PE(s,e,t){return e[s]?e[s].bind(e):E6(s,t)}const Bx=Px();function w6(s,e,t){const i=Px();if(typeof console=="object"&&s===!0||typeof s=="object"){const n=["debug","log","info","warn","error"];n.forEach(r=>{i[r]=PE(r,s,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return Px()}n.forEach(r=>{Bx[r]=PE(r,s)})}else gs(Bx,i);return i}const cs=Bx;function kl(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function A6(s){return typeof self<"u"&&s===self.ManagedMediaSource}function MD(s,e){const t=Object.keys(s),i=Object.keys(e),n=t.length,r=i.length;return!n||!r||n===r&&!t.some(a=>i.indexOf(a)===-1)}function Pr(s,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(s);if(e){const f=d.indexOf("\0");return f!==-1?d.substring(0,f):d}return d.replace(/\0/g,"")}const t=s.length;let i,n,r,a="",u=0;for(;u>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:n=s[u++],a+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=s[u++],r=s[u++],a+=String.fromCharCode((i&15)<<12|(n&63)<<6|(r&63)<<0);break}}return a}function On(s){let e="";for(let t=0;t1||n===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!Dt(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return sn(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const n=t[e];n&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=n.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,r,a=!1){const{elementaryStreams:u}=this,c=u[e];if(!c){u[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:a};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,r)}}class D6 extends BD{constructor(e,t,i,n,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function FD(s,e){const t=Object.getPrototypeOf(s);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||FD(t,e)}}function L6(s,e){const t=FD(s,e);t&&(t.enumerable=!0,Object.defineProperty(s,e,t))}const FE=Math.pow(2,32)-1,R6=[].push,UD={video:1,audio:2,id3:3,text:4};function yn(s){return String.fromCharCode.apply(null,s)}function jD(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function hi(s,e){const t=$D(s,e);return t<0?4294967296+t:t}function UE(s,e){let t=hi(s,e);return t*=Math.pow(2,32),t+=hi(s,e+4),t}function $D(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function I6(s){const e=s.byteLength;for(let t=0;t8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function Pi(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let n=0;n1?n+r:i;if(a===e[0])if(e.length===1)t.push(s.subarray(n+8,u));else{const c=Pi(s.subarray(n+8,u),e.slice(1));c.length&&R6.apply(t,c)}n=u}return t}function N6(s){const e=[],t=s[0];let i=8;const n=hi(s,i);i+=4;let r=0,a=0;t===0?(r=hi(s,i),a=hi(s,i+4),i+=8):(r=UE(s,i),a=UE(s,i+8),i+=16),i+=2;let u=s.length+a;const c=jD(s,i);i+=2;for(let d=0;d>>31===1)return cs.warn("SIDX has hierarchical references (not supported)"),null;const b=hi(s,f);f+=4,e.push({referenceSize:y,subsegmentDuration:b,info:{duration:b/n,start:u,end:u+y-1}}),u+=y,f+=4,i=f}return{earliestPresentationTime:r,timescale:n,version:t,referencesCount:c,references:e}}function HD(s){const e=[],t=Pi(s,["moov","trak"]);for(let n=0;n{const r=hi(n,4),a=e[r];a&&(a.default={duration:hi(n,12),flags:hi(n,20)})}),e}function O6(s){const e=s.subarray(8),t=e.subarray(86),i=yn(e.subarray(4,8));let n=i,r;const a=i==="enca"||i==="encv";if(a){const d=Pi(e,[i])[0].subarray(i==="enca"?28:78);Pi(d,["sinf"]).forEach(p=>{const y=Pi(p,["schm"])[0];if(y){const v=yn(y.subarray(4,8));if(v==="cbcs"||v==="cenc"){const b=Pi(p,["frma"])[0];b&&(n=yn(b))}}})}const u=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Pi(t,["avcC"])[0];c&&c.length>3&&(n+="."+Lm(c[1])+Lm(c[2])+Lm(c[3]),r=Dm(u==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Pi(e,[i])[0],d=Pi(c.subarray(28),["esds"])[0];if(d&&d.length>7){let f=4;if(d[f++]!==3)break;f=Tv(d,f),f+=2;const p=d[f++];if(p&128&&(f+=2),p&64&&(f+=d[f++]),d[f++]!==4)break;f=Tv(d,f);const y=d[f++];if(y===64)n+="."+Lm(y);else break;if(f+=12,d[f++]!==5)break;f=Tv(d,f);const v=d[f++];let b=(v&248)>>3;b===31&&(b+=1+((v&7)<<3)+((d[f]&224)>>5)),n+="."+b}break}case"hvc1":case"hev1":{const c=Pi(t,["hvcC"])[0];if(c&&c.length>12){const d=c[1],f=["","A","B","C"][d>>6],p=d&31,y=hi(c,2),v=(d&32)>>5?"H":"L",b=c[12],T=c.subarray(6,12);n+="."+f+p,n+="."+M6(y).toString(16).toUpperCase(),n+="."+v+b;let E="";for(let D=T.length;D--;){const O=T[D];(O||E)&&(E="."+O.toString(16).toUpperCase()+E)}n+=E}r=Dm(u=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=Dm(n,t)||n;break}case"vp09":{const c=Pi(t,["vpcC"])[0];if(c&&c.length>6){const d=c[4],f=c[5],p=c[6]>>4&15;n+="."+Da(d)+"."+Da(f)+"."+Da(p)}break}case"av01":{const c=Pi(t,["av1C"])[0];if(c&&c.length>2){const d=c[1]>>>5,f=c[1]&31,p=c[2]>>>7?"H":"M",y=(c[2]&64)>>6,v=(c[2]&32)>>5,b=d===2&&y?v?12:10:y?10:8,T=(c[2]&16)>>4,E=(c[2]&8)>>3,D=(c[2]&4)>>2,O=c[2]&3;n+="."+d+"."+Da(f)+p+"."+Da(b)+"."+T+"."+E+D+O+"."+Da(1)+"."+Da(1)+"."+Da(1)+"."+0,r=Dm("dav1",t)}break}}return{codec:n,encrypted:a,supplemental:r}}function Dm(s,e){const t=Pi(e,["dvvC"]),i=t.length?t[0]:Pi(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return s+"."+Da(n)+"."+Da(r)}}function M6(s){let e=0;for(let t=0;t<32;t++)e|=(s>>t&1)<<31-t;return e>>>0}function Tv(s,e){const t=e+5;for(;s[e++]&128&&e{const r=i.subarray(8,24);r.some(a=>a!==0)||(cs.log(`[eme] Patching keyId in 'enc${n?"a":"v"}>sinf>>tenc' box: ${On(r)} -> ${On(t)}`),i.set(t,8))})}function B6(s){const e=[];return zD(s,t=>e.push(t.subarray(8,24))),e}function zD(s,e){Pi(s,["moov","trak"]).forEach(i=>{const n=Pi(i,["mdia","minf","stbl","stsd"])[0];if(!n)return;const r=n.subarray(8);let a=Pi(r,["enca"]);const u=a.length>0;u||(a=Pi(r,["encv"])),a.forEach(c=>{const d=u?c.subarray(28):c.subarray(78);Pi(d,["sinf"]).forEach(p=>{const y=VD(p);y&&e(y,u)})})})}function VD(s){const e=Pi(s,["schm"])[0];if(e){const t=yn(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=Pi(s,["schi","tenc"])[0];if(i)return i}}}function F6(s,e,t){const i={},n=Pi(s,["moof","traf"]);for(let r=0;ri[r].duration)){let r=1/0,a=0;const u=Pi(s,["sidx"]);for(let c=0;cp+y.info.duration||0,0);a=Math.max(a,f+d.earliestPresentationTime/d.timescale)}}a&&Dt(a)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=a*i[c].timescale-i[c].start)})}return i}function U6(s){const e={valid:null,remainder:null},t=Pi(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=s.slice(0,i.byteOffset-8),e.remainder=s.slice(i.byteOffset-8),e}function Xr(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function jE(s,e){const t=[],i=e.samples,n=e.timescale,r=e.id;let a=!1;return Pi(i,["moof"]).map(c=>{const d=c.byteOffset-8;Pi(c,["traf"]).map(p=>{const y=Pi(p,["tfdt"]).map(v=>{const b=v[0];let T=hi(v,4);return b===1&&(T*=Math.pow(2,32),T+=hi(v,8)),T/n})[0];return y!==void 0&&(s=y),Pi(p,["tfhd"]).map(v=>{const b=hi(v,4),T=hi(v,0)&16777215,E=(T&1)!==0,D=(T&2)!==0,O=(T&8)!==0;let R=0;const j=(T&16)!==0;let F=0;const z=(T&32)!==0;let N=8;b===r&&(E&&(N+=8),D&&(N+=4),O&&(R=hi(v,N),N+=4),j&&(F=hi(v,N),N+=4),z&&(N+=4),e.type==="video"&&(a=Cp(e.codec)),Pi(p,["trun"]).map(Y=>{const L=Y[0],I=hi(Y,0)&16777215,X=(I&1)!==0;let G=0;const q=(I&4)!==0,ae=(I&256)!==0;let ie=0;const W=(I&512)!==0;let K=0;const Q=(I&1024)!==0,te=(I&2048)!==0;let re=0;const U=hi(Y,4);let ne=8;X&&(G=hi(Y,ne),ne+=4),q&&(ne+=4);let Z=G+d;for(let fe=0;fe>1&63;return t===39||t===40}else return(e&31)===6}function Zb(s,e,t,i){const n=GD(s);let r=0;r+=e;let a=0,u=0,c=0;for(;r=n.length)break;c=n[r++],a+=c}while(c===255);u=0;do{if(r>=n.length)break;c=n[r++],u+=c}while(c===255);const d=n.length-r;let f=r;if(ud){cs.error(`Malformed SEI payload. ${u} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(n[f++]===181){const y=jD(n,f);if(f+=2,y===49){const v=hi(n,f);if(f+=4,v===1195456820){const b=n[f++];if(b===3){const T=n[f++],E=31&T,D=64&T,O=D?2+E*3:0,R=new Uint8Array(O);if(D){R[0]=T;for(let j=1;j16){const p=[];for(let b=0;b<16;b++){const T=n[f++].toString(16);p.push(T.length==1?"0"+T:T),(b===3||b===5||b===7||b===9)&&p.push("-")}const y=u-16,v=new Uint8Array(y);for(let b=0;b>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(s,4),n=0,i=8;n0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),H6([112,115,115,104],new Uint8Array([i,0,0,0]),s,r,n,a,t)}function V6(s){const e=[];if(s instanceof ArrayBuffer){const t=s.byteLength;let i=0;for(;i+32>>24;if(r!==0&&r!==1)return{offset:t,size:e};const a=s.buffer,u=On(new Uint8Array(a,t+12,16));let c=null,d=null,f=0;if(r===0)f=28;else{const y=s.getUint32(28);if(!y||i<32+y*16)return{offset:t,size:e};c=[];for(let v=0;v/\(Windows.+Firefox\//i.test(navigator.userAgent),Hc={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Jb(s,e){const t=Hc[e];return!!t&&!!t[s.slice(0,4)]}function Bh(s,e,t=!0){return!s.split(",").some(i=>!e1(i,e,t))}function e1(s,e,t=!0){var i;const n=kl(t);return(i=n?.isTypeSupported(Fh(s,e)))!=null?i:!1}function Fh(s,e){return`${e}/mp4;codecs=${s}`}function $E(s){if(s){const e=s.substring(0,4);return Hc.video[e]}return 2}function B0(s){const e=qD();return s.split(",").reduce((t,i)=>{const r=e&&Cp(i)?9:Hc.video[i];return r?(r*2+t)/(t?3:2):(Hc.audio[i]+t)/(t?2:1)},0)}const Sv={};function q6(s,e=!0){if(Sv[s])return Sv[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[s];for(let n=0;nq6(t.toLowerCase(),e))}function W6(s,e){const t=[];if(s){const i=s.split(",");for(let n=0;n4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(s)!==-1)&&(HE(s,"audio")||HE(s,"video")))return s;if(e){const t=e.split(",");if(t.length>1){if(s){for(let i=t.length;i--;)if(t[i].substring(0,4)===s.substring(0,4))return t[i]}return t[0]}}return e||s}function HE(s,e){return Jb(s,e)&&e1(s,e)}function Y6(s){const e=s.split(",");for(let t=0;t2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function X6(s){if(s.startsWith("av01.")){const e=s.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return s}function zE(s){const e=kl(s)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Fx(s){return s.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Q6={supported:!0,powerEfficient:!0,smooth:!0},Z6={supported:!1,smooth:!1,powerEfficient:!1},KD={supported:!0,configurations:[],decodingInfoResults:[Q6]};function WD(s,e){return{supported:!1,configurations:e,decodingInfoResults:[Z6],error:s}}function J6(s,e,t,i,n,r){const a=s.videoCodec,u=s.audioCodec?s.audioGroups:null,c=r?.audioCodec,d=r?.channels,f=d?parseInt(d):c?1/0:2;let p=null;if(u!=null&&u.length)try{u.length===1&&u[0]?p=e.groups[u[0]].channels:p=u.reduce((y,v)=>{if(v){const b=e.groups[v];if(!b)throw new Error(`Audio track group ${v} not found`);Object.keys(b.channels).forEach(T=>{y[T]=(y[T]||0)+b.channels[T]})}return y},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(y=>Cp(y))||s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(n,8e6))||!!p&&Dt(f)&&Object.keys(p).some(y=>parseInt(y)>f)}function YD(s,e,t,i={}){const n=s.videoCodec;if(!n&&!s.audioCodec||!t)return Promise.resolve(KD);const r=[],a=eU(s),u=a.length,c=tU(s,e,u>0),d=c.length;for(let f=u||1*d||1;f--;){const p={type:"media-source"};if(u&&(p.video=a[f%u]),d){p.audio=c[f%d];const y=p.audio.bitrate;p.video&&y&&(p.video.bitrate-=y)}r.push(p)}if(n){const f=navigator.userAgent;if(n.split(",").some(p=>Cp(p))&&qD())return Promise.resolve(WD(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),r))}return Promise.all(r.map(f=>{const p=sU(f);return i[p]||(i[p]=t.decodingInfo(f))})).then(f=>({supported:!f.some(p=>!p.supported),configurations:r,decodingInfoResults:f})).catch(f=>({supported:!1,configurations:r,decodingInfoResults:[],error:f}))}function eU(s){var e;const t=(e=s.videoCodec)==null?void 0:e.split(","),i=XD(s),n=s.width||640,r=s.height||480,a=s.frameRate||30,u=s.videoRange.toLowerCase();return t?t.map(c=>{const d={contentType:Fh(X6(c),"video"),width:n,height:r,bitrate:i,framerate:a};return u!=="sdr"&&(d.transferFunction=u),d}):[]}function tU(s,e,t){var i;const n=(i=s.audioCodec)==null?void 0:i.split(","),r=XD(s);return n&&s.audioGroups?s.audioGroups.reduce((a,u)=>{var c;const d=u?(c=e.groups[u])==null?void 0:c.tracks:null;return d?d.reduce((f,p)=>{if(p.groupId===u){const y=parseFloat(p.channels||"");n.forEach(v=>{const b={contentType:Fh(v,"audio"),bitrate:t?iU(v,r):r};y&&(b.channels=""+y),f.push(b)})}return f},a):a},[]):[]}function iU(s,e){if(e<=1)return 1;let t=128e3;return s==="ec-3"?t=768e3:s==="ac-3"&&(t=64e4),Math.min(e/2,t)}function XD(s){return Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)/1e3)*1e3||1}function sU(s){let e="";const{audio:t,video:i}=s;if(i){const n=Fx(i.contentType);e+=`${n}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const n=Fx(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const Ux=["NONE","TYPE-0","TYPE-1",null];function nU(s){return Ux.indexOf(s)>-1}const U0=["SDR","PQ","HLG"];function rU(s){return!!s&&U0.indexOf(s)>-1}var Jm={No:"",Yes:"YES",v2:"v2"};function VE(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,n=i!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return qE(this._audioGroups,e)}hasSubtitleGroup(e){return qE(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function qE(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function aU(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function oU(s,e){let t=!1,i=[];if(s&&(t=s!=="SDR",i=[s]),e){i=e.allowedVideoRanges||U0.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&aU(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const lU=s=>{const e=new WeakSet;return(t,i)=>{if(s&&(i=s(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Ss=(s,e)=>JSON.stringify(s,lU(e));function uU(s,e,t,i,n){const r=Object.keys(s),a=i?.channels,u=i?.audioCodec,c=n?.videoCodec,d=a&&parseInt(a)===2;let f=!1,p=!1,y=1/0,v=1/0,b=1/0,T=1/0,E=0,D=[];const{preferHDR:O,allowedVideoRanges:R}=oU(e,n);for(let Y=r.length;Y--;){const L=s[r[Y]];f||(f=L.channels[2]>0),y=Math.min(y,L.minHeight),v=Math.min(v,L.minFramerate),b=Math.min(b,L.minBitrate),R.filter(X=>L.videoRanges[X]>0).length>0&&(p=!0)}y=Dt(y)?y:0,v=Dt(v)?v:0;const j=Math.max(1080,y),F=Math.max(30,v);b=Dt(b)?b:t,t=Math.max(b,t),p||(e=void 0);const z=r.length>1;return{codecSet:r.reduce((Y,L)=>{const I=s[L];if(L===Y)return Y;if(D=p?R.filter(X=>I.videoRanges[X]>0):[],z){if(I.minBitrate>t)return Aa(L,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),Y;if(!I.hasDefaultAudio)return Aa(L,"no renditions with default or auto-select sound found"),Y;if(u&&L.indexOf(u.substring(0,4))%5!==0)return Aa(L,`audio codec preference "${u}" not found`),Y;if(a&&!d){if(!I.channels[a])return Aa(L,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),Y}else if((!u||d)&&f&&I.channels[2]===0)return Aa(L,"no renditions with stereo sound found"),Y;if(I.minHeight>j)return Aa(L,`min resolution of ${I.minHeight} > maximum of ${j}`),Y;if(I.minFramerate>F)return Aa(L,`min framerate of ${I.minFramerate} > maximum of ${F}`),Y;if(!D.some(X=>I.videoRanges[X]>0))return Aa(L,`no variants with VIDEO-RANGE of ${Ss(D)} found`),Y;if(c&&L.indexOf(c.substring(0,4))%5!==0)return Aa(L,`video codec preference "${c}" not found`),Y;if(I.maxScore=B0(Y)||I.fragmentError>s[Y].fragmentError)?Y:(T=I.minIndex,E=I.maxScore,L)},void 0),videoRanges:D,preferHDR:O,minFramerate:v,minBitrate:b,minIndex:T}}function Aa(s,e){cs.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function QD(s){return s.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function cU(s,e,t,i){return s.slice(t,i+1).reduce((n,r,a)=>{if(!r.codecSet)return n;const u=r.audioGroups;let c=n[r.codecSet];c||(n[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!u,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const d=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,d),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,a),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,u&&u.forEach(f=>{if(!f)return;const p=e.groups[f];p&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?p.hasDefault:p.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(p.channels).forEach(y=>{c.channels[y]=(c.channels[y]||0)+p.channels[y]}))}),n},{})}function KE(s){if(!s)return s;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:r}=s;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:r}}function Ba(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;ii.indexOf(n)===-1)}function au(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function fU(s,e,t,i,n){const r=e[i],u=e.reduce((y,v,b)=>{const T=v.uri;return(y[T]||(y[T]=[])).push(b),y},{})[r.uri];u.length>1&&(i=Math.max.apply(Math,u));const c=r.videoRange,d=r.frameRate,f=r.codecSet.substring(0,4),p=WE(e,i,y=>{if(y.videoRange!==c||y.frameRate!==d||y.codecSet.substring(0,4)!==f)return!1;const v=y.audioGroups,b=t.filter(T=>!v||v.indexOf(T.groupId)!==-1);return Ba(s,b,n)>-1});return p>-1?p:WE(e,i,y=>{const v=y.audioGroups,b=t.filter(T=>!v||v.indexOf(T.groupId)!==-1);return Ba(s,b,n)>-1})}function WE(s,e,t){for(let i=e;i>-1;i--)if(t(s[i]))return i;for(let i=e+1;i{var i;const{fragCurrent:n,partCurrent:r,hls:a}=this,{autoLevelEnabled:u,media:c}=a;if(!n||!c)return;const d=performance.now(),f=r?r.stats:n.stats,p=r?r.duration:n.duration,y=d-f.loading.start,v=a.minAutoLevel,b=n.level,T=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||b<=v){this.clearTimer(),this._nextAutoLevel=-1;return}if(!u)return;const E=T>-1&&T!==b,D=!!t||E;if(!D&&(c.paused||!c.playbackRate||!c.readyState))return;const O=a.mainForwardBufferInfo;if(!D&&O===null)return;const R=this.bwEstimator.getEstimateTTFB(),j=Math.abs(c.playbackRate);if(y<=Math.max(R,1e3*(p/(j*2))))return;const F=O?O.len/j:0,z=f.loading.first?f.loading.first-f.loading.start:-1,N=f.loaded&&z>-1,Y=this.getBwEstimate(),L=a.levels,I=L[b],X=Math.max(f.loaded,Math.round(p*(n.bitrate||I.averageBitrate)/8));let G=N?y-z:y;G<1&&N&&(G=Math.min(y,f.loaded*8/Y));const q=N?f.loaded*1e3/G:0,ae=R/1e3,ie=q?(X-f.loaded)/q:X*8/Y+ae;if(ie<=F)return;const W=q?q*8:Y,K=((i=t?.details||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,Q=this.hls.config.abrBandWidthUpFactor;let te=Number.POSITIVE_INFINITY,re;for(re=b-1;re>v;re--){const fe=L[re].maxBitrate,xe=!L[re].details||K;if(te=this.getTimeToLoadFrag(ae,W,p*fe,xe),te=ie||te>p*10)return;N?this.bwEstimator.sample(y-Math.min(R,z),f.loaded):this.bwEstimator.sampleTTFB(y);const U=L[re].maxBitrate;this.getBwEstimate()*Q>U&&this.resetEstimator(U);const ne=this.findBestLevel(U,v,re,0,F,1,1);ne>-1&&(re=ne),this.warn(`Fragment ${n.sn}${r?" part "+r.index:""} of level ${b} is loading too slowly; +`.split("").map(s=>s.charCodeAt(0)));class U8 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class j8 extends Px{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Cn();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return Cn([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=B0(e);let n=this.initSegments_[i];if(t&&!n&&e.bytes){const r=PE.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(PE,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){mh(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===$a.TIMEOUT&&this.handleTimeout_(),e.code===$a.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,r=i.mp4VttCues&&i.mp4VttCues.length;r&&(n.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof he.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(n)}catch(u){this.stopForError({message:u.message,metadata:{errorType:Pe.Error.StreamingVttParserError,error:u}});return}if(r||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(u=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new he.VTTCue(u.startTime,u.endTime,u.text):u)}),S8(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",n=t&&t.type==="text";i&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const n=i.start+t,r=i.end+t,a=new he.VTTCue(n,r,i.cueText);i.settings&&i.settings.split(" ").forEach(u=>{const c=u.split(":"),d=c[0],f=c[1];a[d]=isNaN(f)?f:Number(f)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof he.WebVTT!="function")throw new U8;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof he.TextDecoder=="function"?t=new he.TextDecoder("utf8"):(t=he.WebVTT.StringDecoder(),i=!0);const n=new he.WebVTT.Parser(he,he.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{Pe.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=ME(a)),n.parse(a)}let r=e.bytes;i&&(r=ME(r)),n.parse(r),n.flush()}updateTimeMapping_(e,t,i){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:r,LOCAL:a}=e.timestampmap,c=r/du.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(d=>{const f=d.endTime-d.startTime,g=this.handleRollover_(d.startTime+c,t.time);d.startTime=Math.max(g,0),d.endTime=Math.max(g+f,0)}),!i.syncInfo){const d=e.cues[0].startTime,f=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(d,f-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*du.ONE_SECOND_IN_TS;const n=t*du.ONE_SECOND_IN_TS;let r;for(n4294967296;)i+=r;return i/du.ONE_SECOND_IN_TS}}const $8=function(s,e){const t=s.cues;for(let i=0;i=n.adStartTime&&e<=n.adEndTime)return n}return null},H8=function(s,e,t=0){if(!s.segments)return;let i=t,n;for(let r=0;r=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class RD{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:n}=e;if(this.isReliable_=this.isReliablePlaylist_(i,n),!!this.isReliable_)return this.updateStorage_(n,i,this.calculateBaseTime_(i,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const n of i)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const n=new Map;let r=` +`,a=i,u=t;this.start_=a,e.forEach((c,d)=>{const f=this.storage_.get(u),g=a,y=g+c.duration,v=!!(f&&f.segmentSyncInfo&&f.segmentSyncInfo.isAppended),b=new FE({start:g,end:y,appended:v,segmentIndex:d});c.syncInfo=b;let T=a;const E=(c.parts||[]).map((D,O)=>{const R=T,j=T+D.duration,F=!!(f&&f.partsSyncInfo&&f.partsSyncInfo[O]&&f.partsSyncInfo[O].isAppended),G=new FE({start:R,end:j,appended:F,segmentIndex:d,partIndex:O});return T=j,r+=`Media Sequence: ${u}.${O} | Range: ${R} --> ${j} | Appended: ${F} +`,D.syncInfo=G,G});n.set(u,new z8(b,E)),r+=`${kD(c.resolvedUri)} | Media Sequence: ${u} | Range: ${g} --> ${y} | Appended: ${v} +`,u++,a=y}),this.end_=a,this.storage_=n,this.diagnostics_=r}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(et!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,n,r)=>{const a=s.getMediaSequenceSync(r);if(!a||!a.isReliable)return null;const u=a.getSyncInfoForTime(n);return u?{time:u.start,partIndex:u.partIndex,segmentIndex:u.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,n)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let r=null,a=null;const u=kx(e);n=n||0;for(let c=0;c{let r=null,a=null;n=n||0;const u=kx(e);for(let c=0;c=v)&&(a=v,r={time:y,segmentIndex:f.segmentIndex,partIndex:f.partIndex})}}return r}},{name:"Discontinuity",run:(s,e,t,i,n)=>{let r=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let u=0;u=g)&&(a=g,r={time:f.time,segmentIndex:c,partIndex:null})}}}return r}},{name:"Playlist",run:(s,e,t,i,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class G8 extends Pe.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new RD,i=new BE(t),n=new BE(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:n},this.logger_=ia("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,n,r){if(t!==1/0)return Tv.find(({name:c})=>c==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,n,r);if(!a.length)return null;for(const u of a){const{syncPoint:c,strategy:d}=u,{segmentIndex:f,time:g}=c;if(f<0)continue;const y=e.segments[f],v=g,b=v+y.duration;if(this.logger_(`Strategy: ${d}. Current time: ${n}. selected segment: ${f}. Time: [${v} -> ${b}]}`),n>=v&&n0&&(n.time*=-1),Math.abs(n.time+kh({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n,r){const a=[];for(let u=0;uV8){Pe.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let n=i-1;n>=0;n--){const r=e.segments[n];if(r&&typeof r.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const r=n.dateTimeObject;n.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[n.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,r=e.part;let a=this.timelines[e.timeline],u,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),u=e.startOfSegment,c=t.end+a.mapping;else if(a)u=t.start+a.mapping,c=t.end+a.mapping;else return!1;return r&&(r.start=u,r.end=c),(!n.start||uc){let d;u<0?d=i.start-kh({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):d=i.end+kh({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:d,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class q8 extends Pe.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const K8=gD(yD(function(){var s=(function(){function T(){this.listeners={}}var E=T.prototype;return E.on=function(O,R){this.listeners[O]||(this.listeners[O]=[]),this.listeners[O].push(R)},E.off=function(O,R){if(!this.listeners[O])return!1;var j=this.listeners[O].indexOf(R);return this.listeners[O]=this.listeners[O].slice(0),this.listeners[O].splice(j,1),j>-1},E.trigger=function(O){var R=this.listeners[O];if(R)if(arguments.length===2)for(var j=R.length,F=0;F>7)*283)^j]=j;for(F=G=0;!O[F];F^=I||1,G=W[G]||1)for(V=G^G<<1^G<<2^G<<3^G<<4,V=V>>8^V&255^99,O[F]=V,R[V]=F,X=L[N=L[I=L[F]]],ne=X*16843009^N*65537^I*257^F*16843008,Y=L[V]*257^V*16843008,j=0;j<4;j++)E[j][F]=Y=Y<<24^Y>>>8,D[j][V]=ne=ne<<24^ne>>>8;for(j=0;j<5;j++)E[j]=E[j].slice(0),D[j]=D[j].slice(0);return T};let i=null;class n{constructor(E){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let D,O,R;const j=this._tables[0][4],F=this._tables[1],G=E.length;let L=1;if(G!==4&&G!==6&&G!==8)throw new Error("Invalid aes key size");const W=E.slice(0),I=[];for(this._key=[W,I],D=G;D<4*G+28;D++)R=W[D-1],(D%G===0||G===8&&D%G===4)&&(R=j[R>>>24]<<24^j[R>>16&255]<<16^j[R>>8&255]<<8^j[R&255],D%G===0&&(R=R<<8^R>>>24^L<<24,L=L<<1^(L>>7)*283)),W[D]=W[D-G]^R;for(O=0;D;O++,D--)R=W[O&3?D:D-4],D<=4||O<4?I[O]=R:I[O]=F[0][j[R>>>24]]^F[1][j[R>>16&255]]^F[2][j[R>>8&255]]^F[3][j[R&255]]}decrypt(E,D,O,R,j,F){const G=this._key[1];let L=E^G[0],W=R^G[1],I=O^G[2],N=D^G[3],X,V,Y;const ne=G.length/4-2;let ie,K=4;const q=this._tables[1],Z=q[0],te=q[1],le=q[2],z=q[3],re=q[4];for(ie=0;ie>>24]^te[W>>16&255]^le[I>>8&255]^z[N&255]^G[K],V=Z[W>>>24]^te[I>>16&255]^le[N>>8&255]^z[L&255]^G[K+1],Y=Z[I>>>24]^te[N>>16&255]^le[L>>8&255]^z[W&255]^G[K+2],N=Z[N>>>24]^te[L>>16&255]^le[W>>8&255]^z[I&255]^G[K+3],K+=4,L=X,W=V,I=Y;for(ie=0;ie<4;ie++)j[(3&-ie)+F]=re[L>>>24]<<24^re[W>>16&255]<<16^re[I>>8&255]<<8^re[N&255]^G[K++],X=L,L=W,W=I,I=N,N=X}}class r extends s{constructor(){super(s),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(E){this.jobs.push(E),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(T){return T<<24|(T&65280)<<8|(T&16711680)>>8|T>>>24},u=function(T,E,D){const O=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),R=new n(Array.prototype.slice.call(E)),j=new Uint8Array(T.byteLength),F=new Int32Array(j.buffer);let G,L,W,I,N,X,V,Y,ne;for(G=D[0],L=D[1],W=D[2],I=D[3],ne=0;ne{const O=T[D];y(O)?E[D]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:E[D]=O}),E};self.onmessage=function(T){const E=T.data,D=new Uint8Array(E.encrypted.bytes,E.encrypted.byteOffset,E.encrypted.byteLength),O=new Uint32Array(E.key.bytes,E.key.byteOffset,E.key.byteLength/4),R=new Uint32Array(E.iv.bytes,E.iv.byteOffset,E.iv.byteLength/4);new c(D,O,R,function(j,F){self.postMessage(b({source:E.source,decrypted:F}),[F.buffer])})}}));var W8=pD(K8);const Y8=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},ID=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Bx=(s,e)=>{e.activePlaylistLoader=s,s.load()},X8=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:n}}=e,r=n.activeTrack(),a=n.getActiveGroup(),u=n.activePlaylistLoader,c=n.lastGroup_;if(!(a&&c&&a.id===c.id)&&(n.lastGroup_=a,n.lastTrack_=r,ID(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Bx(a.playlistLoader,n)}},Q8=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Z8=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:n},mediaTypes:{[s]:r}}=e,a=r.activeTrack(),u=r.getActiveGroup(),c=r.activePlaylistLoader,d=r.lastTrack_;if(!(d&&a&&d.id===a.id)&&(r.lastGroup_=u,r.lastTrack_=a,ID(i,r),!!u)){if(u.isMainPlaylist){if(!a||!d||a.id===d.id)return;const f=e.vhs.playlistController_,g=f.selectPlaylist();if(f.media()===g)return;r.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),t.pause(),n.resetEverything(),f.fastQualityChange_(g);return}if(s==="AUDIO"){if(!u.playlistLoader){n.setAudio(!0),n.resetEverything();return}i.setAudio(!0),n.setAudio(!1)}if(c===u.playlistLoader){Bx(u.playlistLoader,r);return}i.track&&i.track(a),i.resetEverything(),Bx(u.playlistLoader,r)}},U0={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,n=t.activeTrack(),r=t.activeGroup(),a=(r.filter(c=>c.default)[0]||r[0]).id,u=t.tracks[a];if(n===u){i({error:{message:"Problem encountered loading the default audio track."}});return}Pe.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===u;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;Pe.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},UE={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:n,segmentLoaders:{[s]:r}}=t;e.on("loadedmetadata",()=>{const a=e.media();r.playlist(a,n),(!i.paused()||a.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",U0[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:n,segmentLoaders:{[s]:r},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const u=e.media();r.playlist(u,n),r.track(a.activeTrack()),(!i.paused()||u.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",U0[s](s,t))}},J8={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[s]:{groups:u,tracks:c,logger_:d}},mainPlaylistLoader:f}=e,g=tf(f.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},g&&(a[s].main.default.playlists=f.main.playlists));for(const y in a[s]){u[y]||(u[y]=[]);for(const v in a[s][y]){let b=a[s][y][v],T;if(g?(d(`AUDIO group '${y}' label '${v}' is a main playlist`),b.isMainPlaylist=!0,T=null):i==="vhs-json"&&b.playlists?T=new pc(b.playlists[0],t,r):b.resolvedUri?T=new pc(b.resolvedUri,t,r):b.playlists&&i==="dash"?T=new Nx(b.playlists[0],t,r,f):T=null,b=cs({id:v,playlistLoader:T},b),UE[s](s,b.playlistLoader,e),u[y].push(b),typeof c[v]>"u"){const E=new Pe.AudioTrack({id:v,kind:Y8(b),enabled:!1,language:b.language,default:b.default,label:v});c[v]=E}}}n.on("error",U0[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:n,segmentLoaders:{[s]:r},requestOptions:a,main:{mediaGroups:u},mediaTypes:{[s]:{groups:c,tracks:d}},mainPlaylistLoader:f}=e;for(const g in u[s]){c[g]||(c[g]=[]);for(const y in u[s][g]){if(!i.options_.useForcedSubtitles&&u[s][g][y].forced)continue;let v=u[s][g][y],b;if(n==="hls")b=new pc(v.resolvedUri,i,a);else if(n==="dash"){if(!v.playlists.filter(E=>E.excludeUntil!==1/0).length)return;b=new Nx(v.playlists[0],i,a,f)}else n==="vhs-json"&&(b=new pc(v.playlists?v.playlists[0]:v.resolvedUri,i,a));if(v=cs({id:y,playlistLoader:b},v),UE[s](s,v.playlistLoader,e),c[g].push(v),typeof d[y]>"u"){const T=t.addRemoteTextTrack({id:y,kind:"subtitles",default:v.default&&v.autoselect,language:v.language,label:y},!1).track;d[y]=T}}}r.on("error",U0[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:n,tracks:r}}}=e;for(const a in i[s]){n[a]||(n[a]=[]);for(const u in i[s][a]){const c=i[s][a][u];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const d=t.options_.vhs&&t.options_.vhs.captionServices||{};let f={label:u,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(d[f.instreamId]&&(f=cs(f,d[f.instreamId])),f.default===void 0&&delete f.default,n[a].push(cs({id:u},c)),typeof r[u]>"u"){const g=t.addRemoteTextTrack({id:f.instreamId,kind:"captions",default:f.default,language:f.language,label:f.label},!1).track;r[u]=g}}}}},ND=(s,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:n}}}=e,r=i.media();if(!r)return null;let a=null;r.attributes[s]&&(a=n[r.attributes[s]]);const u=Object.keys(n);if(!a)if(s==="AUDIO"&&u.length>1&&tf(e.main))for(let c=0;c"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},t6={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},i6=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},s6=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(d=>{J8[d](d,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:n,segmentLoaders:{["AUDIO"]:r,main:a}}=s;["AUDIO","SUBTITLES"].forEach(d=>{e[d].activeGroup=e6(d,s),e[d].activeTrack=t6[d](d,s),e[d].onGroupChanged=X8(d,s),e[d].onGroupChanging=Q8(d,s),e[d].onTrackChanged=Z8(d,s),e[d].getActiveGroup=i6(d,s)});const u=e.AUDIO.activeGroup();if(u){const d=(u.filter(g=>g.default)[0]||u[0]).id;e.AUDIO.tracks[d].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),r.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const d in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[d])},n6=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Eo,activeTrack:Eo,getActiveGroup:Eo,onGroupChanged:Eo,onTrackChanged:Eo,lastTrack_:null,logger_:ia(`MediaGroups[${e}]`)}}),s};class jE{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=pr(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}let r6=class extends Pe.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new jE,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=ia("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=pr(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(r,a)=>{if(r){if(a.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const d=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${d} seconds.`),this.startTTLTimeout_(parseInt(d,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let u;try{u=JSON.parse(this.request_.responseText)}catch(d){const f={errorType:Pe.Error.StreamingContentSteeringParserError,error:d};this.trigger({type:"error",metadata:f})}this.assignSteeringProperties_(u);const c={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new he.URL(e),i=new he.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(he.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new he.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const r=`_${this.manifestType_}_pathway`;t.searchParams.set(r,i)}if(n){const r=`_${this.manifestType_}_throughput`;t.searchParams.set(r,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=he.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){he.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new jE}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(pr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}};const a6=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},o6=10;let fl;const l6=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],u6=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},c6=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:u,log:c}){if(!i)return Pe.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return c(`${d} as current playlist is not set`),!0;if(i.id===s.id)return!1;const f=!!mc(e,t).length;if(!s.endList)return!f&&typeof s.partTargetDuration=="number"?(c(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${d} as current playlist is live`),!0);const g=Kb(e,t),y=u?An.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:An.MAX_BUFFER_LOW_WATER_LINE;if(ab)&&g>=n){let T=`${d} as forwardBuffer >= bufferLowWaterLine (${g} >= ${n})`;return u&&(T+=` and next bandwidth > current bandwidth (${v} > ${b})`),c(T),!0}return c(`not ${d} as no switching criteria met`),!1};class d6 extends Pe.EventTarget{constructor(e){super(),this.fastQualityChange_=a6(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:a,useCueTags:u,playlistExclusionDuration:c,enableLowInitialPlaylist:d,sourceType:f,cacheEncryptionKeys:g,bufferBasedABR:y,leastPixelDiffSelector:v,captionServices:b,experimentalUseMMS:T}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:E}=e;(E===null||typeof E>"u")&&(E=1/0),fl=a,this.bufferBasedABR=!!y,this.leastPixelDiffSelector=!!v,this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=f,this.useCueTags_=u,this.playlistExclusionDuration=c,this.maxPlaylistRetries=E,this.enableLowInitialPlaylist=d,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:E,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=n6(),T&&he.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new he.ManagedMediaSource,this.usingManagedMediaSource_=!0,Pe.log("Using ManagedMediaSource")):he.MediaSource&&(this.mediaSource=new he.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Cn(),this.hasPlayed_=!1,this.syncController_=new G8(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new W8,this.sourceUpdater_=new LD(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new q8,this.keyStatusMap_=new Map;const D={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:b,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:g,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Nx(t,this.vhs_,cs(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new pc(t,this.vhs_,cs(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Px(cs(D,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Px(cs(D,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new j8(cs(D,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((j,F)=>{function G(){n.off("vttjserror",L),j()}function L(){n.off("vttjsloaded",G),F()}n.one("vttjsloaded",G),n.one("vttjserror",L),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new r6(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),l6.forEach(j=>{this[j+"_"]=u6.bind(this,j)}),this.logger_=ia("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const R=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(R,()=>{const j=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-j,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),r=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_(`switch media ${r} -> ${a} from ${t}`);const u={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:u}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(i&&n){const a=(i.length?i[0].playlists:i.playlists).filter(u=>u.attributes.serviceLocation===n);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=he.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(he.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const u=i.main||n.length&&i[n[0]];for(const c in u)if(u[c].default){r={label:c};break}}if(!r)return t;const a=[];for(const u in i)if(i[u][r.label]){const c=i[u][r.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let d=0;d{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Cx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),s6({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Cx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(cn({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const r=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const u in i.AUDIO[a])i.AUDIO[a][u].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),fl.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return c6({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const n=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:o6}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,n=>{this.player_.trigger(cn({},n))}),this.audioSegmentLoader_.on(i,n=>{this.player_.trigger(cn({},n))}),this.subtitleSegmentLoader_.on(i,n=>{this.player_.trigger(cn({},n))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const n=fl.Playlist.playlistEnd(e,i),r=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return n-r<=ja;const u=a.end(a.length-1);return u-r<=ja&&n-u<=ja}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,r=n.filter(Rp),a=r.length===1&&r[0]===e;if(n.length===1&&i!==1/0)return Pe.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const b=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(b),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(b)},T);return}let v=!1;n.forEach(b=>{if(b===e)return;const T=b.excludeUntil;typeof T<"u"&&T!==1/0&&(v=!0,delete b.excludeUntil)}),v&&(Pe.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let u;e.playlistErrors_>this.maxPlaylistRetries?u=1/0:u=Date.now()+i*1e3,e.excludeUntil=u,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const d=t.internal?this.logger_:Pe.log.warn,f=t.message?" "+t.message:"";d(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${f} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const g=c.targetDuration/2*1e3||5*1e3,y=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=g;return this.switchMedia_(c,"exclude",a||y)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n=e==="all";(n||e==="main")&&i.push(this.mainPlaylistLoader_);const r=[];(n||e==="audio")&&r.push("AUDIO"),(n||e==="subtitle")&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(a=>{const u=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;u&&i.push(u)}),["main","audio","subtitle"].forEach(a=>{const u=this[`${a}SegmentLoader_`];u&&(e===a||e==="all")&&i.push(u)}),i.forEach(a=>t.forEach(u=>{typeof a[u]=="function"&&a[u]()}))}setCurrentTime(e){const t=mc(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:fl.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const u=n.start,c=n.end;if(!isFinite(u)||!isFinite(c))return null;const d=fl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),f=Math.max(u,c-d);return Cn([[u,f]])}const r=this.syncController_.getExpiredTime(i,this.duration());if(r===null)return null;const a=fl.Playlist.seekable(i,r,fl.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),n=e.end(0),r=t.start(0),a=t.end(0);return r>n||i>a?e:Cn([[Math.max(i,r),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${zC(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=Ch(this.main(),t),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||J3),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||D2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||D2,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(d,f)=>d?_h(f,this.usingManagedMediaSource_):tv(f),u={};let c;if(["video","audio"].forEach(function(d){if(n.hasOwnProperty(d)&&!a(e[d].isFmp4,n[d])){const f=e[d].isFmp4?"browser":"muxer";u[f]=u[f]||[],u[f].push(n[d]),d==="audio"&&(c=f)}}),r&&c&&t.attributes.AUDIO){const d=t.attributes.AUDIO;this.main().playlists.forEach(f=>{(f.attributes&&f.attributes.AUDIO)===d&&f!==t&&(f.excludeUntil=1/0)}),this.logger_(`excluding audio group ${d} as ${c} does not support codec(s): "${n.audio}"`)}if(Object.keys(u).length){const d=Object.keys(u).reduce((f,g)=>(f&&(f+=", "),f+=`${g} does not support codec(s): "${u[g].join(",")}"`,f),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:d},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const d=[];if(["video","audio"].forEach(f=>{const g=(Ma(this.sourceUpdater_.codecs[f]||"")[0]||{}).type,y=(Ma(n[f]||"")[0]||{}).type;g&&y&&g.toLowerCase()!==y.toLowerCase()&&d.push(`"${this.sourceUpdater_.codecs[f]}" -> "${n[f]}"`)}),d.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${d.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const n=e[i];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const r=Ch(this.main,n),a=[];r.audio&&!tv(r.audio)&&!_h(r.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${r.audio}`),r.video&&!tv(r.video)&&!_h(r.video,this.usingManagedMediaSource_)&&a.push(`video codec ${r.video}`),r.text&&r.text==="stpp.ttml.im1t"&&a.push(`text codec ${r.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=Bh(Ma(e)),r=SE(n),a=n.video&&Ma(n.video)[0]||null,u=n.audio&&Ma(n.audio)[0]||null;Object.keys(i).forEach(c=>{const d=i[c];if(t.indexOf(d.id)!==-1||d.excludeUntil===1/0)return;t.push(d.id);const f=[],g=Ch(this.mainPlaylistLoader_.main,d),y=SE(g);if(!(!g.audio&&!g.video)){if(y!==r&&f.push(`codec count "${y}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const v=g.video&&Ma(g.video)[0]||null,b=g.audio&&Ma(g.audio)[0]||null;v&&a&&v.type.toLowerCase()!==a.type.toLowerCase()&&f.push(`video codec "${v.type}" !== "${a.type}"`),b&&u&&b.type.toLowerCase()!==u.type.toLowerCase()&&f.push(`audio codec "${b.type}" !== "${u.type}"`)}f.length&&(d.excludeUntil=1/0,this.logger_(`excluding ${d.id}: ${f.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),H8(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=An.GOAL_BUFFER_LENGTH,i=An.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,An.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=An.BUFFER_LOW_WATER_LINE,i=An.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,An.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,An.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:n)}bufferHighWaterLine(){return An.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){LE(this.inbandTextTracks_,"com.apple.streaming",this.tech_),T8({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();LE(this.inbandTextTracks_,e,this.tech_),v8({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(cn({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const r=this.contentSteeringController_.getAvailablePathways(),a=[];for(const u of t.playlists){const c=u.attributes.serviceLocation;if(c&&(a.push(c),!r.has(c)))return!0}return!!(!a.length&&r.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,n=new Set;let r=!1;Object.keys(i).forEach(a=>{const u=i[a],c=this.pathwayAttribute_(u),d=c&&e!==c;u.excludeUntil===1/0&&u.lastExcludeReason_==="content-steering"&&!d&&(delete u.excludeUntil,delete u.lastExcludeReason_,r=!0);const g=!u.excludeUntil&&u.excludeUntil!==1/0;!n.has(u.id)&&d&&g&&(n.add(u.id),u.excludeUntil=1/0,u.lastExcludeReason_="content-steering",this.logger_(`excluding ${u.id} for ${u.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const u=this.mediaTypes_[a];if(u.activePlaylistLoader){const c=u.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||n&&n.size){for(const[a,u]of i.entries())n.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(a));for(const[a,u]of n.entries()){const c=i.get(a);if(!c){t.filter(f=>f.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(f=>{this.mainPlaylistLoader_.addClonePathway(u,f)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(c,u)||(this.mainPlaylistLoader_.updateOrDeleteClone(u,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const r in i)if(i[r]!==n[r])return!1;for(const r in n)if(i[r]!==n[r])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=this.mainPlaylistLoader_.getKeyIdSet(i);!n||!n.size||n.forEach(r=>{const a="usable",u=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===a,c=i.lastExcludeReason_===t&&i.excludeUntil===1/0;u?u&&c&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,r=i.excludeUntil===1/0&&i.lastExcludeReason_===t;n&&r&&(delete i.excludeUntil,Pe.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:B8(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const h6=(s,e,t)=>i=>{const n=s.main.playlists[e],r=Yb(n),a=Rp(n);if(typeof i>"u")return a;i?delete n.disabled:n.disabled=!0;const u={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return i!==a&&!r&&(i?(t(n),s.trigger({type:"renditionenabled",metadata:u})):s.trigger({type:"renditiondisabled",metadata:u})),i};class f6{constructor(e,t,i){const{playlistController_:n}=e,r=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Ch(n.main(),t),this.playlist=t,this.id=i,this.enabled=h6(e.playlists,t.id,r)}}const m6=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=tf(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!Yb(i)).map((i,n)=>new f6(s,i,i.id)):[]}},$E=["seeking","seeked","pause","playing","error"];class p6 extends Pe.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=ia("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,u=["main","subtitle","audio"],c={};u.forEach(f=>{c[f]={reset:()=>this.resetSegmentDownloads_(f),updateend:()=>this.checkSegmentDownloads_(f)},a[`${f}SegmentLoader_`].on("appendsdone",c[f].updateend),a[`${f}SegmentLoader_`].on("playlistupdate",c[f].reset),this.tech_.on(["seeked","seeking"],c[f].reset)});const d=f=>{["main","audio"].forEach(g=>{a[`${g}SegmentLoader_`][f]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on($E,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off($E,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),u.forEach(f=>{a[`${f}SegmentLoader_`].off("appendsdone",c[f].updateend),a[`${f}SegmentLoader_`].off("playlistupdate",c[f].reset),this.tech_.off(["seeked","seeking"],c[f].reset)}),this.checkCurrentTimeTimeout_&&he.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&he.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=he.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),r=eB(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,r){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:hu(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ja>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Cn([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const b=t.start(0);r=b+(b===t.end(0)?0:ja)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${zC(t)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const a=this.playlistController_.sourceUpdater_,u=this.tech_.buffered(),c=a.audioBuffer?a.audioBuffered():null,d=a.videoBuffer?a.videoBuffered():null,f=this.media(),g=f.partTargetDuration?f.partTargetDuration:(f.targetDuration-Ua)*2,y=[c,d];for(let b=0;b ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const u=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${u}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(u),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=Dm(n,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let r=e.end(e.length-1)+ja;const a=!i.endList,u=typeof i.partTargetDuration=="number";return a&&(u||n)&&(r=e.end(e.length-1)+i.targetDuration*3),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null}}const g6={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},OD=function(s,e){let t=0,i=0;const n=cs(g6,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const r=function(){i&&s.currentTime(i)},a=function(f){f!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",r),s.src(f),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},u=function(){if(Date.now()-t{Object.defineProperty(Gs,s,{get(){return Pe.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),An[s]},set(e){if(Pe.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Pe.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}An[s]=e}})});const PD="videojs-vhs",FD=function(s,e){const t=e.media();let i=-1;for(let n=0;n{s.addQualityLevel(t)}),FD(s,e.playlists)};Gs.canPlaySource=function(){return Pe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const _6=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Bh(Ma(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const n=Mc(i.video),r=Mc(i.audio),a={};for(const u in s)a[u]={},r&&(a[u].audioContentType=r),n&&(a[u].videoContentType=n),e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(a[u].pssh=e.contentProtection[u].pssh),typeof s[u]=="string"&&(a[u].url=s[u]);return cs(s,a)},E6=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const n=e.reduce((r,a)=>{const u=i.contentProtection[a];return u&&u.pssh&&(r[a]={pssh:u.pssh}),r},{});return Object.keys(n).length&&t.push(n),t},[]),w6=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const n=t?i.concat([t]):i,r=E6(n,Object.keys(e)),a=[],u=[];return r.forEach(c=>{u.push(new Promise((d,f)=>{s.tech_.one("keysessioncreated",d)})),a.push(new Promise((d,f)=>{s.eme.initializeMediaKeys({keySystems:c},g=>{if(g){f(g);return}d()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},A6=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const n=_6(e,t,i);return n?(s.currentSource().keySystems=n,n&&!s.eme?(Pe.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},BD=()=>{if(!he.localStorage)return null;const s=he.localStorage.getItem(PD);if(!s)return null;try{return JSON.parse(s)}catch{return null}},k6=s=>{if(!he.localStorage)return!1;let e=BD();e=e?cs(e,s):s;try{he.localStorage.setItem(PD,JSON.stringify(e))}catch{return!1}return e},C6=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,UD=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},jD=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},$D=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},HD=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Gs.supportsNativeHls=(function(){if(!_t||!_t.createElement)return!1;const s=_t.createElement("video");return Pe.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(s.canPlayType(t))}):!1})();Gs.supportsNativeDash=(function(){return!_t||!_t.createElement||!Pe.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(_t.createElement("video").canPlayType("application/dash+xml"))})();Gs.supportsTypeNatively=s=>s==="hls"?Gs.supportsNativeHls:s==="dash"?Gs.supportsNativeDash:!1;Gs.isSupported=function(){return Pe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Gs.xhr.onRequest=function(s){UD(Gs.xhr,s)};Gs.xhr.onResponse=function(s){jD(Gs.xhr,s)};Gs.xhr.offRequest=function(s){$D(Gs.xhr,s)};Gs.xhr.offResponse=function(s){HD(Gs.xhr,s)};const D6=Pe.getComponent("Component");class zD extends D6{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=ia("VhsHandler"),t.options_&&t.options_.playerId){const n=Pe.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(_t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const r=_t.fullscreenElement||_t.webkitFullscreenElement||_t.mozFullScreenElement||_t.msFullscreenElement;r&&r.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=cs(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=BD();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=An.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===An.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=C6(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Gs,this.options_.sourceType=ck(t),this.options_.seekTo=r=>{this.tech_.setCurrentTime(r)},this.options_.player_=this.player_,this.playlistController_=new d6(this.options_);const i=cs({liveRangeSafeTimeDelta:ja},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new p6(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const r=Pe.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),r.error(a)});const n=this.options_.bufferBasedABR?Gs.movingAverageBandwidthSelector(.55):Gs.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Gs.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(r){this.playlistController_.selectPlaylist=r.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(r){this.playlistController_.mainSegmentLoader_.throughput.rate=r,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let r=this.playlistController_.mainSegmentLoader_.bandwidth;const a=he.navigator.connection||he.navigator.mozConnection||he.navigator.webkitConnection,u=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=u&&r>=u?r=Math.max(r,c):r=c}return r},set(r){this.playlistController_.mainSegmentLoader_.bandwidth=r,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const r=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(r+a))},set(){Pe.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>hu(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>hu(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&k6({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{m6(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=he.URL.createObjectURL(this.playlistController_.mediaSource),(Pe.browser.IS_ANY_SAFARI||Pe.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),w6({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=A6({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Pe.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{S6(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{FD(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":MD,"mux.js":v6,"mpd-parser":x6,"m3u8-parser":b6,"aes-decrypter":T6}}version(){return this.constructor.version()}canChangeType(){return LD.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&he.URL.revokeObjectURL&&(he.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return NB({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return fD({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{UD(this.xhr,e)},this.xhr.onResponse=e=>{jD(this.xhr,e)},this.xhr.offRequest=e=>{$D(this.xhr,e)},this.xhr.offResponse=e=>{HD(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,n=>{this.player_.trigger(cn({},n))})}),t.forEach(i=>{this.playbackWatcher_.on(i,n=>{this.player_.trigger(cn({},n))})})}}const j0={name:"videojs-http-streaming",VERSION:MD,canHandleSource(s,e={}){const t=cs(Pe.options,e);return!t.vhs.experimentalUseMMS&&!_h("avc1.4d400d,mp4a.40.2",!1)?!1:j0.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=cs(Pe.options,t);return e.vhs=new zD(s,e,i),e.vhs.xhr=lD(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=ck(s);if(!t)return"";const i=j0.getOverrideNative(e);return!Gs.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(Pe.browser.IS_ANY_SAFARI||Pe.browser.IS_IOS),{overrideNative:i=t}=e;return i}},L6=()=>_h("avc1.4d400d,mp4a.40.2",!0);L6()&&Pe.getTech("Html5").registerSourceHandler(j0,0);Pe.VhsHandler=zD;Pe.VhsSourceHandler=j0;Pe.Vhs=Gs;Pe.use||Pe.registerComponent("Vhs",Gs);Pe.options.vhs=Pe.options.vhs||{};(!Pe.getPlugin||!Pe.getPlugin("reloadSourceOnError"))&&Pe.registerPlugin("reloadSourceOnError",y6);const R6="",au=s=>{const e=s.startsWith("/")?s:`/${s}`;return`${R6}${e}`};async function Sv(s,e){const t=await fetch(au(s),{...e,credentials:"include",headers:{...e?.headers??{},"Content-Type":e?.headers?.["Content-Type"]??"application/json"}});return t.status===401&&(location.pathname.startsWith("/login")||(location.href="/login")),t}const Pt=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},I6=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=N6},N6=Number.MAX_SAFE_INTEGER||9007199254740991;let Jt=(function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s})({}),Oe=(function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",s.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",s.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.ASSET_LIST_LOAD_ERROR="assetListLoadError",s.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",s.ASSET_LIST_PARSING_ERROR="assetListParsingError",s.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.ATTACH_MEDIA_ERROR="attachMediaError",s.UNKNOWN="unknown",s})({}),$=(function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.MEDIA_ENDED="hlsMediaEnded",s.STALL_RESOLVED="hlsStallResolved",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFERED_TO_END="hlsBufferedToEnd",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s.ASSET_LIST_LOADING="hlsAssetListLoading",s.ASSET_LIST_LOADED="hlsAssetListLoaded",s.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",s.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",s.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",s.INTERSTITIAL_STARTED="hlsInterstitialStarted",s.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",s.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",s.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",s.INTERSTITIAL_ENDED="hlsInterstitialEnded",s.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",s.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",s.EVENT_CUE_ENTER="hlsEventCueEnter",s})({});var Hi={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},$t={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class nc{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class O6{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new nc(e),this.fast_=new nc(t),this.defaultTTFB_=n,this.ttfb_=new nc(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new nc(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new nc(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new nc(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,r=i/n;this.fast_.sample(n,r),this.slow_.sample(n,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function M6(s,e,t){return(e=F6(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Ss(){return Ss=Object.assign?Object.assign.bind():function(s){for(var e=1;e`):xl}function zE(s,e,t){return e[s]?e[s].bind(e):U6(s,t)}const jx=Ux();function j6(s,e,t){const i=Ux();if(typeof console=="object"&&s===!0||typeof s=="object"){const n=["debug","log","info","warn","error"];n.forEach(r=>{i[r]=zE(r,s,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return Ux()}n.forEach(r=>{jx[r]=zE(r,s)})}else Ss(jx,i);return i}const ys=jx;function Cl(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function $6(s){return typeof self<"u"&&s===self.ManagedMediaSource}function VD(s,e){const t=Object.keys(s),i=Object.keys(e),n=t.length,r=i.length;return!n||!r||n===r&&!t.some(a=>i.indexOf(a)===-1)}function jr(s,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(s);if(e){const f=d.indexOf("\0");return f!==-1?d.substring(0,f):d}return d.replace(/\0/g,"")}const t=s.length;let i,n,r,a="",u=0;for(;u>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:n=s[u++],a+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=s[u++],r=s[u++],a+=String.fromCharCode((i&15)<<12|(n&63)<<6|(r&63)<<0);break}}return a}function Bn(s){let e="";for(let t=0;t1||n===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!Pt(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return un(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const n=t[e];n&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=n.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,r,a=!1){const{elementaryStreams:u}=this,c=u[e];if(!c){u[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:a};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,r)}}class V6 extends qD{constructor(e,t,i,n,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function KD(s,e){const t=Object.getPrototypeOf(s);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||KD(t,e)}}function G6(s,e){const t=KD(s,e);t&&(t.enumerable=!0,Object.defineProperty(s,e,t))}const GE=Math.pow(2,32)-1,q6=[].push,WD={video:1,audio:2,id3:3,text:4};function xn(s){return String.fromCharCode.apply(null,s)}function YD(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function Ti(s,e){const t=XD(s,e);return t<0?4294967296+t:t}function qE(s,e){let t=Ti(s,e);return t*=Math.pow(2,32),t+=Ti(s,e+4),t}function XD(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function K6(s){const e=s.byteLength;for(let t=0;t8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function Bi(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let n=0;n1?n+r:i;if(a===e[0])if(e.length===1)t.push(s.subarray(n+8,u));else{const c=Bi(s.subarray(n+8,u),e.slice(1));c.length&&q6.apply(t,c)}n=u}return t}function W6(s){const e=[],t=s[0];let i=8;const n=Ti(s,i);i+=4;let r=0,a=0;t===0?(r=Ti(s,i),a=Ti(s,i+4),i+=8):(r=qE(s,i),a=qE(s,i+8),i+=16),i+=2;let u=s.length+a;const c=YD(s,i);i+=2;for(let d=0;d>>31===1)return ys.warn("SIDX has hierarchical references (not supported)"),null;const b=Ti(s,f);f+=4,e.push({referenceSize:y,subsegmentDuration:b,info:{duration:b/n,start:u,end:u+y-1}}),u+=y,f+=4,i=f}return{earliestPresentationTime:r,timescale:n,version:t,referencesCount:c,references:e}}function QD(s){const e=[],t=Bi(s,["moov","trak"]);for(let n=0;n{const r=Ti(n,4),a=e[r];a&&(a.default={duration:Ti(n,12),flags:Ti(n,20)})}),e}function Y6(s){const e=s.subarray(8),t=e.subarray(86),i=xn(e.subarray(4,8));let n=i,r;const a=i==="enca"||i==="encv";if(a){const d=Bi(e,[i])[0].subarray(i==="enca"?28:78);Bi(d,["sinf"]).forEach(g=>{const y=Bi(g,["schm"])[0];if(y){const v=xn(y.subarray(4,8));if(v==="cbcs"||v==="cenc"){const b=Bi(g,["frma"])[0];b&&(n=xn(b))}}})}const u=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Bi(t,["avcC"])[0];c&&c.length>3&&(n+="."+Nm(c[1])+Nm(c[2])+Nm(c[3]),r=Im(u==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=Bi(e,[i])[0],d=Bi(c.subarray(28),["esds"])[0];if(d&&d.length>7){let f=4;if(d[f++]!==3)break;f=wv(d,f),f+=2;const g=d[f++];if(g&128&&(f+=2),g&64&&(f+=d[f++]),d[f++]!==4)break;f=wv(d,f);const y=d[f++];if(y===64)n+="."+Nm(y);else break;if(f+=12,d[f++]!==5)break;f=wv(d,f);const v=d[f++];let b=(v&248)>>3;b===31&&(b+=1+((v&7)<<3)+((d[f]&224)>>5)),n+="."+b}break}case"hvc1":case"hev1":{const c=Bi(t,["hvcC"])[0];if(c&&c.length>12){const d=c[1],f=["","A","B","C"][d>>6],g=d&31,y=Ti(c,2),v=(d&32)>>5?"H":"L",b=c[12],T=c.subarray(6,12);n+="."+f+g,n+="."+X6(y).toString(16).toUpperCase(),n+="."+v+b;let E="";for(let D=T.length;D--;){const O=T[D];(O||E)&&(E="."+O.toString(16).toUpperCase()+E)}n+=E}r=Im(u=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=Im(n,t)||n;break}case"vp09":{const c=Bi(t,["vpcC"])[0];if(c&&c.length>6){const d=c[4],f=c[5],g=c[6]>>4&15;n+="."+Oa(d)+"."+Oa(f)+"."+Oa(g)}break}case"av01":{const c=Bi(t,["av1C"])[0];if(c&&c.length>2){const d=c[1]>>>5,f=c[1]&31,g=c[2]>>>7?"H":"M",y=(c[2]&64)>>6,v=(c[2]&32)>>5,b=d===2&&y?v?12:10:y?10:8,T=(c[2]&16)>>4,E=(c[2]&8)>>3,D=(c[2]&4)>>2,O=c[2]&3;n+="."+d+"."+Oa(f)+g+"."+Oa(b)+"."+T+"."+E+D+O+"."+Oa(1)+"."+Oa(1)+"."+Oa(1)+"."+0,r=Im("dav1",t)}break}}return{codec:n,encrypted:a,supplemental:r}}function Im(s,e){const t=Bi(e,["dvvC"]),i=t.length?t[0]:Bi(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return s+"."+Oa(n)+"."+Oa(r)}}function X6(s){let e=0;for(let t=0;t<32;t++)e|=(s>>t&1)<<31-t;return e>>>0}function wv(s,e){const t=e+5;for(;s[e++]&128&&e{const r=i.subarray(8,24);r.some(a=>a!==0)||(ys.log(`[eme] Patching keyId in 'enc${n?"a":"v"}>sinf>>tenc' box: ${Bn(r)} -> ${Bn(t)}`),i.set(t,8))})}function Z6(s){const e=[];return ZD(s,t=>e.push(t.subarray(8,24))),e}function ZD(s,e){Bi(s,["moov","trak"]).forEach(i=>{const n=Bi(i,["mdia","minf","stbl","stsd"])[0];if(!n)return;const r=n.subarray(8);let a=Bi(r,["enca"]);const u=a.length>0;u||(a=Bi(r,["encv"])),a.forEach(c=>{const d=u?c.subarray(28):c.subarray(78);Bi(d,["sinf"]).forEach(g=>{const y=JD(g);y&&e(y,u)})})})}function JD(s){const e=Bi(s,["schm"])[0];if(e){const t=xn(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=Bi(s,["schi","tenc"])[0];if(i)return i}}}function J6(s,e,t){const i={},n=Bi(s,["moof","traf"]);for(let r=0;ri[r].duration)){let r=1/0,a=0;const u=Bi(s,["sidx"]);for(let c=0;cg+y.info.duration||0,0);a=Math.max(a,f+d.earliestPresentationTime/d.timescale)}}a&&Pt(a)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=a*i[c].timescale-i[c].start)})}return i}function eU(s){const e={valid:null,remainder:null},t=Bi(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=s.slice(0,i.byteOffset-8),e.remainder=s.slice(i.byteOffset-8),e}function ea(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function KE(s,e){const t=[],i=e.samples,n=e.timescale,r=e.id;let a=!1;return Bi(i,["moof"]).map(c=>{const d=c.byteOffset-8;Bi(c,["traf"]).map(g=>{const y=Bi(g,["tfdt"]).map(v=>{const b=v[0];let T=Ti(v,4);return b===1&&(T*=Math.pow(2,32),T+=Ti(v,8)),T/n})[0];return y!==void 0&&(s=y),Bi(g,["tfhd"]).map(v=>{const b=Ti(v,4),T=Ti(v,0)&16777215,E=(T&1)!==0,D=(T&2)!==0,O=(T&8)!==0;let R=0;const j=(T&16)!==0;let F=0;const G=(T&32)!==0;let L=8;b===r&&(E&&(L+=8),D&&(L+=4),O&&(R=Ti(v,L),L+=4),j&&(F=Ti(v,L),L+=4),G&&(L+=4),e.type==="video"&&(a=Ip(e.codec)),Bi(g,["trun"]).map(W=>{const I=W[0],N=Ti(W,0)&16777215,X=(N&1)!==0;let V=0;const Y=(N&4)!==0,ne=(N&256)!==0;let ie=0;const K=(N&512)!==0;let q=0;const Z=(N&1024)!==0,te=(N&2048)!==0;let le=0;const z=Ti(W,4);let re=8;X&&(V=Ti(W,re),re+=4),Y&&(re+=4);let Q=V+d;for(let pe=0;pe>1&63;return t===39||t===40}else return(e&31)===6}function t1(s,e,t,i){const n=eL(s);let r=0;r+=e;let a=0,u=0,c=0;for(;r=n.length)break;c=n[r++],a+=c}while(c===255);u=0;do{if(r>=n.length)break;c=n[r++],u+=c}while(c===255);const d=n.length-r;let f=r;if(ud){ys.error(`Malformed SEI payload. ${u} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(n[f++]===181){const y=YD(n,f);if(f+=2,y===49){const v=Ti(n,f);if(f+=4,v===1195456820){const b=n[f++];if(b===3){const T=n[f++],E=31&T,D=64&T,O=D?2+E*3:0,R=new Uint8Array(O);if(D){R[0]=T;for(let j=1;j16){const g=[];for(let b=0;b<16;b++){const T=n[f++].toString(16);g.push(T.length==1?"0"+T:T),(b===3||b===5||b===7||b===9)&&g.push("-")}const y=u-16,v=new Uint8Array(y);for(let b=0;b>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(s,4),n=0,i=8;n0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),sU([112,115,115,104],new Uint8Array([i,0,0,0]),s,r,n,a,t)}function rU(s){const e=[];if(s instanceof ArrayBuffer){const t=s.byteLength;let i=0;for(;i+32>>24;if(r!==0&&r!==1)return{offset:t,size:e};const a=s.buffer,u=Bn(new Uint8Array(a,t+12,16));let c=null,d=null,f=0;if(r===0)f=28;else{const y=s.getUint32(28);if(!y||i<32+y*16)return{offset:t,size:e};c=[];for(let v=0;v/\(Windows.+Firefox\//i.test(navigator.userAgent),Vc={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function i1(s,e){const t=Vc[e];return!!t&&!!t[s.slice(0,4)]}function Uh(s,e,t=!0){return!s.split(",").some(i=>!s1(i,e,t))}function s1(s,e,t=!0){var i;const n=Cl(t);return(i=n?.isTypeSupported(jh(s,e)))!=null?i:!1}function jh(s,e){return`${e}/mp4;codecs=${s}`}function WE(s){if(s){const e=s.substring(0,4);return Vc.video[e]}return 2}function $0(s){const e=tL();return s.split(",").reduce((t,i)=>{const r=e&&Ip(i)?9:Vc.video[i];return r?(r*2+t)/(t?3:2):(Vc.audio[i]+t)/(t?2:1)},0)}const Av={};function oU(s,e=!0){if(Av[s])return Av[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[s];for(let n=0;noU(t.toLowerCase(),e))}function uU(s,e){const t=[];if(s){const i=s.split(",");for(let n=0;n4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(s)!==-1)&&(YE(s,"audio")||YE(s,"video")))return s;if(e){const t=e.split(",");if(t.length>1){if(s){for(let i=t.length;i--;)if(t[i].substring(0,4)===s.substring(0,4))return t[i]}return t[0]}}return e||s}function YE(s,e){return i1(s,e)&&s1(s,e)}function cU(s){const e=s.split(",");for(let t=0;t2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function dU(s){if(s.startsWith("av01.")){const e=s.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return s}function XE(s){const e=Cl(s)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function $x(s){return s.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const hU={supported:!0,powerEfficient:!0,smooth:!0},fU={supported:!1,smooth:!1,powerEfficient:!1},iL={supported:!0,configurations:[],decodingInfoResults:[hU]};function sL(s,e){return{supported:!1,configurations:e,decodingInfoResults:[fU],error:s}}function mU(s,e,t,i,n,r){const a=s.videoCodec,u=s.audioCodec?s.audioGroups:null,c=r?.audioCodec,d=r?.channels,f=d?parseInt(d):c?1/0:2;let g=null;if(u!=null&&u.length)try{u.length===1&&u[0]?g=e.groups[u[0]].channels:g=u.reduce((y,v)=>{if(v){const b=e.groups[v];if(!b)throw new Error(`Audio track group ${v} not found`);Object.keys(b.channels).forEach(T=>{y[T]=(y[T]||0)+b.channels[T]})}return y},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(y=>Ip(y))||s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(n,8e6))||!!g&&Pt(f)&&Object.keys(g).some(y=>parseInt(y)>f)}function nL(s,e,t,i={}){const n=s.videoCodec;if(!n&&!s.audioCodec||!t)return Promise.resolve(iL);const r=[],a=pU(s),u=a.length,c=gU(s,e,u>0),d=c.length;for(let f=u||1*d||1;f--;){const g={type:"media-source"};if(u&&(g.video=a[f%u]),d){g.audio=c[f%d];const y=g.audio.bitrate;g.video&&y&&(g.video.bitrate-=y)}r.push(g)}if(n){const f=navigator.userAgent;if(n.split(",").some(g=>Ip(g))&&tL())return Promise.resolve(sL(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),r))}return Promise.all(r.map(f=>{const g=vU(f);return i[g]||(i[g]=t.decodingInfo(f))})).then(f=>({supported:!f.some(g=>!g.supported),configurations:r,decodingInfoResults:f})).catch(f=>({supported:!1,configurations:r,decodingInfoResults:[],error:f}))}function pU(s){var e;const t=(e=s.videoCodec)==null?void 0:e.split(","),i=rL(s),n=s.width||640,r=s.height||480,a=s.frameRate||30,u=s.videoRange.toLowerCase();return t?t.map(c=>{const d={contentType:jh(dU(c),"video"),width:n,height:r,bitrate:i,framerate:a};return u!=="sdr"&&(d.transferFunction=u),d}):[]}function gU(s,e,t){var i;const n=(i=s.audioCodec)==null?void 0:i.split(","),r=rL(s);return n&&s.audioGroups?s.audioGroups.reduce((a,u)=>{var c;const d=u?(c=e.groups[u])==null?void 0:c.tracks:null;return d?d.reduce((f,g)=>{if(g.groupId===u){const y=parseFloat(g.channels||"");n.forEach(v=>{const b={contentType:jh(v,"audio"),bitrate:t?yU(v,r):r};y&&(b.channels=""+y),f.push(b)})}return f},a):a},[]):[]}function yU(s,e){if(e<=1)return 1;let t=128e3;return s==="ec-3"?t=768e3:s==="ac-3"&&(t=64e4),Math.min(e/2,t)}function rL(s){return Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)/1e3)*1e3||1}function vU(s){let e="";const{audio:t,video:i}=s;if(i){const n=$x(i.contentType);e+=`${n}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const n=$x(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const Hx=["NONE","TYPE-0","TYPE-1",null];function xU(s){return Hx.indexOf(s)>-1}const z0=["SDR","PQ","HLG"];function bU(s){return!!s&&z0.indexOf(s)>-1}var n0={No:"",Yes:"YES",v2:"v2"};function QE(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,n=i!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return JE(this._audioGroups,e)}hasSubtitleGroup(e){return JE(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function JE(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function TU(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function SU(s,e){let t=!1,i=[];if(s&&(t=s!=="SDR",i=[s]),e){i=e.allowedVideoRanges||z0.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&TU(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const _U=s=>{const e=new WeakSet;return(t,i)=>{if(s&&(i=s(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Cs=(s,e)=>JSON.stringify(s,_U(e));function EU(s,e,t,i,n){const r=Object.keys(s),a=i?.channels,u=i?.audioCodec,c=n?.videoCodec,d=a&&parseInt(a)===2;let f=!1,g=!1,y=1/0,v=1/0,b=1/0,T=1/0,E=0,D=[];const{preferHDR:O,allowedVideoRanges:R}=SU(e,n);for(let W=r.length;W--;){const I=s[r[W]];f||(f=I.channels[2]>0),y=Math.min(y,I.minHeight),v=Math.min(v,I.minFramerate),b=Math.min(b,I.minBitrate),R.filter(X=>I.videoRanges[X]>0).length>0&&(g=!0)}y=Pt(y)?y:0,v=Pt(v)?v:0;const j=Math.max(1080,y),F=Math.max(30,v);b=Pt(b)?b:t,t=Math.max(b,t),g||(e=void 0);const G=r.length>1;return{codecSet:r.reduce((W,I)=>{const N=s[I];if(I===W)return W;if(D=g?R.filter(X=>N.videoRanges[X]>0):[],G){if(N.minBitrate>t)return Ra(I,`min bitrate of ${N.minBitrate} > current estimate of ${t}`),W;if(!N.hasDefaultAudio)return Ra(I,"no renditions with default or auto-select sound found"),W;if(u&&I.indexOf(u.substring(0,4))%5!==0)return Ra(I,`audio codec preference "${u}" not found`),W;if(a&&!d){if(!N.channels[a])return Ra(I,`no renditions with ${a} channel sound found (channels options: ${Object.keys(N.channels)})`),W}else if((!u||d)&&f&&N.channels[2]===0)return Ra(I,"no renditions with stereo sound found"),W;if(N.minHeight>j)return Ra(I,`min resolution of ${N.minHeight} > maximum of ${j}`),W;if(N.minFramerate>F)return Ra(I,`min framerate of ${N.minFramerate} > maximum of ${F}`),W;if(!D.some(X=>N.videoRanges[X]>0))return Ra(I,`no variants with VIDEO-RANGE of ${Cs(D)} found`),W;if(c&&I.indexOf(c.substring(0,4))%5!==0)return Ra(I,`video codec preference "${c}" not found`),W;if(N.maxScore=$0(W)||N.fragmentError>s[W].fragmentError)?W:(T=N.minIndex,E=N.maxScore,I)},void 0),videoRanges:D,preferHDR:O,minFramerate:v,minBitrate:b,minIndex:T}}function Ra(s,e){ys.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function aL(s){return s.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function wU(s,e,t,i){return s.slice(t,i+1).reduce((n,r,a)=>{if(!r.codecSet)return n;const u=r.audioGroups;let c=n[r.codecSet];c||(n[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!u,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const d=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,d),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,a),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,u&&u.forEach(f=>{if(!f)return;const g=e.groups[f];g&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?g.hasDefault:g.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(g.channels).forEach(y=>{c.channels[y]=(c.channels[y]||0)+g.channels[y]}))}),n},{})}function ew(s){if(!s)return s;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:r}=s;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:r}}function Ha(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;ii.indexOf(n)===-1)}function ou(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function CU(s,e,t,i,n){const r=e[i],u=e.reduce((y,v,b)=>{const T=v.uri;return(y[T]||(y[T]=[])).push(b),y},{})[r.uri];u.length>1&&(i=Math.max.apply(Math,u));const c=r.videoRange,d=r.frameRate,f=r.codecSet.substring(0,4),g=tw(e,i,y=>{if(y.videoRange!==c||y.frameRate!==d||y.codecSet.substring(0,4)!==f)return!1;const v=y.audioGroups,b=t.filter(T=>!v||v.indexOf(T.groupId)!==-1);return Ha(s,b,n)>-1});return g>-1?g:tw(e,i,y=>{const v=y.audioGroups,b=t.filter(T=>!v||v.indexOf(T.groupId)!==-1);return Ha(s,b,n)>-1})}function tw(s,e,t){for(let i=e;i>-1;i--)if(t(s[i]))return i;for(let i=e+1;i{var i;const{fragCurrent:n,partCurrent:r,hls:a}=this,{autoLevelEnabled:u,media:c}=a;if(!n||!c)return;const d=performance.now(),f=r?r.stats:n.stats,g=r?r.duration:n.duration,y=d-f.loading.start,v=a.minAutoLevel,b=n.level,T=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||b<=v){this.clearTimer(),this._nextAutoLevel=-1;return}if(!u)return;const E=T>-1&&T!==b,D=!!t||E;if(!D&&(c.paused||!c.playbackRate||!c.readyState))return;const O=a.mainForwardBufferInfo;if(!D&&O===null)return;const R=this.bwEstimator.getEstimateTTFB(),j=Math.abs(c.playbackRate);if(y<=Math.max(R,1e3*(g/(j*2))))return;const F=O?O.len/j:0,G=f.loading.first?f.loading.first-f.loading.start:-1,L=f.loaded&&G>-1,W=this.getBwEstimate(),I=a.levels,N=I[b],X=Math.max(f.loaded,Math.round(g*(n.bitrate||N.averageBitrate)/8));let V=L?y-G:y;V<1&&L&&(V=Math.min(y,f.loaded*8/W));const Y=L?f.loaded*1e3/V:0,ne=R/1e3,ie=Y?(X-f.loaded)/Y:X*8/W+ne;if(ie<=F)return;const K=Y?Y*8:W,q=((i=t?.details||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,Z=this.hls.config.abrBandWidthUpFactor;let te=Number.POSITIVE_INFINITY,le;for(le=b-1;le>v;le--){const pe=I[le].maxBitrate,be=!I[le].details||q;if(te=this.getTimeToLoadFrag(ne,K,g*pe,be),te=ie||te>g*10)return;L?this.bwEstimator.sample(y-Math.min(R,G),f.loaded):this.bwEstimator.sampleTTFB(y);const z=I[le].maxBitrate;this.getBwEstimate()*Z>z&&this.resetEstimator(z);const re=this.findBestLevel(z,v,le,0,F,1,1);re>-1&&(le=re),this.warn(`Fragment ${n.sn}${r?" part "+r.index:""} of level ${b} is loading too slowly; Fragment duration: ${n.duration.toFixed(3)} Time to underbuffer: ${F.toFixed(3)} s Estimated load time for current fragment: ${ie.toFixed(3)} s Estimated load time for down switch fragment: ${te.toFixed(3)} s - TTFB estimate: ${z|0} ms - Current BW estimate: ${Dt(Y)?Y|0:"Unknown"} bps + TTFB estimate: ${G|0} ms + Current BW estimate: ${Pt(W)?W|0:"Unknown"} bps New BW estimate: ${this.getBwEstimate()|0} bps - Switching to level ${re} @ ${U|0} bps`),a.nextLoadLevel=a.nextAutoLevel=re,this.clearTimer();const Z=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===re&&re>0){const fe=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${re>0?"and switching down":""} + Switching to level ${le} @ ${z|0} bps`),a.nextLoadLevel=a.nextAutoLevel=le,this.clearTimer();const Q=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===le&&le>0){const pe=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${le>0?"and switching down":""} Fragment duration: ${n.duration.toFixed(3)} s - Time to underbuffer: ${fe.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,re>v){let xe=this.findBestLevel(this.hls.levels[v].bitrate,v,re,0,fe,1,1);xe===-1&&(xe=v),this.hls.nextLoadLevel=this.hls.nextAutoLevel=xe,this.resetEstimator(this.hls.levels[xe].bitrate)}}};E||ie>te*2?Z():this.timer=self.setInterval(Z,te*1e3),a.trigger($.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:r,stats:f})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new x6(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_LOADED,this.onFragLoaded,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_LOADED,this.onFragLoaded,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off($.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Oe.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:r}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const a=performance.now(),u=r?r.stats:i.stats,c=a-u.loading.start,d=u.loading.first?u.loading.first-u.loading.start:-1;if(u.loaded&&d>-1){const p=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(p,d),u.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const r=e+i/t,a=n?e+this.lastLevelLoadSec:0;return r+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,r=n.end-n.first;Dt(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===Ot.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=i?i.duration:t.duration,a=this.hls.levels[t.level],u=(a.loaded?a.loaded.bytes:0)+n.loaded,c=(a.loaded?a.loaded.duration:0)+r;a.loaded={bytes:u,duration:c},a.realBitrate=Math.round(8*u/c)}if(t.bitrateTest){const r={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered($.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,r=n!=null&&n.stats.loaded?n.stats:i.stats;if(r.aborted||this.ignoreFragment(i))return;const a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ot.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,n,1,1);if(r>-1)return r;const a=this.hls.firstLevel,u=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${u}`),u}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,r)&&a[e].loadError<=a[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:r,minAutoLevel:a}=i,u=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),d=this.getStarvationDelay();let f=r.abrBandWidthFactor,p=r.abrBandWidthUpFactor;if(d){const E=this.findBestLevel(c,a,n,d,0,f,p);if(E>=0)return this.rebufferNotice=-1,E}let y=u?Math.min(u,r.maxStarvationDelay):r.maxStarvationDelay;if(!d){const E=this.bitrateTestDelay;E&&(y=(u?Math.min(u,r.maxLoadingDelay):r.maxLoadingDelay)-E,this.info(`bitrate test took ${Math.round(1e3*E)}ms, set first fragment max fetchDuration to ${Math.round(1e3*y)} ms`),f=p=1)}const v=this.findBestLevel(c,a,n,d,y,f,p);if(this.rebufferNotice!==v&&(this.rebufferNotice=v,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`)),v>-1)return v;const b=i.levels[a],T=i.loadLevelObj;return T&&b?.bitrate=t;W--){var ie;const K=b[W],Q=W>p;if(!K)continue;if(D.useMediaCapabilities&&!K.supportedResult&&!K.supportedPromise){const xe=navigator.mediaCapabilities;typeof xe?.decodingInfo=="function"&&J6(K,I,z,N,e,Y)?(K.supportedPromise=YD(K,I,xe,this.supportedCache),K.supportedPromise.then(ge=>{if(!this.hls)return;K.supportedResult=ge;const Ce=this.hls.levels,Me=Ce.indexOf(K);ge.error?this.warn(`MediaCapabilities decodingInfo error: "${ge.error}" for level ${Me} ${Ss(ge)}`):ge.supported?ge.decodingInfoResults.some(Re=>Re.smooth===!1||Re.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Me} not smooth or powerEfficient: ${Ss(ge)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Me} ${Ss(ge)}`),Me>-1&&Ce.length>1&&(this.log(`Removing unsupported level ${Me}`),this.hls.removeLevel(Me),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(ge=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${ge}`)})):K.supportedResult=KD}if((F&&K.codecSet!==F||z&&K.videoRange!==z||Q&&N>K.frameRate||!Q&&N>0&&Nxe.smooth===!1))&&(!j||W!==X)){ae.push(W);continue}const te=K.details,re=(v?te?.partTarget:te?.averagetargetduration)||G;let U;Q?U=u*e:U=a*e;const ne=G&&n>=G*2&&r===0?K.averageBitrate:K.maxBitrate,Z=this.getTimeToLoadFrag(q,U,ne*re,te===void 0);if(U>=ne&&(W===f||K.loadError===0&&K.fragmentError===0)&&(Z<=q||!Dt(Z)||R&&!this.bitrateTestDelay||Z${W} adjustedbw(${Math.round(U)})-bitrate=${Math.round(U-ne)} ttfb:${q.toFixed(1)} avgDuration:${re.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${Z.toFixed(1)} firstSelection:${j} codecSet:${K.codecSet} videoRange:${K.videoRange} hls.loadLevel:${E}`)),j&&(this.firstSelection=W),W}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const ZD={search:function(s,e){let t=0,i=s.length-1,n=null,r=null;for(;t<=i;){n=(t+i)/2|0,r=s[n];const a=e(r);if(a>0)t=n+1;else if(a<0)i=n-1;else return r}return null}};function pU(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!Dt(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const n=s[s.length-1].endProgramDateTime;if(e>=(n||0))return null;for(let r=0;r0&&u<15e-7&&(t+=15e-7),r&&s.level!==r.level&&r.end<=s.end&&(r=e[2+s.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!s||s.level===r.level)&&YE(t,i,r)===0||gU(r,s,Math.min(n,i))))return r;const a=ZD.search(e,YE.bind(null,t,i));return a&&(a!==s||!r)?a:r}function gU(s,e,t){if(e&&e.start===0&&e.level0){const i=e.tagList.reduce((n,r)=>(r[0]==="INF"&&(n+=parseFloat(r[1])),n),t);return s.start<=i}return!1}function YE(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function yU(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function JD(s,e,t){if(s&&s.startCC<=e&&s.endCC>=e){let i=s.fragments;const{fragmentHint:n}=s;n&&(i=i.concat(n));let r;return ZD.search(i,a=>a.cce?-1:(r=a,a.end<=t?1:a.start>t?-1:0)),r||null}return null}function $0(s){switch(s.details){case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_TIMEOUT:case Oe.LEVEL_LOAD_TIMEOUT:case Oe.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function eL(s){return s.details.startsWith("key")}function tL(s){return eL(s)&&!!s.frag&&!s.frag.decryptdata}function XE(s,e){const t=$0(e);return s.default[`${t?"timeout":"error"}Retry`]}function t1(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function QE(s){return us(us({},s),{errorRetry:null,timeoutRetry:null})}function H0(s,e,t,i){if(!s)return!1;const n=i?.code,r=e499)}function jx(s){return s===0&&navigator.onLine===!1}var In={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Ir={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class xU extends Jr{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on($.ERROR,this.onError,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off($.ERROR,this.onError,this),e.off($.ERROR,this.onErrorOut,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===Ot.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const n=e.audioGroups;if(n)return this.hls.allAudioTracks.filter(a=>n.indexOf(a.groupId)>=0).some(a=>{var u;return(u=a.details)==null?void 0:u.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,r=t.context;switch(t.details){case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Oe.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Ac();return}case Oe.FRAG_GAP:case Oe.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=In.SendAlternateToPenaltyBox;return}case Oe.LEVEL_EMPTY_ERROR:case Oe.LEVEL_PARSING_ERROR:{var a;const c=t.parent===Ot.MAIN?t.level:n.loadLevel;t.details===Oe.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case Oe.LEVEL_LOAD_ERROR:case Oe.LEVEL_LOAD_TIMEOUT:typeof r?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case Oe.AUDIO_TRACK_LOAD_ERROR:case Oe.AUDIO_TRACK_LOAD_TIMEOUT:case Oe.SUBTITLE_LOAD_ERROR:case Oe.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=n.loadLevelObj;if(c&&(r.type===ji.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===ji.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=In.SendAlternateToPenaltyBox,t.errorAction.flags=Ir.MoveAllAlternatesMatchingHost;return}}return;case Oe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:In.SendAlternateToPenaltyBox,flags:Ir.MoveAllAlternatesMatchingHDCP};return;case Oe.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Oe.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Oe.KEY_SYSTEM_NO_SESSION:t.errorAction={action:In.SendAlternateToPenaltyBox,flags:Ir.MoveAllAlternatesMatchingKey};return;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.REMUX_ALLOC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(!t.errorAction){var u;t.errorAction=this.getLevelSwitchAction(t,(u=t.level)!=null?u:n.loadLevel)}return;case Oe.INTERNAL_EXCEPTION:case Oe.BUFFER_APPENDING_ERROR:case Oe.BUFFER_FULL_ERROR:case Oe.LEVEL_SWITCH_ERROR:case Oe.BUFFER_STALLED_ERROR:case Oe.BUFFER_SEEK_OVER_HOLE:case Oe.BUFFER_NUDGE_ON_STALL:t.errorAction=Ac();return}t.type===jt.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Ac())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=XE(i.config.playlistLoadPolicy,e),r=this.playlistError++;if(H0(n,r,$0(e),e.response))return{action:In.RetryRequest,flags:Ir.None,retryConfig:n,retryCount:r};const u=this.getLevelSwitchAction(e,t);return n&&(u.retryConfig=n,u.retryCount=r),u}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,u=XE(eL(e)?a:r,e),c=t.levels.reduce((f,p)=>f+p.fragmentError,0);if(n&&(e.details!==Oe.FRAG_GAP&&n.fragmentError++,!tL(e)&&H0(u,c,$0(e),e.response)))return{action:In.RetryRequest,flags:Ir.None,retryConfig:u,retryCount:c};const d=this.getLevelSwitchAction(e,i);return u&&(d.retryConfig=u,d.retryCount=c),d}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var r,a;const d=e.details;n.loadError++,d===Oe.BUFFER_APPEND_ERROR&&n.fragmentError++;let f=-1;const{levels:p,loadLevel:y,minAutoLevel:v,maxAutoLevel:b}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const T=(r=e.frag)==null?void 0:r.type,D=(T===Ot.AUDIO&&d===Oe.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===Oe.BUFFER_ADD_CODEC_ERROR||d===Oe.BUFFER_APPEND_ERROR))&&p.some(({audioCodec:z})=>n.audioCodec!==z),R=e.sourceBufferName==="video"&&(d===Oe.BUFFER_ADD_CODEC_ERROR||d===Oe.BUFFER_APPEND_ERROR)&&p.some(({codecSet:z,audioCodec:N})=>n.codecSet!==z&&n.audioCodec===N),{type:j,groupId:F}=(a=e.context)!=null?a:{};for(let z=p.length;z--;){const N=(z+y)%p.length;if(N!==y&&N>=v&&N<=b&&p[N].loadError===0){var u,c;const Y=p[N];if(d===Oe.FRAG_GAP&&T===Ot.MAIN&&e.frag){const L=p[N].details;if(L){const I=_u(e.frag,L.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(j===ji.AUDIO_TRACK&&Y.hasAudioGroup(F)||j===ji.SUBTITLE_TRACK&&Y.hasSubtitleGroup(F))continue;if(T===Ot.AUDIO&&(u=n.audioGroups)!=null&&u.some(L=>Y.hasAudioGroup(L))||T===Ot.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(L=>Y.hasSubtitleGroup(L))||D&&n.audioCodec===Y.audioCodec||R&&n.codecSet===Y.codecSet||!D&&n.codecSet!==Y.codecSet)continue}f=N;break}}if(f>-1&&i.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:In.SendAlternateToPenaltyBox,flags:Ir.None,nextAutoLevel:f}}return{action:In.SendAlternateToPenaltyBox,flags:Ir.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case In.DoNothing:break;case In.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Oe.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,r=i.nextAutoLevel;switch(n){case Ir.None:this.switchLevel(e,r);break;case Ir.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),d=t.levels[c],f=d?.attrs["HDCP-LEVEL"];if(i.hdcpLevel=f,f==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(f){t.maxHdcpLevel=Ux[Ux.indexOf(f)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Ir.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const d=this.hls.levels,f=d.length;for(let y=f;y--;)if(this.variantHasKey(d[y],c)){var a,u;this.log(`Banned key found in level ${y} (${d[y].bitrate}bps) or audio group "${(a=d[y].audioGroups)==null?void 0:a.join(",")}" (${(u=e.frag)==null?void 0:u.type} fragment) ${On(c.keyId||[])}`),d[y].fragmentError++,d[y].loadError++,this.log(`Removing level ${y} with key error (${e.error})`),this.hls.removeLevel(y)}const p=e.frag;if(this.hls.levels.length{const c=this.fragments[u];if(!c||a>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===i&&this.removeFragment(c.body);return}const d=c.range[e];if(d){if(d.time.length===0){this.removeFragment(c.body);return}d.time.some(f=>{const p=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return p&&this.removeFragment(c.body),p})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=sc(i),r=this.fragments[n];if(!r||r.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(u=>{const c=i.elementaryStreams[u];if(!c)return;const d=t[u],f=a||c.partial===!0;r.range[u]=this.getBufferedTimes(i,e.part,f,d)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,i),Rm(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=ZE(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=sc(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,this.bufferedEnd(n,e))}getBufferedTimes(e,t,i,n){const r={time:[],partial:i},a=e.start,u=e.end,c=e.minEndPTS||u,d=e.maxStartPTS||a;for(let f=0;f=p&&c<=y){r.time.push({startPTS:Math.max(a,n.start(f)),endPTS:Math.min(u,n.end(f))});break}else if(ap){const v=Math.max(a,n.start(f)),b=Math.min(u,n.end(f));b>v&&(r.partial=!0,r.time.push({startPTS:v,endPTS:b}))}else if(u<=p)break}return r}getPartialFragment(e){let t=null,i,n,r,a=0;const{bufferPadding:u,fragments:c}=this;return Object.keys(c).forEach(d=>{const f=c[d];f&&Rm(f)&&(n=f.body.start-u,r=f.body.end+u,e>=n&&e<=r&&(i=Math.min(e-n,r-e),a<=i&&(t=f.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Rm(t))}getState(e){const t=sc(e),i=this.fragments[t];return i?i.buffered?Rm(i)?vn.PARTIAL:vn.OK:vn.APPENDING:vn.NOT_LOADED}isTimeBuffered(e,t,i){let n,r;for(let a=0;a=n&&t<=r)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,r=sc(i);this.fragments[r]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:r,type:a}=t;if(i.sn==="initSegment")return;const u=i.type;if(n){let d=this.activePartLists[u];d||(this.activePartLists[u]=d=[]),d.push(n)}this.timeRanges=r;const c=r[a];this.detectEvictedFragments(a,c,u,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=sc(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const r=t[i[n]];if(r?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const u=this.fragments[a];if(!u)return;const c=u.body;c.type!==i||n&&!c.gap||c.starte&&(u.buffered||r)&&this.removeFragment(c)})}removeFragment(e){const t=sc(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=ZE(i,r=>r.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function Rm(s){var e,t,i;return s.buffered&&!!(s.body.gap||(e=s.range.video)!=null&&e.partial||(t=s.range.audio)!=null&&t.partial||(i=s.range.audiovideo)!=null&&i.partial)}function sc(s){return`${s.type}_${s.level}_${s.sn}`}function ZE(s,e){return s.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Cl={cbc:0,ctr:1};class TU{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Cl.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Cl.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function SU(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?s.slice(0,e-t):s}class _U{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],r=i[1],a=i[2],u=i[3],c=this.invSubMix,d=c[0],f=c[1],p=c[2],y=c[3],v=new Uint32Array(256);let b=0,T=0,E=0;for(E=0;E<256;E++)E<128?v[E]=E<<1:v[E]=E<<1^283;for(E=0;E<256;E++){let D=T^T<<1^T<<2^T<<3^T<<4;D=D>>>8^D&255^99,e[b]=D,t[D]=b;const O=v[b],R=v[O],j=v[R];let F=v[D]*257^D*16843008;n[b]=F<<24|F>>>8,r[b]=F<<16|F>>>16,a[b]=F<<8|F>>>24,u[b]=F,F=j*16843009^R*65537^O*257^b*16843008,d[D]=F<<24|F>>>8,f[D]=F<<16|F>>>16,p[D]=F<<8|F>>>24,y[D]=F,b?(b=O^v[v[v[j^O]]],T^=v[v[T]]):b=T=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n{const u=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(u,t,i,n);const c=this.flush();c?r(c.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:r,currentResult:a,remainderData:u}=this;if(n!==Cl.cbc||t.byteLength!==16)return cs.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),u&&(e=Xr(u,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;r&&(i=r);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new _U),d.expandKey(t);const f=a;return this.currentResult=d.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new EU(this.subtle,t,n)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new TU(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(cs.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%AU;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(cs.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const JE=Math.pow(2,17);class kU{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new vo({type:jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,a=n.loader;return new Promise((u,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(b=>b[0]==="GAP")){c(tw(e));return}else e.gap=!1;const d=this.loader=r?new r(n):new a(n),f=ew(e);e.loader=d;const p=QE(n.fragLoadPolicy.default),y={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:JE};e.stats=d.stats;const v={onSuccess:(b,T,E,D)=>{this.resetLoader(e,d);let O=b.data;E.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(O.slice(0,16)),O=O.slice(16)),u({frag:e,part:null,payload:O,networkDetails:D})},onError:(b,T,E,D)=>{this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:us({url:i,data:void 0},b),error:new Error(`HTTP Error ${b.code} ${b.text}`),networkDetails:E,stats:D}))},onAbort:(b,T,E)=>{this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:E,stats:b}))},onTimeout:(b,T,E)=>{this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${y.timeout}ms`),networkDetails:E,stats:b}))}};t&&(v.onProgress=(b,T,E,D)=>t({frag:e,part:null,payload:E,networkDetails:D})),d.load(f,y,v)})}loadPart(e,t,i){this.abort();const n=this.config,r=n.fLoader,a=n.loader;return new Promise((u,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(tw(e,t));return}const d=this.loader=r?new r(n):new a(n),f=ew(e,t);e.loader=d;const p=QE(n.fragLoadPolicy.default),y={loadPolicy:p,timeout:p.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:JE};t.stats=d.stats,d.load(f,y,{onSuccess:(v,b,T,E)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const D={frag:e,part:t,payload:v.data,networkDetails:E};i(D),u(D)},onError:(v,b,T,E)=>{this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:us({url:f.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:T,stats:E}))},onAbort:(v,b,T)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:T,stats:v}))},onTimeout:(v,b,T)=>{this.resetLoader(e,d),c(new vo({type:jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${y.timeout}ms`),networkDetails:T,stats:v}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,r=n.total;if(i.loaded+=n.loaded,r){const c=Math.round(e.duration/t.duration),d=Math.min(Math.round(i.loaded/r),c),p=(c-d)*Math.round(i.loaded/d);i.total=i.loaded+p}else i.total=Math.max(i.loaded,i.total);const a=i.loading,u=n.loading;a.start?a.first+=u.first-u.start:(a.start=u.start,a.first=u.first),a.end=u.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ew(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(Dt(n)&&Dt(r)){var a;let u=n,c=r;if(s.sn==="initSegment"&&CU((a=s.decryptdata)==null?void 0:a.method)){const d=r-n;d%16&&(c=r+(16-d%16)),n!==0&&(i.resetIV=!0,u=n-16)}i.rangeStart=u,i.rangeEnd=c}return i}function tw(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:jt.MEDIA_ERROR,details:Oe.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new vo(i)}function CU(s){return s==="AES-128"||s==="AES-256"}class vo extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class iL extends Jr{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class s1{constructor(e,t,i,n=0,r=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Im(),this.buffering={audio:Im(),video:Im(),audiovideo:Im()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=r,this.partial=a}}function Im(){return{start:0,executeStart:0,executeEnd:0,end:0}}const iw={length:0,start:()=>0,end:()=>0};class vi{static isBuffered(e,t){if(e){const i=vi.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=vi.getBuffered(e);return vi.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i1&&e.sort((f,p)=>f.start-p.start||p.end-f.end);let n=-1,r=[];if(i)for(let f=0;f=e[f].start&&t<=e[f].end&&(n=f);const p=r.length;if(p){const y=r[p-1].end;e[f].start-yy&&(r[p-1].end=e[f].end):r.push(e[f])}else r.push(e[f])}else r=e;let a=0,u,c=t,d=t;for(let f=0;f=p&&t<=y&&(n=f),t+i>=p&&t{const n=i.substring(2,i.length-1),r=t?.[n];return r===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):r})}return e}function nw(s,e,t){let i=s.variableList;i||(s.variableList=i={});let n,r;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(n))r=a.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(a){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else n=e.NAME,r=e.VALUE;n in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=r||""}function DU(s,e,t){const i=e.IMPORT;if(t&&i in t){let n=s.variableList;n||(s.variableList=n={}),n[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const LU=/^(\d+)x(\d+)$/,rw=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Bs{constructor(e,t){typeof e=="string"&&(e=Bs.parseAttrList(e,t)),gs(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;nNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,r)=>(n[r.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=LU.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={};for(rw.lastIndex=0;(i=rw.exec(e))!==null;){const a=i[1].trim();let u=i[2];const c=u.indexOf('"')===0&&u.lastIndexOf('"')===u.length-1;let d=!1;if(c)u=u.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(c||d))u=$x(t,u);else if(!d&&!c)switch(a){case"CLOSED-CAPTIONS":if(u==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":cs.warn(`${e}: attribute ${a} is missing quotes`)}n[a]=u}return n}}const RU="com.apple.hls.interstitial";function IU(s){return s!=="ID"&&s!=="CLASS"&&s!=="CUE"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function NU(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"||s==="SCTE35-CMD"}class nL{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(n=t?.tagOrder)!=null?n:i,t){const r=t.attr;for(const a in r)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==r[a]){cs.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=gs(new Bs({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=t?.endDate||new Date(this.attr["END-DATE"]);Dt(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(cs.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Dt(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===RU}get isValid(){return!!this.id&&!this._badValueForSameId&&Dt(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const OU=10;class MU{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?Dt(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||OU}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function z0(s,e){return s.length===e.length?!s.some((t,i)=>t!==e[i]):!1}function aw(s,e){return!s&&!e?!0:!s||!e?!1:z0(s,e)}function kc(s){return s==="AES-128"||s==="AES-256"||s==="AES-256-CTR"}function n1(s){switch(s){case"AES-128":case"AES-256":return Cl.cbc;case"AES-256-CTR":return Cl.ctr;default:throw new Error(`invalid full segment method ${s}`)}}function r1(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Hx(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}function PU(s){const e=Hx(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function rL(s){const e=function(i,n,r){const a=i[n];i[n]=i[r],i[r]=a};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function aL(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const r=n[0]==="base64",a=n[1];r?(i.splice(-1,1),t=r1(a)):t=PU(a)}}return t}const V0=typeof self<"u"?self:void 0;var Fs={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Mn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function e0(s){switch(s){case Mn.FAIRPLAY:return Fs.FAIRPLAY;case Mn.PLAYREADY:return Fs.PLAYREADY;case Mn.WIDEVINE:return Fs.WIDEVINE;case Mn.CLEARKEY:return Fs.CLEARKEY}}function _v(s){switch(s){case Fs.FAIRPLAY:return Mn.FAIRPLAY;case Fs.PLAYREADY:return Mn.PLAYREADY;case Fs.WIDEVINE:return Mn.WIDEVINE;case Fs.CLEARKEY:return Mn.CLEARKEY}}function mh(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Fs.FAIRPLAY,Fs.WIDEVINE,Fs.PLAYREADY,Fs.CLEARKEY].filter(n=>!!e[n]):[];return!i[Fs.WIDEVINE]&&t&&i.push(Fs.WIDEVINE),i}const oL=(function(s){return V0!=null&&(s=V0.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function BU(s,e,t,i){let n;switch(s){case Fs.FAIRPLAY:n=["cenc","sinf"];break;case Fs.WIDEVINE:case Fs.PLAYREADY:n=["cenc"];break;case Fs.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return FU(n,e,t,i)}function FU(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function UU(s){var e;return!!s&&(s.sessionType==="persistent-license"||!!((e=s.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function lL(s){const e=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const u=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(u){const c=r1(u).subarray(0,16);return rL(c),c}}return null}let nc={};class El{static clearKeyUriToKeyIdMap(){nc={}}static setKeyIdForUri(e,t){nc[e]=t}static addKeyIdForUri(e){const t=Object.keys(nc).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),nc[e]=i,i}constructor(e,t,i,n=[1],r=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!kc(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(PD(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&z0(e.keyFormatVersions,this.keyFormatVersions)&&aw(e.iv,this.iv)&&aw(e.keyId,this.keyId)}isSupported(){if(this.method){if(kc(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Mn.FAIRPLAY:case Mn.WIDEVINE:case Mn.PLAYREADY:case Mn.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(kc(this.method)){let r=this.iv;return r||(typeof e!="number"&&(cs.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=$U(e)),new El(this.method,this.uri,"identity",this.keyFormatVersions,r)}if(this.keyId){const r=nc[this.uri];if(r&&!z0(this.keyId,r)&&El.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=aL(this.uri);if(i)switch(this.keyFormat){case Mn.WIDEVINE:if(this.pssh=i,!this.keyId){const r=V6(i.buffer);if(r.length){var n;const a=r[0];this.keyId=(n=a.kids)!=null&&n.length?a.kids[0]:null}}this.keyId||(this.keyId=ow(t));break;case Mn.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=z6(r,null,i),this.keyId=lL(i);break}default:{let r=i.subarray(0,16);if(r.length!==16){const a=new Uint8Array(16);a.set(r,16-r.length),r=a}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=jU(t),r||(r=ow(t),r||(r=nc[this.uri])),r&&(this.keyId=r,El.setKeyIdForUri(this.uri,r))}return this}}function jU(s){const e=s?.[Mn.WIDEVINE];return e?e.keyId:null}function ow(s){const e=s?.[Mn.PLAYREADY];if(e){const t=aL(e.uri);if(t)return lL(t)}return null}function $U(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const lw=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,uw=/#EXT-X-MEDIA:(.*)/g,HU=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ev=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),zU=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Fa{static findGroup(e,t){for(let i=0;i0&&r.length({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(uw.lastIndex=0;(n=uw.exec(e))!==null;){const d=new Bs(n[1],i),f=d.TYPE;if(f){const p=u[f],y=r[f]||[];r[f]=y;const v=d.LANGUAGE,b=d["ASSOC-LANGUAGE"],T=d.CHANNELS,E=d.CHARACTERISTICS,D=d["INSTREAM-ID"],O={attrs:d,bitrate:0,id:c++,groupId:d["GROUP-ID"]||"",name:d.NAME||v||"",type:f,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:v,url:d.URI?Fa.resolve(d.URI,t):""};if(b&&(O.assocLang=b),T&&(O.channels=T),E&&(O.characteristics=E),D&&(O.instreamId=D),p!=null&&p.length){const R=Fa.findGroup(p,O.groupId)||p[0];fw(O,R,"audioCodec"),fw(O,R,"textCodec")}y.push(O)}}return r}static parseLevelPlaylist(e,t,i,n,r,a){var u;const c={url:t},d=new MU(t),f=d.fragments,p=[];let y=null,v=0,b=0,T=0,E=0,D=0,O=null,R=new bv(n,c),j,F,z,N=-1,Y=!1,L=null,I;if(Ev.lastIndex=0,d.m3u8=e,d.hasVariableRefs=sw(e),((u=Ev.exec(e))==null?void 0:u[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(j=Ev.exec(e))!==null;){Y&&(Y=!1,R=new bv(n,c),R.playlistOffset=T,R.setStart(T),R.sn=v,R.cc=E,D&&(R.bitrate=D),R.level=i,y&&(R.initSegment=y,y.rawProgramDateTime&&(R.rawProgramDateTime=y.rawProgramDateTime,y.rawProgramDateTime=null),L&&(R.setByteRange(L),L=null)));const ae=j[1];if(ae){R.duration=parseFloat(ae);const ie=(" "+j[2]).slice(1);R.title=ie||null,R.tagList.push(ie?["INF",ae,ie]:["INF",ae])}else if(j[3]){if(Dt(R.duration)){R.playlistOffset=T,R.setStart(T),z&&pw(R,z,d),R.sn=v,R.level=i,R.cc=E,f.push(R);const ie=(" "+j[3]).slice(1);R.relurl=$x(d,ie),zx(R,O,p),O=R,T+=R.duration,v++,b=0,Y=!0}}else{if(j=j[0].match(zU),!j){cs.warn("No matches on slow regex match for level playlist!");continue}for(F=1;F0&&gw(d,ie,j),v=d.startSN=parseInt(W);break;case"SKIP":{d.skippedSegments&&fo(d,ie,j);const Q=new Bs(W,d),te=Q.decimalInteger("SKIPPED-SEGMENTS");if(Dt(te)){d.skippedSegments+=te;for(let U=te;U--;)f.push(null);v+=te}const re=Q.enumeratedString("RECENTLY-REMOVED-DATERANGES");re&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(re.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&fo(d,ie,j),d.targetduration=Math.max(parseInt(W),1);break;case"VERSION":d.version!==null&&fo(d,ie,j),d.version=parseInt(W);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||fo(d,ie,j),d.live=!1;break;case"#":(W||K)&&R.tagList.push(K?[W,K]:[W]);break;case"DISCONTINUITY":E++,R.tagList.push(["DIS"]);break;case"GAP":R.gap=!0,R.tagList.push([ie]);break;case"BITRATE":R.tagList.push([ie,W]),D=parseInt(W)*1e3,Dt(D)?R.bitrate=D:D=0;break;case"DATERANGE":{const Q=new Bs(W,d),te=new nL(Q,d.dateRanges[Q.ID],d.dateRangeTagCount);d.dateRangeTagCount++,te.isValid||d.skippedSegments?d.dateRanges[te.id]=te:cs.warn(`Ignoring invalid DATERANGE tag: "${W}"`),R.tagList.push(["EXT-X-DATERANGE",W]);break}case"DEFINE":{{const Q=new Bs(W,d);"IMPORT"in Q?DU(d,Q,a):nw(d,Q,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?fo(d,ie,j):f.length>0&&gw(d,ie,j),d.startCC=E=parseInt(W);break;case"KEY":{const Q=cw(W,t,d);if(Q.isSupported()){if(Q.method==="NONE"){z=void 0;break}z||(z={});const te=z[Q.keyFormat];te!=null&&te.matches(Q)||(te&&(z=gs({},z)),z[Q.keyFormat]=Q)}else cs.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${W}"`);break}case"START":d.startTimeOffset=dw(W);break;case"MAP":{const Q=new Bs(W,d);if(R.duration){const te=new bv(n,c);mw(te,Q,i,z),y=te,R.initSegment=y,y.rawProgramDateTime&&!R.rawProgramDateTime&&(R.rawProgramDateTime=y.rawProgramDateTime)}else{const te=R.byteRangeEndOffset;if(te){const re=R.byteRangeStartOffset;L=`${te-re}@${re}`}else L=null;mw(R,Q,i,z),y=R,Y=!0}y.cc=E;break}case"SERVER-CONTROL":{I&&fo(d,ie,j),I=new Bs(W),d.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),d.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&fo(d,ie,j);const Q=new Bs(W);d.partTarget=Q.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Q=d.partList;Q||(Q=d.partList=[]);const te=b>0?Q[Q.length-1]:void 0,re=b++,U=new Bs(W,d),ne=new D6(U,R,c,re,te);Q.push(ne),R.duration+=ne.duration;break}case"PRELOAD-HINT":{const Q=new Bs(W,d);d.preloadHint=Q;break}case"RENDITION-REPORT":{const Q=new Bs(W,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(Q);break}default:cs.warn(`line parsed but not handled: ${j}`);break}}}O&&!O.relurl?(f.pop(),T-=O.duration,d.partList&&(d.fragmentHint=O)):d.partList&&(zx(R,O,p),R.cc=E,d.fragmentHint=R,z&&pw(R,z,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const X=f.length,G=f[0],q=f[X-1];if(T+=d.skippedSegments*d.targetduration,T>0&&X&&q){d.averagetargetduration=T/X;const ae=q.sn;d.endSN=ae!=="initSegment"?ae:0,d.live||(q.endList=!0),N>0&&(GU(f,N),G&&p.unshift(G))}return d.fragmentHint&&(T+=d.fragmentHint.duration),d.totalduration=T,p.length&&d.dateRangeTagCount&&G&&uL(p,d),d.endCC=E,d}}function uL(s,e){let t=s.length;if(!t)if(e.hasProgramDateTime){const u=e.fragments[e.fragments.length-1];s.push(u),t++}else return;const i=s[t-1],n=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let u=r.length;u--;){const c=e.dateRanges[r[u]],d=c.startDate.getTime();c.tagAnchor=i.ref;for(let f=t;f--;){var a;if(((a=s[f])==null?void 0:a.sn)=u||i===0){var a;const c=(((a=t[i+1])==null?void 0:a.start)||n)-r.start;if(e<=u+c*1e3){const d=t[i].sn-s.startSN;if(d<0)return-1;const f=s.fragments;if(f.length>t.length){const y=(t[i+1]||f[f.length-1]).sn-s.startSN;for(let v=y;v>d;v--){const b=f[v].programDateTime;if(e>=b&&ei);["video","audio","text"].forEach(i=>{const n=t.filter(r=>Jb(r,i));n.length&&(e[`${i}Codec`]=n.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>n.indexOf(r)===-1))}),e.unknownCodecs=t}function fw(s,e,t){const i=e[t];i&&(s[t]=i)}function GU(s,e){let t=s[e];for(let i=e;i--;){const n=s[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function zx(s,e,t){s.rawProgramDateTime?t.push(s):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime)}function mw(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function pw(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(s)}function fo(s,e,t){s.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function gw(s,e,t){s.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function wv(s,e){const t=e.startPTS;if(Dt(t)){let i=0,n;e.sn>s.sn?(i=t-s.start,n=s):(i=s.start-t,n=e),n.duration!==i&&n.setDuration(i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.setStart(s.start+(s.minEndPTS-s.start)):e.setStart(s.start+s.duration):e.setStart(Math.max(s.start-e.duration,0))}function cL(s,e,t,i,n,r,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,r=n+e.duration);let c=t,d=i;const f=e.startPTS,p=e.endPTS;if(Dt(f)){const D=Math.abs(f-t);s&&D>s.totalduration?a.warn(`media timestamps and playlist times differ by ${D}s for level ${e.level} ${s.url}`):Dt(e.deltaPTS)?e.deltaPTS=Math.max(D,e.deltaPTS):e.deltaPTS=D,c=Math.max(t,f),t=Math.min(t,f),n=e.startDTS!==void 0?Math.min(n,e.startDTS):n,d=Math.min(i,p),i=Math.max(i,p),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}const y=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=n,e.endPTS=i,e.minEndPTS=d,e.endDTS=r;const v=e.sn;if(!s||vs.endSN)return 0;let b;const T=v-s.startSN,E=s.fragments;for(E[T]=e,b=T;b>0;b--)wv(E[b],E[b-1]);for(b=T;b=0;f--){const p=n[f].initSegment;if(p){i=p;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r;YU(s,e,(f,p,y,v)=>{if((!e.startCC||e.skippedSegments)&&p.cc!==f.cc){const b=f.cc-p.cc;for(let T=y;T{var p;f&&(!f.initSegment||f.initSegment.relurl===((p=i)==null?void 0:p.relurl))&&(f.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(f=>!f),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let f=e.skippedSegments;f--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=KU(s.dateRanges,e,t));const f=s.fragments.filter(p=>p.rawProgramDateTime);if(s.hasProgramDateTime&&!e.hasProgramDateTime)for(let p=1;p{p.elementaryStreams=f.elementaryStreams,p.stats=f.stats}),r?cL(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):dL(s,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const f=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=f),e.driftEndTime=d,e.driftEnd=f}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=s.requestScheduled)}function KU(s,e,t){const{dateRanges:i,recentlyRemovedDateranges:n}=e,r=gs({},s);n&&n.forEach(c=>{delete r[c]});const u=Object.keys(r).length;return u?(Object.keys(i).forEach(c=>{const d=r[c],f=new nL(i[c].attr,d);f.isValid?(r[c]=f,d||(f.tagOrder+=u)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Ss(i[c].attr)}"`)}),r):i}function WU(s,e,t){if(s&&e){let i=0;for(let n=0,r=s.length;n<=r;n++){const a=s[n],u=e[n+i];a&&u&&a.index===u.index&&a.fragment.sn===u.fragment.sn?t(a,u):i--}}}function YU(s,e,t){const i=e.skippedSegments,n=Math.max(s.startSN,e.startSN)-e.startSN,r=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,a=e.startSN-s.startSN,u=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let d=n;d<=r;d++){const f=c[a+d];let p=u[d];if(i&&!p&&f&&(p=e.fragments[d]=f),f&&p){t(f,p,d,u);const y=f.relurl,v=p.relurl;if(y&&XU(y,v)){e.playlistParsingError=yw(`media sequence mismatch ${p.sn}:`,s,e,f,p);return}else if(f.cc!==p.cc){e.playlistParsingError=yw(`discontinuity sequence mismatch (${f.cc}!=${p.cc})`,s,e,f,p);return}}}}function yw(s,e,t,i,n){return new Error(`${s} ${n.url} + Time to underbuffer: ${pe.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,le>v){let be=this.findBestLevel(this.hls.levels[v].bitrate,v,le,0,pe,1,1);be===-1&&(be=v),this.hls.nextLoadLevel=this.hls.nextAutoLevel=be,this.resetEstimator(this.hls.levels[be].bitrate)}}};E||ie>te*2?Q():this.timer=self.setInterval(Q,te*1e3),a.trigger($.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:r,stats:f})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new O6(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_LOADED,this.onFragLoaded,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_LOADED,this.onFragLoaded,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off($.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Oe.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:r}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const a=performance.now(),u=r?r.stats:i.stats,c=a-u.loading.start,d=u.loading.first?u.loading.first-u.loading.start:-1;if(u.loaded&&d>-1){const g=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(g,d),u.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const r=e+i/t,a=n?e+this.lastLevelLoadSec:0;return r+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,r=n.end-n.first;Pt(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===$t.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=i?i.duration:t.duration,a=this.hls.levels[t.level],u=(a.loaded?a.loaded.bytes:0)+n.loaded,c=(a.loaded?a.loaded.duration:0)+r;a.loaded={bytes:u,duration:c},a.realBitrate=Math.round(8*u/c)}if(t.bitrateTest){const r={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered($.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,r=n!=null&&n.stats.loaded?n.stats:i.stats;if(r.aborted||this.ignoreFragment(i))return;const a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==$t.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,n,1,1);if(r>-1)return r;const a=this.hls.firstLevel,u=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${u}`),u}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,r)&&a[e].loadError<=a[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:r,minAutoLevel:a}=i,u=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),d=this.getStarvationDelay();let f=r.abrBandWidthFactor,g=r.abrBandWidthUpFactor;if(d){const E=this.findBestLevel(c,a,n,d,0,f,g);if(E>=0)return this.rebufferNotice=-1,E}let y=u?Math.min(u,r.maxStarvationDelay):r.maxStarvationDelay;if(!d){const E=this.bitrateTestDelay;E&&(y=(u?Math.min(u,r.maxLoadingDelay):r.maxLoadingDelay)-E,this.info(`bitrate test took ${Math.round(1e3*E)}ms, set first fragment max fetchDuration to ${Math.round(1e3*y)} ms`),f=g=1)}const v=this.findBestLevel(c,a,n,d,y,f,g);if(this.rebufferNotice!==v&&(this.rebufferNotice=v,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${v}`)),v>-1)return v;const b=i.levels[a],T=i.loadLevelObj;return T&&b?.bitrate=t;K--){var ie;const q=b[K],Z=K>g;if(!q)continue;if(D.useMediaCapabilities&&!q.supportedResult&&!q.supportedPromise){const be=navigator.mediaCapabilities;typeof be?.decodingInfo=="function"&&mU(q,N,G,L,e,W)?(q.supportedPromise=nL(q,N,be,this.supportedCache),q.supportedPromise.then(ve=>{if(!this.hls)return;q.supportedResult=ve;const we=this.hls.levels,He=we.indexOf(q);ve.error?this.warn(`MediaCapabilities decodingInfo error: "${ve.error}" for level ${He} ${Cs(ve)}`):ve.supported?ve.decodingInfoResults.some(Fe=>Fe.smooth===!1||Fe.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${He} not smooth or powerEfficient: ${Cs(ve)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${He} ${Cs(ve)}`),He>-1&&we.length>1&&(this.log(`Removing unsupported level ${He}`),this.hls.removeLevel(He),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(ve=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${ve}`)})):q.supportedResult=iL}if((F&&q.codecSet!==F||G&&q.videoRange!==G||Z&&L>q.frameRate||!Z&&L>0&&Lbe.smooth===!1))&&(!j||K!==X)){ne.push(K);continue}const te=q.details,le=(v?te?.partTarget:te?.averagetargetduration)||V;let z;Z?z=u*e:z=a*e;const re=V&&n>=V*2&&r===0?q.averageBitrate:q.maxBitrate,Q=this.getTimeToLoadFrag(Y,z,re*le,te===void 0);if(z>=re&&(K===f||q.loadError===0&&q.fragmentError===0)&&(Q<=Y||!Pt(Q)||R&&!this.bitrateTestDelay||Q${K} adjustedbw(${Math.round(z)})-bitrate=${Math.round(z-re)} ttfb:${Y.toFixed(1)} avgDuration:${le.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${Q.toFixed(1)} firstSelection:${j} codecSet:${q.codecSet} videoRange:${q.videoRange} hls.loadLevel:${E}`)),j&&(this.firstSelection=K),K}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const oL={search:function(s,e){let t=0,i=s.length-1,n=null,r=null;for(;t<=i;){n=(t+i)/2|0,r=s[n];const a=e(r);if(a>0)t=n+1;else if(a<0)i=n-1;else return r}return null}};function LU(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!Pt(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const n=s[s.length-1].endProgramDateTime;if(e>=(n||0))return null;for(let r=0;r0&&u<15e-7&&(t+=15e-7),r&&s.level!==r.level&&r.end<=s.end&&(r=e[2+s.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!s||s.level===r.level)&&iw(t,i,r)===0||RU(r,s,Math.min(n,i))))return r;const a=oL.search(e,iw.bind(null,t,i));return a&&(a!==s||!r)?a:r}function RU(s,e,t){if(e&&e.start===0&&e.level0){const i=e.tagList.reduce((n,r)=>(r[0]==="INF"&&(n+=parseFloat(r[1])),n),t);return s.start<=i}return!1}function iw(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function IU(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function lL(s,e,t){if(s&&s.startCC<=e&&s.endCC>=e){let i=s.fragments;const{fragmentHint:n}=s;n&&(i=i.concat(n));let r;return oL.search(i,a=>a.cce?-1:(r=a,a.end<=t?1:a.start>t?-1:0)),r||null}return null}function G0(s){switch(s.details){case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_TIMEOUT:case Oe.LEVEL_LOAD_TIMEOUT:case Oe.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function uL(s){return s.details.startsWith("key")}function cL(s){return uL(s)&&!!s.frag&&!s.frag.decryptdata}function sw(s,e){const t=G0(e);return s.default[`${t?"timeout":"error"}Retry`]}function n1(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function nw(s){return gs(gs({},s),{errorRetry:null,timeoutRetry:null})}function q0(s,e,t,i){if(!s)return!1;const n=i?.code,r=e499)}function zx(s){return s===0&&navigator.onLine===!1}var Pn={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Pr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class OU extends sa{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on($.ERROR,this.onError,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off($.ERROR,this.onError,this),e.off($.ERROR,this.onErrorOut,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===$t.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const n=e.audioGroups;if(n)return this.hls.allAudioTracks.filter(a=>n.indexOf(a.groupId)>=0).some(a=>{var u;return(u=a.details)==null?void 0:u.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,r=t.context;switch(t.details){case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Oe.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Cc();return}case Oe.FRAG_GAP:case Oe.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Pn.SendAlternateToPenaltyBox;return}case Oe.LEVEL_EMPTY_ERROR:case Oe.LEVEL_PARSING_ERROR:{var a;const c=t.parent===$t.MAIN?t.level:n.loadLevel;t.details===Oe.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case Oe.LEVEL_LOAD_ERROR:case Oe.LEVEL_LOAD_TIMEOUT:typeof r?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case Oe.AUDIO_TRACK_LOAD_ERROR:case Oe.AUDIO_TRACK_LOAD_TIMEOUT:case Oe.SUBTITLE_LOAD_ERROR:case Oe.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=n.loadLevelObj;if(c&&(r.type===Hi.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===Hi.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Pn.SendAlternateToPenaltyBox,t.errorAction.flags=Pr.MoveAllAlternatesMatchingHost;return}}return;case Oe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Pn.SendAlternateToPenaltyBox,flags:Pr.MoveAllAlternatesMatchingHDCP};return;case Oe.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Oe.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Oe.KEY_SYSTEM_NO_SESSION:t.errorAction={action:Pn.SendAlternateToPenaltyBox,flags:Pr.MoveAllAlternatesMatchingKey};return;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.REMUX_ALLOC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(!t.errorAction){var u;t.errorAction=this.getLevelSwitchAction(t,(u=t.level)!=null?u:n.loadLevel)}return;case Oe.INTERNAL_EXCEPTION:case Oe.BUFFER_APPENDING_ERROR:case Oe.BUFFER_FULL_ERROR:case Oe.LEVEL_SWITCH_ERROR:case Oe.BUFFER_STALLED_ERROR:case Oe.BUFFER_SEEK_OVER_HOLE:case Oe.BUFFER_NUDGE_ON_STALL:t.errorAction=Cc();return}t.type===Jt.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Cc())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=sw(i.config.playlistLoadPolicy,e),r=this.playlistError++;if(q0(n,r,G0(e),e.response))return{action:Pn.RetryRequest,flags:Pr.None,retryConfig:n,retryCount:r};const u=this.getLevelSwitchAction(e,t);return n&&(u.retryConfig=n,u.retryCount=r),u}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,u=sw(uL(e)?a:r,e),c=t.levels.reduce((f,g)=>f+g.fragmentError,0);if(n&&(e.details!==Oe.FRAG_GAP&&n.fragmentError++,!cL(e)&&q0(u,c,G0(e),e.response)))return{action:Pn.RetryRequest,flags:Pr.None,retryConfig:u,retryCount:c};const d=this.getLevelSwitchAction(e,i);return u&&(d.retryConfig=u,d.retryCount=c),d}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var r,a;const d=e.details;n.loadError++,d===Oe.BUFFER_APPEND_ERROR&&n.fragmentError++;let f=-1;const{levels:g,loadLevel:y,minAutoLevel:v,maxAutoLevel:b}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const T=(r=e.frag)==null?void 0:r.type,D=(T===$t.AUDIO&&d===Oe.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===Oe.BUFFER_ADD_CODEC_ERROR||d===Oe.BUFFER_APPEND_ERROR))&&g.some(({audioCodec:G})=>n.audioCodec!==G),R=e.sourceBufferName==="video"&&(d===Oe.BUFFER_ADD_CODEC_ERROR||d===Oe.BUFFER_APPEND_ERROR)&&g.some(({codecSet:G,audioCodec:L})=>n.codecSet!==G&&n.audioCodec===L),{type:j,groupId:F}=(a=e.context)!=null?a:{};for(let G=g.length;G--;){const L=(G+y)%g.length;if(L!==y&&L>=v&&L<=b&&g[L].loadError===0){var u,c;const W=g[L];if(d===Oe.FRAG_GAP&&T===$t.MAIN&&e.frag){const I=g[L].details;if(I){const N=Eu(e.frag,I.fragments,e.frag.start);if(N!=null&&N.gap)continue}}else{if(j===Hi.AUDIO_TRACK&&W.hasAudioGroup(F)||j===Hi.SUBTITLE_TRACK&&W.hasSubtitleGroup(F))continue;if(T===$t.AUDIO&&(u=n.audioGroups)!=null&&u.some(I=>W.hasAudioGroup(I))||T===$t.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(I=>W.hasSubtitleGroup(I))||D&&n.audioCodec===W.audioCodec||R&&n.codecSet===W.codecSet||!D&&n.codecSet!==W.codecSet)continue}f=L;break}}if(f>-1&&i.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:Pn.SendAlternateToPenaltyBox,flags:Pr.None,nextAutoLevel:f}}return{action:Pn.SendAlternateToPenaltyBox,flags:Pr.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Pn.DoNothing:break;case Pn.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Oe.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,r=i.nextAutoLevel;switch(n){case Pr.None:this.switchLevel(e,r);break;case Pr.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),d=t.levels[c],f=d?.attrs["HDCP-LEVEL"];if(i.hdcpLevel=f,f==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(f){t.maxHdcpLevel=Hx[Hx.indexOf(f)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Pr.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const d=this.hls.levels,f=d.length;for(let y=f;y--;)if(this.variantHasKey(d[y],c)){var a,u;this.log(`Banned key found in level ${y} (${d[y].bitrate}bps) or audio group "${(a=d[y].audioGroups)==null?void 0:a.join(",")}" (${(u=e.frag)==null?void 0:u.type} fragment) ${Bn(c.keyId||[])}`),d[y].fragmentError++,d[y].loadError++,this.log(`Removing level ${y} with key error (${e.error})`),this.hls.removeLevel(y)}const g=e.frag;if(this.hls.levels.length{const c=this.fragments[u];if(!c||a>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===i&&this.removeFragment(c.body);return}const d=c.range[e];if(d){if(d.time.length===0){this.removeFragment(c.body);return}d.time.some(f=>{const g=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return g&&this.removeFragment(c.body),g})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=rc(i),r=this.fragments[n];if(!r||r.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(u=>{const c=i.elementaryStreams[u];if(!c)return;const d=t[u],f=a||c.partial===!0;r.range[u]=this.getBufferedTimes(i,e.part,f,d)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,i),Om(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=rw(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=rc(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,this.bufferedEnd(n,e))}getBufferedTimes(e,t,i,n){const r={time:[],partial:i},a=e.start,u=e.end,c=e.minEndPTS||u,d=e.maxStartPTS||a;for(let f=0;f=g&&c<=y){r.time.push({startPTS:Math.max(a,n.start(f)),endPTS:Math.min(u,n.end(f))});break}else if(ag){const v=Math.max(a,n.start(f)),b=Math.min(u,n.end(f));b>v&&(r.partial=!0,r.time.push({startPTS:v,endPTS:b}))}else if(u<=g)break}return r}getPartialFragment(e){let t=null,i,n,r,a=0;const{bufferPadding:u,fragments:c}=this;return Object.keys(c).forEach(d=>{const f=c[d];f&&Om(f)&&(n=f.body.start-u,r=f.body.end+u,e>=n&&e<=r&&(i=Math.min(e-n,r-e),a<=i&&(t=f.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Om(t))}getState(e){const t=rc(e),i=this.fragments[t];return i?i.buffered?Om(i)?bn.PARTIAL:bn.OK:bn.APPENDING:bn.NOT_LOADED}isTimeBuffered(e,t,i){let n,r;for(let a=0;a=n&&t<=r)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,r=rc(i);this.fragments[r]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:r,type:a}=t;if(i.sn==="initSegment")return;const u=i.type;if(n){let d=this.activePartLists[u];d||(this.activePartLists[u]=d=[]),d.push(n)}this.timeRanges=r;const c=r[a];this.detectEvictedFragments(a,c,u,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=rc(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const r=t[i[n]];if(r?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const u=this.fragments[a];if(!u)return;const c=u.body;c.type!==i||n&&!c.gap||c.starte&&(u.buffered||r)&&this.removeFragment(c)})}removeFragment(e){const t=rc(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=rw(i,r=>r.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function Om(s){var e,t,i;return s.buffered&&!!(s.body.gap||(e=s.range.video)!=null&&e.partial||(t=s.range.audio)!=null&&t.partial||(i=s.range.audiovideo)!=null&&i.partial)}function rc(s){return`${s.type}_${s.level}_${s.sn}`}function rw(s,e){return s.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Dl={cbc:0,ctr:1};class PU{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Dl.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Dl.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function FU(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?s.slice(0,e-t):s}class BU{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],r=i[1],a=i[2],u=i[3],c=this.invSubMix,d=c[0],f=c[1],g=c[2],y=c[3],v=new Uint32Array(256);let b=0,T=0,E=0;for(E=0;E<256;E++)E<128?v[E]=E<<1:v[E]=E<<1^283;for(E=0;E<256;E++){let D=T^T<<1^T<<2^T<<3^T<<4;D=D>>>8^D&255^99,e[b]=D,t[D]=b;const O=v[b],R=v[O],j=v[R];let F=v[D]*257^D*16843008;n[b]=F<<24|F>>>8,r[b]=F<<16|F>>>16,a[b]=F<<8|F>>>24,u[b]=F,F=j*16843009^R*65537^O*257^b*16843008,d[D]=F<<24|F>>>8,f[D]=F<<16|F>>>16,g[D]=F<<8|F>>>24,y[D]=F,b?(b=O^v[v[v[j^O]]],T^=v[v[T]]):b=T=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n{const u=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(u,t,i,n);const c=this.flush();c?r(c.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:r,currentResult:a,remainderData:u}=this;if(n!==Dl.cbc||t.byteLength!==16)return ys.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),u&&(e=ea(u,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;r&&(i=r);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new BU),d.expandKey(t);const f=a;return this.currentResult=d.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new UU(this.subtle,t,n)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new PU(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(ys.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%$U;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(ys.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const aw=Math.pow(2,17);class HU{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new bo({type:Jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,a=n.loader;return new Promise((u,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(b=>b[0]==="GAP")){c(lw(e));return}else e.gap=!1;const d=this.loader=r?new r(n):new a(n),f=ow(e);e.loader=d;const g=nw(n.fragLoadPolicy.default),y={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:aw};e.stats=d.stats;const v={onSuccess:(b,T,E,D)=>{this.resetLoader(e,d);let O=b.data;E.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(O.slice(0,16)),O=O.slice(16)),u({frag:e,part:null,payload:O,networkDetails:D})},onError:(b,T,E,D)=>{this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:gs({url:i,data:void 0},b),error:new Error(`HTTP Error ${b.code} ${b.text}`),networkDetails:E,stats:D}))},onAbort:(b,T,E)=>{this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:E,stats:b}))},onTimeout:(b,T,E)=>{this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${y.timeout}ms`),networkDetails:E,stats:b}))}};t&&(v.onProgress=(b,T,E,D)=>t({frag:e,part:null,payload:E,networkDetails:D})),d.load(f,y,v)})}loadPart(e,t,i){this.abort();const n=this.config,r=n.fLoader,a=n.loader;return new Promise((u,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(lw(e,t));return}const d=this.loader=r?new r(n):new a(n),f=ow(e,t);e.loader=d;const g=nw(n.fragLoadPolicy.default),y={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:aw};t.stats=d.stats,d.load(f,y,{onSuccess:(v,b,T,E)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const D={frag:e,part:t,payload:v.data,networkDetails:E};i(D),u(D)},onError:(v,b,T,E)=>{this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:gs({url:f.url,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:T,stats:E}))},onAbort:(v,b,T)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:T,stats:v}))},onTimeout:(v,b,T)=>{this.resetLoader(e,d),c(new bo({type:Jt.NETWORK_ERROR,details:Oe.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${y.timeout}ms`),networkDetails:T,stats:v}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,r=n.total;if(i.loaded+=n.loaded,r){const c=Math.round(e.duration/t.duration),d=Math.min(Math.round(i.loaded/r),c),g=(c-d)*Math.round(i.loaded/d);i.total=i.loaded+g}else i.total=Math.max(i.loaded,i.total);const a=i.loading,u=n.loading;a.start?a.first+=u.first-u.start:(a.start=u.start,a.first=u.first),a.end=u.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ow(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(Pt(n)&&Pt(r)){var a;let u=n,c=r;if(s.sn==="initSegment"&&zU((a=s.decryptdata)==null?void 0:a.method)){const d=r-n;d%16&&(c=r+(16-d%16)),n!==0&&(i.resetIV=!0,u=n-16)}i.rangeStart=u,i.rangeEnd=c}return i}function lw(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:Jt.MEDIA_ERROR,details:Oe.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new bo(i)}function zU(s){return s==="AES-128"||s==="AES-256"}class bo extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class dL extends sa{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class a1{constructor(e,t,i,n=0,r=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Mm(),this.buffering={audio:Mm(),video:Mm(),audiovideo:Mm()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=r,this.partial=a}}function Mm(){return{start:0,executeStart:0,executeEnd:0,end:0}}const uw={length:0,start:()=>0,end:()=>0};class Ai{static isBuffered(e,t){if(e){const i=Ai.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=Ai.getBuffered(e);return Ai.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i1&&e.sort((f,g)=>f.start-g.start||g.end-f.end);let n=-1,r=[];if(i)for(let f=0;f=e[f].start&&t<=e[f].end&&(n=f);const g=r.length;if(g){const y=r[g-1].end;e[f].start-yy&&(r[g-1].end=e[f].end):r.push(e[f])}else r.push(e[f])}else r=e;let a=0,u,c=t,d=t;for(let f=0;f=g&&t<=y&&(n=f),t+i>=g&&t{const n=i.substring(2,i.length-1),r=t?.[n];return r===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):r})}return e}function dw(s,e,t){let i=s.variableList;i||(s.variableList=i={});let n,r;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(n))r=a.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(a){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else n=e.NAME,r=e.VALUE;n in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=r||""}function VU(s,e,t){const i=e.IMPORT;if(t&&i in t){let n=s.variableList;n||(s.variableList=n={}),n[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const GU=/^(\d+)x(\d+)$/,hw=/(.+?)=(".*?"|.*?)(?:,|$)/g;class zs{constructor(e,t){typeof e=="string"&&(e=zs.parseAttrList(e,t)),Ss(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;nNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,r)=>(n[r.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=GU.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={};for(hw.lastIndex=0;(i=hw.exec(e))!==null;){const a=i[1].trim();let u=i[2];const c=u.indexOf('"')===0&&u.lastIndexOf('"')===u.length-1;let d=!1;if(c)u=u.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(c||d))u=Vx(t,u);else if(!d&&!c)switch(a){case"CLOSED-CAPTIONS":if(u==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ys.warn(`${e}: attribute ${a} is missing quotes`)}n[a]=u}return n}}const qU="com.apple.hls.interstitial";function KU(s){return s!=="ID"&&s!=="CLASS"&&s!=="CUE"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function WU(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"||s==="SCTE35-CMD"}class fL{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(n=t?.tagOrder)!=null?n:i,t){const r=t.attr;for(const a in r)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==r[a]){ys.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=Ss(new zs({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=t?.endDate||new Date(this.attr["END-DATE"]);Pt(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(ys.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Pt(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===qU}get isValid(){return!!this.id&&!this._badValueForSameId&&Pt(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const YU=10;class XU{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?Pt(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||YU}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function K0(s,e){return s.length===e.length?!s.some((t,i)=>t!==e[i]):!1}function fw(s,e){return!s&&!e?!0:!s||!e?!1:K0(s,e)}function Dc(s){return s==="AES-128"||s==="AES-256"||s==="AES-256-CTR"}function o1(s){switch(s){case"AES-128":case"AES-256":return Dl.cbc;case"AES-256-CTR":return Dl.ctr;default:throw new Error(`invalid full segment method ${s}`)}}function l1(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Gx(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}function QU(s){const e=Gx(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function mL(s){const e=function(i,n,r){const a=i[n];i[n]=i[r],i[r]=a};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function pL(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const r=n[0]==="base64",a=n[1];r?(i.splice(-1,1),t=l1(a)):t=QU(a)}}return t}const W0=typeof self<"u"?self:void 0;var Vs={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Un={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function r0(s){switch(s){case Un.FAIRPLAY:return Vs.FAIRPLAY;case Un.PLAYREADY:return Vs.PLAYREADY;case Un.WIDEVINE:return Vs.WIDEVINE;case Un.CLEARKEY:return Vs.CLEARKEY}}function kv(s){switch(s){case Vs.FAIRPLAY:return Un.FAIRPLAY;case Vs.PLAYREADY:return Un.PLAYREADY;case Vs.WIDEVINE:return Un.WIDEVINE;case Vs.CLEARKEY:return Un.CLEARKEY}}function ph(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Vs.FAIRPLAY,Vs.WIDEVINE,Vs.PLAYREADY,Vs.CLEARKEY].filter(n=>!!e[n]):[];return!i[Vs.WIDEVINE]&&t&&i.push(Vs.WIDEVINE),i}const gL=(function(s){return W0!=null&&(s=W0.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function ZU(s,e,t,i){let n;switch(s){case Vs.FAIRPLAY:n=["cenc","sinf"];break;case Vs.WIDEVINE:case Vs.PLAYREADY:n=["cenc"];break;case Vs.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return JU(n,e,t,i)}function JU(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function ej(s){var e;return!!s&&(s.sessionType==="persistent-license"||!!((e=s.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function yL(s){const e=new Uint16Array(s.buffer,s.byteOffset,s.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const u=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(u){const c=l1(u).subarray(0,16);return mL(c),c}}return null}let ac={};class wl{static clearKeyUriToKeyIdMap(){ac={}}static setKeyIdForUri(e,t){ac[e]=t}static addKeyIdForUri(e){const t=Object.keys(ac).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),ac[e]=i,i}constructor(e,t,i,n=[1],r=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Dc(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(GD(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&K0(e.keyFormatVersions,this.keyFormatVersions)&&fw(e.iv,this.iv)&&fw(e.keyId,this.keyId)}isSupported(){if(this.method){if(Dc(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Un.FAIRPLAY:case Un.WIDEVINE:case Un.PLAYREADY:case Un.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Dc(this.method)){let r=this.iv;return r||(typeof e!="number"&&(ys.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=ij(e)),new wl(this.method,this.uri,"identity",this.keyFormatVersions,r)}if(this.keyId){const r=ac[this.uri];if(r&&!K0(this.keyId,r)&&wl.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=pL(this.uri);if(i)switch(this.keyFormat){case Un.WIDEVINE:if(this.pssh=i,!this.keyId){const r=rU(i.buffer);if(r.length){var n;const a=r[0];this.keyId=(n=a.kids)!=null&&n.length?a.kids[0]:null}}this.keyId||(this.keyId=mw(t));break;case Un.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=nU(r,null,i),this.keyId=yL(i);break}default:{let r=i.subarray(0,16);if(r.length!==16){const a=new Uint8Array(16);a.set(r,16-r.length),r=a}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=tj(t),r||(r=mw(t),r||(r=ac[this.uri])),r&&(this.keyId=r,wl.setKeyIdForUri(this.uri,r))}return this}}function tj(s){const e=s?.[Un.WIDEVINE];return e?e.keyId:null}function mw(s){const e=s?.[Un.PLAYREADY];if(e){const t=pL(e.uri);if(t)return yL(t)}return null}function ij(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const pw=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,gw=/#EXT-X-MEDIA:(.*)/g,sj=/^#EXT(?:INF|-X-TARGETDURATION):/m,Cv=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),nj=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class za{static findGroup(e,t){for(let i=0;i0&&r.length({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(gw.lastIndex=0;(n=gw.exec(e))!==null;){const d=new zs(n[1],i),f=d.TYPE;if(f){const g=u[f],y=r[f]||[];r[f]=y;const v=d.LANGUAGE,b=d["ASSOC-LANGUAGE"],T=d.CHANNELS,E=d.CHARACTERISTICS,D=d["INSTREAM-ID"],O={attrs:d,bitrate:0,id:c++,groupId:d["GROUP-ID"]||"",name:d.NAME||v||"",type:f,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:v,url:d.URI?za.resolve(d.URI,t):""};if(b&&(O.assocLang=b),T&&(O.channels=T),E&&(O.characteristics=E),D&&(O.instreamId=D),g!=null&&g.length){const R=za.findGroup(g,O.groupId)||g[0];bw(O,R,"audioCodec"),bw(O,R,"textCodec")}y.push(O)}}return r}static parseLevelPlaylist(e,t,i,n,r,a){var u;const c={url:t},d=new XU(t),f=d.fragments,g=[];let y=null,v=0,b=0,T=0,E=0,D=0,O=null,R=new Ev(n,c),j,F,G,L=-1,W=!1,I=null,N;if(Cv.lastIndex=0,d.m3u8=e,d.hasVariableRefs=cw(e),((u=Cv.exec(e))==null?void 0:u[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(j=Cv.exec(e))!==null;){W&&(W=!1,R=new Ev(n,c),R.playlistOffset=T,R.setStart(T),R.sn=v,R.cc=E,D&&(R.bitrate=D),R.level=i,y&&(R.initSegment=y,y.rawProgramDateTime&&(R.rawProgramDateTime=y.rawProgramDateTime,y.rawProgramDateTime=null),I&&(R.setByteRange(I),I=null)));const ne=j[1];if(ne){R.duration=parseFloat(ne);const ie=(" "+j[2]).slice(1);R.title=ie||null,R.tagList.push(ie?["INF",ne,ie]:["INF",ne])}else if(j[3]){if(Pt(R.duration)){R.playlistOffset=T,R.setStart(T),G&&Sw(R,G,d),R.sn=v,R.level=i,R.cc=E,f.push(R);const ie=(" "+j[3]).slice(1);R.relurl=Vx(d,ie),qx(R,O,g),O=R,T+=R.duration,v++,b=0,W=!0}}else{if(j=j[0].match(nj),!j){ys.warn("No matches on slow regex match for level playlist!");continue}for(F=1;F0&&_w(d,ie,j),v=d.startSN=parseInt(K);break;case"SKIP":{d.skippedSegments&&po(d,ie,j);const Z=new zs(K,d),te=Z.decimalInteger("SKIPPED-SEGMENTS");if(Pt(te)){d.skippedSegments+=te;for(let z=te;z--;)f.push(null);v+=te}const le=Z.enumeratedString("RECENTLY-REMOVED-DATERANGES");le&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(le.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&po(d,ie,j),d.targetduration=Math.max(parseInt(K),1);break;case"VERSION":d.version!==null&&po(d,ie,j),d.version=parseInt(K);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||po(d,ie,j),d.live=!1;break;case"#":(K||q)&&R.tagList.push(q?[K,q]:[K]);break;case"DISCONTINUITY":E++,R.tagList.push(["DIS"]);break;case"GAP":R.gap=!0,R.tagList.push([ie]);break;case"BITRATE":R.tagList.push([ie,K]),D=parseInt(K)*1e3,Pt(D)?R.bitrate=D:D=0;break;case"DATERANGE":{const Z=new zs(K,d),te=new fL(Z,d.dateRanges[Z.ID],d.dateRangeTagCount);d.dateRangeTagCount++,te.isValid||d.skippedSegments?d.dateRanges[te.id]=te:ys.warn(`Ignoring invalid DATERANGE tag: "${K}"`),R.tagList.push(["EXT-X-DATERANGE",K]);break}case"DEFINE":{{const Z=new zs(K,d);"IMPORT"in Z?VU(d,Z,a):dw(d,Z,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?po(d,ie,j):f.length>0&&_w(d,ie,j),d.startCC=E=parseInt(K);break;case"KEY":{const Z=yw(K,t,d);if(Z.isSupported()){if(Z.method==="NONE"){G=void 0;break}G||(G={});const te=G[Z.keyFormat];te!=null&&te.matches(Z)||(te&&(G=Ss({},G)),G[Z.keyFormat]=Z)}else ys.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${K}"`);break}case"START":d.startTimeOffset=vw(K);break;case"MAP":{const Z=new zs(K,d);if(R.duration){const te=new Ev(n,c);Tw(te,Z,i,G),y=te,R.initSegment=y,y.rawProgramDateTime&&!R.rawProgramDateTime&&(R.rawProgramDateTime=y.rawProgramDateTime)}else{const te=R.byteRangeEndOffset;if(te){const le=R.byteRangeStartOffset;I=`${te-le}@${le}`}else I=null;Tw(R,Z,i,G),y=R,W=!0}y.cc=E;break}case"SERVER-CONTROL":{N&&po(d,ie,j),N=new zs(K),d.canBlockReload=N.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=N.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&N.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=N.optionalFloat("PART-HOLD-BACK",0),d.holdBack=N.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&po(d,ie,j);const Z=new zs(K);d.partTarget=Z.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Z=d.partList;Z||(Z=d.partList=[]);const te=b>0?Z[Z.length-1]:void 0,le=b++,z=new zs(K,d),re=new V6(z,R,c,le,te);Z.push(re),R.duration+=re.duration;break}case"PRELOAD-HINT":{const Z=new zs(K,d);d.preloadHint=Z;break}case"RENDITION-REPORT":{const Z=new zs(K,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(Z);break}default:ys.warn(`line parsed but not handled: ${j}`);break}}}O&&!O.relurl?(f.pop(),T-=O.duration,d.partList&&(d.fragmentHint=O)):d.partList&&(qx(R,O,g),R.cc=E,d.fragmentHint=R,G&&Sw(R,G,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const X=f.length,V=f[0],Y=f[X-1];if(T+=d.skippedSegments*d.targetduration,T>0&&X&&Y){d.averagetargetduration=T/X;const ne=Y.sn;d.endSN=ne!=="initSegment"?ne:0,d.live||(Y.endList=!0),L>0&&(aj(f,L),V&&g.unshift(V))}return d.fragmentHint&&(T+=d.fragmentHint.duration),d.totalduration=T,g.length&&d.dateRangeTagCount&&V&&vL(g,d),d.endCC=E,d}}function vL(s,e){let t=s.length;if(!t)if(e.hasProgramDateTime){const u=e.fragments[e.fragments.length-1];s.push(u),t++}else return;const i=s[t-1],n=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let u=r.length;u--;){const c=e.dateRanges[r[u]],d=c.startDate.getTime();c.tagAnchor=i.ref;for(let f=t;f--;){var a;if(((a=s[f])==null?void 0:a.sn)=u||i===0){var a;const c=(((a=t[i+1])==null?void 0:a.start)||n)-r.start;if(e<=u+c*1e3){const d=t[i].sn-s.startSN;if(d<0)return-1;const f=s.fragments;if(f.length>t.length){const y=(t[i+1]||f[f.length-1]).sn-s.startSN;for(let v=y;v>d;v--){const b=f[v].programDateTime;if(e>=b&&ei);["video","audio","text"].forEach(i=>{const n=t.filter(r=>i1(r,i));n.length&&(e[`${i}Codec`]=n.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>n.indexOf(r)===-1))}),e.unknownCodecs=t}function bw(s,e,t){const i=e[t];i&&(s[t]=i)}function aj(s,e){let t=s[e];for(let i=e;i--;){const n=s[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function qx(s,e,t){s.rawProgramDateTime?t.push(s):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime)}function Tw(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function Sw(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(s)}function po(s,e,t){s.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function _w(s,e,t){s.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Dv(s,e){const t=e.startPTS;if(Pt(t)){let i=0,n;e.sn>s.sn?(i=t-s.start,n=s):(i=s.start-t,n=e),n.duration!==i&&n.setDuration(i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.setStart(s.start+(s.minEndPTS-s.start)):e.setStart(s.start+s.duration):e.setStart(Math.max(s.start-e.duration,0))}function xL(s,e,t,i,n,r,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,r=n+e.duration);let c=t,d=i;const f=e.startPTS,g=e.endPTS;if(Pt(f)){const D=Math.abs(f-t);s&&D>s.totalduration?a.warn(`media timestamps and playlist times differ by ${D}s for level ${e.level} ${s.url}`):Pt(e.deltaPTS)?e.deltaPTS=Math.max(D,e.deltaPTS):e.deltaPTS=D,c=Math.max(t,f),t=Math.min(t,f),n=e.startDTS!==void 0?Math.min(n,e.startDTS):n,d=Math.min(i,g),i=Math.max(i,g),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}const y=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=n,e.endPTS=i,e.minEndPTS=d,e.endDTS=r;const v=e.sn;if(!s||vs.endSN)return 0;let b;const T=v-s.startSN,E=s.fragments;for(E[T]=e,b=T;b>0;b--)Dv(E[b],E[b-1]);for(b=T;b=0;f--){const g=n[f].initSegment;if(g){i=g;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r;cj(s,e,(f,g,y,v)=>{if((!e.startCC||e.skippedSegments)&&g.cc!==f.cc){const b=f.cc-g.cc;for(let T=y;T{var g;f&&(!f.initSegment||f.initSegment.relurl===((g=i)==null?void 0:g.relurl))&&(f.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(f=>!f),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let f=e.skippedSegments;f--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=lj(s.dateRanges,e,t));const f=s.fragments.filter(g=>g.rawProgramDateTime);if(s.hasProgramDateTime&&!e.hasProgramDateTime)for(let g=1;g{g.elementaryStreams=f.elementaryStreams,g.stats=f.stats}),r?xL(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):bL(s,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const f=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=f),e.driftEndTime=d,e.driftEnd=f}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=s.requestScheduled)}function lj(s,e,t){const{dateRanges:i,recentlyRemovedDateranges:n}=e,r=Ss({},s);n&&n.forEach(c=>{delete r[c]});const u=Object.keys(r).length;return u?(Object.keys(i).forEach(c=>{const d=r[c],f=new fL(i[c].attr,d);f.isValid?(r[c]=f,d||(f.tagOrder+=u)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Cs(i[c].attr)}"`)}),r):i}function uj(s,e,t){if(s&&e){let i=0;for(let n=0,r=s.length;n<=r;n++){const a=s[n],u=e[n+i];a&&u&&a.index===u.index&&a.fragment.sn===u.fragment.sn?t(a,u):i--}}}function cj(s,e,t){const i=e.skippedSegments,n=Math.max(s.startSN,e.startSN)-e.startSN,r=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,a=e.startSN-s.startSN,u=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let d=n;d<=r;d++){const f=c[a+d];let g=u[d];if(i&&!g&&f&&(g=e.fragments[d]=f),f&&g){t(f,g,d,u);const y=f.relurl,v=g.relurl;if(y&&dj(y,v)){e.playlistParsingError=Ew(`media sequence mismatch ${g.sn}:`,s,e,f,g);return}else if(f.cc!==g.cc){e.playlistParsingError=Ew(`discontinuity sequence mismatch (${f.cc}!=${g.cc})`,s,e,f,g);return}}}}function Ew(s,e,t,i,n){return new Error(`${s} ${n.url} Playlist starting @${e.startSN} ${e.m3u8} Playlist starting @${t.startSN} -${t.m3u8}`)}function dL(s,e,t=!0){const i=e.startSN+e.skippedSegments-s.startSN,n=s.fragments,r=i>=0;let a=0;if(r&&ie){const r=i[i.length-1].duration*1e3;r{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function XU(s,e){return s!==e&&e?xw(s)!==xw(e):!1}function xw(s){return s.replace(/\?[^?]*$/,"")}function Ch(s,e){for(let i=0,n=s.length;is.startCC)}function bw(s,e){const t=s.start+e;s.startPTS=t,s.setStart(t),s.endPTS=t+s.duration}function gL(s,e){const t=e.fragments;for(let i=0,n=t.length;i{const{config:a,fragCurrent:u,media:c,mediaBuffer:d,state:f}=this,p=c?c.currentTime:0,y=vi.bufferInfo(d||c,p,a.maxBufferHole),v=!y.len;if(this.log(`Media seeking to ${Dt(p)?p.toFixed(3):p}, state: ${f}, ${v?"out of":"in"} buffer`),this.state===tt.ENDED)this.resetLoadingState();else if(u){const b=a.maxFragLookUpTolerance,T=u.start-b,E=u.start+u.duration+b;if(v||Ey.end){const D=p>E;(pb&&(this.lastCurrentTime=p),!this.loadingParts){const T=Math.max(y.end,p),E=this.shouldLoadParts(this.getLevelDetails(),T);E&&(this.log(`LL-Part loading ON after seeking to ${p.toFixed(2)} with buffer @${T.toFixed(2)}`),this.loadingParts=E)}}this.hls.hasEnoughToStart||(this.log(`Setting ${v?"startPosition":"nextLoadPosition"} to ${p} for seek without enough to start`),this.nextLoadPosition=p,v&&(this.startPosition=p)),v&&this.state===tt.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new kU(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new i1(e.config)}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===tt.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=tt.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=vi.bufferedInfo(r,e.start,0));const a=e.nextStart;if(a&&a>n&&a{const a=r.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(a,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,i,n).then(r=>{if(!r)return;const a=this.state,u=r.frag;if(this.fragContextChanged(u)){(a===tt.FRAG_LOADING||!this.fragCurrent&&a===tt.PARSING)&&(this.fragmentTracker.removeFragment(u),this.state=tt.IDLE);return}"payload"in r&&(this.log(`Loaded ${u.type} sn: ${u.sn} of ${this.playlistLabel()} ${u.level}`),this.hls.trigger($.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===vn.APPENDING){const r=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,r),u=Math.max(e.duration,a?a.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(u,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===vn.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger($.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i?.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:r,payload:a}=i,u=r.decryptdata;if(a&&a.byteLength>0&&u!=null&&u.key&&u.iv&&kc(u.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),u.key.buffer,u.iv.buffer,n1(u.method)).catch(d=>{throw n.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:r}),d}).then(d=>{const f=self.performance.now();return n.trigger($.FRAG_DECRYPTED,{frag:r,payload:d,stats:{tstart:c,tdecrypt:f}}),i.payload=d,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==tt.STOPPED&&(this.state=tt.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,n;const r=e.tracks;if(r&&!t.encrypted&&((i=r.audio)!=null&&i.encrypted||(n=r.video)!=null&&n.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,u=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(u.message),!a||a.mediaKeys?!1:(this.hls.trigger($.ERROR,{type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_KEYS,fatal:!1,error:u,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?JU.toString(vi.getBuffered(i)):"(detached)"})`),sn(e)){var n;if(e.type!==Ot.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(u=>!!a[u])){this.state=tt.IDLE;return}}const r=(n=this.levels)==null?void 0:n[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=tt.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:r}=e,a=!r||r.length===0||r.some(c=>!c),u=new s1(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(u)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var r;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let u=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=tt.KEY_LOADING,this.fragCurrent=e,u=this.keyLoader.load(e).then(y=>{if(!this.fragContextChanged(y.frag))return this.hls.trigger($.KEY_LOADED,y),this.state===tt.KEY_LOADING&&(this.state=tt.IDLE),y}),this.hls.trigger($.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(u=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),u&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(sn(e)&&(!c||e.sn!==c.sn)){const y=this.shouldLoadParts(t.details,e.end);y!==this.loadingParts&&(this.log(`LL-Part loading ${y?"ON":"OFF"} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=y)}if(i=Math.max(e.start,i||0),this.loadingParts&&sn(e)){const y=a.partList;if(y&&n){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const v=this.getNextPart(y,e,i);if(v>-1){const b=y[v];e=this.fragCurrent=b.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${b.index} (${v}/${y.length-1}) of ${this.fragInfo(e,!1,b)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=b.start+b.duration,this.state=tt.FRAG_LOADING;let T;return u?T=u.then(E=>!E||this.fragContextChanged(E.frag)?null:this.doFragPartsLoad(e,b,t,n)).catch(E=>this.handleFragLoadError(E)):T=this.doFragPartsLoad(e,b,t,n).catch(E=>this.handleFragLoadError(E)),this.hls.trigger($.FRAG_LOADING,{frag:e,part:b,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}else if(!e.url||this.loadedEndOfParts(y,i))return Promise.resolve(null)}}if(sn(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=a.partList)==null?void 0:d.filter(y=>y.loaded).map(y=>`[${y.start}-${y.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),Dt(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=tt.FRAG_LOADING;const f=this.config.progressive&&e.type!==Ot.SUBTITLE;let p;return f&&u?p=u.then(y=>!y||this.fragContextChanged(y.frag)?null:this.fragmentLoader.load(e,n)).catch(y=>this.handleFragLoadError(y)):p=Promise.all([this.fragmentLoader.load(e,f?n:void 0),u]).then(([y])=>(!f&&n&&n(y),y)).catch(y=>this.handleFragLoadError(y)),this.hls.trigger($.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):p}doFragPartsLoad(e,t,i,n){return new Promise((r,a)=>{var u;const c=[],d=(u=i.details)==null?void 0:u.partList,f=p=>{this.fragmentLoader.loadPart(e,p,n).then(y=>{c[p.index]=y;const v=y.part;this.hls.trigger($.FRAG_LOADED,y);const b=vw(i.details,e.sn,p.index+1)||mL(d,e.sn,p.index+1);if(b)f(b);else return r({frag:e,part:v,partsLoaded:c})}).catch(a)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===Oe.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===jt.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger($.ERROR,t)}else this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==tt.PARSING){!this.fragCurrent&&this.state!==tt.STOPPED&&this.state!==tt.ERROR&&(this.state=tt.IDLE);return}const{frag:i,part:n,level:r}=t,a=self.performance.now();i.stats.parsing.end=a,n&&(n.stats.parsing.end=a);const u=this.getLevelDetails(),d=u&&i.sn>u.endSN||this.shouldLoadParts(u,i.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(i,n,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const r=e.partList[0];if(r.fragment.type===Ot.SUBTITLE)return!1;const a=r.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:r,part:a}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const u=t[n],c=u.details,d=a>-1?vw(c,r,a):null,f=d?d.fragment:fL(c,r,i);return f?(i&&i!==f&&(f.stats=i.stats),{frag:f,part:d,level:u}):null}bufferFragmentData(e,t,i,n,r){if(this.state!==tt.PARSING)return;const{data1:a,data2:u}=e;let c=a;if(u&&(c=Xr(a,u)),!c.length)return;const d=this.initPTS[t.cc],f=d?-d.baseTime/d.timescale:void 0,p={type:e.type,frag:t,part:i,chunkMeta:n,offset:f,parent:t.type,data:c};if(this.hls.trigger($.BUFFER_APPENDING,p),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!vi.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=vi.bufferInfo(t,i,0),r=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),u=Math.max(Math.min(e.start-a,n.end-a),i+a);e.start-u>a&&this.flushMainBuffer(u,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!Dt(n))return null;const a=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,a)}getFwdBufferInfoAtPos(e,t,i,n){const r=vi.bufferInfo(e,t,n);if(r.len===0&&r.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(r.nextStart<=a.end||a.gap)){const u=Math.max(Math.min(r.nextStart,a.end)-t,n);return vi.bufferInfo(e,t,u)}}return r}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return r>=n?(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=Ot.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:r}=this,a=i[0].start,u=r.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const p=r.initialLiveManifestSize;if(n=a?y:v)||c.start:e;this.log(`Setting startPosition to ${b} to match start frag at live edge. mainStart: ${y} liveSyncPosition: ${v} frag.start: ${(d=c)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=b}}else e<=a&&(c=i[0]);if(!c){const p=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,p,t)}let f=this.filterReplacedPrimary(c,t);if(!f&&c){const p=c.sn-t.startSN;f=this.filterReplacedPrimary(i[p+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===vn.OK||i===vn.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,r){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(u!==null&&i.len+u.len>=r){const c=a.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Tw(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Tw(this.config)&&e.type!==Ot.SUBTITLE){const i=this.hls.interstitialsManager,n=i?.bufferingItem;if(n){const a=n.event;if(a){if(a.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&t?.live===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const r=i?.playerQueue;if(r)for(let a=r.length;a--;){const u=r[a].interstitial;if(u.appendInPlace&&e.start>=u.startTime&&e.end<=u.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,r=!1,a=!0;for(let u=0,c=e.length;u-1&&ii.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=pU(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){const a=t[r-e.startSN];i.cc===a.cc&&(n=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=JD(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(n=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:r}=this,{fragments:a,endSN:u}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:d}=n,f=i.partList,p=!!(this.loadingParts&&f!=null&&f.length&&c);p&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(a=a.concat(c),u=c.sn);let y;if(et-d||(v=this.media)!=null&&v.paused||!this.startFragRequested?0:d;y=_u(r,a,e,T)}else y=a[a.length-1];if(y){const b=y.sn-i.startSN,T=this.fragmentTracker.getState(y);if((T===vn.OK||T===vn.PARTIAL&&y.gap)&&(r=y),r&&y.sn===r.sn&&(!p||f[0].fragment.sn>y.sn||!i.live)&&y.level===r.level){const D=a[b+1];y.sn${e.startSN} fragments: ${n}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&sn(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==tt.FRAG_LOADING_WAITING_RETRY)&&(this.state=tt.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const D=this.getCurrentContext(t.chunkMeta);D&&(t.frag=D.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var r;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const a=t.details===Oe.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(n,!0);const u=t.errorAction;if(!u){this.state=tt.ERROR;return}const{action:c,flags:d,retryCount:f=0,retryConfig:p}=u,y=!!p,v=y&&c===In.RetryRequest,b=y&&!u.resolved&&d===Ir.MoveAllAlternatesMatchingHost,T=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!v&&b&&sn(n)&&!n.endList&&T&&!tL(t))this.resetFragmentErrors(e),this.treatAsGap(n),u.resolved=!0;else if((v||b)&&f=t||i&&!jx(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=tt.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===tt.PARSING||this.state===tt.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,t?.duration||10);const a=!r;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===Ot.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==tt.STOPPED&&(this.state=tt.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=vi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===tt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==tt.STOPPED&&(this.state=tt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const r=i.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,d)=>{const f=e.elementaryStreams[d];if(f){const p=f.endPTS-f.startPTS;if(p<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${p})`),c||!1;const y=n?0:cL(r,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this);return this.hls.trigger($.LEVEL_PTS_UPDATED,{details:r,level:i,drift:y,type:d,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var u;const c=((u=this.transmuxer)==null?void 0:u.error)===null;if((i.fragmentError===0||c&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),c){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=tt.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger($.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Ot.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,r;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((r=t&&!i?e.endPTS:(i||e).end)!=null?r:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Tw(s){return!!s.interstitialsController&&s.enableInterstitialPlayback!==!1}class vL{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=ej(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function ej(s,e){const t=new Uint8Array(e);let i=0;for(let n=0;n0)return s.subarray(t,t+i)}function oj(s,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],a=r>>2&15;if(a>12){const v=new Error(`invalid ADTS sampling index:${a}`);s.emit($.ERROR,$.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message});return}const u=(r>>6&3)+1,c=e[t+3]>>6&3|(r&1)<<2,d="mp4a.40."+u,f=n[a];let p=a;(u===5||u===29)&&(p-=3);const y=[u<<3|(p&14)>>1,(p&1)<<7|c<<3];return cs.log(`manifest codec:${i}, parsed codec:${d}, channels:${c}, rate:${f} (ADTS object type:${u} sampling index:${a})`),{config:y,samplerate:f,channelCount:c,codec:d,parsedCodec:d,manifestCodec:i}}function bL(s,e){return s[e]===255&&(s[e+1]&246)===240}function TL(s,e){return s[e+1]&1?7:9}function u1(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function lj(s,e){return e+5=s.length)return!1;const i=u1(s,e);if(i<=t)return!1;const n=e+i;return n===s.length||q0(s,n)}return!1}function SL(s,e,t,i,n){if(!s.samplerate){const r=oj(e,t,i,n);if(!r)return;gs(s,r)}}function _L(s){return 1024*9e4/s}function dj(s,e){const t=TL(s,e);if(e+t<=s.length){const i=u1(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function EL(s,e,t,i,n){const r=_L(s.samplerate),a=i+n*r,u=dj(e,t);let c;if(u){const{frameLength:p,headerLength:y}=u,v=y+p,b=Math.max(0,t+v-e.length);b?(c=new Uint8Array(v-y),c.set(e.subarray(t+y,e.length),0)):c=e.subarray(t+y,t+v);const T={unit:c,pts:a};return b||s.samples.push(T),{sample:T,length:v,missing:b}}const d=e.length-t;return c=new Uint8Array(d),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:a},length:d,missing:-1}}function hj(s,e){return l1(s,e)&&Dp(s,e+6)+10<=s.length-e}function fj(s){return s instanceof ArrayBuffer?s:s.byteOffset==0&&s.byteLength==s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer}function kv(s,e=0,t=1/0){return mj(s,e,t,Uint8Array)}function mj(s,e,t,i){const n=pj(s);let r=1;"BYTES_PER_ELEMENT"in i&&(r=i.BYTES_PER_ELEMENT);const a=gj(s)?s.byteOffset:0,u=(a+s.byteLength)/r,c=(a+e)/r,d=Math.floor(Math.max(0,Math.min(c,u))),f=Math.floor(Math.min(d+Math.max(t,0),u));return new i(n,d,f-d)}function pj(s){return s instanceof ArrayBuffer?s:s.buffer}function gj(s){return s&&s.buffer instanceof ArrayBuffer&&s.byteLength!==void 0&&s.byteOffset!==void 0}function yj(s){const e={key:s.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(s.size<2)return;if(s.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=s.data.subarray(1).indexOf(0);if(i===-1)return;const n=Pr(kv(s.data,1,i)),r=s.data[2+i],a=s.data.subarray(3+i).indexOf(0);if(a===-1)return;const u=Pr(kv(s.data,3+i,a));let c;return n==="-->"?c=Pr(kv(s.data,4+i+a)):c=fj(s.data.subarray(4+i+a)),e.mimeType=n,e.pictureType=r,e.description=u,e.data=c,e}function vj(s){if(s.size<2)return;const e=Pr(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}}function xj(s){if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Pr(s.data.subarray(t),!0);t+=i.length+1;const n=Pr(s.data.subarray(t));return{key:s.type,info:i,data:n}}const e=Pr(s.data.subarray(1));return{key:s.type,info:"",data:e}}function bj(s){if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Pr(s.data.subarray(t),!0);t+=i.length+1;const n=Pr(s.data.subarray(t));return{key:s.type,info:i,data:n}}const e=Pr(s.data);return{key:s.type,info:"",data:e}}function Tj(s){return s.type==="PRIV"?vj(s):s.type[0]==="W"?bj(s):s.type==="APIC"?yj(s):xj(s)}function Sj(s){const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Dp(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}}const Nm=10,_j=10;function wL(s){let e=0;const t=[];for(;l1(s,e);){const i=Dp(s,e+6);s[e+5]>>6&1&&(e+=Nm),e+=Nm;const n=e+i;for(;e+_j0&&u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Or.audioId3,duration:Number.POSITIVE_INFINITY});n{if(Dt(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Om=null;const Aj=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],kj=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Cj=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Dj=[0,1,1,4];function kL(s,e,t,i,n){if(t+24>e.length)return;const r=CL(e,t);if(r&&t+r.frameLength<=e.length){const a=r.samplesPerFrame*9e4/r.sampleRate,u=i+n*a,c={unit:e.subarray(t,t+r.frameLength),pts:u,dts:u};return s.config=[],s.channelCount=r.channelCount,s.samplerate=r.sampleRate,s.samples.push(c),{sample:c,length:r.frameLength,missing:0}}}function CL(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,n=s[e+2]>>4&15,r=s[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&r!==3){const a=s[e+2]>>1&1,u=s[e+3]>>6,c=t===3?3-i:i===3?3:4,d=Aj[c*14+n-1]*1e3,p=kj[(t===3?0:t===2?1:2)*3+r],y=u===3?1:2,v=Cj[t][i],b=Dj[i],T=v*8*b,E=Math.floor(v*d/p+a)*b;if(Om===null){const R=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Om=R?parseInt(R[1]):0}return Om&&Om<=87&&i===2&&d>=224e3&&u===0&&(s[e+3]=s[e+3]|128),{sampleRate:p,channelCount:y,frameLength:E,samplesPerFrame:T}}}function h1(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function DL(s,e){return e+1{let t=0,i=5;e+=i;const n=new Uint32Array(1),r=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=s[e];const u=Math.min(i,8),c=8-u;r[0]=4278190080>>>24+c<>c,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const u=[48e3,44100,32e3][r],c=e[t+4]&63,f=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+r]*2;if(t+f>e.length)return-1;const p=e[t+6]>>5;let y=0;p===2?y+=2:(p&1&&p!==1&&(y+=2),p&4&&(y+=2));const v=(e[t+6]<<8|e[t+7])>>12-y&1,T=[2,1,2,3,3,4,4,5][p]+v,E=e[t+5]>>3,D=e[t+5]&7,O=new Uint8Array([r<<6|E<<1|D>>2,(D&3)<<6|p<<3|v<<2|c>>4,c<<4&224]),R=1536/u*9e4,j=i+n*R,F=e.subarray(t,t+f);return s.config=O,s.channelCount=T,s.samplerate=u,s.samples.push({unit:F,pts:j}),f}class Nj extends d1{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=$h(e,0);let i=t?.length||0;if(t&&e[i]===11&&e[i+1]===119&&c1(t)!==void 0&&RL(e,i)<=16)return!1;for(let n=e.length;i{const a=$6(r);if(Oj.test(a.schemeIdUri)){const u=_w(a,t);let c=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const d=a.payload;i.samples.push({data:d,len:d.byteLength,dts:u,pts:u,type:Or.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const u=_w(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:u,pts:u,type:Or.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function _w(s,e){return Dt(s.presentationTime)?s.presentationTime/s.timeScale:e+s.presentationTimeDelta/s.timeScale}class Pj{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new i1(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Cl.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then(u=>{const c=new Uint8Array(u);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let r=32;r{r.data=this.getAvcDecryptedUnit(a,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)}).catch(n)}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const r=e[t].units;for(;!(i>=r.length);i++){const a=r[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,n,a),!this.decrypter.isSync()))return}}}}class NL{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const r=i.units;n=r[r.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const r=i[n-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let r=e.naluState||0;const a=r,u=[];let c=0,d,f,p,y=-1,v=0;for(r===-1&&(y=0,v=this.getNALuType(t,0),r=0,c=1);c=0){const b={data:t.subarray(y,f),type:v};u.push(b)}else{const b=this.getLastNalUnit(e.samples);b&&(a&&c<=4-a&&b.state&&(b.data=b.data.subarray(0,b.data.byteLength-a)),f>0&&(b.data=Xr(b.data,t.subarray(0,f)),b.state=0))}c=0&&r>=0){const b={data:t.subarray(y,n),type:v,state:r};u.push(b)}if(u.length===0){const b=this.getLastNalUnit(e.samples);b&&(b.data=Xr(b.data,t))}return e.naluState=r,u}}class Dh{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");n.set(e.subarray(i,i+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&cs.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Bj extends NL{parsePES(e,t,i,n){const r=this.parseNALu(e,i.data,n);let a=this.VideoSample,u,c=!1;i.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(d=>{var f,p;switch(d.type){case 1:{let T=!1;u=!0;const E=d.data;if(c&&E.length>4){const D=this.readSliceType(E);(D===2||D===4||D===7||D===9)&&(T=!0)}if(T){var y;(y=a)!=null&&y.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=T;break}case 5:u=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{u=!0,Zb(d.data,1,i.pts,t.samples);break}case 7:{var v,b;u=!0,c=!0;const T=d.data,E=this.readSPS(T);if(!e.sps||e.width!==E.width||e.height!==E.height||((v=e.pixelRatio)==null?void 0:v[0])!==E.pixelRatio[0]||((b=e.pixelRatio)==null?void 0:b[1])!==E.pixelRatio[1]){e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.sps=[T];const D=T.subarray(1,4);let O="avc1.";for(let R=0;R<3;R++){let j=D[R].toString(16);j.length<2&&(j="0"+j),O+=j}e.codec=O}break}case 8:u=!0,e.pps=[d.data];break;case 9:u=!0,e.audFound=!0,(p=a)!=null&&p.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:u=!0;break;default:u=!1;break}a&&u&&a.units.push(d)}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Dh(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,r;for(let a=0;a{var f,p;switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,u=!0;break;case 16:case 17:case 18:case 21:if(u=!0,c){var y;(y=a)!=null&&y.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:u=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:u=!0,Zb(d.data,2,i.pts,t.samples);break;case 32:u=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=gs(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(u=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const v=this.readSPS(d.data);e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.codec=v.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const b in v.params)e.params[b]=v.params[b]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(u=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const v=this.readPPS(d.data);for(const b in v)e.params[b]=v[b]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:u=!0,e.audFound=!0,(p=a)!=null&&p.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:u=!1;break}a&&u&&a.units.push(d)}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Dh(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Dh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),r=t.readBoolean(),a=t.readBits(5),u=t.readUByte(),c=t.readUByte(),d=t.readUByte(),f=t.readUByte(),p=t.readUByte(),y=t.readUByte(),v=t.readUByte(),b=t.readUByte(),T=t.readUByte(),E=t.readUByte(),D=t.readUByte(),O=[],R=[];for(let Ve=0;Ve0)for(let Ve=i;Ve<8;Ve++)t.readBits(2);for(let Ve=0;Ve1&&t.readEG();for(let _t=0;_t0&&pe<16?(ne=We[pe-1],Z=Je[pe-1]):pe===255&&(ne=t.readBits(16),Z=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),Ce=t.readBoolean(),Ce&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(xe=t.readBits(32),ge=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Je=t.readBoolean(),ot=t.readBoolean();let St=!1;(Je||ot)&&(St=t.readBoolean(),St&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),St&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let vt=0;vt<=i;vt++){fe=t.readBoolean();const Vt=fe||t.readBoolean();let si=!1;Vt?t.readEG():si=t.readBoolean();const $t=si?1:t.readUEG()+1;if(Je)for(let Pt=0;Pt<$t;Pt++)t.readUEG(),t.readUEG(),St&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(ot)for(let Pt=0;Pt<$t;Pt++)t.readUEG(),t.readUEG(),St&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),U=t.readUEG())}let Re=F,Ae=z;if(N){let Ve=1,ht=1;j===1?Ve=ht=2:j==2&&(Ve=2),Re=F-Ve*L-Ve*Y,Ae=z-ht*X-ht*I}const be=n?["A","B","C"][n]:"",Pe=u<<24|c<<16|d<<8|f;let gt=0;for(let Ve=0;Ve<32;Ve++)gt=(gt|(Pe>>Ve&1)<<31-Ve)>>>0;let Ye=gt.toString(16);return a===1&&Ye==="2"&&(Ye="6"),{codecString:`hvc1.${be}${a}.${Ye}.${r?"H":"L"}${D}.B0`,params:{general_tier_flag:r,general_profile_idc:a,general_profile_space:n,general_profile_compatibility_flags:[u,c,d,f],general_constraint_indicator_flags:[p,y,v,b,T,E],general_level_idc:D,bit_depth:G+8,bit_depth_luma_minus8:G,bit_depth_chroma_minus8:q,min_spatial_segmentation_idc:U,chroma_format_idc:j,frame_rate:{fixed:fe,fps:ge/xe}},width:Re,height:Ae,pixelRatio:[ne,Z]}}readPPS(e){const t=new Dh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),r=t.readBoolean();let a=1;return r&&n?a=0:r?a=3:n&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const _n=188;class xl{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=xl.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(_n*5,t-_n)+1,n=0;for(;n1&&(a===0&&u>2||c+_n>i))return a}else{if(u)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:UD[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=xl.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=xl.createTrack("audio",n),this._id3Track=xl.createTrack("id3"),this._txtTrack=xl.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let r;const a=this._videoTrack,u=this._audioTrack,c=this._id3Track,d=this._txtTrack;let f=a.pid,p=a.pesData,y=u.pid,v=c.pid,b=u.pesData,T=c.pesData,E=null,D=this.pmtParsed,O=this._pmtId,R=e.length;if(this.remainderData&&(e=Xr(this.remainderData,e),R=e.length,this.remainderData=null),R<_n&&!n)return this.remainderData=e,{audioTrack:u,videoTrack:a,id3Track:c,textTrack:d};const j=Math.max(0,xl.syncOffset(e));R-=(R-j)%_n,R>4;let X;if(I>1){if(X=N+5+e[N+4],X===N+_n)continue}else X=N+4;switch(L){case f:Y&&(p&&(r=rc(p,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,d,r,!1)),p={data:[],size:0}),p&&(p.data.push(e.subarray(X,N+_n)),p.size+=N+_n-X);break;case y:if(Y){if(b&&(r=rc(b,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,r);break;case"mp3":this.parseMPEGPES(u,r);break;case"ac3":this.parseAC3PES(u,r);break}b={data:[],size:0}}b&&(b.data.push(e.subarray(X,N+_n)),b.size+=N+_n-X);break;case v:Y&&(T&&(r=rc(T,this.logger))&&this.parseID3PES(c,r),T={data:[],size:0}),T&&(T.data.push(e.subarray(X,N+_n)),T.size+=N+_n-X);break;case 0:Y&&(X+=e[X]+1),O=this._pmtId=Uj(e,X);break;case O:{Y&&(X+=e[X]+1);const G=jj(e,X,this.typeSupported,i,this.observer,this.logger);f=G.videoPid,f>0&&(a.pid=f,a.segmentCodec=G.segmentVideoCodec),y=G.audioPid,y>0&&(u.pid=y,u.segmentCodec=G.segmentAudioCodec),v=G.id3Pid,v>0&&(c.pid=v),E!==null&&!D&&(this.logger.warn(`MPEG-TS PMT found at ${N} after unknown PID '${E}'. Backtracking to sync byte @${j} to parse all TS packets.`),E=null,N=j-188),D=this.pmtParsed=!0;break}case 17:case 8191:break;default:E=L;break}}else F++;F>0&&qx(this.observer,new Error(`Found ${F} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=p,u.pesData=b,c.pesData=T;const z={audioTrack:u,videoTrack:a,id3Track:c,textTrack:d};return n&&this.extractRemainingSamples(z),z}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:r}=e,a=i.pesData,u=t.pesData,c=n.pesData;let d;if(a&&(d=rc(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,r,d,!0),i.pesData=null)):i.pesData=a,u&&(d=rc(u,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else u!=null&&u.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=u;c&&(d=rc(c,this.logger))?(this.parseID3PES(n,d),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Pj(this.observer,this.config,t);return this.decrypt(n,r)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Bj:e==="hevc"&&(this.videoParser=new Fj))}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{i(e)}):i(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let r=t.data;if(n){this.aacOverFlow=null;const p=n.missing,y=n.sample.unit.byteLength;if(p===-1)r=Xr(n.sample.unit,r);else{const v=y-p;n.sample.unit.set(r.subarray(0,p),v),e.samples.push(n.sample),i=n.missing}}let a,u;for(a=i,u=r.length;a0;)u+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=gs({},t,{type:this._videoTrack?Or.emsg:Or.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Gx(s,e){return((s[e+1]&31)<<8)+s[e+2]}function Uj(s,e){return(s[e+10]&31)<<8|s[e+11]}function jj(s,e,t,i,n,r){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(s[e+1]&15)<<8|s[e+2],c=e+3+u-4,d=(s[e+10]&15)<<8|s[e+11];for(e+=12+d;e0){let y=e+5,v=p;for(;v>2;){s[y]===106&&(t.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=f,a.segmentAudioCodec="ac3"));const T=s[y+1]+2;y+=T,v-=T}}break;case 194:case 135:return qx(n,new Error("Unsupported EC-3 in M2TS found"),void 0,r),a;case 36:a.videoPid===-1&&(a.videoPid=f,a.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=p+5}return a}function qx(s,e,t,i){i.warn(`parsing error: ${e.message}`),s.emit($.ERROR,$.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Cv(s,e){e.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function rc(s,e){let t=0,i,n,r,a,u;const c=s.data;if(!s||s.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Xr(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>s.size-6)return null;const f=i[7];f&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,f&64?(u=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-u>60*9e4&&(e.warn(`${Math.round((a-u)/9e4)}s delta between PTS and DTS, align them`),a=u)):u=a),r=i[8];let p=r+9;if(s.size<=p)return null;s.size-=p;const y=new Uint8Array(s.size);for(let v=0,b=c.length;vT){p-=T;continue}else i=i.subarray(p),T-=p,p=0;y.set(i,t),t+=T}return n&&(n-=r+3),{data:y,pts:a,dts:u,len:n}}return null}class $j{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const fl=Math.pow(2,32)-1;class Ie{static init(){Ie.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in Ie.types)Ie.types.hasOwnProperty(e)&&(Ie.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Ie.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Ie.STTS=Ie.STSC=Ie.STCO=r,Ie.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ie.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ie.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Ie.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Ie.FTYP=Ie.box(Ie.types.ftyp,a,c,a,u),Ie.DINF=Ie.box(Ie.types.dinf,Ie.box(Ie.types.dref,n))}static box(e,...t){let i=8,n=t.length;const r=n;for(;n--;)i+=t[n].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),n=0,i=8;n>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return Ie.box(Ie.types.mdia,Ie.mdhd(e.timescale||0,e.duration||0),Ie.hdlr(e.type),Ie.minf(e))}static mfhd(e){return Ie.box(Ie.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Ie.box(Ie.types.minf,Ie.box(Ie.types.smhd,Ie.SMHD),Ie.DINF,Ie.stbl(e)):Ie.box(Ie.types.minf,Ie.box(Ie.types.vmhd,Ie.VMHD),Ie.DINF,Ie.stbl(e))}static moof(e,t,i){return Ie.box(Ie.types.moof,Ie.mfhd(e),Ie.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Ie.trak(e[t]);return Ie.box.apply(null,[Ie.types.moov,Ie.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Ie.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Ie.trex(e[t]);return Ie.box.apply(null,[Ie.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(fl+1)),n=Math.floor(t%(fl+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Ie.box(Ie.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,r;for(n=0;n>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(r));for(n=0;n>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(r));const u=Ie.box(Ie.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,d=e.height,f=e.pixelRatio[0],p=e.pixelRatio[1];return Ie.box(Ie.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,Ie.box(Ie.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ie.box(Ie.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,p>>24,p>>16&255,p>>8&255,p&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return Ie.box(Ie.types.mp4a,Ie.audioStsd(e),Ie.box(Ie.types.esds,Ie.esds(e)))}static mp3(e){return Ie.box(Ie.types[".mp3"],Ie.audioStsd(e))}static ac3(e){return Ie.box(Ie.types["ac-3"],Ie.audioStsd(e),Ie.box(Ie.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Ie.box(Ie.types.stsd,Ie.STSD,Ie.mp4a(e));if(t==="ac3"&&e.config)return Ie.box(Ie.types.stsd,Ie.STSD,Ie.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Ie.box(Ie.types.stsd,Ie.STSD,Ie.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Ie.box(Ie.types.stsd,Ie.STSD,Ie.avc1(e));if(t==="hevc"&&e.vps)return Ie.box(Ie.types.stsd,Ie.STSD,Ie.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,r=e.height||0,a=Math.floor(i/(fl+1)),u=Math.floor(i%(fl+1));return Ie.box(Ie.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,u>>24,u>>16&255,u>>8&255,u&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,n&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const i=Ie.sdtp(e),n=e.id,r=Math.floor(t/(fl+1)),a=Math.floor(t%(fl+1));return Ie.box(Ie.types.traf,Ie.box(Ie.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),Ie.box(Ie.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255])),Ie.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Ie.box(Ie.types.trak,Ie.tkhd(e),Ie.mdia(e))}static trex(e){const t=e.id;return Ie.box(Ie.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,r=12+16*n,a=new Uint8Array(r);let u,c,d,f,p,y;for(t+=8+r,a.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),u=0;u>>24&255,d>>>16&255,d>>>8&255,d&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,p.isLeading<<2|p.dependsOn,p.isDependedOn<<6|p.hasRedundancy<<4|p.paddingValue<<1|p.isNonSync,p.degradPrio&61440,p.degradPrio&15,y>>>24&255,y>>>16&255,y>>>8&255,y&255],12+16*u);return Ie.box(Ie.types.trun,a)}static initSegment(e){Ie.types||Ie.init();const t=Ie.moov(e);return Xr(Ie.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=4,r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=r.length;for(let b=0;b>8,i[b][T].length&255]),a),a+=2,u.set(i[b][T],a),a+=i[b][T].length}const d=Ie.box(Ie.types.hvcC,u),f=e.width,p=e.height,y=e.pixelRatio[0],v=e.pixelRatio[1];return Ie.box(Ie.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,f>>8&255,f&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,Ie.box(Ie.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ie.box(Ie.types.pasp,new Uint8Array([y>>24,y>>16&255,y>>8&255,y&255,v>>24,v>>16&255,v>>8&255,v&255])))}}Ie.types=void 0;Ie.HDLR_TYPES=void 0;Ie.STTS=void 0;Ie.STSC=void 0;Ie.STCO=void 0;Ie.STSZ=void 0;Ie.VMHD=void 0;Ie.SMHD=void 0;Ie.STSD=void 0;Ie.FTYP=void 0;Ie.DINF=void 0;const OL=9e4;function f1(s,e,t=1,i=!1){const n=s*e*t;return i?Math.round(n):n}function Hj(s,e,t=1,i=!1){return f1(s,e,1/t,i)}function sh(s,e=!1){return f1(s,1e3,1/OL,e)}function zj(s,e=1){return f1(s,OL,1/e)}function Ew(s){const{baseTime:e,timescale:t,trackId:i}=s;return`${e/t} (${e}/${t}) trackId: ${i}`}const Vj=10*1e3,Gj=1024,qj=1152,Kj=1536;let ac=null,Dv=null;function ww(s,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:s?2:1,isNonSync:s?0:1}}}class t0 extends Jr{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,ac===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ac=a?parseInt(a[1]):0}if(Dv===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Dv=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Ew(t)} > ${e&&Ew(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((r,a)=>{let u=a.pts,c=u-r;return c<-4294967296&&(t=!0,u=Nr(u,i),c=u-r),c>0?r:u},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,r,a,u,c){let d,f,p,y,v,b,T=r,E=r;const D=e.pid>-1,O=t.pid>-1,R=t.samples.length,j=e.samples.length>0,F=u&&R>0||R>1;if((!D||j)&&(!O||F)||this.ISGenerated||u){if(this.ISGenerated){var N,Y,L,I;const ae=this.videoTrackConfig;(ae&&(t.width!==ae.width||t.height!==ae.height||((N=t.pixelRatio)==null?void 0:N[0])!==((Y=ae.pixelRatio)==null?void 0:Y[0])||((L=t.pixelRatio)==null?void 0:L[1])!==((I=ae.pixelRatio)==null?void 0:I[1]))||!ae&&F||this.nextAudioTs===null&&j)&&this.resetInitSegment()}this.ISGenerated||(p=this.generateIS(e,t,r,a));const X=this.isVideoContiguous;let G=-1,q;if(F&&(G=Wj(t.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(b=!0,G>0){this.warn(`Dropped ${G} out of ${R} video samples due to a missing keyframe`);const ae=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(G),t.dropped+=G,E+=(t.samples[0].pts-ae)/t.inputTimeScale,q=E}else G===-1&&(this.warn(`No keyframe found out of ${R} video samples`),b=!1);if(this.ISGenerated){if(j&&F){const ae=this.getVideoStartPts(t.samples),W=(Nr(e.samples[0].pts,ae)-ae)/t.inputTimeScale;T+=Math.max(0,W),E+=Math.max(0,-W)}if(j){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),p=this.generateIS(e,t,r,a)),f=this.remuxAudio(e,T,this.isAudioContiguous,a,O||F||c===Ot.AUDIO?E:void 0),F){const ae=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),p=this.generateIS(e,t,r,a)),d=this.remuxVideo(t,E,X,ae)}}else F&&(d=this.remuxVideo(t,E,X,0));d&&(d.firstKeyFrame=G,d.independent=G!==-1,d.firstKeyFramePTS=q)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(v=ML(i,r,this._initPTS,this._initDTS)),n.samples.length&&(y=PL(n,r,this._initPTS))),{audio:f,video:d,initSegment:p,independent:b,text:y,id3:v}}computeInitPts(e,t,i,n){const r=Math.round(i*t);let a=Nr(e,r);if(a0?U-1:U].dts&&(O=!0)}O&&a.sort(function(U,ne){const Z=U.dts-ne.dts,fe=U.pts-ne.pts;return Z||fe}),b=a[0].dts,T=a[a.length-1].dts;const j=T-b,F=j?Math.round(j/(c-1)):v||e.inputTimeScale/30;if(i){const U=b-R,ne=U>F,Z=U<-1;if((ne||Z)&&(ne?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${sh(U,!0)} ms (${U}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${sh(-U,!0)} ms (${U}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Z||R>=a[0].pts||ac)){b=R;const fe=a[0].pts-U;if(ne)a[0].dts=b,a[0].pts=fe;else{let xe=!0;for(let ge=0;gefe&&xe);ge++){const Ce=a[ge].pts;if(a[ge].dts-=U,a[ge].pts-=U,ge0?ne.dts-a[U-1].dts:F;if(xe=U>0?ne.pts-a[U-1].pts:F,Ce.stretchShortVideoTrack&&this.nextAudioTs!==null){const Re=Math.floor(Ce.maxBufferHole*r),Ae=(n?E+n*r:this.nextAudioTs+f)-ne.pts;Ae>Re?(v=Ae-Me,v<0?v=Me:G=!0,this.log(`It is approximately ${Ae/90} ms to the next segment; using duration ${v/90} ms for the last video frame.`)):v=Me}else v=Me}const ge=Math.round(ne.pts-ne.dts);q=Math.min(q,v),ie=Math.max(ie,v),ae=Math.min(ae,xe),W=Math.max(W,xe),u.push(ww(ne.key,v,fe,ge))}if(u.length){if(ac){if(ac<70){const U=u[0].flags;U.dependsOn=2,U.isNonSync=0}}else if(Dv&&W-ae0&&(n&&Math.abs(R-(D+O))<9e3||Math.abs(Nr(T[0].pts,R)-(D+O))<20*f),T.forEach(function(W){W.pts=Nr(W.pts,R)}),!i||D<0){const W=T.length;if(T=T.filter(K=>K.pts>=0),W!==T.length&&this.warn(`Removed ${T.length-W} of ${W} samples (initPTS ${O} / ${a})`),!T.length)return;r===0?D=0:n&&!b?D=Math.max(0,R-O):D=T[0].pts-O}if(e.segmentCodec==="aac"){const W=this.config.maxAudioFramesDrift;for(let K=0,Q=D+O;K=W*f&&ne0){N+=E;try{z=new Uint8Array(N)}catch(ne){this.observer.emit($.ERROR,$.ERROR,{type:jt.MUX_ERROR,details:Oe.REMUX_ALLOC_ERROR,fatal:!1,error:ne,bytes:N,reason:`fail allocating audio mdat ${N}`});return}y||(new DataView(z.buffer).setUint32(0,N),z.set(Ie.types.mdat,4))}else return;z.set(te,E);const U=te.byteLength;E+=U,v.push(ww(!0,d,U,0)),F=re}const L=v.length;if(!L)return;const I=v[v.length-1];D=F-O,this.nextAudioTs=D+c*I.duration;const X=y?new Uint8Array(0):Ie.moof(e.sequenceNumber++,j/c,gs({},e,{samples:v}));e.samples=[];const G=(j-O)/a,q=this.nextAudioTs/a,ie={data1:X,data2:z,startPTS:G,endPTS:q,startDTS:G,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:L};return this.isAudioContiguous=!0,ie}}function Nr(s,e){let t;if(e===null)return s;for(e4294967296;)s+=t;return s}function Wj(s){for(let e=0;ea.pts-u.pts);const r=s.samples;return s.samples=[],{samples:r}}class Yj extends Jr{constructor(e,t,i,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:r,video:a}=this.initData=HD(e);if(t)P6(e,t);else{const c=r||a;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}r&&(i=Aw(r,bs.AUDIO,this)),a&&(n=Aw(a,bs.VIDEO,this));const u={};r&&a?u.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:r?u.audio={container:"audio/mp4",codec:i,encrypted:r.encrypted,initSegment:e,id:"audio"}:a?u.video={container:"video/mp4",codec:n,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=u}remux(e,t,i,n,r,a){var u,c;let{initPTS:d,lastEndTime:f}=this;const p={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};Dt(f)||(f=this.lastEndTime=r||0);const y=t.samples;if(!y.length)return p;const v={initPTS:void 0,timescale:void 0,trackId:void 0};let b=this.initData;if((u=b)!=null&&u.length||(this.generateInitSegment(y),b=this.initData),!((c=b)!=null&&c.length))return this.warn("Failed to generate initSegment."),p;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const T=F6(y,b,this),E=b.audio?T[b.audio.id]:null,D=b.video?T[b.video.id]:null,O=Mm(D,1/0),R=Mm(E,1/0),j=Mm(D,0,!0),F=Mm(E,0,!0);let z=r,N=0;const Y=E&&(!D||!d&&R0?this.lastEndTime=X:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const G=!!b.audio,q=!!b.video;let ae="";G&&(ae+="audio"),q&&(ae+="video");const ie=(b.audio?b.audio.encrypted:!1)||(b.video?b.video.encrypted:!1),W={data1:y,startPTS:I,startDTS:I,endPTS:X,endDTS:X,type:ae,hasAudio:G,hasVideo:q,nb:1,dropped:0,encrypted:ie};p.audio=G&&!q?W:void 0,p.video=q?W:void 0;const K=D?.sampleCount;if(K){const Q=D.keyFrameIndex,te=Q!==-1;W.nb=K,W.dropped=Q===0||this.isVideoContiguous?0:te?Q:K,W.independent=te,W.firstKeyFrame=Q,te&&D.keyFrameStart&&(W.firstKeyFramePTS=(D.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(p.independent=te),this.isVideoContiguous||(this.isVideoContiguous=te),W.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Q}/${K} dropped: ${W.dropped} start: ${W.firstKeyFramePTS||"NA"}`)}return p.initSegment=v,p.id3=ML(i,r,d,d),n.samples.length&&(p.text=PL(n,r,d)),p}}function Mm(s,e,t=!1){return s?.start!==void 0?(s.start+(t?s.duration:0))/s.timescale:e}function Xj(s,e,t,i){if(s===null)return!0;const n=Math.max(i,1),r=e-s.baseTime/s.timescale;return Math.abs(r-t)>n}function Aw(s,e,t){const i=s.codec;return i&&i.length>4?i:e===bs.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?F0(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let xo;try{xo=self.performance.now.bind(self.performance)}catch{xo=Date.now}const i0=[{demux:Mj,remux:Yj},{demux:xl,remux:t0},{demux:Rj,remux:t0},{demux:Nj,remux:t0}];i0.splice(2,0,{demux:Ij,remux:t0});class kw{constructor(e,t,i,n,r,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=r,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const r=i.transmuxing;r.executeStart=xo();let a=new Uint8Array(e);const{currentTransmuxState:u,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:d,discontinuity:f,trackSwitch:p,accurateTimeOffset:y,timeOffset:v,initSegmentChange:b}=n||u,{audioCodec:T,videoCodec:E,defaultInitPts:D,duration:O,initSegmentData:R}=c,j=Qj(a,t);if(j&&kc(j.method)){const Y=this.getDecrypter(),L=n1(j.method);if(Y.isSync()){let I=Y.softwareDecrypt(a,j.key.buffer,j.iv.buffer,L);if(i.part>-1){const G=Y.flush();I=G&&G.buffer}if(!I)return r.executeEnd=xo(),Lv(i);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=Y.webCryptoDecrypt(a,j.key.buffer,j.iv.buffer,L).then(I=>{const X=this.push(I,null,i);return this.decryptionPromise=null,X}),this.decryptionPromise}const F=this.needsProbing(f,p);if(F){const Y=this.configureTransmuxer(a);if(Y)return this.logger.warn(`[transmuxer] ${Y.message}`),this.observer.emit($.ERROR,$.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,error:Y,reason:Y.message}),r.executeEnd=xo(),Lv(i)}(f||p||b||F)&&this.resetInitSegment(R,T,E,O,t),(f||b||F)&&this.resetInitialTimestamp(D),d||this.resetContiguity();const z=this.transmux(a,j,v,y,i);this.asyncResult=Hh(z);const N=this.currentTransmuxState;return N.contiguous=!0,N.discontinuity=!1,N.trackSwitch=!1,r.executeEnd=xo(),z}flush(e){const t=e.transmuxing;t.executeStart=xo();const{decrypter:i,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const a=[],{timeOffset:u}=n;if(i){const p=i.flush();p&&a.push(this.push(p.buffer,null,e))}const{demuxer:c,remuxer:d}=this;if(!c||!d){t.executeEnd=xo();const p=[Lv(e)];return this.asyncResult?Promise.resolve(p):p}const f=c.flush(u);return Hh(f)?(this.asyncResult=!0,f.then(p=>(this.flushRemux(a,p,e),a))):(this.flushRemux(a,f,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:r,id3Track:a,textTrack:u}=t,{accurateTimeOffset:c,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===Ot.MAIN?"level":"track"} ${i.level}`);const f=this.remuxer.remux(n,r,a,u,d,c,!0,this.id);e.push({remuxResult:f,chunkMeta:i}),i.transmuxing.executeEnd=xo()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,r){const{demuxer:a,remuxer:u}=this;!a||!u||(a.resetInitSegment(e,t,i,n),u.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,r){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,n,r):a=this.transmuxUnencrypted(e,i,n,r),a}transmuxUnencrypted(e,t,i,n){const{audioTrack:r,videoTrack:a,id3Track:u,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,u,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,r){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,n,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let r;for(let p=0,y=i0.length;p0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Lv=s=>({remuxResult:{},chunkMeta:s});function Hh(s){return"then"in s&&s.then instanceof Function}class Zj{constructor(e,t,i,n,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=r||null}}class Jj{constructor(e,t,i,n,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=a}}let Cw=0;class BL{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Cw++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const d=c.data,f=this.hls;if(!(!f||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var p;const y=(p=this.workerContext)==null?void 0:p.objectURL;y&&self.URL.revokeObjectURL(y);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{f.logger[d.data.logType]&&f.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,f.trigger(d.event,d.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const d=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const a=(c,d)=>{d=d||{},d.frag=this.frag||void 0,c===$.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(c,d)};this.observer=new o1,this.observer.on($.FRAG_DECRYPTED,a),this.observer.on($.ERROR,a);const u=zE(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(r.workerPath||sj()){try{r.workerPath?(c.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=rj(r.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=nj());const{worker:f}=this.workerContext;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:t,config:Ss(r)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new kw(this.observer,u,r,"",t,e.logger)}return}}this.transmuxer=new kw(this.observer,u,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Cw++;const t=this.hls.config,i=zE(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Ss(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),aj(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,r,a,u,c,d,f){var p,y;d.transmuxing.start=self.performance.now();const{instanceNo:v,transmuxer:b}=this,T=a?a.start:r.start,E=r.decryptdata,D=this.frag,O=!(D&&r.cc===D.cc),R=!(D&&d.level===D.level),j=D?d.sn-D.sn:-1,F=this.part?d.part-this.part.index:-1,z=j===0&&d.id>1&&d.id===D?.stats.chunkCount,N=!R&&(j===1||j===0&&(F===1||z&&F<=0)),Y=self.performance.now();(R||j||r.stats.parsing.start===0)&&(r.stats.parsing.start=Y),a&&(F||!N)&&(a.stats.parsing.start=Y);const L=!(D&&((p=r.initSegment)==null?void 0:p.url)===((y=D.initSegment)==null?void 0:y.url)),I=new Jj(O,N,c,R,T,L);if(!N||O||L){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===Ot.MAIN?"level":"track"}: ${d.level} id: ${d.id} +${t.m3u8}`)}function bL(s,e,t=!0){const i=e.startSN+e.skippedSegments-s.startSN,n=s.fragments,r=i>=0;let a=0;if(r&&ie){const r=i[i.length-1].duration*1e3;r{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function dj(s,e){return s!==e&&e?Aw(s)!==Aw(e):!1}function Aw(s){return s.replace(/\?[^?]*$/,"")}function Dh(s,e){for(let i=0,n=s.length;is.startCC)}function kw(s,e){const t=s.start+e;s.startPTS=t,s.setStart(t),s.endPTS=t+s.duration}function wL(s,e){const t=e.fragments;for(let i=0,n=t.length;i{const{config:a,fragCurrent:u,media:c,mediaBuffer:d,state:f}=this,g=c?c.currentTime:0,y=Ai.bufferInfo(d||c,g,a.maxBufferHole),v=!y.len;if(this.log(`Media seeking to ${Pt(g)?g.toFixed(3):g}, state: ${f}, ${v?"out of":"in"} buffer`),this.state===ot.ENDED)this.resetLoadingState();else if(u){const b=a.maxFragLookUpTolerance,T=u.start-b,E=u.start+u.duration+b;if(v||Ey.end){const D=g>E;(gb&&(this.lastCurrentTime=g),!this.loadingParts){const T=Math.max(y.end,g),E=this.shouldLoadParts(this.getLevelDetails(),T);E&&(this.log(`LL-Part loading ON after seeking to ${g.toFixed(2)} with buffer @${T.toFixed(2)}`),this.loadingParts=E)}}this.hls.hasEnoughToStart||(this.log(`Setting ${v?"startPosition":"nextLoadPosition"} to ${g} for seek without enough to start`),this.nextLoadPosition=g,v&&(this.startPosition=g)),v&&this.state===ot.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new HU(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new r1(e.config)}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===ot.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ot.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=Ai.bufferedInfo(r,e.start,0));const a=e.nextStart;if(a&&a>n&&a{const a=r.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(a,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,i,n).then(r=>{if(!r)return;const a=this.state,u=r.frag;if(this.fragContextChanged(u)){(a===ot.FRAG_LOADING||!this.fragCurrent&&a===ot.PARSING)&&(this.fragmentTracker.removeFragment(u),this.state=ot.IDLE);return}"payload"in r&&(this.log(`Loaded ${u.type} sn: ${u.sn} of ${this.playlistLabel()} ${u.level}`),this.hls.trigger($.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===ot.STOPPED||this.state===ot.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===bn.APPENDING){const r=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,r),u=Math.max(e.duration,a?a.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(u,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===bn.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger($.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i?.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:r,payload:a}=i,u=r.decryptdata;if(a&&a.byteLength>0&&u!=null&&u.key&&u.iv&&Dc(u.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),u.key.buffer,u.iv.buffer,o1(u.method)).catch(d=>{throw n.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:r}),d}).then(d=>{const f=self.performance.now();return n.trigger($.FRAG_DECRYPTED,{frag:r,payload:d,stats:{tstart:c,tdecrypt:f}}),i.payload=d,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===ot.STOPPED||this.state===ot.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==ot.STOPPED&&(this.state=ot.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,n;const r=e.tracks;if(r&&!t.encrypted&&((i=r.audio)!=null&&i.encrypted||(n=r.video)!=null&&n.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,u=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(u.message),!a||a.mediaKeys?!1:(this.hls.trigger($.ERROR,{type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_KEYS,fatal:!1,error:u,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?mj.toString(Ai.getBuffered(i)):"(detached)"})`),un(e)){var n;if(e.type!==$t.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(u=>!!a[u])){this.state=ot.IDLE;return}}const r=(n=this.levels)==null?void 0:n[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=ot.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:r}=e,a=!r||r.length===0||r.some(c=>!c),u=new a1(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(u)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var r;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let u=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=ot.KEY_LOADING,this.fragCurrent=e,u=this.keyLoader.load(e).then(y=>{if(!this.fragContextChanged(y.frag))return this.hls.trigger($.KEY_LOADED,y),this.state===ot.KEY_LOADING&&(this.state=ot.IDLE),y}),this.hls.trigger($.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(u=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),u&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(un(e)&&(!c||e.sn!==c.sn)){const y=this.shouldLoadParts(t.details,e.end);y!==this.loadingParts&&(this.log(`LL-Part loading ${y?"ON":"OFF"} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=y)}if(i=Math.max(e.start,i||0),this.loadingParts&&un(e)){const y=a.partList;if(y&&n){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const v=this.getNextPart(y,e,i);if(v>-1){const b=y[v];e=this.fragCurrent=b.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${b.index} (${v}/${y.length-1}) of ${this.fragInfo(e,!1,b)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=b.start+b.duration,this.state=ot.FRAG_LOADING;let T;return u?T=u.then(E=>!E||this.fragContextChanged(E.frag)?null:this.doFragPartsLoad(e,b,t,n)).catch(E=>this.handleFragLoadError(E)):T=this.doFragPartsLoad(e,b,t,n).catch(E=>this.handleFragLoadError(E)),this.hls.trigger($.FRAG_LOADING,{frag:e,part:b,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}else if(!e.url||this.loadedEndOfParts(y,i))return Promise.resolve(null)}}if(un(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=a.partList)==null?void 0:d.filter(y=>y.loaded).map(y=>`[${y.start}-${y.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),Pt(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ot.FRAG_LOADING;const f=this.config.progressive&&e.type!==$t.SUBTITLE;let g;return f&&u?g=u.then(y=>!y||this.fragContextChanged(y.frag)?null:this.fragmentLoader.load(e,n)).catch(y=>this.handleFragLoadError(y)):g=Promise.all([this.fragmentLoader.load(e,f?n:void 0),u]).then(([y])=>(!f&&n&&n(y),y)).catch(y=>this.handleFragLoadError(y)),this.hls.trigger($.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):g}doFragPartsLoad(e,t,i,n){return new Promise((r,a)=>{var u;const c=[],d=(u=i.details)==null?void 0:u.partList,f=g=>{this.fragmentLoader.loadPart(e,g,n).then(y=>{c[g.index]=y;const v=y.part;this.hls.trigger($.FRAG_LOADED,y);const b=ww(i.details,e.sn,g.index+1)||_L(d,e.sn,g.index+1);if(b)f(b);else return r({frag:e,part:v,partsLoaded:c})}).catch(a)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===Oe.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===Jt.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger($.ERROR,t)}else this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==ot.PARSING){!this.fragCurrent&&this.state!==ot.STOPPED&&this.state!==ot.ERROR&&(this.state=ot.IDLE);return}const{frag:i,part:n,level:r}=t,a=self.performance.now();i.stats.parsing.end=a,n&&(n.stats.parsing.end=a);const u=this.getLevelDetails(),d=u&&i.sn>u.endSN||this.shouldLoadParts(u,i.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(i,n,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const r=e.partList[0];if(r.fragment.type===$t.SUBTITLE)return!1;const a=r.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:r,part:a}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const u=t[n],c=u.details,d=a>-1?ww(c,r,a):null,f=d?d.fragment:SL(c,r,i);return f?(i&&i!==f&&(f.stats=i.stats),{frag:f,part:d,level:u}):null}bufferFragmentData(e,t,i,n,r){if(this.state!==ot.PARSING)return;const{data1:a,data2:u}=e;let c=a;if(u&&(c=ea(a,u)),!c.length)return;const d=this.initPTS[t.cc],f=d?-d.baseTime/d.timescale:void 0,g={type:e.type,frag:t,part:i,chunkMeta:n,offset:f,parent:t.type,data:c};if(this.hls.trigger($.BUFFER_APPENDING,g),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ai.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=Ai.bufferInfo(t,i,0),r=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),u=Math.max(Math.min(e.start-a,n.end-a),i+a);e.start-u>a&&this.flushMainBuffer(u,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!Pt(n))return null;const a=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,a)}getFwdBufferInfoAtPos(e,t,i,n){const r=Ai.bufferInfo(e,t,n);if(r.len===0&&r.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(r.nextStart<=a.end||a.gap)){const u=Math.max(Math.min(r.nextStart,a.end)-t,n);return Ai.bufferInfo(e,t,u)}}return r}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return r>=n?(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=$t.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:r}=this,a=i[0].start,u=r.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const g=r.initialLiveManifestSize;if(n=a?y:v)||c.start:e;this.log(`Setting startPosition to ${b} to match start frag at live edge. mainStart: ${y} liveSyncPosition: ${v} frag.start: ${(d=c)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=b}}else e<=a&&(c=i[0]);if(!c){const g=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,g,t)}let f=this.filterReplacedPrimary(c,t);if(!f&&c){const g=c.sn-t.startSN;f=this.filterReplacedPrimary(i[g+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===bn.OK||i===bn.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,r){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(u!==null&&i.len+u.len>=r){const c=a.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Cw(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Cw(this.config)&&e.type!==$t.SUBTITLE){const i=this.hls.interstitialsManager,n=i?.bufferingItem;if(n){const a=n.event;if(a){if(a.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&t?.live===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const r=i?.playerQueue;if(r)for(let a=r.length;a--;){const u=r[a].interstitial;if(u.appendInPlace&&e.start>=u.startTime&&e.end<=u.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,r=!1,a=!0;for(let u=0,c=e.length;u-1&&ii.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=LU(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){const a=t[r-e.startSN];i.cc===a.cc&&(n=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=lL(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(n=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:r}=this,{fragments:a,endSN:u}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:d}=n,f=i.partList,g=!!(this.loadingParts&&f!=null&&f.length&&c);g&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(a=a.concat(c),u=c.sn);let y;if(et-d||(v=this.media)!=null&&v.paused||!this.startFragRequested?0:d;y=Eu(r,a,e,T)}else y=a[a.length-1];if(y){const b=y.sn-i.startSN,T=this.fragmentTracker.getState(y);if((T===bn.OK||T===bn.PARTIAL&&y.gap)&&(r=y),r&&y.sn===r.sn&&(!g||f[0].fragment.sn>y.sn||!i.live)&&y.level===r.level){const D=a[b+1];y.sn${e.startSN} fragments: ${n}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&un(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==ot.FRAG_LOADING_WAITING_RETRY)&&(this.state=ot.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const D=this.getCurrentContext(t.chunkMeta);D&&(t.frag=D.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var r;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const a=t.details===Oe.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(n,!0);const u=t.errorAction;if(!u){this.state=ot.ERROR;return}const{action:c,flags:d,retryCount:f=0,retryConfig:g}=u,y=!!g,v=y&&c===Pn.RetryRequest,b=y&&!u.resolved&&d===Pr.MoveAllAlternatesMatchingHost,T=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!v&&b&&un(n)&&!n.endList&&T&&!cL(t))this.resetFragmentErrors(e),this.treatAsGap(n),u.resolved=!0;else if((v||b)&&f=t||i&&!zx(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=ot.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===ot.PARSING||this.state===ot.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,t?.duration||10);const a=!r;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===$t.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ot.STOPPED&&(this.state=ot.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=Ai.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===ot.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ot.STOPPED&&(this.state=ot.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const r=i.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,d)=>{const f=e.elementaryStreams[d];if(f){const g=f.endPTS-f.startPTS;if(g<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${g})`),c||!1;const y=n?0:xL(r,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this);return this.hls.trigger($.LEVEL_PTS_UPDATED,{details:r,level:i,drift:y,type:d,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var u;const c=((u=this.transmuxer)==null?void 0:u.error)===null;if((i.fragmentError===0||c&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),c){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=ot.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger($.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===$t.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,r;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((r=t&&!i?e.endPTS:(i||e).end)!=null?r:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Cw(s){return!!s.interstitialsController&&s.enableInterstitialPlayback!==!1}class kL{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=pj(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function pj(s,e){const t=new Uint8Array(e);let i=0;for(let n=0;n0)return s.subarray(t,t+i)}function Sj(s,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],a=r>>2&15;if(a>12){const v=new Error(`invalid ADTS sampling index:${a}`);s.emit($.ERROR,$.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message});return}const u=(r>>6&3)+1,c=e[t+3]>>6&3|(r&1)<<2,d="mp4a.40."+u,f=n[a];let g=a;(u===5||u===29)&&(g-=3);const y=[u<<3|(g&14)>>1,(g&1)<<7|c<<3];return ys.log(`manifest codec:${i}, parsed codec:${d}, channels:${c}, rate:${f} (ADTS object type:${u} sampling index:${a})`),{config:y,samplerate:f,channelCount:c,codec:d,parsedCodec:d,manifestCodec:i}}function DL(s,e){return s[e]===255&&(s[e+1]&246)===240}function LL(s,e){return s[e+1]&1?7:9}function h1(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function _j(s,e){return e+5=s.length)return!1;const i=h1(s,e);if(i<=t)return!1;const n=e+i;return n===s.length||X0(s,n)}return!1}function RL(s,e,t,i,n){if(!s.samplerate){const r=Sj(e,t,i,n);if(!r)return;Ss(s,r)}}function IL(s){return 1024*9e4/s}function Aj(s,e){const t=LL(s,e);if(e+t<=s.length){const i=h1(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function NL(s,e,t,i,n){const r=IL(s.samplerate),a=i+n*r,u=Aj(e,t);let c;if(u){const{frameLength:g,headerLength:y}=u,v=y+g,b=Math.max(0,t+v-e.length);b?(c=new Uint8Array(v-y),c.set(e.subarray(t+y,e.length),0)):c=e.subarray(t+y,t+v);const T={unit:c,pts:a};return b||s.samples.push(T),{sample:T,length:v,missing:b}}const d=e.length-t;return c=new Uint8Array(d),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:a},length:d,missing:-1}}function kj(s,e){return d1(s,e)&&Np(s,e+6)+10<=s.length-e}function Cj(s){return s instanceof ArrayBuffer?s:s.byteOffset==0&&s.byteLength==s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer}function Rv(s,e=0,t=1/0){return Dj(s,e,t,Uint8Array)}function Dj(s,e,t,i){const n=Lj(s);let r=1;"BYTES_PER_ELEMENT"in i&&(r=i.BYTES_PER_ELEMENT);const a=Rj(s)?s.byteOffset:0,u=(a+s.byteLength)/r,c=(a+e)/r,d=Math.floor(Math.max(0,Math.min(c,u))),f=Math.floor(Math.min(d+Math.max(t,0),u));return new i(n,d,f-d)}function Lj(s){return s instanceof ArrayBuffer?s:s.buffer}function Rj(s){return s&&s.buffer instanceof ArrayBuffer&&s.byteLength!==void 0&&s.byteOffset!==void 0}function Ij(s){const e={key:s.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(s.size<2)return;if(s.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=s.data.subarray(1).indexOf(0);if(i===-1)return;const n=jr(Rv(s.data,1,i)),r=s.data[2+i],a=s.data.subarray(3+i).indexOf(0);if(a===-1)return;const u=jr(Rv(s.data,3+i,a));let c;return n==="-->"?c=jr(Rv(s.data,4+i+a)):c=Cj(s.data.subarray(4+i+a)),e.mimeType=n,e.pictureType=r,e.description=u,e.data=c,e}function Nj(s){if(s.size<2)return;const e=jr(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}}function Oj(s){if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=jr(s.data.subarray(t),!0);t+=i.length+1;const n=jr(s.data.subarray(t));return{key:s.type,info:i,data:n}}const e=jr(s.data.subarray(1));return{key:s.type,info:"",data:e}}function Mj(s){if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=jr(s.data.subarray(t),!0);t+=i.length+1;const n=jr(s.data.subarray(t));return{key:s.type,info:i,data:n}}const e=jr(s.data);return{key:s.type,info:"",data:e}}function Pj(s){return s.type==="PRIV"?Nj(s):s.type[0]==="W"?Mj(s):s.type==="APIC"?Ij(s):Oj(s)}function Fj(s){const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Np(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}}const Pm=10,Bj=10;function OL(s){let e=0;const t=[];for(;d1(s,e);){const i=Np(s,e+6);s[e+5]>>6&1&&(e+=Pm),e+=Pm;const n=e+i;for(;e+Bj0&&u.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Br.audioId3,duration:Number.POSITIVE_INFINITY});n{if(Pt(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Fm=null;const $j=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Hj=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],zj=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Vj=[0,1,1,4];function PL(s,e,t,i,n){if(t+24>e.length)return;const r=FL(e,t);if(r&&t+r.frameLength<=e.length){const a=r.samplesPerFrame*9e4/r.sampleRate,u=i+n*a,c={unit:e.subarray(t,t+r.frameLength),pts:u,dts:u};return s.config=[],s.channelCount=r.channelCount,s.samplerate=r.sampleRate,s.samples.push(c),{sample:c,length:r.frameLength,missing:0}}}function FL(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,n=s[e+2]>>4&15,r=s[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&r!==3){const a=s[e+2]>>1&1,u=s[e+3]>>6,c=t===3?3-i:i===3?3:4,d=$j[c*14+n-1]*1e3,g=Hj[(t===3?0:t===2?1:2)*3+r],y=u===3?1:2,v=zj[t][i],b=Vj[i],T=v*8*b,E=Math.floor(v*d/g+a)*b;if(Fm===null){const R=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Fm=R?parseInt(R[1]):0}return Fm&&Fm<=87&&i===2&&d>=224e3&&u===0&&(s[e+3]=s[e+3]|128),{sampleRate:g,channelCount:y,frameLength:E,samplesPerFrame:T}}}function p1(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function BL(s,e){return e+1{let t=0,i=5;e+=i;const n=new Uint32Array(1),r=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=s[e];const u=Math.min(i,8),c=8-u;r[0]=4278190080>>>24+c<>c,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const u=[48e3,44100,32e3][r],c=e[t+4]&63,f=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+r]*2;if(t+f>e.length)return-1;const g=e[t+6]>>5;let y=0;g===2?y+=2:(g&1&&g!==1&&(y+=2),g&4&&(y+=2));const v=(e[t+6]<<8|e[t+7])>>12-y&1,T=[2,1,2,3,3,4,4,5][g]+v,E=e[t+5]>>3,D=e[t+5]&7,O=new Uint8Array([r<<6|E<<1|D>>2,(D&3)<<6|g<<3|v<<2|c>>4,c<<4&224]),R=1536/u*9e4,j=i+n*R,F=e.subarray(t,t+f);return s.config=O,s.channelCount=T,s.samplerate=u,s.samples.push({unit:F,pts:j}),f}class Wj extends m1{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=zh(e,0);let i=t?.length||0;if(t&&e[i]===11&&e[i+1]===119&&f1(t)!==void 0&&jL(e,i)<=16)return!1;for(let n=e.length;i{const a=iU(r);if(Yj.test(a.schemeIdUri)){const u=Lw(a,t);let c=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const d=a.payload;i.samples.push({data:d,len:d.byteLength,dts:u,pts:u,type:Br.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const u=Lw(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:u,pts:u,type:Br.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function Lw(s,e){return Pt(s.presentationTime)?s.presentationTime/s.timeScale:e+s.presentationTimeDelta/s.timeScale}class Qj{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new r1(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Dl.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then(u=>{const c=new Uint8Array(u);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let r=32;r{r.data=this.getAvcDecryptedUnit(a,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)}).catch(n)}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const r=e[t].units;for(;!(i>=r.length);i++){const a=r[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,n,a),!this.decrypter.isSync()))return}}}}class HL{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const r=i.units;n=r[r.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const r=i[n-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let r=e.naluState||0;const a=r,u=[];let c=0,d,f,g,y=-1,v=0;for(r===-1&&(y=0,v=this.getNALuType(t,0),r=0,c=1);c=0){const b={data:t.subarray(y,f),type:v};u.push(b)}else{const b=this.getLastNalUnit(e.samples);b&&(a&&c<=4-a&&b.state&&(b.data=b.data.subarray(0,b.data.byteLength-a)),f>0&&(b.data=ea(b.data,t.subarray(0,f)),b.state=0))}c=0&&r>=0){const b={data:t.subarray(y,n),type:v,state:r};u.push(b)}if(u.length===0){const b=this.getLastNalUnit(e.samples);b&&(b.data=ea(b.data,t))}return e.naluState=r,u}}class Lh{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");n.set(e.subarray(i,i+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&ys.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Zj extends HL{parsePES(e,t,i,n){const r=this.parseNALu(e,i.data,n);let a=this.VideoSample,u,c=!1;i.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(d=>{var f,g;switch(d.type){case 1:{let T=!1;u=!0;const E=d.data;if(c&&E.length>4){const D=this.readSliceType(E);(D===2||D===4||D===7||D===9)&&(T=!0)}if(T){var y;(y=a)!=null&&y.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=T;break}case 5:u=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{u=!0,t1(d.data,1,i.pts,t.samples);break}case 7:{var v,b;u=!0,c=!0;const T=d.data,E=this.readSPS(T);if(!e.sps||e.width!==E.width||e.height!==E.height||((v=e.pixelRatio)==null?void 0:v[0])!==E.pixelRatio[0]||((b=e.pixelRatio)==null?void 0:b[1])!==E.pixelRatio[1]){e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.sps=[T];const D=T.subarray(1,4);let O="avc1.";for(let R=0;R<3;R++){let j=D[R].toString(16);j.length<2&&(j="0"+j),O+=j}e.codec=O}break}case 8:u=!0,e.pps=[d.data];break;case 9:u=!0,e.audFound=!0,(g=a)!=null&&g.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:u=!0;break;default:u=!1;break}a&&u&&a.units.push(d)}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Lh(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,r;for(let a=0;a{var f,g;switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,u=!0;break;case 16:case 17:case 18:case 21:if(u=!0,c){var y;(y=a)!=null&&y.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:u=!0,(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:u=!0,t1(d.data,2,i.pts,t.samples);break;case 32:u=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=Ss(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(u=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const v=this.readSPS(d.data);e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.codec=v.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const b in v.params)e.params[b]=v.params[b]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(u=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const v=this.readPPS(d.data);for(const b in v)e.params[b]=v[b]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:u=!0,e.audFound=!0,(g=a)!=null&&g.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:u=!1;break}a&&u&&a.units.push(d)}),n&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Lh(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new Lh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),r=t.readBoolean(),a=t.readBits(5),u=t.readUByte(),c=t.readUByte(),d=t.readUByte(),f=t.readUByte(),g=t.readUByte(),y=t.readUByte(),v=t.readUByte(),b=t.readUByte(),T=t.readUByte(),E=t.readUByte(),D=t.readUByte(),O=[],R=[];for(let ke=0;ke0)for(let ke=i;ke<8;ke++)t.readBits(2);for(let ke=0;ke1&&t.readEG();for(let Re=0;Re0&&ze<16?(re=Ue[ze-1],Q=de[ze-1]):ze===255&&(re=t.readBits(16),Q=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),we=t.readBoolean(),we&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(be=t.readBits(32),ve=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const de=t.readBoolean(),qe=t.readBoolean();let ht=!1;(de||qe)&&(ht=t.readBoolean(),ht&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ht&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let tt=0;tt<=i;tt++){pe=t.readBoolean();const At=pe||t.readBoolean();let ft=!1;At?t.readEG():ft=t.readBoolean();const Et=ft?1:t.readUEG()+1;if(de)for(let Lt=0;Lt>ke&1)<<31-ke)>>>0;let vt=wt.toString(16);return a===1&&vt==="2"&&(vt="6"),{codecString:`hvc1.${De}${a}.${vt}.${r?"H":"L"}${D}.B0`,params:{general_tier_flag:r,general_profile_idc:a,general_profile_space:n,general_profile_compatibility_flags:[u,c,d,f],general_constraint_indicator_flags:[g,y,v,b,T,E],general_level_idc:D,bit_depth:V+8,bit_depth_luma_minus8:V,bit_depth_chroma_minus8:Y,min_spatial_segmentation_idc:z,chroma_format_idc:j,frame_rate:{fixed:pe,fps:ve/be}},width:Fe,height:Ze,pixelRatio:[re,Q]}}readPPS(e){const t=new Lh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),r=t.readBoolean();let a=1;return r&&n?a=0:r?a=3:n&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const En=188;class bl{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=bl.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(En*5,t-En)+1,n=0;for(;n1&&(a===0&&u>2||c+En>i))return a}else{if(u)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:WD[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=bl.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=bl.createTrack("audio",n),this._id3Track=bl.createTrack("id3"),this._txtTrack=bl.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let r;const a=this._videoTrack,u=this._audioTrack,c=this._id3Track,d=this._txtTrack;let f=a.pid,g=a.pesData,y=u.pid,v=c.pid,b=u.pesData,T=c.pesData,E=null,D=this.pmtParsed,O=this._pmtId,R=e.length;if(this.remainderData&&(e=ea(this.remainderData,e),R=e.length,this.remainderData=null),R>4;let X;if(N>1){if(X=L+5+e[L+4],X===L+En)continue}else X=L+4;switch(I){case f:W&&(g&&(r=oc(g,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,d,r,!1)),g={data:[],size:0}),g&&(g.data.push(e.subarray(X,L+En)),g.size+=L+En-X);break;case y:if(W){if(b&&(r=oc(b,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,r);break;case"mp3":this.parseMPEGPES(u,r);break;case"ac3":this.parseAC3PES(u,r);break}b={data:[],size:0}}b&&(b.data.push(e.subarray(X,L+En)),b.size+=L+En-X);break;case v:W&&(T&&(r=oc(T,this.logger))&&this.parseID3PES(c,r),T={data:[],size:0}),T&&(T.data.push(e.subarray(X,L+En)),T.size+=L+En-X);break;case 0:W&&(X+=e[X]+1),O=this._pmtId=e7(e,X);break;case O:{W&&(X+=e[X]+1);const V=t7(e,X,this.typeSupported,i,this.observer,this.logger);f=V.videoPid,f>0&&(a.pid=f,a.segmentCodec=V.segmentVideoCodec),y=V.audioPid,y>0&&(u.pid=y,u.segmentCodec=V.segmentAudioCodec),v=V.id3Pid,v>0&&(c.pid=v),E!==null&&!D&&(this.logger.warn(`MPEG-TS PMT found at ${L} after unknown PID '${E}'. Backtracking to sync byte @${j} to parse all TS packets.`),E=null,L=j-188),D=this.pmtParsed=!0;break}case 17:case 8191:break;default:E=I;break}}else F++;F>0&&Yx(this.observer,new Error(`Found ${F} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=g,u.pesData=b,c.pesData=T;const G={audioTrack:u,videoTrack:a,id3Track:c,textTrack:d};return n&&this.extractRemainingSamples(G),G}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:r}=e,a=i.pesData,u=t.pesData,c=n.pesData;let d;if(a&&(d=oc(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,r,d,!0),i.pesData=null)):i.pesData=a,u&&(d=oc(u,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else u!=null&&u.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=u;c&&(d=oc(c,this.logger))?(this.parseID3PES(n,d),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Qj(this.observer,this.config,t);return this.decrypt(n,r)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Zj:e==="hevc"&&(this.videoParser=new Jj))}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{i(e)}):i(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let r=t.data;if(n){this.aacOverFlow=null;const g=n.missing,y=n.sample.unit.byteLength;if(g===-1)r=ea(n.sample.unit,r);else{const v=y-g;n.sample.unit.set(r.subarray(0,g),v),e.samples.push(n.sample),i=n.missing}}let a,u;for(a=i,u=r.length;a0;)u+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ss({},t,{type:this._videoTrack?Br.emsg:Br.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Wx(s,e){return((s[e+1]&31)<<8)+s[e+2]}function e7(s,e){return(s[e+10]&31)<<8|s[e+11]}function t7(s,e,t,i,n,r){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=(s[e+1]&15)<<8|s[e+2],c=e+3+u-4,d=(s[e+10]&15)<<8|s[e+11];for(e+=12+d;e0){let y=e+5,v=g;for(;v>2;){s[y]===106&&(t.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=f,a.segmentAudioCodec="ac3"));const T=s[y+1]+2;y+=T,v-=T}}break;case 194:case 135:return Yx(n,new Error("Unsupported EC-3 in M2TS found"),void 0,r),a;case 36:a.videoPid===-1&&(a.videoPid=f,a.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=g+5}return a}function Yx(s,e,t,i){i.warn(`parsing error: ${e.message}`),s.emit($.ERROR,$.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Iv(s,e){e.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function oc(s,e){let t=0,i,n,r,a,u;const c=s.data;if(!s||s.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=ea(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>s.size-6)return null;const f=i[7];f&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,f&64?(u=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-u>60*9e4&&(e.warn(`${Math.round((a-u)/9e4)}s delta between PTS and DTS, align them`),a=u)):u=a),r=i[8];let g=r+9;if(s.size<=g)return null;s.size-=g;const y=new Uint8Array(s.size);for(let v=0,b=c.length;vT){g-=T;continue}else i=i.subarray(g),T-=g,g=0;y.set(i,t),t+=T}return n&&(n-=r+3),{data:y,pts:a,dts:u,len:n}}return null}class i7{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const ml=Math.pow(2,32)-1;class Ne{static init(){Ne.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in Ne.types)Ne.types.hasOwnProperty(e)&&(Ne.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Ne.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Ne.STTS=Ne.STSC=Ne.STCO=r,Ne.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ne.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ne.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Ne.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Ne.FTYP=Ne.box(Ne.types.ftyp,a,c,a,u),Ne.DINF=Ne.box(Ne.types.dinf,Ne.box(Ne.types.dref,n))}static box(e,...t){let i=8,n=t.length;const r=n;for(;n--;)i+=t[n].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),n=0,i=8;n>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return Ne.box(Ne.types.mdia,Ne.mdhd(e.timescale||0,e.duration||0),Ne.hdlr(e.type),Ne.minf(e))}static mfhd(e){return Ne.box(Ne.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?Ne.box(Ne.types.minf,Ne.box(Ne.types.smhd,Ne.SMHD),Ne.DINF,Ne.stbl(e)):Ne.box(Ne.types.minf,Ne.box(Ne.types.vmhd,Ne.VMHD),Ne.DINF,Ne.stbl(e))}static moof(e,t,i){return Ne.box(Ne.types.moof,Ne.mfhd(e),Ne.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Ne.trak(e[t]);return Ne.box.apply(null,[Ne.types.moov,Ne.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(Ne.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Ne.trex(e[t]);return Ne.box.apply(null,[Ne.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(ml+1)),n=Math.floor(t%(ml+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return Ne.box(Ne.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,r;for(n=0;n>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(r));for(n=0;n>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(r));const u=Ne.box(Ne.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),c=e.width,d=e.height,f=e.pixelRatio[0],g=e.pixelRatio[1];return Ne.box(Ne.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,Ne.box(Ne.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ne.box(Ne.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,g>>24,g>>16&255,g>>8&255,g&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return Ne.box(Ne.types.mp4a,Ne.audioStsd(e),Ne.box(Ne.types.esds,Ne.esds(e)))}static mp3(e){return Ne.box(Ne.types[".mp3"],Ne.audioStsd(e))}static ac3(e){return Ne.box(Ne.types["ac-3"],Ne.audioStsd(e),Ne.box(Ne.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Ne.box(Ne.types.stsd,Ne.STSD,Ne.mp4a(e));if(t==="ac3"&&e.config)return Ne.box(Ne.types.stsd,Ne.STSD,Ne.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Ne.box(Ne.types.stsd,Ne.STSD,Ne.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Ne.box(Ne.types.stsd,Ne.STSD,Ne.avc1(e));if(t==="hevc"&&e.vps)return Ne.box(Ne.types.stsd,Ne.STSD,Ne.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,r=e.height||0,a=Math.floor(i/(ml+1)),u=Math.floor(i%(ml+1));return Ne.box(Ne.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,u>>24,u>>16&255,u>>8&255,u&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,n&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const i=Ne.sdtp(e),n=e.id,r=Math.floor(t/(ml+1)),a=Math.floor(t%(ml+1));return Ne.box(Ne.types.traf,Ne.box(Ne.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),Ne.box(Ne.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255])),Ne.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Ne.box(Ne.types.trak,Ne.tkhd(e),Ne.mdia(e))}static trex(e){const t=e.id;return Ne.box(Ne.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,r=12+16*n,a=new Uint8Array(r);let u,c,d,f,g,y;for(t+=8+r,a.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),u=0;u>>24&255,d>>>16&255,d>>>8&255,d&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,g.isLeading<<2|g.dependsOn,g.isDependedOn<<6|g.hasRedundancy<<4|g.paddingValue<<1|g.isNonSync,g.degradPrio&61440,g.degradPrio&15,y>>>24&255,y>>>16&255,y>>>8&255,y&255],12+16*u);return Ne.box(Ne.types.trun,a)}static initSegment(e){Ne.types||Ne.init();const t=Ne.moov(e);return ea(Ne.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=4,r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=r.length;for(let b=0;b>8,i[b][T].length&255]),a),a+=2,u.set(i[b][T],a),a+=i[b][T].length}const d=Ne.box(Ne.types.hvcC,u),f=e.width,g=e.height,y=e.pixelRatio[0],v=e.pixelRatio[1];return Ne.box(Ne.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,f>>8&255,f&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,Ne.box(Ne.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ne.box(Ne.types.pasp,new Uint8Array([y>>24,y>>16&255,y>>8&255,y&255,v>>24,v>>16&255,v>>8&255,v&255])))}}Ne.types=void 0;Ne.HDLR_TYPES=void 0;Ne.STTS=void 0;Ne.STSC=void 0;Ne.STCO=void 0;Ne.STSZ=void 0;Ne.VMHD=void 0;Ne.SMHD=void 0;Ne.STSD=void 0;Ne.FTYP=void 0;Ne.DINF=void 0;const zL=9e4;function g1(s,e,t=1,i=!1){const n=s*e*t;return i?Math.round(n):n}function s7(s,e,t=1,i=!1){return g1(s,e,1/t,i)}function nh(s,e=!1){return g1(s,1e3,1/zL,e)}function n7(s,e=1){return g1(s,zL,1/e)}function Rw(s){const{baseTime:e,timescale:t,trackId:i}=s;return`${e/t} (${e}/${t}) trackId: ${i}`}const r7=10*1e3,a7=1024,o7=1152,l7=1536;let lc=null,Nv=null;function Iw(s,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:s?2:1,isNonSync:s?0:1}}}class a0 extends sa{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,lc===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);lc=a?parseInt(a[1]):0}if(Nv===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Nv=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Rw(t)} > ${e&&Rw(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((r,a)=>{let u=a.pts,c=u-r;return c<-4294967296&&(t=!0,u=Fr(u,i),c=u-r),c>0?r:u},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,r,a,u,c){let d,f,g,y,v,b,T=r,E=r;const D=e.pid>-1,O=t.pid>-1,R=t.samples.length,j=e.samples.length>0,F=u&&R>0||R>1;if((!D||j)&&(!O||F)||this.ISGenerated||u){if(this.ISGenerated){var L,W,I,N;const ne=this.videoTrackConfig;(ne&&(t.width!==ne.width||t.height!==ne.height||((L=t.pixelRatio)==null?void 0:L[0])!==((W=ne.pixelRatio)==null?void 0:W[0])||((I=t.pixelRatio)==null?void 0:I[1])!==((N=ne.pixelRatio)==null?void 0:N[1]))||!ne&&F||this.nextAudioTs===null&&j)&&this.resetInitSegment()}this.ISGenerated||(g=this.generateIS(e,t,r,a));const X=this.isVideoContiguous;let V=-1,Y;if(F&&(V=u7(t.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(b=!0,V>0){this.warn(`Dropped ${V} out of ${R} video samples due to a missing keyframe`);const ne=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(V),t.dropped+=V,E+=(t.samples[0].pts-ne)/t.inputTimeScale,Y=E}else V===-1&&(this.warn(`No keyframe found out of ${R} video samples`),b=!1);if(this.ISGenerated){if(j&&F){const ne=this.getVideoStartPts(t.samples),K=(Fr(e.samples[0].pts,ne)-ne)/t.inputTimeScale;T+=Math.max(0,K),E+=Math.max(0,-K)}if(j){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),g=this.generateIS(e,t,r,a)),f=this.remuxAudio(e,T,this.isAudioContiguous,a,O||F||c===$t.AUDIO?E:void 0),F){const ne=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),g=this.generateIS(e,t,r,a)),d=this.remuxVideo(t,E,X,ne)}}else F&&(d=this.remuxVideo(t,E,X,0));d&&(d.firstKeyFrame=V,d.independent=V!==-1,d.firstKeyFramePTS=Y)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(v=VL(i,r,this._initPTS,this._initDTS)),n.samples.length&&(y=GL(n,r,this._initPTS))),{audio:f,video:d,initSegment:g,independent:b,text:y,id3:v}}computeInitPts(e,t,i,n){const r=Math.round(i*t);let a=Fr(e,r);if(a0?z-1:z].dts&&(O=!0)}O&&a.sort(function(z,re){const Q=z.dts-re.dts,pe=z.pts-re.pts;return Q||pe}),b=a[0].dts,T=a[a.length-1].dts;const j=T-b,F=j?Math.round(j/(c-1)):v||e.inputTimeScale/30;if(i){const z=b-R,re=z>F,Q=z<-1;if((re||Q)&&(re?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${nh(z,!0)} ms (${z}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${nh(-z,!0)} ms (${z}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Q||R>=a[0].pts||lc)){b=R;const pe=a[0].pts-z;if(re)a[0].dts=b,a[0].pts=pe;else{let be=!0;for(let ve=0;vepe&&be);ve++){const we=a[ve].pts;if(a[ve].dts-=z,a[ve].pts-=z,ve0?re.dts-a[z-1].dts:F;if(be=z>0?re.pts-a[z-1].pts:F,we.stretchShortVideoTrack&&this.nextAudioTs!==null){const Fe=Math.floor(we.maxBufferHole*r),Ze=(n?E+n*r:this.nextAudioTs+f)-re.pts;Ze>Fe?(v=Ze-He,v<0?v=He:V=!0,this.log(`It is approximately ${Ze/90} ms to the next segment; using duration ${v/90} ms for the last video frame.`)):v=He}else v=He}const ve=Math.round(re.pts-re.dts);Y=Math.min(Y,v),ie=Math.max(ie,v),ne=Math.min(ne,be),K=Math.max(K,be),u.push(Iw(re.key,v,pe,ve))}if(u.length){if(lc){if(lc<70){const z=u[0].flags;z.dependsOn=2,z.isNonSync=0}}else if(Nv&&K-ne0&&(n&&Math.abs(R-(D+O))<9e3||Math.abs(Fr(T[0].pts,R)-(D+O))<20*f),T.forEach(function(K){K.pts=Fr(K.pts,R)}),!i||D<0){const K=T.length;if(T=T.filter(q=>q.pts>=0),K!==T.length&&this.warn(`Removed ${T.length-K} of ${K} samples (initPTS ${O} / ${a})`),!T.length)return;r===0?D=0:n&&!b?D=Math.max(0,R-O):D=T[0].pts-O}if(e.segmentCodec==="aac"){const K=this.config.maxAudioFramesDrift;for(let q=0,Z=D+O;q=K*f&&re0){L+=E;try{G=new Uint8Array(L)}catch(re){this.observer.emit($.ERROR,$.ERROR,{type:Jt.MUX_ERROR,details:Oe.REMUX_ALLOC_ERROR,fatal:!1,error:re,bytes:L,reason:`fail allocating audio mdat ${L}`});return}y||(new DataView(G.buffer).setUint32(0,L),G.set(Ne.types.mdat,4))}else return;G.set(te,E);const z=te.byteLength;E+=z,v.push(Iw(!0,d,z,0)),F=le}const I=v.length;if(!I)return;const N=v[v.length-1];D=F-O,this.nextAudioTs=D+c*N.duration;const X=y?new Uint8Array(0):Ne.moof(e.sequenceNumber++,j/c,Ss({},e,{samples:v}));e.samples=[];const V=(j-O)/a,Y=this.nextAudioTs/a,ie={data1:X,data2:G,startPTS:V,endPTS:Y,startDTS:V,endDTS:Y,type:"audio",hasAudio:!0,hasVideo:!1,nb:I};return this.isAudioContiguous=!0,ie}}function Fr(s,e){let t;if(e===null)return s;for(e4294967296;)s+=t;return s}function u7(s){for(let e=0;ea.pts-u.pts);const r=s.samples;return s.samples=[],{samples:r}}class c7 extends sa{constructor(e,t,i,n){super("passthrough-remuxer",n),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:r,video:a}=this.initData=QD(e);if(t)Q6(e,t);else{const c=r||a;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}r&&(i=Nw(r,As.AUDIO,this)),a&&(n=Nw(a,As.VIDEO,this));const u={};r&&a?u.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:r?u.audio={container:"audio/mp4",codec:i,encrypted:r.encrypted,initSegment:e,id:"audio"}:a?u.video={container:"video/mp4",codec:n,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=u}remux(e,t,i,n,r,a){var u,c;let{initPTS:d,lastEndTime:f}=this;const g={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};Pt(f)||(f=this.lastEndTime=r||0);const y=t.samples;if(!y.length)return g;const v={initPTS:void 0,timescale:void 0,trackId:void 0};let b=this.initData;if((u=b)!=null&&u.length||(this.generateInitSegment(y),b=this.initData),!((c=b)!=null&&c.length))return this.warn("Failed to generate initSegment."),g;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);const T=J6(y,b,this),E=b.audio?T[b.audio.id]:null,D=b.video?T[b.video.id]:null,O=Bm(D,1/0),R=Bm(E,1/0),j=Bm(D,0,!0),F=Bm(E,0,!0);let G=r,L=0;const W=E&&(!D||!d&&R0?this.lastEndTime=X:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const V=!!b.audio,Y=!!b.video;let ne="";V&&(ne+="audio"),Y&&(ne+="video");const ie=(b.audio?b.audio.encrypted:!1)||(b.video?b.video.encrypted:!1),K={data1:y,startPTS:N,startDTS:N,endPTS:X,endDTS:X,type:ne,hasAudio:V,hasVideo:Y,nb:1,dropped:0,encrypted:ie};g.audio=V&&!Y?K:void 0,g.video=Y?K:void 0;const q=D?.sampleCount;if(q){const Z=D.keyFrameIndex,te=Z!==-1;K.nb=q,K.dropped=Z===0||this.isVideoContiguous?0:te?Z:q,K.independent=te,K.firstKeyFrame=Z,te&&D.keyFrameStart&&(K.firstKeyFramePTS=(D.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(g.independent=te),this.isVideoContiguous||(this.isVideoContiguous=te),K.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Z}/${q} dropped: ${K.dropped} start: ${K.firstKeyFramePTS||"NA"}`)}return g.initSegment=v,g.id3=VL(i,r,d,d),n.samples.length&&(g.text=GL(n,r,d)),g}}function Bm(s,e,t=!1){return s?.start!==void 0?(s.start+(t?s.duration:0))/s.timescale:e}function d7(s,e,t,i){if(s===null)return!0;const n=Math.max(i,1),r=e-s.baseTime/s.timescale;return Math.abs(r-t)>n}function Nw(s,e,t){const i=s.codec;return i&&i.length>4?i:e===As.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?H0(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let To;try{To=self.performance.now.bind(self.performance)}catch{To=Date.now}const o0=[{demux:Xj,remux:c7},{demux:bl,remux:a0},{demux:qj,remux:a0},{demux:Wj,remux:a0}];o0.splice(2,0,{demux:Kj,remux:a0});class Ow{constructor(e,t,i,n,r,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=r,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const r=i.transmuxing;r.executeStart=To();let a=new Uint8Array(e);const{currentTransmuxState:u,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:d,discontinuity:f,trackSwitch:g,accurateTimeOffset:y,timeOffset:v,initSegmentChange:b}=n||u,{audioCodec:T,videoCodec:E,defaultInitPts:D,duration:O,initSegmentData:R}=c,j=h7(a,t);if(j&&Dc(j.method)){const W=this.getDecrypter(),I=o1(j.method);if(W.isSync()){let N=W.softwareDecrypt(a,j.key.buffer,j.iv.buffer,I);if(i.part>-1){const V=W.flush();N=V&&V.buffer}if(!N)return r.executeEnd=To(),Ov(i);a=new Uint8Array(N)}else return this.asyncResult=!0,this.decryptionPromise=W.webCryptoDecrypt(a,j.key.buffer,j.iv.buffer,I).then(N=>{const X=this.push(N,null,i);return this.decryptionPromise=null,X}),this.decryptionPromise}const F=this.needsProbing(f,g);if(F){const W=this.configureTransmuxer(a);if(W)return this.logger.warn(`[transmuxer] ${W.message}`),this.observer.emit($.ERROR,$.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,fatal:!1,error:W,reason:W.message}),r.executeEnd=To(),Ov(i)}(f||g||b||F)&&this.resetInitSegment(R,T,E,O,t),(f||b||F)&&this.resetInitialTimestamp(D),d||this.resetContiguity();const G=this.transmux(a,j,v,y,i);this.asyncResult=Vh(G);const L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,r.executeEnd=To(),G}flush(e){const t=e.transmuxing;t.executeStart=To();const{decrypter:i,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const a=[],{timeOffset:u}=n;if(i){const g=i.flush();g&&a.push(this.push(g.buffer,null,e))}const{demuxer:c,remuxer:d}=this;if(!c||!d){t.executeEnd=To();const g=[Ov(e)];return this.asyncResult?Promise.resolve(g):g}const f=c.flush(u);return Vh(f)?(this.asyncResult=!0,f.then(g=>(this.flushRemux(a,g,e),a))):(this.flushRemux(a,f,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:r,id3Track:a,textTrack:u}=t,{accurateTimeOffset:c,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===$t.MAIN?"level":"track"} ${i.level}`);const f=this.remuxer.remux(n,r,a,u,d,c,!0,this.id);e.push({remuxResult:f,chunkMeta:i}),i.transmuxing.executeEnd=To()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,r){const{demuxer:a,remuxer:u}=this;!a||!u||(a.resetInitSegment(e,t,i,n),u.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,r){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,n,r):a=this.transmuxUnencrypted(e,i,n,r),a}transmuxUnencrypted(e,t,i,n){const{audioTrack:r,videoTrack:a,id3Track:u,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,u,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,r){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,n,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let r;for(let g=0,y=o0.length;g0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ov=s=>({remuxResult:{},chunkMeta:s});function Vh(s){return"then"in s&&s.then instanceof Function}class f7{constructor(e,t,i,n,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=r||null}}class m7{constructor(e,t,i,n,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=a}}let Mw=0;class qL{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Mw++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const d=c.data,f=this.hls;if(!(!f||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var g;const y=(g=this.workerContext)==null?void 0:g.objectURL;y&&self.URL.revokeObjectURL(y);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{f.logger[d.data.logType]&&f.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,f.trigger(d.event,d.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const d=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const a=(c,d)=>{d=d||{},d.frag=this.frag||void 0,c===$.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(c,d)};this.observer=new c1,this.observer.on($.FRAG_DECRYPTED,a),this.observer.on($.ERROR,a);const u=XE(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(r.workerPath||vj()){try{r.workerPath?(c.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=bj(r.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=xj());const{worker:f}=this.workerContext;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:u,id:t,config:Cs(r)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new Ow(this.observer,u,r,"",t,e.logger)}return}}this.transmuxer=new Ow(this.observer,u,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Mw++;const t=this.hls.config,i=XE(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Cs(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Tj(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,r,a,u,c,d,f){var g,y;d.transmuxing.start=self.performance.now();const{instanceNo:v,transmuxer:b}=this,T=a?a.start:r.start,E=r.decryptdata,D=this.frag,O=!(D&&r.cc===D.cc),R=!(D&&d.level===D.level),j=D?d.sn-D.sn:-1,F=this.part?d.part-this.part.index:-1,G=j===0&&d.id>1&&d.id===D?.stats.chunkCount,L=!R&&(j===1||j===0&&(F===1||G&&F<=0)),W=self.performance.now();(R||j||r.stats.parsing.start===0)&&(r.stats.parsing.start=W),a&&(F||!L)&&(a.stats.parsing.start=W);const I=!(D&&((g=r.initSegment)==null?void 0:g.url)===((y=D.initSegment)==null?void 0:y.url)),N=new m7(O,L,c,R,T,I);if(!L||O||I){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===$t.MAIN?"level":"track"}: ${d.level} id: ${d.id} discontinuity: ${O} trackSwitch: ${R} - contiguous: ${N} + contiguous: ${L} accurateTimeOffset: ${c} timeOffset: ${T} - initSegmentChange: ${L}`);const X=new Zj(i,n,t,u,f);this.configureTransmuxer(X)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:v,cmd:"demux",data:e,decryptdata:E,chunkMeta:d,state:I},e instanceof ArrayBuffer?[e]:[]);else if(b){const X=b.push(e,E,d,I);Hh(X)?X.then(G=>{this.handleTransmuxComplete(G)}).catch(G=>{this.transmuxerError(G,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(X)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);Hh(n)?n.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Dw=100;class e7 extends a1{constructor(e,t,i){super(e,t,i,"audio-stream-controller",Ot.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on($.BUFFER_RESET,this.onBufferReset,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off($.BUFFER_RESET,this.onBufferReset,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:a}){if(i===Ot.MAIN){const u=t.cc,c=this.fragCurrent;if(this.initPTS[u]={baseTime:n,timescale:r,trackId:a},this.log(`InitPTS for cc: ${u} found from main: ${n/r} (${n}/${r}) trackId: ${a}`),this.mainAnchor=t,this.state===tt.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==u)&&this.syncWithAnchor(t,d?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==u?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===tt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&n?.cc===t.cc)return;const r=(n||e).cc,a=this.getLevelDetails(),u=this.getLoadPosition(),c=JD(a,r,u);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===tt.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=tt.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Dw),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=tt.IDLE):this.state=tt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case tt.IDLE:this.doTickIdle();break;case tt.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e?.[t],n=i?.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=tt.WAITING_INIT_PTS}break}case tt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case tt.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:r}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=tt.FRAG_LOADING;const u=n.flush().buffer,c={frag:t,part:i,payload:u,networkDetails:null};this._handleFragmentLoadProgress(c),r&&super._handleFragmentLoadComplete(c)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=tt.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:r}=this,a=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[r]))return;const u=i[r],c=u.details;if(!c||this.waitForLive(u)||this.waitForCdnTuneIn(c)){this.state=tt.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,bs.AUDIO,Ot.AUDIO));const f=this.getFwdBufferInfo(d,Ot.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger($.BUFFER_EOS,{type:"audio"}),this.state=tt.ENDED;return}const p=f.len,y=t.maxBufferLength,v=c.fragments,b=v[0].start,T=this.getLoadPosition(),E=this.flushing?T:f.end;if(this.switchingTrack&&n){const R=T;c.PTSKnown&&Rb||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=b+.05)}if(p>=y&&!this.switchingTrack&&EO.end){const j=this.fragmentTracker.getFragAtPos(E,Ot.MAIN);j&&j.end>O.end&&(O=j,this.mainFragLoading={frag:j,targetBufferTime:null})}if(D.start>O.end)return}this.loadFragment(D,u,E)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Uh(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==tt.STOPPED&&(this.setInterval(Dw),this.state=tt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded($.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:r,id:a,groupId:u,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${a} "${c.name}" of "${u}"`);return}const d=this.mainDetails;if(!d||r.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==tt.STOPPED&&(this.state=tt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${c.name}" of "${u}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const f=n[a];let p=0;if(r.live||(i=f.details)!=null&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(f.details){var y;p=this.alignPlaylists(r,f.details,(y=this.levelLastLoaded)==null?void 0:y.details)}r.alignedSliding||(yL(r,d),r.alignedSliding||G0(r,d),p=r.fragmentStart)}f.details=r,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(d,p),this.hls.trigger($.AUDIO_TRACK_UPDATED,{details:r,id:a,groupId:t.groupId}),this.state===tt.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=tt.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:r}=e,{config:a,trackId:u,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const d=c[u];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const f=d.details;if(!f){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const p=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let y=this.transmuxer;y||(y=this.transmuxer=new BL(this.hls,Ot.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[i.cc],b=(t=i.initSegment)==null?void 0:t.data;if(v!==void 0){const E=n?n.index:-1,D=E!==-1,O=new s1(i.level,i.sn,i.stats.chunkCount,r.byteLength,E,D);y.push(r,b,p,"",i,n,f.totalduration,!1,O,v)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${f.startSN} ,${f.endSN}],track ${u}`);const{cache:T}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new vL,complete:!1};T.push(new Uint8Array(r)),this.state!==tt.STOPPED&&(this.state=tt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Ot.MAIN&&sn(t.frag)&&(this.mainFragLoading=t,this.state===tt.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==Ot.AUDIO){!this.audioOnly&&i.type===Ot.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(sn(i)){this.fragPrevious=i;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger($.AUDIO_TRACK_SWITCHED,us({},r)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=tt.ERROR;return}switch(t.details){case Oe.FRAG_GAP:case Oe.FRAG_PARSING_ERROR:case Oe.FRAG_DECRYPT_ERROR:case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ot.AUDIO,t);break;case Oe.AUDIO_TRACK_LOAD_ERROR:case Oe.AUDIO_TRACK_LOAD_TIMEOUT:case Oe.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===tt.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ji.AUDIO_TRACK&&(this.state=tt.IDLE);break;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Oe.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Oe.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==bs.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==bs.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===tt.ENDED&&(this.state=tt.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,Ot.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:r,chunkMeta:a}=e,u=this.getCurrentContext(a);if(!u){this.resetWhenMissingContext(a);return}const{frag:c,part:d,level:f}=u,{details:p}=f,{audio:y,text:v,id3:b,initSegment:T}=r;if(this.fragContextChanged(c)||!p){this.fragmentTracker.removeFragment(c);return}if(this.state=tt.PARSING,this.switchingTrack&&y&&this.completeAudioSwitch(this.switchingTrack),T!=null&&T.tracks){const E=c.initSegment||c;if(this.unhandledEncryptionError(T,c))return;this._bufferInitSegment(f,T.tracks,E,a),n.trigger($.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:i,tracks:T.tracks})}if(y){const{startPTS:E,endPTS:D,startDTS:O,endDTS:R}=y;d&&(d.elementaryStreams[bs.AUDIO]={startPTS:E,endPTS:D,startDTS:O,endDTS:R}),c.setElementaryStreamInfo(bs.AUDIO,E,D,O,R),this.bufferFragmentData(y,c,d,a)}if(b!=null&&(t=b.samples)!=null&&t.length){const E=gs({id:i,frag:c,details:p},b);n.trigger($.FRAG_PARSING_METADATA,E)}if(v){const E=gs({id:i,frag:c,details:p},v);n.trigger($.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,i,n){if(this.state!==tt.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=Ot.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&a.split(",").length===1&&(r.levelCodec=a),this.hls.trigger($.BUFFER_CODECS,t);const u=r.initSegment;if(u!=null&&u.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:u};this.hls.trigger($.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===vn.NOT_LOADED||n===vn.PARTIAL){var r;if(!sn(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=tt.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&G0(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:r,audioCodec:a,channels:u}=this.bufferedTrack;yu({name:t,lang:i,assocLang:n,characteristics:r,audioCodec:a,channels:u},e,au)||(j0(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger($.AUDIO_TRACK_SWITCHED,us({},e))}}class m1 extends Jr{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t?.renditionReports;if(n){let r=-1;for(let a=0;a=0&&f>t.partTarget&&(c+=1)}const d=i&&VE(i);return new GE(u,c>=0?c:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:r}=t,a=self.performance.now(),u=r.loading.first?Math.max(0,a-r.loading.first):0;n.advancedDateTime=Date.now()-u;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const f=Math.max(c||0,0);n.appliedTimelineOffset=f,n.fragments.forEach(p=>{p.setStart(p.playlistOffset+f)})}if(n.live||i!=null&&i.live){const f="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){qU(i,n,this);const O=n.playlistParsingError;if(O){this.warn(O);const R=this.hls;if(!R.config.ignorePlaylistParsingErrors){var d;const{networkDetails:j}=t;R.trigger($.ERROR,{type:jt.NETWORK_ERROR,details:Oe.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:O,reason:O.message,level:t.level||void 0,parent:(d=n.fragments[0])==null?void 0:d.type,networkDetails:j,stats:r});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=r.loading.start);const p=this.hls.mainForwardBufferInfo,y=p?p.end-p.len:0,v=(n.edge-y)*1e3,b=hL(n,v);if(n.requestScheduled+b0){if(L>n.targetduration*3)this.log(`Playlist last advanced ${Y.toFixed(2)}s ago. Omitting segment and part directives.`),E=void 0,D=void 0;else if(i!=null&&i.tuneInGoal&&L-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${I} with playlist age: ${n.age}`),I=0;else{const X=Math.floor(I/n.targetduration);if(E+=X,D!==void 0){const G=Math.round(I%n.targetduration/n.partTarget);D+=G}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Y.toFixed(2)}s goal: ${I} skip sn ${X} to part ${D}`)}n.tuneInGoal=I}if(T=this.getDeliveryDirectives(n,t.deliveryDirectives,E,D),O||!N){n.requestScheduled=a,this.loadingPlaylist(f,T);return}}else(n.canBlockReload||n.canSkipUntil)&&(T=this.getDeliveryDirectives(n,t.deliveryDirectives,E,D));T&&E!==void 0&&n.canBlockReload&&(n.requestScheduled=r.loading.first+Math.max(b-u*2,b/2)),this.scheduleLoading(f,T,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const r=self.performance.now(),a=n.requestScheduled;if(r>=a){this.loadingPlaylist(e,t);return}const u=a-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(u)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),u)}getDeliveryDirectives(e,t,i,n){let r=VE(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,r=Jm.No),new GE(i,n,r)}checkRetry(e){const t=e.details,i=$0(e),n=e.errorAction,{action:r,retryCount:a=0,retryConfig:u}=n||{},c=!!n&&!!u&&(r===In.RetryRequest||!n.resolved&&r===In.SendAlternateToPenaltyBox);if(c){var d;if(a>=u.maxNumRetry)return!1;if(i&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=t1(u,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function FL(s,e){if(s.length!==e.length)return!1;for(let t=0;ts[n]!==e[n])}function Kx(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}class t7 extends m1{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off($.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${a?.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||n?.length!==i?.length||i!=null&&i.some(u=>n?.indexOf(u)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const u=this.tracks.filter(y=>!i||i.indexOf(y.groupId)!==-1);if(u.length)this.selectDefaultTrack&&!u.some(y=>y.default)&&(this.selectDefaultTrack=!1),u.forEach((y,v)=>{y.id=v});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=u;const c=this.hls.config.audioPreference;if(!r&&c){const y=Ba(c,u,au);if(y>-1)r=u[y];else{const v=Ba(c,this.tracks);r=this.tracks[v]}}let d=this.findTrackId(r);d===-1&&r&&(d=this.findTrackId(null));const f={audioTracks:u};this.log(`Updating audio tracks, ${u.length} track(s) found in group(s): ${i?.join(",")}`),this.hls.trigger($.AUDIO_TRACKS_UPDATED,f);const p=this.trackId;if(d!==-1&&p===-1)this.setAudioTrack(d);else if(u.length&&p===-1){var a;const y=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${u.length}`);this.warn(y.message),this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:y})}}}onError(e,t){t.fatal||!t.context||t.context.type===ji.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&yu(e,n,au))return n;const r=Ba(e,this.tracksInGroup,au);if(r>-1){const a=this.tracksInGroup[r];return this.setAudioTrack(r),a}else if(n){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const u=fU(e,t.levels,i,a,au);if(u===-1)return null;t.nextLoadLevel=u}if(e.channels||e.audioCodec){const a=Ba(e,i);if(a>-1)return i[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],r=n.details&&!n.details.live;if(e===this.trackId&&n===i&&r||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger($.AUDIO_TRACK_SWITCHING,us({},n)),r))return;const a=this.switchParams(n.url,i?.details,n.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(r){var i;if(n.onError(r),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"":` + initSegmentChange: ${I}`);const X=new f7(i,n,t,u,f);this.configureTransmuxer(X)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:v,cmd:"demux",data:e,decryptdata:E,chunkMeta:d,state:N},e instanceof ArrayBuffer?[e]:[]);else if(b){const X=b.push(e,E,d,N);Vh(X)?X.then(V=>{this.handleTransmuxComplete(V)}).catch(V=>{this.transmuxerError(V,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(X)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);Vh(n)?n.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Pw=100;class p7 extends u1{constructor(e,t,i){super(e,t,i,"audio-stream-controller",$t.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on($.BUFFER_RESET,this.onBufferReset,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off($.BUFFER_RESET,this.onBufferReset,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:a}){if(i===$t.MAIN){const u=t.cc,c=this.fragCurrent;if(this.initPTS[u]={baseTime:n,timescale:r,trackId:a},this.log(`InitPTS for cc: ${u} found from main: ${n/r} (${n}/${r}) trackId: ${a}`),this.mainAnchor=t,this.state===ot.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==u)&&this.syncWithAnchor(t,d?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==u?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===ot.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&n?.cc===t.cc)return;const r=(n||e).cc,a=this.getLevelDetails(),u=this.getLoadPosition(),c=lL(a,r,u);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===ot.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=ot.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Pw),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=ot.IDLE):this.state=ot.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case ot.IDLE:this.doTickIdle();break;case ot.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e?.[t],n=i?.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=ot.WAITING_INIT_PTS}break}case ot.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case ot.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:r}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=ot.FRAG_LOADING;const u=n.flush().buffer,c={frag:t,part:i,payload:u,networkDetails:null};this._handleFragmentLoadProgress(c),r&&super._handleFragmentLoadComplete(c)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=ot.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:r}=this,a=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[r]))return;const u=i[r],c=u.details;if(!c||this.waitForLive(u)||this.waitForCdnTuneIn(c)){this.state=ot.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,As.AUDIO,$t.AUDIO));const f=this.getFwdBufferInfo(d,$t.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger($.BUFFER_EOS,{type:"audio"}),this.state=ot.ENDED;return}const g=f.len,y=t.maxBufferLength,v=c.fragments,b=v[0].start,T=this.getLoadPosition(),E=this.flushing?T:f.end;if(this.switchingTrack&&n){const R=T;c.PTSKnown&&Rb||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=b+.05)}if(g>=y&&!this.switchingTrack&&EO.end){const j=this.fragmentTracker.getFragAtPos(E,$t.MAIN);j&&j.end>O.end&&(O=j,this.mainFragLoading={frag:j,targetBufferTime:null})}if(D.start>O.end)return}this.loadFragment(D,u,E)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new $h(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==ot.STOPPED&&(this.setInterval(Pw),this.state=ot.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded($.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:r,id:a,groupId:u,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${a} "${c.name}" of "${u}"`);return}const d=this.mainDetails;if(!d||r.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==ot.STOPPED&&(this.state=ot.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${c.name}" of "${u}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const f=n[a];let g=0;if(r.live||(i=f.details)!=null&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(f.details){var y;g=this.alignPlaylists(r,f.details,(y=this.levelLastLoaded)==null?void 0:y.details)}r.alignedSliding||(AL(r,d),r.alignedSliding||Y0(r,d),g=r.fragmentStart)}f.details=r,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(d,g),this.hls.trigger($.AUDIO_TRACK_UPDATED,{details:r,id:a,groupId:t.groupId}),this.state===ot.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=ot.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:r}=e,{config:a,trackId:u,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const d=c[u];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const f=d.details;if(!f){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const g=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let y=this.transmuxer;y||(y=this.transmuxer=new qL(this.hls,$t.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const v=this.initPTS[i.cc],b=(t=i.initSegment)==null?void 0:t.data;if(v!==void 0){const E=n?n.index:-1,D=E!==-1,O=new a1(i.level,i.sn,i.stats.chunkCount,r.byteLength,E,D);y.push(r,b,g,"",i,n,f.totalduration,!1,O,v)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${f.startSN} ,${f.endSN}],track ${u}`);const{cache:T}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new kL,complete:!1};T.push(new Uint8Array(r)),this.state!==ot.STOPPED&&(this.state=ot.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===$t.MAIN&&un(t.frag)&&(this.mainFragLoading=t,this.state===ot.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==$t.AUDIO){!this.audioOnly&&i.type===$t.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(un(i)){this.fragPrevious=i;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger($.AUDIO_TRACK_SWITCHED,gs({},r)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=ot.ERROR;return}switch(t.details){case Oe.FRAG_GAP:case Oe.FRAG_PARSING_ERROR:case Oe.FRAG_DECRYPT_ERROR:case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($t.AUDIO,t);break;case Oe.AUDIO_TRACK_LOAD_ERROR:case Oe.AUDIO_TRACK_LOAD_TIMEOUT:case Oe.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ot.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Hi.AUDIO_TRACK&&(this.state=ot.IDLE);break;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case Oe.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Oe.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==As.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==As.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ot.ENDED&&(this.state=ot.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,$t.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:r,chunkMeta:a}=e,u=this.getCurrentContext(a);if(!u){this.resetWhenMissingContext(a);return}const{frag:c,part:d,level:f}=u,{details:g}=f,{audio:y,text:v,id3:b,initSegment:T}=r;if(this.fragContextChanged(c)||!g){this.fragmentTracker.removeFragment(c);return}if(this.state=ot.PARSING,this.switchingTrack&&y&&this.completeAudioSwitch(this.switchingTrack),T!=null&&T.tracks){const E=c.initSegment||c;if(this.unhandledEncryptionError(T,c))return;this._bufferInitSegment(f,T.tracks,E,a),n.trigger($.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:i,tracks:T.tracks})}if(y){const{startPTS:E,endPTS:D,startDTS:O,endDTS:R}=y;d&&(d.elementaryStreams[As.AUDIO]={startPTS:E,endPTS:D,startDTS:O,endDTS:R}),c.setElementaryStreamInfo(As.AUDIO,E,D,O,R),this.bufferFragmentData(y,c,d,a)}if(b!=null&&(t=b.samples)!=null&&t.length){const E=Ss({id:i,frag:c,details:g},b);n.trigger($.FRAG_PARSING_METADATA,E)}if(v){const E=Ss({id:i,frag:c,details:g},v);n.trigger($.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,i,n){if(this.state!==ot.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=$t.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&a.split(",").length===1&&(r.levelCodec=a),this.hls.trigger($.BUFFER_CODECS,t);const u=r.initSegment;if(u!=null&&u.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:u};this.hls.trigger($.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===bn.NOT_LOADED||n===bn.PARTIAL){var r;if(!un(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=ot.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Y0(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:r,audioCodec:a,channels:u}=this.bufferedTrack;vu({name:t,lang:i,assocLang:n,characteristics:r,audioCodec:a,channels:u},e,ou)||(V0(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger($.AUDIO_TRACK_SWITCHED,gs({},e))}}class y1 extends sa{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t?.renditionReports;if(n){let r=-1;for(let a=0;a=0&&f>t.partTarget&&(c+=1)}const d=i&&QE(i);return new ZE(u,c>=0?c:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:r}=t,a=self.performance.now(),u=r.loading.first?Math.max(0,a-r.loading.first):0;n.advancedDateTime=Date.now()-u;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const f=Math.max(c||0,0);n.appliedTimelineOffset=f,n.fragments.forEach(g=>{g.setStart(g.playlistOffset+f)})}if(n.live||i!=null&&i.live){const f="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){oj(i,n,this);const O=n.playlistParsingError;if(O){this.warn(O);const R=this.hls;if(!R.config.ignorePlaylistParsingErrors){var d;const{networkDetails:j}=t;R.trigger($.ERROR,{type:Jt.NETWORK_ERROR,details:Oe.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:O,reason:O.message,level:t.level||void 0,parent:(d=n.fragments[0])==null?void 0:d.type,networkDetails:j,stats:r});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=r.loading.start);const g=this.hls.mainForwardBufferInfo,y=g?g.end-g.len:0,v=(n.edge-y)*1e3,b=TL(n,v);if(n.requestScheduled+b0){if(I>n.targetduration*3)this.log(`Playlist last advanced ${W.toFixed(2)}s ago. Omitting segment and part directives.`),E=void 0,D=void 0;else if(i!=null&&i.tuneInGoal&&I-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${N} with playlist age: ${n.age}`),N=0;else{const X=Math.floor(N/n.targetduration);if(E+=X,D!==void 0){const V=Math.round(N%n.targetduration/n.partTarget);D+=V}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${W.toFixed(2)}s goal: ${N} skip sn ${X} to part ${D}`)}n.tuneInGoal=N}if(T=this.getDeliveryDirectives(n,t.deliveryDirectives,E,D),O||!L){n.requestScheduled=a,this.loadingPlaylist(f,T);return}}else(n.canBlockReload||n.canSkipUntil)&&(T=this.getDeliveryDirectives(n,t.deliveryDirectives,E,D));T&&E!==void 0&&n.canBlockReload&&(n.requestScheduled=r.loading.first+Math.max(b-u*2,b/2)),this.scheduleLoading(f,T,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const r=self.performance.now(),a=n.requestScheduled;if(r>=a){this.loadingPlaylist(e,t);return}const u=a-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(u)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),u)}getDeliveryDirectives(e,t,i,n){let r=QE(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,r=n0.No),new ZE(i,n,r)}checkRetry(e){const t=e.details,i=G0(e),n=e.errorAction,{action:r,retryCount:a=0,retryConfig:u}=n||{},c=!!n&&!!u&&(r===Pn.RetryRequest||!n.resolved&&r===Pn.SendAlternateToPenaltyBox);if(c){var d;if(a>=u.maxNumRetry)return!1;if(i&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=n1(u,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${a+1}/${u.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function KL(s,e){if(s.length!==e.length)return!1;for(let t=0;ts[n]!==e[n])}function Xx(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}class g7 extends y1{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off($.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${a?.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||n?.length!==i?.length||i!=null&&i.some(u=>n?.indexOf(u)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const u=this.tracks.filter(y=>!i||i.indexOf(y.groupId)!==-1);if(u.length)this.selectDefaultTrack&&!u.some(y=>y.default)&&(this.selectDefaultTrack=!1),u.forEach((y,v)=>{y.id=v});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=u;const c=this.hls.config.audioPreference;if(!r&&c){const y=Ha(c,u,ou);if(y>-1)r=u[y];else{const v=Ha(c,this.tracks);r=this.tracks[v]}}let d=this.findTrackId(r);d===-1&&r&&(d=this.findTrackId(null));const f={audioTracks:u};this.log(`Updating audio tracks, ${u.length} track(s) found in group(s): ${i?.join(",")}`),this.hls.trigger($.AUDIO_TRACKS_UPDATED,f);const g=this.trackId;if(d!==-1&&g===-1)this.setAudioTrack(d);else if(u.length&&g===-1){var a;const y=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${u.length}`);this.warn(y.message),this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:y})}}}onError(e,t){t.fatal||!t.context||t.context.type===Hi.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&vu(e,n,ou))return n;const r=Ha(e,this.tracksInGroup,ou);if(r>-1){const a=this.tracksInGroup[r];return this.setAudioTrack(r),a}else if(n){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const u=CU(e,t.levels,i,a,ou);if(u===-1)return null;t.nextLoadLevel=u}if(e.channels||e.audioCodec){const a=Ha(e,i);if(a>-1)return i[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],r=n.details&&!n.details.live;if(e===this.trackId&&n===i&&r||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger($.AUDIO_TRACK_SWITCHING,gs({},n)),r))return;const a=this.switchParams(n.url,i?.details,n.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(r){var i;if(n.onError(r),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"":` ${this.list("video")} ${this.list("audio")} -${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i?.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const Lw=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,UL="HlsJsTrackRemovedError";class s7 extends Error{constructor(e){super(e),this.name=UL}}class n7 extends Jr{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:r}=this;i&&this.log("Media source opened"),!(!n||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger($.MEDIA_ATTACHED,{media:n,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=A6(kl(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.BUFFER_RESET,this.onBufferReset,this),e.on($.BUFFER_APPENDING,this.onBufferAppending,this),e.on($.BUFFER_CODECS,this.onBufferCodecs,this),e.on($.BUFFER_EOS,this.onBufferEos,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.FRAG_PARSED,this.onFragParsed,this),e.on($.FRAG_CHANGED,this.onFragChanged,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.BUFFER_RESET,this.onBufferReset,this),e.off($.BUFFER_APPENDING,this.onBufferAppending,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.BUFFER_EOS,this.onBufferEos,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.FRAG_PARSED,this.onFragParsed,this),e.off($.FRAG_CHANGED,this.onFragChanged,this),e.off($.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const a=this.isQueued();(r||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?gs(i,n.tracks):this.sourceBuffers.forEach(r=>{const[a]=r;a&&(i[a]=gs({},this.tracks[a]),this.removeBuffer(a)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=kl(this.appendSource);if(n){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(a),r)this._objectUrl=i.src,this.attachTransferred();else{const u=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&a instanceof c,Rw(i),r7(i,u),i.load()}catch{i.src=u}else i.src=u}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,r=n?Object.keys(n):null,a=r?r.length:0,u=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(n&&r&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) -required tracks: ${Ss(i,(c,d)=>c==="initSegment"?void 0:d)}; -transfer tracks: ${Ss(n,(c,d)=>c==="initSegment"?void 0:d)}}`),!MD(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,d=this.details,f=Math.max(c,d?.fragments[0].start||0);if(f-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${f}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching($.MEDIA_DETACHING,{}),this.onMediaAttaching($.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,r.forEach(c=>{const d=c,f=n[d];if(f){const p=f.buffer;if(p){const y=this.fragmentTracker,v=f.id;if(y.hasFragments(v)||y.hasParts(v)){const E=vi.getBuffered(p);y.detectEvictedFragments(d,E,v,null,!0)}const b=Rv(d),T=[d,p];this.sourceBuffers[b]=T,p.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,f)}}}),u(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),u()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:r,_objectUrl:a}=this;if(r){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([u])=>{u&&this.removeBuffer(u)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const u=r.readyState==="open";try{const c=r.sourceBuffers;for(let d=c.length;d--;)u&&c[d].abort(),r.removeSourceBuffer(c[d]);u&&r.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(n.removeAttribute("src"),this.appendSource&&Rw(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger($.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Rv(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new i7(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),u=!a&&this.sourceBufferCount&&this.media&&r.some(c=>!n[c]);if(a||u){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`);return}r.forEach(c=>{var d,f;const p=t[c],{id:y,codec:v,levelCodec:b,container:T,metadata:E,supplemental:D}=p;let O=n[c];const R=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[c],j=R!=null&&R.buffer?R:O,F=j?.pendingCodec||j?.codec,z=j?.levelCodec;O||(O=n[c]={buffer:void 0,listeners:[],codec:v,supplemental:D,container:T,levelCodec:b,metadata:E,id:y});const N=Zm(F,z),Y=N?.replace(Lw,"$1");let L=Zm(v,b);const I=(f=L)==null?void 0:f.replace(Lw,"$1");L&&N&&Y!==I&&(c.slice(0,5)==="audio"&&(L=F0(L,this.appendSource)),this.log(`switching codec ${F} to ${L}`),L!==(O.pendingCodec||O.codec)&&(O.pendingCodec=L),O.container=T,this.appendChangeType(c,T,L))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,r={label:`change-type=${n}`,execute:()=>{const a=this.tracks[e];if(a){const u=a.buffer;u!=null&&u.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),u.changeType(n),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,Ot.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var u;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&vi.isBuffered(c.buffer,n)||((u=this.fragmentTracker.getAppendedFrag(n,Ot.MAIN))==null?void 0:u.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:u=>{this.warn("Error executing block-audio operation",u)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:r,parent:a,frag:u,part:c,chunkMeta:d,offset:f}=t,p=d.buffering[r],{sn:y,cc:v}=u,b=self.performance.now();p.start=b;const T=u.stats.buffering,E=c?c.stats.buffering:null;T.start===0&&(T.start=b),E&&E.start===0&&(E.start=b);const D=i.audio;let O=!1;r==="audio"&&D?.container==="audio/mpeg"&&(O=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const R=i.video,j=R?.buffer;if(j&&y!=="initSegment"){const N=c||u,Y=this.blockedAudioAppend;if(r==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(R.ending||R.ended)){const I=N.start+N.duration*.05,X=j.buffered,G=this.currentOp("video");!X.length&&!G?this.blockAudio(N):!G&&!vi.isBuffered(j,I)&&this.lastVideoAppendEndI||L{var N;p.executeStart=self.performance.now();const Y=(N=this.tracks[r])==null?void 0:N.buffer;Y&&(O?this.updateTimestampOffset(Y,F,.1,r,y,v):f!==void 0&&Dt(f)&&this.updateTimestampOffset(Y,f,1e-6,r,y,v)),this.appendExecutor(n,r)},onStart:()=>{},onComplete:()=>{const N=self.performance.now();p.executeEnd=p.end=N,T.first===0&&(T.first=N),E&&E.first===0&&(E.first=N);const Y={};this.sourceBuffers.forEach(([L,I])=>{L&&(Y[L]=vi.getBuffered(I))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger($.BUFFER_APPENDED,{type:r,frag:u,part:c,chunkMeta:d,parent:u.type,timeRanges:Y})},onError:N=>{var Y;const L={type:jt.MEDIA_ERROR,parent:u.type,details:Oe.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:u,part:c,chunkMeta:d,error:N,err:N,fatal:!1},I=(Y=this.media)==null?void 0:Y.error;if(N.code===DOMException.QUOTA_EXCEEDED_ERR||N.name=="QuotaExceededError"||"quota"in N)L.details=Oe.BUFFER_FULL_ERROR;else if(N.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)L.errorAction=Ac(!0);else if(N.name===UL&&this.sourceBufferCount===0)L.errorAction=Ac(!0);else{const X=++this.appendErrors[r];this.warn(`Failed ${X}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${I||"no media error"})`),(X>=this.hls.config.appendErrorMaxRetry||I)&&(L.fatal=!0)}this.hls.trigger($.ERROR,L)}};this.log(`queuing "${r}" append sn: ${y}${c?" p: "+c.index:""} of ${u.type===Ot.MAIN?"level":"track"} ${u.level} cc: ${v}`),this.append(z,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger($.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:r}=t;i?this.append(this.getFlushOp(i,n,r),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,n,r),a)})}onFragParsed(e,t){const{frag:i,part:n}=t,r=[],a=n?n.elementaryStreams:i.elementaryStreams;a[bs.AUDIOVIDEO]?r.push("audiovideo"):(a[bs.AUDIO]&&r.push("audio"),a[bs.VIDEO]&&r.push("video"));const u=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const d=n?n.stats:i.stats;this.hls.trigger($.FRAG_BUFFERED,{frag:i,part:n,stats:d,id:i.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(u,r).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const u=this.tracks[a];(!t.type||t.type===a)&&(u.ending=!0,u.ended||(u.ended=!0,this.log(`${a} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var u;return a&&!((u=this.tracks[a])!=null&&u.ended)})?n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger($.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger($.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===Oe.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;Dt(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,r=i.currentTime,a=t.levelTargetDuration,u=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(Dt(u)&&u>=0){const d=Math.max(u,a),f=Math.floor(r/a)*a-d;this.flushBackBuffer(r,a,f)}const c=n.frontBufferFlushThreshold;if(Dt(c)&&c>0){const d=Math.max(n.maxBufferLength,c),f=Math.max(d,a),p=Math.floor(r/a)*a+f;this.flushFrontBuffer(r,a,p)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,r])=>{if(r){const u=vi.getBuffered(r);if(u.length>0&&i>u.start(0)){var a;this.hls.trigger($.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((a=this.details)!=null&&a.live)this.hls.trigger($.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger($.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,r])=>{if(r){const a=vi.getBuffered(r),u=a.length;if(u<2)return;const c=a.start(u-1),d=a.end(u-1);if(i>c||e>=c&&e<=d)return;this.hls.trigger($.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||i?.readyState!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),f=Math.max(d,n);return{duration:1/0,start:d,end:f}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return Dt(r)?{duration:r}:null;const a=this.media.duration,u=Dt(i.duration)?i.duration:0;return n>u&&n>a||!Dt(a)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(Dt(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Ss(i)}`),this.tracksReady){var n;const r=(n=this.transferData)==null?void 0:n.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger($.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const a=r,u=e[a];if(this.isPending(u)){const c=this.getTrackCodec(u,a),d=`${u.container};codecs=${c}`;u.codec=c,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${Ss(u)}`);try{const f=i.addSourceBuffer(d),p=Rv(a),y=[a,f];t[p]=y,u.buffer=f}catch(f){var n;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(a),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[a],this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:a,mimeType:d,parent:u.id});return}this.trackSourceBuffer(a,u)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&Bh(i,"video")&&(n=W6(n,i));const r=Zm(n,e.levelCodec);return r?t.slice(0,5)==="audio"?F0(r,this.appendSource):r:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,a)=>{const u=a.removedRanges;u!=null&&u.length&&this.hls.trigger($.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,i,n,r,a){const u=t-e.timestampOffset;Math.abs(u)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:n,mediaSource:r}=this,a=this.tracks[e],u=a?.buffer;if(!n||!r||!u){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=Dt(n.duration)?n.duration:1/0,d=Dt(r.duration)?r.duration:1/0,f=Math.max(0,t),p=Math.min(i,c,d);p>f&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${f},${p}] from the ${e} SourceBuffer`),u.remove(f,p)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i?.buffer;if(!n)throw new s7(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const r=n.buffer;if(!r)return;const a=i.bind(this,e);n.listeners.push({event:t,listener:a}),r.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function Rw(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function r7(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}function Rv(s){return s==="audio"?1:0}class p1{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on($.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.BUFFER_CODECS,this.onBufferCodecs,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off($.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Dt(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,r)=>this.isLevelAllowed(n)&&r<=e);return this.clientRect=null,p1.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(u,c)=>c?u.width!==c.width||u.height!==c.height:!0;let r=e.length-1;const a=Math.max(t,i);for(let u=0;u=a||c.height>=a)&&n(c,e[u+1])){r=u;break}}return r}}const a7={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},dr=a7,o7={HLS:"h"},l7=o7;class Ga{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Ga?i:new Ga(i))),this.value=e,this.params=t}}const u7="Dict";function c7(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function d7(s,e,t,i){return new Error(`failed to ${s} "${c7(e)}" as ${t}`,{cause:i})}function qa(s,e,t){return d7("serialize",s,e,t)}class jL{constructor(e){this.description=e}}const Iw="Bare Item",h7="Boolean";function f7(s){if(typeof s!="boolean")throw qa(s,h7);return s?"?1":"?0"}function m7(s){return btoa(String.fromCharCode(...s))}const p7="Byte Sequence";function g7(s){if(ArrayBuffer.isView(s)===!1)throw qa(s,p7);return`:${m7(s)}:`}const y7="Integer";function v7(s){return s<-999999999999999||99999999999999912)throw qa(s,b7);const t=e.toString();return t.includes(".")?t:`${t}.0`}const S7="String",_7=/[\x00-\x1f\x7f]+/;function E7(s){if(_7.test(s))throw qa(s,S7);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function w7(s){return s.description||s.toString().slice(7,-1)}const A7="Token";function Nw(s){const e=w7(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw qa(e,A7);return e}function Wx(s){switch(typeof s){case"number":if(!Dt(s))throw qa(s,Iw);return Number.isInteger(s)?$L(s):T7(s);case"string":return E7(s);case"symbol":return Nw(s);case"boolean":return f7(s);case"object":if(s instanceof Date)return x7(s);if(s instanceof Uint8Array)return g7(s);if(s instanceof jL)return Nw(s);default:throw qa(s,Iw)}}const k7="Key";function Yx(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw qa(s,k7);return s}function g1(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Yx(e)}`:`;${Yx(e)}=${Wx(t)}`).join("")}function zL(s){return s instanceof Ga?`${Wx(s.value)}${g1(s.params)}`:Wx(s)}function C7(s){return`(${s.value.map(zL).join(" ")})${g1(s.params)}`}function D7(s,e={whitespace:!0}){if(typeof s!="object"||s==null)throw qa(s,u7);const t=s instanceof Map?s.entries():Object.entries(s),i=e?.whitespace?" ":"";return Array.from(t).map(([n,r])=>{r instanceof Ga||(r=new Ga(r));let a=Yx(n);return r.value===!0?a+=g1(r.params):(a+="=",Array.isArray(r.value)?a+=C7(r):a+=zL(r)),a}).join(`,${i}`)}function VL(s,e){return D7(s,e)}const ka="CMCD-Object",Ks="CMCD-Request",Jl="CMCD-Session",ml="CMCD-Status",L7={br:ka,ab:ka,d:ka,ot:ka,tb:ka,tpb:ka,lb:ka,tab:ka,lab:ka,url:ka,pb:Ks,bl:Ks,tbl:Ks,dl:Ks,ltc:Ks,mtp:Ks,nor:Ks,nrr:Ks,rc:Ks,sn:Ks,sta:Ks,su:Ks,ttfb:Ks,ttfbb:Ks,ttlb:Ks,cmsdd:Ks,cmsds:Ks,smrt:Ks,df:Ks,cs:Ks,ts:Ks,cid:Jl,pr:Jl,sf:Jl,sid:Jl,st:Jl,v:Jl,msd:Jl,bs:ml,bsd:ml,cdn:ml,rtp:ml,bg:ml,pt:ml,ec:ml,e:ml},R7={REQUEST:Ks};function I7(s){return Object.keys(s).reduce((e,t)=>{var i;return(i=s[t])===null||i===void 0||i.forEach(n=>e[n]=t),e},{})}function N7(s,e){const t={};if(!s)return t;const i=Object.keys(s),n=e?I7(e):{};return i.reduce((r,a)=>{var u;const c=L7[a]||n[a]||R7.REQUEST,d=(u=r[c])!==null&&u!==void 0?u:r[c]={};return d[a]=s[a],r},t)}function O7(s){return["ot","sf","st","e","sta"].includes(s)}function M7(s){return typeof s=="number"?Dt(s):s!=null&&s!==""&&s!==!1}const GL="event";function P7(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const n=t.pathname.split("/").slice(1),r=i.pathname.split("/").slice(1,-1);for(;n[0]===r[0];)n.shift(),r.shift();for(;r.length;)r.shift(),n.unshift("..");return n.join("/")+t.search+t.hash}const s0=s=>Math.round(s),Xx=(s,e)=>Array.isArray(s)?s.map(t=>Xx(t,e)):s instanceof Ga&&typeof s.value=="string"?new Ga(Xx(s.value,e),s.params):(e.baseUrl&&(s=P7(s,e.baseUrl)),e.version===1?encodeURIComponent(s):s),Pm=s=>s0(s/100)*100,B7=(s,e)=>{let t=s;return e.version>=2&&(s instanceof Ga&&typeof s.value=="string"?t=new Ga([s]):typeof s=="string"&&(t=[s])),Xx(t,e)},F7={br:s0,d:s0,bl:Pm,dl:Pm,mtp:Pm,nor:B7,rtp:Pm,tb:s0},qL="request",KL="response",y1=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],U7=["e"],j7=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Lp(s){return j7.test(s)}function $7(s){return y1.includes(s)||U7.includes(s)||Lp(s)}const WL=["d","dl","nor","ot","rtp","su"];function H7(s){return y1.includes(s)||WL.includes(s)||Lp(s)}const z7=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function V7(s){return y1.includes(s)||WL.includes(s)||z7.includes(s)||Lp(s)}const G7=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function q7(s){return G7.includes(s)||Lp(s)}const K7={[KL]:V7,[GL]:$7,[qL]:H7};function YL(s,e={}){const t={};if(s==null||typeof s!="object")return t;const i=e.version||s.v||1,n=e.reportingMode||qL,r=i===1?q7:K7[n];let a=Object.keys(s).filter(r);const u=e.filter;typeof u=="function"&&(a=a.filter(u));const c=n===KL||n===GL;c&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const d=gs({},F7,e.formatters),f={version:i,reportingMode:n,baseUrl:e.baseUrl};return a.sort().forEach(p=>{let y=s[p];const v=d[p];if(typeof v=="function"&&(y=v(y,f)),p==="v"){if(i===1)return;y=i}p=="pr"&&y===1||(c&&p==="ts"&&!Dt(y)&&(y=Date.now()),M7(y)&&(O7(p)&&typeof y=="string"&&(y=new jL(y)),t[p]=y))}),t}function W7(s,e={}){const t={};if(!s)return t;const i=YL(s,e),n=N7(i,e?.customHeaderMap);return Object.entries(n).reduce((r,[a,u])=>{const c=VL(u,{whitespace:!1});return c&&(r[a]=c),r},t)}function Y7(s,e,t){return gs(s,W7(e,t))}const X7="CMCD";function Q7(s,e={}){return s?VL(YL(s,e),{whitespace:!1}):""}function Z7(s,e={}){if(!s)return"";const t=Q7(s,e);return encodeURIComponent(t)}function J7(s,e={}){if(!s)return"";const t=Z7(s,e);return`${X7}=${t}`}const Ow=/CMCD=[^&#]+/;function e9(s,e,t){const i=J7(e,t);if(!i)return s;if(Ow.test(s))return s.replace(Ow,i);const n=s.includes("?")?"&":"?";return`${s}${n}${i}`}class t9{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:dr.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=n=>{try{const{frag:r,part:a}=n,u=this.hls.levels[r.level],c=this.getObjectType(r),d={d:(a||r).duration*1e3,ot:c};(c===dr.VIDEO||c===dr.AUDIO||c==dr.MUXED)&&(d.br=u.bitrate/1e3,d.tb=this.getTopBandwidth(c)/1e3,d.bl=this.getBufferLength(c));const f=a?this.getNextPart(a):this.getNextFrag(r);f!=null&&f.url&&f.url!==r.url&&(d.nor=f.url),this.apply(n,d)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHED,this.onMediaDetached,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHED,this.onMediaDetached,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:l7.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){gs(t,this.createData());const i=t.ot===dr.INIT||t.ot===dr.VIDEO||t.ot===dr.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((a,u)=>(n.includes(u)&&(a[u]=t[u]),a),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),Y7(e.headers,t,r)):e.url=e9(e.url,t,r)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,r=(t=this.hls.levels[n.level])==null||(t=t.details)==null?void 0:t.partList;if(r){const{sn:a}=n;for(let u=r.length-1;u>=0;u--){const c=r[u];if(c.index===i&&c.fragment.sn===a)return r[u+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return dr.TIMED_TEXT;if(e.sn==="initSegment")return dr.INIT;if(t==="audio")return dr.AUDIO;if(t==="main")return this.hls.audioTracks.length?dr.VIDEO:dr.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===dr.AUDIO)i=n.audioTracks;else{const r=n.maxAutoLevel,a=r>-1?r+1:n.levels.length;i=n.levels.slice(0,a)}return i.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===dr.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:vi.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,u){t(r),this.loader.load(r,a,u)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,u){t(r),this.loader.load(r,a,u)}}}}const i9=3e5;class s9 extends Jr{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if(i?.action===In.SendAlternateToPenaltyBox&&i.flags===Ir.MoveAllAlternatesMatchingHost){const n=this.levels;let r=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:u,pathwayId:c,type:d}=t.context;u&&n?a=this.getPathwayForGroupId(u,d,a):c&&(a=c)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&n&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==a),t.details===Oe.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${n&&n.length} priorities: ${Ss(r)} penalized: ${Ss(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(r=>{n-i[r]>i9&&delete i[r]});for(let r=0;r0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,pL(t),this.hls.trigger($.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[u];c&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=u);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r{const{ID:a,"BASE-ID":u,"URI-REPLACEMENT":c}=r;if(t.some(f=>f.pathwayId===a))return;const d=this.getLevelsForPathway(u).map(f=>{const p=new Bs(f.attrs);p["PATHWAY-ID"]=a;const y=p.AUDIO&&`${p.AUDIO}_clone_${a}`,v=p.SUBTITLES&&`${p.SUBTITLES}_clone_${a}`;y&&(i[p.AUDIO]=y,p.AUDIO=y),v&&(n[p.SUBTITLES]=v,p.SUBTITLES=v);const b=XL(f.uri,p["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),T=new Uh({attrs:p,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:b,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let E=1;E{this.log(`Loaded steering manifest: "${n}"`);const b=f.data;if(b?.VERSION!==1){this.log(`Steering VERSION ${b.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=b.TTL;const{"RELOAD-URI":T,"PATHWAY-CLONES":E,"PATHWAY-PRIORITY":D}=b;if(T)try{this.uri=new self.URL(T,n).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${T}`);return}this.scheduleRefresh(this.uri||y.url),E&&this.clonePathways(E);const O={steeringManifest:b,url:n.toString()};this.hls.trigger($.STEERING_MANIFEST_LOADED,O),D&&this.updatePathwayPriority(D)},onError:(f,p,y,v)=>{if(this.log(`Error loading steering manifest: ${f.code} ${f.text} (${p.url})`),this.stopLoad(),f.code===410){this.enabled=!1,this.log(`Steering manifest ${p.url} no longer available`);return}let b=this.timeToLoad*1e3;if(f.code===429){const T=this.loader;if(typeof T?.getResponseHeader=="function"){const E=T.getResponseHeader("Retry-After");E&&(b=parseFloat(E)*1e3)}this.log(`Steering manifest ${p.url} rate limited`);return}this.scheduleRefresh(this.uri||p.url,b)},onTimeout:(f,p,y)=>{this.log(`Timeout loading steering manifest (${p.url})`),this.scheduleRefresh(this.uri||p.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,c,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Mw(s,e,t,i){s&&Object.keys(e).forEach(n=>{const r=s.filter(a=>a.groupId===n).map(a=>{const u=gs({},a);return u.details=void 0,u.attrs=new Bs(u.attrs),u.url=u.attrs.URI=XL(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),u.groupId=u.attrs["GROUP-ID"]=e[n],u.attrs["PATHWAY-ID"]=i,u});s.push(...r)})}function XL(s,e,t,i){const{HOST:n,PARAMS:r,[t]:a}=i;let u;e&&(u=a?.[e],u&&(s=u));const c=new self.URL(s);return n&&!u&&(c.host=n),r&&Object.keys(r).sort().forEach(d=>{d&&c.searchParams.set(d,r[d])}),c.href}class Cc extends Jr{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=Cc.CDMCleanupPromise?[Cc.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,r=`"${t.type}" event: init data type: "${i}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=mh(this.config));const u=a.map(_v).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(u)}this.keyFormatPromise.then(a=>{const u=e0(a);if(i!=="sinf"||u!==Fs.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${u}`);return}let c;try{const v=yn(new Uint8Array(n)),b=r1(JSON.parse(v).sinf),T=VD(b);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(T.subarray(8,24))}catch(v){this.warn(`${r} Failed to parse sinf: ${v}`);return}const d=On(c),{keyIdToKeySessionPromise:f,mediaKeySessions:p}=this;let y=f[d];for(let v=0;vthis.generateRequestWithPreferredKeySession(b,i,n,"encrypted-event-key-match")),y.catch(D=>this.handleError(D));break}}y||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${p.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on($.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on($.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on($.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off($.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off($.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off($.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t?.[e];if(n)return n.licenseUrl;if(e===Fs.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t?.[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,u,c)=>!!a&&c.indexOf(a)===u,n=t.map(a=>a.audioCodec).filter(i),r=t.map(a=>a.videoCodec).filter(i);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise((a,u)=>{const c=d=>{const f=d.shift();this.getMediaKeysPromise(f,n,r).then(p=>a({keySystem:f,mediaKeys:p})).catch(p=>{d.length?c(d):p instanceof Rr?u(p):u(new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_ACCESS,error:p,fatal:!0},p.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return oL===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){var n;const r=BU(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],u=(n=a)==null?void 0:n.keySystemAccess;if(!u){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Ss(r)}`),u=this.requestMediaKeySystemAccess(e,r);const c=a=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),u.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const f=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const p=c.mediaKeys=d.createMediaKeys().then(y=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,f.then(v=>v?this.setMediaKeysServerCertificate(y,e,v):y)));return p.catch(y=>{this.error(`Failed to create media-keys for "${e}"}: ${y}`)}),p})}return u.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${On(e.keyId||[])} keyUri: ${e.uri}`);const n=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=Bm(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${On(e.decryptdata.keyId||[])} - } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>_v(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const r=_v(n);r?t(r):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=mh(this.config),i=e.map(e0).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(c,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:d,decryptdata:t}))))).then(c=>{const d="cenc",f=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,d,f,"playlist-key")});return u.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[i]=u,u}return a.catch(u=>{if(u instanceof Rr){const c=us({},u.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const d=new Rr(c,u.message);this.handleError(d,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Rr){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${On(i.keyId||[])})`:""}`),this.hls.trigger($.ERROR,e.data)}else this.error(e.message),this.hls.trigger($.ERROR,{type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Bm(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=e0(e.keyFormat),r=n?[n]:mh(this.config);return this.attemptKeySystemAccess(r)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=mh(this.config)),e.length===0)throw new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Ss({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((r,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(r).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>i.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var r;const a=(r=this.config.drmSystems)==null||(r=r[e.keySystem])==null?void 0:r.generateRequest;if(a)try{const b=a.call(this.hls,t,i,e);if(!b)throw new Error("Invalid response from configured generateRequest filter");t=b.initDataType,i=b.initData?b.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(b){if(this.warn(b.message),this.hls&&this.hls.config.debug)throw b}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const u=Bm(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${u} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const d=new o1,f=e._onmessage=b=>{const T=e.mediaKeysSession;if(!T){d.emit("error",new Error("invalid state"));return}const{messageType:E,message:D}=b;this.log(`"${E}" message event for session "${T.sessionId}" message size: ${D.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,D).catch(O=>{d.eventNames().length?d.emit("error",O):this.handleError(O)}):E==="license-release"?e.keySystem===Fs.FAIRPLAY&&this.updateKeySession(e,Hx("acknowledged")).then(()=>this.removeSession(e)).catch(O=>this.handleError(O)):this.warn(`unhandled media key message type "${E}"`)},p=(b,T)=>{T.keyStatus=b;let E;b.startsWith("usable")?d.emit("resolved"):b==="internal-error"||b==="output-restricted"||b==="output-downscaled"?E=Pw(b,T.decryptdata):b==="expired"?E=new Error(`key expired (keyId: ${u})`):b==="released"?E=new Error("key released"):b==="status-pending"||this.warn(`unhandled key status change "${b}" (keyId: ${u})`),E&&(d.eventNames().length?d.emit("error",E):this.handleError(E))},y=e._onkeystatuseschange=b=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const E=this.getKeyStatuses(e);if(!Object.keys(E).some(j=>E[j]!=="status-pending"))return;if(E[u]==="expired"){this.log(`Expired key ${Ss(E)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let O=E[u];if(O)p(O,e);else{var R;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(R=e.keyStatusTimeouts)[u]||(R[u]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const F=this.getKeyStatus(e.decryptdata);if(F&&F!=="status-pending")return this.log(`No status for keyId ${u} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${F} from other session.`),p(F,e);this.log(`key status for ${u} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),O="internal-error",p(O,e)},1e3)),this.log(`No status for keyId ${u} (${Ss(E)}).`)}};Qn(e.mediaKeysSession,"message",f),Qn(e.mediaKeysSession,"keystatuseschange",y);const v=new Promise((b,T)=>{d.on("error",T),d.on("resolved",b)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${u} URI: ${c}`)}).catch(b=>{throw new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_SESSION,error:b,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${b}`)}).then(()=>v).catch(b=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw b}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const u=n;n=i,i=u}const r="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);if(e.keySystem===Fs.PLAYREADY&&r.length===16){const u=On(r);t[u]=i,rL(r)}const a=On(r);i==="internal-error"&&(this.bannedKeyIds[a]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,u)=>{const c={responseType:"arraybuffer",url:r},d=t.certLoadPolicy.default,f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:(y,v,b,T)=>{a(y.data)},onError:(y,v,b,T)=>{u(new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:us({url:c.url,data:void 0},y)},`"${e}" certificate request failed (${r}). Status: ${y.code} (${y.text})`))},onTimeout:(y,v,b)=>{u(new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(y,v,b)=>{u(new Error("aborted"))}};n.load(c,f,p)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,r)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)}).catch(a=>{r(new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:n,fatal:!1},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0){let f;for(let p=0,y=r.length;p in key message");return Hx(atob(d))}setupLicenseXHR(e,t,i,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,n)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),r.call(this.hls,e,t,i,n)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,r)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(u.readyState===4)if(u.status===200){this._requestLicenseFailureCount=0;let c=u.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const d=this.config.licenseResponseCallback;if(d)try{c=d.call(this.hls,u,a,e)}catch(f){this.error(f)}n(c)}else{const c=i.errorRetry,d=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||u.status>=400&&u.status<500)r(new Rr({type:jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const f=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,this.setupLicenseXHR(u,a,e,t).then(({xhr:c,licenseChallenge:d})=>{e.keySystem==Fs.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(c,d)),c.send(d)}).catch(r)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Qn(i,"encrypted",this.onMediaEncrypted),Qn(i,"waitingforkey",this.onWaitingForKey);const n=this.mediaResolved;n?n():this.mediaKeys=i.mediaKeys}onMediaDetached(){const e=this.media;e&&(pr(e,"encrypted",this.onMediaEncrypted),pr(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,El.clearKeyUriToKeyIdMap();const r=n.length;Cc.CDMCleanupPromise=Promise.all(n.map(a=>this.removeSession(a)).concat((i==null||(e=i.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,r)=>(n.indexOf(r.keyFormat)===-1&&n.push(r.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${On(n?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(d=>self.clearTimeout(a[d]));const{drmSystemOptions:u}=this.config;return(UU(u)?new Promise((d,f)=>{self.setTimeout(()=>f(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(d).catch(f)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>t.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}}Cc.CDMCleanupPromise=void 0;function Bm(s){if(!s)throw new Error("Could not read keyId of undefined decryptdata");if(s.keyId===null)throw new Error("keyId is null");return On(s.keyId)}function n9(s,e){if(s.keyId&&e.mediaKeysSession.keyStatuses.has(s.keyId))return e.mediaKeysSession.keyStatuses.get(s.keyId);if(s.matches(e.decryptdata))return e.keyStatus}class Rr extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function Pw(s,e){const t=s==="output-restricted",i=t?Oe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Oe.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Rr({type:jt.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${s}"`)}class r9{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on($.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off($.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const r=n-this.lastTime,a=i-this.lastDroppedFrames,u=t-this.lastDecodedFrames,c=1e3*a/r,d=this.hls;if(d.trigger($.FPS_DROP,{currentDropped:a,currentDecoded:u,totalDroppedFrames:i}),c>0&&a>d.config.fpsDroppedMonitoringThreshold*u){let f=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=f)&&(f=f-1,d.trigger($.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:d.currentLevel}),d.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function QL(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function ZL(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){cs.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,s.addCue(n)}catch(n){cs.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(s.mode=t)}function mc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues)for(let i=s.cues.length;i--;)e&&s.cues[i].removeEventListener("enter",e),s.removeCue(s.cues[i]);t==="disabled"&&(s.mode=t)}function Qx(s,e,t,i){const n=s.mode;if(n==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const r=o9(s.cues,e,t);for(let a=0;as[t].endTime)return-1;let i=0,n=t,r;for(;i<=n;)if(r=Math.floor((n+i)/2),es[r].startTime&&i-1)for(let r=n,a=s.length;r=e&&u.endTime<=t)i.push(u);else if(u.startTime>t)return i}return i}function n0(s){const e=[];for(let t=0;tthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=n0(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off($.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;n0(i.textTracks).forEach(a=>{mc(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${a?.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||n?.length!==i?.length||i!=null&&i.some(a=>n?.indexOf(a)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(f=>!i||i.indexOf(f.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(f=>f.default)&&(this.selectDefaultTrack=!1),a.forEach((f,p)=>{f.id=p});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const u=this.hls.config.subtitlePreference;if(!r&&u){this.selectDefaultTrack=!1;const f=Ba(u,a);if(f>-1)r=a[f];else{const p=Ba(u,this.tracks);r=this.tracks[p]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i?.join(",")}" group-id`),this.hls.trigger($.SUBTITLE_TRACKS_UPDATED,d),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n-1){const r=this.tracksInGroup[n];return this.setSubtitleTrack(n),r}else{if(i)return null;{const r=Ba(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,u=a?.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type&&" "+a.type||""):""} ${r}`),this.hls.trigger($.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=n0(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(r=>Kx(i,r))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==n&&(r.mode="disabled")}),n){const r=this.subtitleDisplay?"showing":"hidden";n.mode!==r&&(n.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Dt(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger($.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:a,groupId:u="",name:c,type:d,url:f}=n;this.hls.trigger($.SUBTITLE_TRACK_SWITCH,{id:a,groupId:u,name:c,type:d,url:f});const p=this.switchParams(n.url,i?.details,n.details);this.loadPlaylist(p)}}function u9(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?r:r&3|8).toString(16)})}}}function Lh(s){let e=5381,t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return(e>>>0).toString()}const Dc=.025;let K0=(function(s){return s[s.Point=0]="Point",s[s.Range=1]="Range",s})({});function c9(s,e,t){return`${s.identifier}-${t+1}-${Lh(e)}`}class d9{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Iv(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=Iv(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=Dt(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Iv(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||this.assetListResponse!==null}toString(){return h9(this)}}function Iv(s,e){return s-e.start":s.cue.post?"":""}${s.timelineStart.toFixed(2)}-${s.resumeTime.toFixed(2)}]`}function cc(s){const e=s.timelineStart,t=s.duration||0;return`["${s.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class f9{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger($.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const a=()=>{this.hasDetails=!0};r.once($.LEVEL_LOADED,a),r.once($.AUDIO_TRACK_LOADED,a),r.once($.SUBTITLE_TRACK_LOADED,a),r.on($.MEDIA_ATTACHING,(u,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on($.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,r.trigger($.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=JL(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,r=vi.bufferInfo(e,n,0);return this.getAssetTime(r.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=vi.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;(n=this.hls)==null||n.on(e,t)}once(e,t,i){var n;(n=this.hls)==null||n.once(e,t)}off(e,t,i){var n;(n=this.hls)==null||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${cc(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Bw=.033;class m9 extends Jr{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(r=n[i])!=null&&r.event;){var r;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;nr.start&&e1)for(let r=0;ru&&(t!u.includes(d.identifier)):[];a.length&&a.sort((d,f)=>{const p=d.cue.pre,y=d.cue.post,v=f.cue.pre,b=f.cue.post;if(p&&!v)return-1;if(v&&!p||y&&!b)return 1;if(b&&!y)return-1;if(!p&&!v&&!y&&!b){const T=d.startTime,E=f.startTime;if(T!==E)return T-E}return d.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=a,c.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const r=this.items,a=this.parseSchedule(n,e);(i||t.length||r?.length!==a.length||a.some((c,d)=>Math.abs(c.playout.start-r[d].playout.start)>.005||Math.abs(c.playout.end-r[d].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const n=[],r=Object.keys(e);for(let a=0;a!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,d=0;if(e.forEach((f,p)=>{const y=f.cue.pre,v=f.cue.post,b=e[p-1]||null,T=f.appendInPlace,E=v?r:f.startOffset,D=f.duration,O=f.timelineOccupancy===K0.Range?D:0,R=f.resumptionOffset,j=b?.startTime===E,F=E+f.cumulativeDuration;let z=T?F+D:E+R;if(y||!v&&E<=0){const Y=d;d+=O,f.timelineStart=F;const L=a;a+=D,i.push({event:f,start:F,end:z,playout:{start:L,end:a},integrated:{start:Y,end:d}})}else if(E<=r){if(!j){const I=E-c;if(I>Bw){const X=c,G=d;d+=I;const q=a;a+=I;const ae={previousEvent:e[p-1]||null,nextEvent:f,start:X,end:X+I,playout:{start:q,end:a},integrated:{start:G,end:d}};i.push(ae)}else I>0&&b&&(b.cumulativeDuration+=I,i[i.length-1].end=E)}v&&(z=F),f.timelineStart=F;const Y=d;d+=O;const L=a;a+=D,i.push({event:f,start:F,end:z,playout:{start:L,end:a},integrated:{start:Y,end:d}})}else return;const N=f.resumeTime;v||N>r?c=r:c=N}),c{const d=u.cue.pre,f=u.cue.post,p=d?0:f?n:u.startTime;this.updateAssetDurations(u),a===p?u.cumulativeDuration=r:(r=0,a=p),!f&&u.snapOptions.in&&(u.resumeAnchor=_u(null,i.fragments,u.startOffset+u.resumptionOffset,0,0)||void 0),u.appendInPlace&&!u.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(u,t)||(u.appendInPlace=!1)),!u.appendInPlace&&c+1Dc?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):!Object.keys(t).some(a=>{const u=t[a].details,c=u.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${c}`),!1;const d=_u(null,u.fragments,i);if(!d)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${u.fragStart}-${u.fragmentEnd})`),!0;const f=a==="audio"?.175:0;return Math.abs(d.start-i){const E=y.data,D=E?.ASSETS;if(!Array.isArray(D)){const O=this.assignAssetListError(e,Oe.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),b.url,v,T);this.hls.trigger($.ERROR,O);return}e.assetListResponse=E,this.hls.trigger($.ASSET_LIST_LOADED,{event:e,assetListResponse:E,networkDetails:T})},onError:(y,v,b,T)=>{const E=this.assignAssetListError(e,Oe.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${y.code} ${y.text} (${v.url})`),v.url,T,b);this.hls.trigger($.ERROR,E)},onTimeout:(y,v,b)=>{const T=this.assignAssetListError(e,Oe.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${v.url})`),v.url,y,b);this.hls.trigger($.ERROR,T)}};return u.load(c,f,p),this.hls.trigger($.ASSET_LIST_LOADING,{event:e}),u}assignAssetListError(e,t,i,n,r,a){return e.error=i,{type:jt.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:a,stats:r}}}function Fw(s){var e;s==null||(e=s.play())==null||e.catch(()=>{})}function Fm(s,e){return`[${s}] Advancing timeline position to ${e}`}class g9 extends Jr{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const a=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const u=this.playingItem;if(!u){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(!0),this.checkBuffer(),a&&i=u.end){var c;const v=this.findItemIndex(u);let b=this.schedule.findItemIndexAtTime(i);if(b===-1&&(b=v+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${v} to ${b})`)),!this.isInterstitial(u)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!a&&b>v){const T=this.schedule.findJumpRestrictedIndex(v+1,b);if(T>v){this.setSchedulePosition(T);return}}this.setSchedulePosition(b);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(u)){const v=u.event.assetList[0];v&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,v))}return}const f=d.timelineStart,p=d.duration||0;if(a&&i=f+p){var y;(y=u.event)!=null&&y.appendInPlace&&(this.clearAssetPlayers(u.event,u),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,d)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const u=this.findItemIndex(n);this.setSchedulePosition(u+1)}const r=this.playingAsset;if(!r)return;const a=r.timelineStart+(r.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,r)},this.onScheduleUpdate=(i,n)=>{const r=this.schedule;if(!r)return;const a=this.playingItem,u=r.events||[],c=r.items||[],d=r.durations,f=i.map(T=>T.identifier),p=!!(u.length||f.length);(p||n)&&this.log(`INTERSTITIALS_UPDATED (${u.length}): ${u} -Schedule: ${c.map(T=>oa(T))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`);let y=null,v=null;a&&(y=this.updateItem(a,this.timelinePos),this.itemsMatch(a,y)?this.playingItem=y:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b&&(v=this.updateItem(b,this.bufferedPos),this.itemsMatch(b,v)?this.bufferingItem=v:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))),i.forEach(T=>{T.assetList.forEach(E=>{this.clearAssetPlayer(E.identifier,null)})}),this.playerQueue.forEach(T=>{if(T.interstitial.appendInPlace){const E=T.assetItem.timelineStart,D=T.timelineOffset-E;if(D)try{T.timelineOffset=E}catch(O){Math.abs(D)>Dc&&this.warn(`${O} ("${T.assetId}" ${T.timelineOffset}->${E})`)}}}),p||n){if(this.hls.trigger($.INTERSTITIALS_UPDATED,{events:u.slice(0),schedule:c.slice(0),durations:d,removedIds:f}),this.isInterstitial(a)&&f.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(y,a),b&&v!==y&&this.trimInPlace(v,b),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new p9(e),this.schedule=new m9(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on($.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on($.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on($.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on($.BUFFER_APPENDED,this.onBufferAppended,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on($.MEDIA_ENDED,this.onMediaEnded,this),e.on($.ERROR,this.onError,this),e.on($.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off($.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off($.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off($.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.BUFFER_APPENDED,this.onBufferAppended,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off($.MEDIA_ENDED,this.onMediaEnded,this),e.off($.ERROR,this.onError,this),e.off($.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){pr(e,"play",this.onPlay),pr(e,"pause",this.onPause),pr(e,"seeking",this.onSeeking),pr(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Qn(i,"seeking",this.onSeeking),Qn(i,"timeupdate",this.onTimeupdate),Qn(i,"play",this.onPlay),Qn(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const r=this.findItemIndex(i);this.setSchedulePosition(r)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.log(`Removing schedule state for detachedData and ${r}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=p=>p&&e.getAssetPlayer(p.identifier),n=(p,y,v,b,T)=>{if(p){let E=p[y].start;const D=p.event;if(D){if(y==="playout"||D.timelineOccupancy!==K0.Point){const O=i(v);O?.interstitial===D&&(E+=O.assetItem.startOffset+O[T])}}else{const O=b==="bufferedPos"?a():e[b];E+=O-p.start}return E}return 0},r=(p,y)=>{var v;if(p!==0&&y!=="primary"&&(v=e.schedule)!=null&&v.length){var b;const T=e.schedule.findItemIndexAtTime(p),E=(b=e.schedule.items)==null?void 0:b[T];if(E){const D=E[y].start-E.start;return p+D}}return p},a=()=>{const p=e.bufferedPos;return p===Number.MAX_VALUE?u("primary"):Math.max(p,0)},u=p=>{var y,v;return(y=e.primaryDetails)!=null&&y.live?e.primaryDetails.edge:((v=e.schedule)==null?void 0:v.durations[p])||0},c=(p,y)=>{var v,b;const T=e.effectivePlayingItem;if(T!=null&&(v=T.event)!=null&&v.restrictions.skip||!e.schedule)return;e.log(`seek to ${p} "${y}"`);const E=e.effectivePlayingItem,D=e.schedule.findItemIndexAtTime(p,y),O=(b=e.schedule.items)==null?void 0:b[D],R=e.getBufferingPlayer(),j=R?.interstitial,F=j?.appendInPlace,z=E&&e.itemsMatch(E,O);if(E&&(F||z)){const N=i(e.playingAsset),Y=N?.media||e.primaryMedia;if(Y){const L=y==="primary"?Y.currentTime:n(E,y,e.playingAsset,"timelinePos","currentTime"),I=p-L,X=(F?L:Y.currentTime)+I;if(X>=0&&(!N||F||X<=N.duration)){Y.currentTime=X;return}}}if(O){let N=p;if(y!=="primary"){const L=O[y].start,I=p-L;N=O.start+I}const Y=!e.isInterstitial(O);if((!e.isInterstitial(E)||E.event.appendInPlace)&&(Y||O.event.appendInPlace)){const L=e.media||(F?R?.media:null);L&&(L.currentTime=N)}else if(E){const L=e.findItemIndex(E);if(D>L){const X=e.schedule.findJumpRestrictedIndex(L+1,D);if(X>L){e.setSchedulePosition(X);return}}let I=0;if(Y)e.timelinePos=N,e.checkBuffer();else{const X=O.event.assetList,G=p-(O[y]||O).start;for(let q=X.length;q--;){const ae=X[q];if(ae.duration&&G>=ae.startOffset&&G{const p=e.effectivePlayingItem;if(e.isInterstitial(p))return p;const y=t();return e.isInterstitial(y)?y:null},f={get bufferedEnd(){const p=t(),y=e.bufferingItem;if(y&&y===p){var v;return n(y,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-y.playout.start||((v=e.bufferingAsset)==null?void 0:v.startOffset)||0}return 0},get currentTime(){const p=d(),y=e.effectivePlayingItem;return y&&y===p?n(y,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-y.playout.start:0},set currentTime(p){const y=d(),v=e.effectivePlayingItem;v&&v===y&&c(p+v.playout.start,"playout")},get duration(){const p=d();return p?p.playout.end-p.playout.start:0},get assetPlayers(){var p;const y=(p=d())==null?void 0:p.event.assetList;return y?y.map(v=>e.getAssetPlayer(v.identifier)):[]},get playingIndex(){var p;const y=(p=d())==null?void 0:p.event;return y&&e.effectivePlayingAsset?y.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var p;return((p=e.schedule)==null||(p=p.events)==null?void 0:p.slice(0))||[]},get schedule(){var p;return((p=e.schedule)==null||(p=p.items)==null?void 0:p.slice(0))||[]},get interstitialPlayer(){return d()?f:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const p=t();return e.findItemIndex(p)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const p=e.effectivePlayingItem;return e.findItemIndex(p)},primary:{get bufferedEnd(){return a()},get currentTime(){const p=e.timelinePos;return p>0?p:0},set currentTime(p){c(p,"primary")},get duration(){return u("primary")},get seekableStart(){var p;return((p=e.primaryDetails)==null?void 0:p.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(p){c(p,"integrated")},get duration(){return u("integrated")},get seekableStart(){var p;return r(((p=e.primaryDetails)==null?void 0:p.fragmentStart)||0,"integrated")}},skip:()=>{const p=e.effectivePlayingItem,y=p?.event;if(y&&!y.restrictions.skip){const v=e.findItemIndex(p);if(y.appendInPlace){const b=p.playout.start+p.event.duration;c(b+.001,"playout")}else e.advanceAfterAssetEnded(y,v,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);const r=(t=n)==null?void 0:t.currentTime;if(!(r===void 0||!Dt(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Ss(r)}`),this.detachedData=r}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let r=null;const a=this.hls,u=e!==a,c=u&&e.interstitial.appendInPlace,d=(i=this.detachedData)==null?void 0:i.mediaSource;let f;if(a.media)c&&(r=a.transferMedia(),this.detachedData=r),f="Primary";else if(d){const b=this.getBufferingPlayer();b?(r=b.transferMedia(),f=`${b}`):f="detached MediaSource"}else f="detached media";if(!r){if(d)r=this.detachedData,this.log(`using detachedData: MediaSource ${Ss(r)}`);else if(!this.detachedData||a.media===t){const b=this.playerQueue;b.length>1&&b.forEach(T=>{if(u&&T.interstitial.appendInPlace!==c){const E=T.interstitial;this.clearInterstitial(T.interstitial,null),E.appendInPlace=!1,E.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${E}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const p=r&&"mediaSource"in r&&((n=r.mediaSource)==null?void 0:n.readyState)!=="closed",y=p&&r?r:t;this.log(`${p?"transfering MediaSource":"attaching media"} to ${u?e:"Primary"} from ${f} (media.currentTime: ${t.currentTime})`);const v=this.schedule;if(y===r&&v){const b=u&&e.assetId===v.assetIdAtEnd;y.overrides={duration:v.duration,endOfStream:!u||b,cueRemoval:!u}}e.attachMedia(y)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const r=this.hls.startPosition;if(this.log(Fm("checkStart",r)),this.timelinePos=r,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(r>=0||!this.primaryLive){const a=this.timelinePos=r>0?r:0,u=e.findItemIndexAtTime(a);this.setSchedulePosition(u)}}else if(n&&!this.playingItem){const r=e.findItemIndex(n);this.setSchedulePosition(r)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),r=Nv(i,n);if(!i.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){var a;const u=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];u&&this.bufferedToItem(u)}}advanceAfterAssetEnded(e,t,i){const n=Nv(e,i);if(e.isAssetPastPlayoutLimit(n)){if(this.schedule){const r=this.schedule.items;if(r){const a=t+1,u=r.length;if(a>=u){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&oa(r)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,u=this.playingLastItem;if(this.isInterstitial(a)){const f=a.event,p=this.playingAsset,y=p?.identifier,v=y?this.getAssetPlayer(y):null;if(v&&y&&(!this.eventItemsMatch(a,r)||t!==void 0&&y!==f.assetList[t].identifier)){var c;const b=f.findAssetIndex(p);if(this.log(`INTERSTITIAL_ASSET_ENDED ${b+1}/${f.assetList.length} ${cc(p)}`),this.endedAsset=p,this.playingAsset=null,this.hls.trigger($.INTERSTITIAL_ASSET_ENDED,{asset:p,assetListIndex:b,event:f,schedule:n.slice(0),scheduleIndex:e,player:v}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),b);return}this.retreiveMediaSource(y,r),v.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&v.detachMedia()}if(!this.eventItemsMatch(a,r)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${oa(a)}`),f.hasPlayed=!0,this.hls.trigger($.INTERSTITIAL_ENDED,{event:f,schedule:n.slice(0),scheduleIndex:e}),f.cue.once)){var d;this.updateSchedule();const b=(d=this.schedule)==null?void 0:d.items;if(r&&b){const T=this.findItemIndex(r);this.advanceSchedule(T,b,t,a,u)}return}}this.advanceSchedule(e,n,t,a,u)}advanceSchedule(e,t,i,n,r){const a=this.schedule;if(!a)return;const u=t[e]||null,c=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(f=>{const p=f.interstitial,y=a.findEventIndex(p.identifier);(ye+1)&&this.clearInterstitial(p,u)}),this.isInterstitial(u)){this.timelinePos=Math.min(Math.max(this.timelinePos,u.start),u.end);const f=u.event;if(i===void 0){i=a.findAssetIndex(f,this.timelinePos);const b=Nv(f,i-1);if(f.isAssetPastPlayoutLimit(b)||f.appendInPlace&&this.timelinePos===u.end){this.advanceAfterAssetEnded(f,e,i);return}i=b}const p=this.waitingItem;this.assetsBuffered(u,c)||this.setBufferingItem(u);let y=this.preloadAssets(f,i);if(this.eventItemsMatch(u,p||n)||(this.waitingItem=u,this.log(`INTERSTITIAL_STARTED ${oa(u)} ${f.appendInPlace?"append in place":""}`),this.hls.trigger($.INTERSTITIAL_STARTED,{event:f,schedule:t.slice(0),scheduleIndex:e})),!f.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${f}`);return}if(f.assetListLoader&&(f.assetListLoader.destroy(),f.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${f}`);return}this.waitingItem=this.endedItem=null,this.playingItem=u;const v=f.assetList[i];if(!v){this.advanceAfterAssetEnded(f,e,i||0);return}if(y||(y=this.getAssetPlayer(v.identifier)),y===null||y.destroyed){const b=f.assetList.length;this.warn(`asset ${i+1}/${b} player destroyed ${f}`),y=this.createAssetPlayer(f,v,i),y.loadSource()}if(!this.eventItemsMatch(u,this.bufferingItem)&&f.appendInPlace&&this.isAssetBuffered(v))return;this.startAssetPlayer(y,i,t,e,c),this.shouldPlay&&Fw(y.media)}else u?(this.resumePrimary(u,e,n),this.shouldPlay&&Fw(this.hls.media)):r&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${oa(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let u=this.timelinePos;(u=e.end)&&(u=this.getPrimaryResumption(e,t),this.log(Fm("resumePrimary",u)),this.timelinePos=u),this.attachPrimary(u,e)}if(!i)return;const a=(r=this.schedule)==null?void 0:r.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${oa(e)}`),this.hls.trigger($.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(in.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:vi.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(Fm("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off($.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on($.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const n=us(us({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=us(us({},this.altSelection),{},{audio:i});return}const r=us(us({},n),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=us(us({},this.altSelection),{},{subtitles:i});return}const r=us(us({},n),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(e,t){const i=KE(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=KE(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setSubtitleOption(t)||t.id!==-1&&n.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((r,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(r.identifier,null)});const i=e.end+.25,n=vi.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${oa(e)} (was ${oa(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const n=vi.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}const a=this.playingItem,u=this.findItemIndex(a);let c=n.findItemIndexAtTime(e);if(this.bufferedPos=r.end||(d=y.event)!=null&&d.appendInPlace&&e+.01>=y.start)&&(c=p),this.isInterstitial(r)){const v=r.event;if(p-u>1&&v.appendInPlace===!1||v.assetList.length===0&&v.assetListLoader)return}if(this.bufferedPos=e,c>f&&c>u)this.bufferedToItem(y);else{const v=this.primaryDetails;this.primaryLive&&v&&e>v.edge-v.targetduration&&y.start{const r=this.getAssetPlayer(n.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:r}=i;if(!n||!r)return t;const a=this.isInterstitial(e),u=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=u?u.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${oa(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const d=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((f,p)=>{const y=this.getAssetPlayer(f.identifier);y&&(p===d&&y.loadSource(),y.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger($.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,r=i.cue.once;if(n||!r){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const u=this.primaryMedia;u&&this.bufferAssetPlayer(a,u)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,r=n===0&&!e.assetListLoader,a=e.cue.once;if(r){const c=e.timelineStart;if(e.appendInPlace){var u;const y=this.playingItem;!this.isInterstitial(y)&&(y==null||(u=y.nextEvent)==null?void 0:u.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let d,f=0;if(!this.playingItem&&this.primaryLive&&(f=this.hls.startPosition,f===-1&&(f=this.hls.liveSyncPosition||0)),f&&!(e.cue.pre||e.cue.post)){const y=f-c;y>0&&(d=Math.round(y*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${d?` live-start: ${f} start-offset: ${d}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const p=this.assetListLoader.loadAssetList(e,d);p&&(e.assetListLoader=p)}else if(!a&&n){for(let d=t;d{this.hls.trigger($.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i1){const F=t.duration;F&&j{if(j.live){var F;const Y=new Error(`Interstitials MUST be VOD assets ${e}`),L={fatal:!0,type:jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:Y},I=((F=this.schedule)==null?void 0:F.findEventIndex(e.identifier))||-1;this.handleAssetItemError(L,e,I,i,Y.message);return}const z=j.edge-j.fragmentStart,N=t.duration;(T||N===null||z>N)&&(T=!1,this.log(`Interstitial asset "${p}" duration change ${N} > ${z}`),t.duration=z,this.updateSchedule())};b.on($.LEVEL_UPDATED,(j,{details:F})=>E(F)),b.on($.LEVEL_PTS_UPDATED,(j,{details:F})=>E(F)),b.on($.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const D=(j,F)=>{const z=this.getAssetPlayer(p);if(z&&F.tracks){z.off($.BUFFER_CODECS,D),z.tracks=F.tracks;const N=this.primaryMedia;this.bufferingAsset===z.assetItem&&N&&!z.media&&this.bufferAssetPlayer(z,N)}};b.on($.BUFFER_CODECS,D);const O=()=>{var j;const F=this.getAssetPlayer(p);if(this.log(`buffered to end of asset ${F}`),!F||!this.schedule)return;const z=this.schedule.findEventIndex(e.identifier),N=(j=this.schedule.items)==null?void 0:j[z];this.isInterstitial(N)&&this.advanceAssetBuffering(N,t)};b.on($.BUFFERED_TO_END,O);const R=j=>()=>{if(!this.getAssetPlayer(p)||!this.schedule)return;this.shouldPlay=!0;const z=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,z,j)};return b.once($.MEDIA_ENDED,R(i)),b.once($.PLAYOUT_LIMIT_REACHED,R(1/0)),b.on($.ERROR,(j,F)=>{if(!this.schedule)return;const z=this.getAssetPlayer(p);if(F.details===Oe.BUFFER_STALLED_ERROR){if(z!=null&&z.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(F,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${F.error} ${e}`)}),b.on($.DESTROYING,()=>{if(!this.getAssetPlayer(p)||!this.schedule)return;const F=new Error(`Asset player destroyed unexpectedly ${p}`),z={fatal:!0,type:jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:F};this.handleAssetItemError(z,e,this.schedule.findEventIndex(e.identifier),i,F.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${cc(t)}`),this.hls.trigger($.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:b}),b}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const n=this.playerQueue[i];this.log(`clear ${n} toSegment: ${t&&oa(t)}`),this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,r){const{interstitial:a,assetItem:u,assetId:c}=e,d=a.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=u,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,i[n]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${cc(u)}`),this.hls.trigger($.INTERSTITIAL_ASSET_STARTED,{asset:u,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:r,assetItem:a}=e,u=this.schedule.findEventIndex(r.identifier),c=(i=this.schedule.items)==null?void 0:i[u];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const f=r.appendInPlace;if(f&&d?.interstitial.appendInPlace===!1)return;const p=d?.tracks||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(p&&!MD(p,e.tracks)){const y=new Error(`Asset ${cc(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(p)}')`),v={fatal:!0,type:jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:y},b=r.findAssetIndex(a);this.handleAssetItemError(v,r,u,b,y.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,r=t.findAssetIndex(e,n),a=e.assetList[r];if(a){const u=this.getAssetPlayer(a.identifier);if(u){const c=u.currentTime||n-a.timelineStart,d=u.duration-c;if(this.warn(`Stalled at ${c} of ${c+d} in ${u} ${e} (media.currentTime: ${n})`),c&&(d/i.playbackRate<.5||u.bufferedInPlaceToEnd(i))&&u.hls){const f=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,f,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime!T.error))t.error=b;else for(let T=n;T{const D=parseFloat(T.DURATION);this.createAsset(r,E,f,c+f,D,T.URI),f+=D}),r.duration=f,this.log(`Loaded asset-list with duration: ${f} (was: ${d}) ${r}`);const p=this.waitingItem,y=p?.event.identifier===a;this.updateSchedule();const v=(n=this.bufferingItem)==null?void 0:n.event;if(y){var b;const T=this.schedule.findEventIndex(a),E=(b=this.schedule.items)==null?void 0:b[T];if(E){if(!this.playingItem&&this.timelinePos>E.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==T){r.error=new Error(`Interstitial ${u.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(E)}this.setSchedulePosition(T)}else if(v?.identifier===a){const T=r.assetList[0];if(T){const E=this.getAssetPlayer(T.identifier);if(v.appendInPlace){const D=this.primaryMedia;E&&D&&this.bufferAssetPlayer(E,D)}else E&&E.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case Oe.ASSET_LIST_PARSING_ERROR:case Oe.ASSET_LIST_LOAD_ERROR:case Oe.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case Oe.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Uw=500;class y9 extends a1{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",Ot.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on($.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off($.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=tt.IDLE,this.setInterval(Uw),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(sn(i)&&(this.fragPrevious=i),this.state=tt.IDLE),!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a;const u=i.start;for(let d=0;d=r[d].start&&u<=r[d].end){a=r[d];break}const c=i.start+i.duration;a?a.end=c:(a={start:u,end:c},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(a=>{for(let u=0;unew Uh(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new Uh(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ot.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==tt.STOPPED&&this.setInterval(Uw)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:r}=this,{details:a,id:u}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${u}`);return}const c=r[u];if(u>=r.length||!c)return;this.log(`Subtitle track ${u} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(a.live||(i=c.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const p=this.mainDetails;if(!p){this.startFragRequested=!1;return}const y=p.fragments[0];if(!c.details)a.hasProgramDateTime&&p.hasProgramDateTime?(G0(a,p),d=a.fragmentStart):y&&(d=y.start,Vx(a,d));else{var f;d=this.alignPlaylists(a,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),d===0&&y&&(d=y.start,Vx(a,d))}p&&!this.startFragRequested&&this.setStartPosition(p,d)}c.details=a,this.levelLastLoaded=c,u===n&&(this.hls.trigger($.SUBTITLE_TRACK_UPDATED,{details:a,id:u,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===tt.IDLE&&(_u(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&kc(n.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,n1(n.method)).catch(u=>{throw r.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:t}),u}).then(u=>{const c=performance.now();r.trigger($.FRAG_DECRYPTED,{frag:t,payload:u,stats:{tstart:a,tdecrypt:c}})}).catch(u=>{this.warn(`${u.name}: ${u.message}`),this.state=tt.IDLE})}}doTick(){if(!this.media){this.state=tt.IDLE;return}if(this.state===tt.IDLE){const{currentTrackId:e,levels:t}=this,i=t?.[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,r=this.getLoadPosition(),a=vi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:u,len:c}=a,d=i.details,f=this.hls.maxBufferLength+d.levelTargetDuration;if(c>f)return;const p=d.fragments,y=p.length,v=d.edge;let b=null;const T=this.fragPrevious;if(uv-O?0:O;b=_u(T,p,Math.max(p[0].start,u),R),!b&&T&&T.start{if(n=n>>>0,n>r-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const x9={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},eR=s=>String.fromCharCode(x9[s]||s),la=15,mo=100,b9={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},T9={17:2,18:4,21:6,22:8,23:10,19:13,20:15},S9={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_9={25:2,26:4,29:6,30:8,31:10,27:13,28:15},E9=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class w9{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;cs.log(`${this.time} [${e}] ${i}`)}}}const eu=function(e){const t=[];for(let i=0;imo&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=mo)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i=144&&this.backSpace();const t=eR(e);if(this.pos>=mo){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t"pacData = "+Ss(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+Ss(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let r=0;r0&&(e?i="["+t.join(" | ")+"]":i=t.join(` -`)),i}getTextAndFormat(){return this.rows}}class jw{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ov(i),this.nonDisplayedMemory=new Ov(i),this.lastOutputScreen=new Ov(i),this.currRollUpRow=this.displayedMemory.rows[la-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[la-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;it+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Ss(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class $w{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=D9(),this.logger=void 0;const n=this.logger=new w9;this.channels=[null,new jw(e,t,n),new jw(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i"["+eu([t[i],t[i+1]])+"] -> ("+eu([n,r])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(C9(n,r,c)){Um(null,null,c),this.logger.log(3,()=>"Repeated command ("+eu([n,r])+") is dropped");continue}Um(n,r,this.cmdHistory),a=this.parseCmd(n,r),a||(a=this.parseMidrow(n,r)),a||(a=this.parsePAC(n,r)),a||(a=this.parseBackgroundAttributes(n,r))}else Um(null,null,c);if(!a&&(u=this.parseChars(n,r),u)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!u&&this.logger.log(2,()=>"Couldn't parse cleaned data "+eu([n,r])+" orig: "+eu([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const r=e===20||e===21||e===23?1:2,a=this.channels[r];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+eu([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(n||r))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?b9[e]:S9[e]:i=a===1?T9[e]:_9[e];const u=this.channels[a];return u?(u.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let a;r===17?a=t+80:r===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+eR(a)+"' in channel "+i),n=[a]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+eu(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let r;const a={};e===16||e===24?(r=Math.floor((t-32)/2),a.background=E9[r],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const u=e<=23?1:2;return this.channels[u].setBkgData(a),!0}reset(){for(let e=0;e100)throw new Error("Position must be between 0 and 100.");z=I,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",r({},p,{get:function(){return N},set:function(I){const X=n(I);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");N=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",r({},p,{get:function(){return Y},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");Y=I,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",r({},p,{get:function(){return L},set:function(I){const X=n(I);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");L=X,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class L9{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function iR(s){function e(i,n,r,a){return(i|0)*3600+(n|0)*60+(r|0)+parseFloat(a||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class R9{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n=0&&i<=100)return this.set(e,i),!0}return!1}}function sR(s,e,t,i){const n=i?s.split(i):[s];for(const r in n){if(typeof n[r]!="string")continue;const a=n[r].split(t);if(a.length!==2)continue;const u=a[0],c=a[1];e(u,c)}}const Zx=new v1(0,0,""),jm=Zx.align==="middle"?"middle":"center";function I9(s,e,t){const i=s;function n(){const u=iR(s);if(u===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),u}function r(u,c){const d=new R9;sR(u,function(y,v){let b;switch(y){case"region":for(let T=t.length-1;T>=0;T--)if(t[T].id===v){d.set(y,t[T].region);break}break;case"vertical":d.alt(y,v,["rl","lr"]);break;case"line":b=v.split(","),d.integer(y,b[0]),d.percent(y,b[0])&&d.set("snapToLines",!1),d.alt(y,b[0],["auto"]),b.length===2&&d.alt("lineAlign",b[1],["start",jm,"end"]);break;case"position":b=v.split(","),d.percent(y,b[0]),b.length===2&&d.alt("positionAlign",b[1],["start",jm,"end","line-left","line-right","auto"]);break;case"size":d.percent(y,v);break;case"align":d.alt(y,v,["start",jm,"end","left","right"]);break}},/:/,/\s/),c.region=d.get("region",null),c.vertical=d.get("vertical","");let f=d.get("line","auto");f==="auto"&&Zx.line===-1&&(f=-1),c.line=f,c.lineAlign=d.get("lineAlign","start"),c.snapToLines=d.get("snapToLines",!0),c.size=d.get("size",100),c.align=d.get("align",jm);let p=d.get("position","auto");p==="auto"&&Zx.position===50&&(p=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=p}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),a(),e.endTime=n(),a(),r(s,e)}function nR(s){return s.replace(//gi,` -`)}class N9{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new L9,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let r=t.buffer,a=0;for(r=nR(r);ai.label).join(", "))||""}}const Fw=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,WL="HlsJsTrackRemovedError";class v7 extends Error{constructor(e){super(e),this.name=WL}}class x7 extends sa{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:r}=this;i&&this.log("Media source opened"),!(!n||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger($.MEDIA_ATTACHED,{media:n,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=$6(Cl(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.BUFFER_RESET,this.onBufferReset,this),e.on($.BUFFER_APPENDING,this.onBufferAppending,this),e.on($.BUFFER_CODECS,this.onBufferCodecs,this),e.on($.BUFFER_EOS,this.onBufferEos,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.FRAG_PARSED,this.onFragParsed,this),e.on($.FRAG_CHANGED,this.onFragChanged,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.BUFFER_RESET,this.onBufferReset,this),e.off($.BUFFER_APPENDING,this.onBufferAppending,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.BUFFER_EOS,this.onBufferEos,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.FRAG_PARSED,this.onFragParsed,this),e.off($.FRAG_CHANGED,this.onFragChanged,this),e.off($.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const a=this.isQueued();(r||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?Ss(i,n.tracks):this.sourceBuffers.forEach(r=>{const[a]=r;a&&(i[a]=Ss({},this.tracks[a]),this.removeBuffer(a)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=Cl(this.appendSource);if(n){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(a),r)this._objectUrl=i.src,this.attachTransferred();else{const u=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&a instanceof c,Bw(i),b7(i,u),i.load()}catch{i.src=u}else i.src=u}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,r=n?Object.keys(n):null,a=r?r.length:0,u=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(n&&r&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) +required tracks: ${Cs(i,(c,d)=>c==="initSegment"?void 0:d)}; +transfer tracks: ${Cs(n,(c,d)=>c==="initSegment"?void 0:d)}}`),!VD(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,d=this.details,f=Math.max(c,d?.fragments[0].start||0);if(f-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${f}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching($.MEDIA_DETACHING,{}),this.onMediaAttaching($.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,r.forEach(c=>{const d=c,f=n[d];if(f){const g=f.buffer;if(g){const y=this.fragmentTracker,v=f.id;if(y.hasFragments(v)||y.hasParts(v)){const E=Ai.getBuffered(g);y.detectEvictedFragments(d,E,v,null,!0)}const b=Mv(d),T=[d,g];this.sourceBuffers[b]=T,g.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,f)}}}),u(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),u()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:r,_objectUrl:a}=this;if(r){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([u])=>{u&&this.removeBuffer(u)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const u=r.readyState==="open";try{const c=r.sourceBuffers;for(let d=c.length;d--;)u&&c[d].abort(),r.removeSourceBuffer(c[d]);u&&r.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(n.removeAttribute("src"),this.appendSource&&Bw(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger($.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Mv(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new y7(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),u=!a&&this.sourceBufferCount&&this.media&&r.some(c=>!n[c]);if(a||u){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${r}" SourceBuffers`);return}r.forEach(c=>{var d,f;const g=t[c],{id:y,codec:v,levelCodec:b,container:T,metadata:E,supplemental:D}=g;let O=n[c];const R=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[c],j=R!=null&&R.buffer?R:O,F=j?.pendingCodec||j?.codec,G=j?.levelCodec;O||(O=n[c]={buffer:void 0,listeners:[],codec:v,supplemental:D,container:T,levelCodec:b,metadata:E,id:y});const L=s0(F,G),W=L?.replace(Fw,"$1");let I=s0(v,b);const N=(f=I)==null?void 0:f.replace(Fw,"$1");I&&L&&W!==N&&(c.slice(0,5)==="audio"&&(I=H0(I,this.appendSource)),this.log(`switching codec ${F} to ${I}`),I!==(O.pendingCodec||O.codec)&&(O.pendingCodec=I),O.container=T,this.appendChangeType(c,T,I))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,r={label:`change-type=${n}`,execute:()=>{const a=this.tracks[e];if(a){const u=a.buffer;u!=null&&u.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),u.changeType(n),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,$t.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var u;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&Ai.isBuffered(c.buffer,n)||((u=this.fragmentTracker.getAppendedFrag(n,$t.MAIN))==null?void 0:u.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:u=>{this.warn("Error executing block-audio operation",u)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:r,parent:a,frag:u,part:c,chunkMeta:d,offset:f}=t,g=d.buffering[r],{sn:y,cc:v}=u,b=self.performance.now();g.start=b;const T=u.stats.buffering,E=c?c.stats.buffering:null;T.start===0&&(T.start=b),E&&E.start===0&&(E.start=b);const D=i.audio;let O=!1;r==="audio"&&D?.container==="audio/mpeg"&&(O=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const R=i.video,j=R?.buffer;if(j&&y!=="initSegment"){const L=c||u,W=this.blockedAudioAppend;if(r==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(R.ending||R.ended)){const N=L.start+L.duration*.05,X=j.buffered,V=this.currentOp("video");!X.length&&!V?this.blockAudio(L):!V&&!Ai.isBuffered(j,N)&&this.lastVideoAppendEndN||I{var L;g.executeStart=self.performance.now();const W=(L=this.tracks[r])==null?void 0:L.buffer;W&&(O?this.updateTimestampOffset(W,F,.1,r,y,v):f!==void 0&&Pt(f)&&this.updateTimestampOffset(W,f,1e-6,r,y,v)),this.appendExecutor(n,r)},onStart:()=>{},onComplete:()=>{const L=self.performance.now();g.executeEnd=g.end=L,T.first===0&&(T.first=L),E&&E.first===0&&(E.first=L);const W={};this.sourceBuffers.forEach(([I,N])=>{I&&(W[I]=Ai.getBuffered(N))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger($.BUFFER_APPENDED,{type:r,frag:u,part:c,chunkMeta:d,parent:u.type,timeRanges:W})},onError:L=>{var W;const I={type:Jt.MEDIA_ERROR,parent:u.type,details:Oe.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:u,part:c,chunkMeta:d,error:L,err:L,fatal:!1},N=(W=this.media)==null?void 0:W.error;if(L.code===DOMException.QUOTA_EXCEEDED_ERR||L.name=="QuotaExceededError"||"quota"in L)I.details=Oe.BUFFER_FULL_ERROR;else if(L.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!N)I.errorAction=Cc(!0);else if(L.name===WL&&this.sourceBufferCount===0)I.errorAction=Cc(!0);else{const X=++this.appendErrors[r];this.warn(`Failed ${X}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${N||"no media error"})`),(X>=this.hls.config.appendErrorMaxRetry||N)&&(I.fatal=!0)}this.hls.trigger($.ERROR,I)}};this.log(`queuing "${r}" append sn: ${y}${c?" p: "+c.index:""} of ${u.type===$t.MAIN?"level":"track"} ${u.level} cc: ${v}`),this.append(G,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger($.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:r}=t;i?this.append(this.getFlushOp(i,n,r),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,n,r),a)})}onFragParsed(e,t){const{frag:i,part:n}=t,r=[],a=n?n.elementaryStreams:i.elementaryStreams;a[As.AUDIOVIDEO]?r.push("audiovideo"):(a[As.AUDIO]&&r.push("audio"),a[As.VIDEO]&&r.push("video"));const u=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const d=n?n.stats:i.stats;this.hls.trigger($.FRAG_BUFFERED,{frag:i,part:n,stats:d,id:i.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(u,r).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const u=this.tracks[a];(!t.type||t.type===a)&&(u.ending=!0,u.ended||(u.ended=!0,this.log(`${a} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var u;return a&&!((u=this.tracks[a])!=null&&u.ended)})?n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger($.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger($.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===Oe.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;Pt(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,r=i.currentTime,a=t.levelTargetDuration,u=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(Pt(u)&&u>=0){const d=Math.max(u,a),f=Math.floor(r/a)*a-d;this.flushBackBuffer(r,a,f)}const c=n.frontBufferFlushThreshold;if(Pt(c)&&c>0){const d=Math.max(n.maxBufferLength,c),f=Math.max(d,a),g=Math.floor(r/a)*a+f;this.flushFrontBuffer(r,a,g)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,r])=>{if(r){const u=Ai.getBuffered(r);if(u.length>0&&i>u.start(0)){var a;this.hls.trigger($.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((a=this.details)!=null&&a.live)this.hls.trigger($.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger($.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,r])=>{if(r){const a=Ai.getBuffered(r),u=a.length;if(u<2)return;const c=a.start(u-1),d=a.end(u-1);if(i>c||e>=c&&e<=d)return;this.hls.trigger($.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||i?.readyState!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),f=Math.max(d,n);return{duration:1/0,start:d,end:f}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return Pt(r)?{duration:r}:null;const a=this.media.duration,u=Pt(i.duration)?i.duration:0;return n>u&&n>a||!Pt(a)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(Pt(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Cs(i)}`),this.tracksReady){var n;const r=(n=this.transferData)==null?void 0:n.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger($.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const a=r,u=e[a];if(this.isPending(u)){const c=this.getTrackCodec(u,a),d=`${u.container};codecs=${c}`;u.codec=c,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${Cs(u)}`);try{const f=i.addSourceBuffer(d),g=Mv(a),y=[a,f];t[g]=y,u.buffer=f}catch(f){var n;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(a),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[a],this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:a,mimeType:d,parent:u.id});return}this.trackSourceBuffer(a,u)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&Uh(i,"video")&&(n=uU(n,i));const r=s0(n,e.levelCodec);return r?t.slice(0,5)==="audio"?H0(r,this.appendSource):r:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,a)=>{const u=a.removedRanges;u!=null&&u.length&&this.hls.trigger($.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const r=this.currentOp(e);r&&r.onError(n)}updateTimestampOffset(e,t,i,n,r,a){const u=t-e.timestampOffset;Math.abs(u)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:n,mediaSource:r}=this,a=this.tracks[e],u=a?.buffer;if(!n||!r||!u){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=Pt(n.duration)?n.duration:1/0,d=Pt(r.duration)?r.duration:1/0,f=Math.max(0,t),g=Math.min(i,c,d);g>f&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${f},${g}] from the ${e} SourceBuffer`),u.remove(f,g)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i?.buffer;if(!n)throw new v7(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const r=n.buffer;if(!r)return;const a=i.bind(this,e);n.listeners.push({event:t,listener:a}),r.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function Bw(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function b7(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}function Mv(s){return s==="audio"?1:0}class v1{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on($.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.BUFFER_CODECS,this.onBufferCodecs,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off($.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Pt(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,r)=>this.isLevelAllowed(n)&&r<=e);return this.clientRect=null,v1.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(u,c)=>c?u.width!==c.width||u.height!==c.height:!0;let r=e.length-1;const a=Math.max(t,i);for(let u=0;u=a||c.height>=a)&&n(c,e[u+1])){r=u;break}}return r}}const T7={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},fr=T7,S7={HLS:"h"},_7=S7;class Wa{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Wa?i:new Wa(i))),this.value=e,this.params=t}}const E7="Dict";function w7(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function A7(s,e,t,i){return new Error(`failed to ${s} "${w7(e)}" as ${t}`,{cause:i})}function Ya(s,e,t){return A7("serialize",s,e,t)}class YL{constructor(e){this.description=e}}const Uw="Bare Item",k7="Boolean";function C7(s){if(typeof s!="boolean")throw Ya(s,k7);return s?"?1":"?0"}function D7(s){return btoa(String.fromCharCode(...s))}const L7="Byte Sequence";function R7(s){if(ArrayBuffer.isView(s)===!1)throw Ya(s,L7);return`:${D7(s)}:`}const I7="Integer";function N7(s){return s<-999999999999999||99999999999999912)throw Ya(s,M7);const t=e.toString();return t.includes(".")?t:`${t}.0`}const F7="String",B7=/[\x00-\x1f\x7f]+/;function U7(s){if(B7.test(s))throw Ya(s,F7);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function j7(s){return s.description||s.toString().slice(7,-1)}const $7="Token";function jw(s){const e=j7(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ya(e,$7);return e}function Qx(s){switch(typeof s){case"number":if(!Pt(s))throw Ya(s,Uw);return Number.isInteger(s)?XL(s):P7(s);case"string":return U7(s);case"symbol":return jw(s);case"boolean":return C7(s);case"object":if(s instanceof Date)return O7(s);if(s instanceof Uint8Array)return R7(s);if(s instanceof YL)return jw(s);default:throw Ya(s,Uw)}}const H7="Key";function Zx(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw Ya(s,H7);return s}function x1(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Zx(e)}`:`;${Zx(e)}=${Qx(t)}`).join("")}function ZL(s){return s instanceof Wa?`${Qx(s.value)}${x1(s.params)}`:Qx(s)}function z7(s){return`(${s.value.map(ZL).join(" ")})${x1(s.params)}`}function V7(s,e={whitespace:!0}){if(typeof s!="object"||s==null)throw Ya(s,E7);const t=s instanceof Map?s.entries():Object.entries(s),i=e?.whitespace?" ":"";return Array.from(t).map(([n,r])=>{r instanceof Wa||(r=new Wa(r));let a=Zx(n);return r.value===!0?a+=x1(r.params):(a+="=",Array.isArray(r.value)?a+=z7(r):a+=ZL(r)),a}).join(`,${i}`)}function JL(s,e){return V7(s,e)}const Ia="CMCD-Object",Qs="CMCD-Request",eu="CMCD-Session",pl="CMCD-Status",G7={br:Ia,ab:Ia,d:Ia,ot:Ia,tb:Ia,tpb:Ia,lb:Ia,tab:Ia,lab:Ia,url:Ia,pb:Qs,bl:Qs,tbl:Qs,dl:Qs,ltc:Qs,mtp:Qs,nor:Qs,nrr:Qs,rc:Qs,sn:Qs,sta:Qs,su:Qs,ttfb:Qs,ttfbb:Qs,ttlb:Qs,cmsdd:Qs,cmsds:Qs,smrt:Qs,df:Qs,cs:Qs,ts:Qs,cid:eu,pr:eu,sf:eu,sid:eu,st:eu,v:eu,msd:eu,bs:pl,bsd:pl,cdn:pl,rtp:pl,bg:pl,pt:pl,ec:pl,e:pl},q7={REQUEST:Qs};function K7(s){return Object.keys(s).reduce((e,t)=>{var i;return(i=s[t])===null||i===void 0||i.forEach(n=>e[n]=t),e},{})}function W7(s,e){const t={};if(!s)return t;const i=Object.keys(s),n=e?K7(e):{};return i.reduce((r,a)=>{var u;const c=G7[a]||n[a]||q7.REQUEST,d=(u=r[c])!==null&&u!==void 0?u:r[c]={};return d[a]=s[a],r},t)}function Y7(s){return["ot","sf","st","e","sta"].includes(s)}function X7(s){return typeof s=="number"?Pt(s):s!=null&&s!==""&&s!==!1}const eR="event";function Q7(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const n=t.pathname.split("/").slice(1),r=i.pathname.split("/").slice(1,-1);for(;n[0]===r[0];)n.shift(),r.shift();for(;r.length;)r.shift(),n.unshift("..");return n.join("/")+t.search+t.hash}const l0=s=>Math.round(s),Jx=(s,e)=>Array.isArray(s)?s.map(t=>Jx(t,e)):s instanceof Wa&&typeof s.value=="string"?new Wa(Jx(s.value,e),s.params):(e.baseUrl&&(s=Q7(s,e.baseUrl)),e.version===1?encodeURIComponent(s):s),Um=s=>l0(s/100)*100,Z7=(s,e)=>{let t=s;return e.version>=2&&(s instanceof Wa&&typeof s.value=="string"?t=new Wa([s]):typeof s=="string"&&(t=[s])),Jx(t,e)},J7={br:l0,d:l0,bl:Um,dl:Um,mtp:Um,nor:Z7,rtp:Um,tb:l0},tR="request",iR="response",b1=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],e9=["e"],t9=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Op(s){return t9.test(s)}function i9(s){return b1.includes(s)||e9.includes(s)||Op(s)}const sR=["d","dl","nor","ot","rtp","su"];function s9(s){return b1.includes(s)||sR.includes(s)||Op(s)}const n9=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function r9(s){return b1.includes(s)||sR.includes(s)||n9.includes(s)||Op(s)}const a9=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function o9(s){return a9.includes(s)||Op(s)}const l9={[iR]:r9,[eR]:i9,[tR]:s9};function nR(s,e={}){const t={};if(s==null||typeof s!="object")return t;const i=e.version||s.v||1,n=e.reportingMode||tR,r=i===1?o9:l9[n];let a=Object.keys(s).filter(r);const u=e.filter;typeof u=="function"&&(a=a.filter(u));const c=n===iR||n===eR;c&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const d=Ss({},J7,e.formatters),f={version:i,reportingMode:n,baseUrl:e.baseUrl};return a.sort().forEach(g=>{let y=s[g];const v=d[g];if(typeof v=="function"&&(y=v(y,f)),g==="v"){if(i===1)return;y=i}g=="pr"&&y===1||(c&&g==="ts"&&!Pt(y)&&(y=Date.now()),X7(y)&&(Y7(g)&&typeof y=="string"&&(y=new YL(y)),t[g]=y))}),t}function u9(s,e={}){const t={};if(!s)return t;const i=nR(s,e),n=W7(i,e?.customHeaderMap);return Object.entries(n).reduce((r,[a,u])=>{const c=JL(u,{whitespace:!1});return c&&(r[a]=c),r},t)}function c9(s,e,t){return Ss(s,u9(e,t))}const d9="CMCD";function h9(s,e={}){return s?JL(nR(s,e),{whitespace:!1}):""}function f9(s,e={}){if(!s)return"";const t=h9(s,e);return encodeURIComponent(t)}function m9(s,e={}){if(!s)return"";const t=f9(s,e);return`${d9}=${t}`}const $w=/CMCD=[^&#]+/;function p9(s,e,t){const i=m9(e,t);if(!i)return s;if($w.test(s))return s.replace($w,i);const n=s.includes("?")?"&":"?";return`${s}${n}${i}`}class g9{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:fr.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=n=>{try{const{frag:r,part:a}=n,u=this.hls.levels[r.level],c=this.getObjectType(r),d={d:(a||r).duration*1e3,ot:c};(c===fr.VIDEO||c===fr.AUDIO||c==fr.MUXED)&&(d.br=u.bitrate/1e3,d.tb=this.getTopBandwidth(c)/1e3,d.bl=this.getBufferLength(c));const f=a?this.getNextPart(a):this.getNextFrag(r);f!=null&&f.url&&f.url!==r.url&&(d.nor=f.url),this.apply(n,d)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHED,this.onMediaDetached,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHED,this.onMediaDetached,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:_7.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ss(t,this.createData());const i=t.ot===fr.INIT||t.ot===fr.VIDEO||t.ot===fr.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((a,u)=>(n.includes(u)&&(a[u]=t[u]),a),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),c9(e.headers,t,r)):e.url=p9(e.url,t,r)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,r=(t=this.hls.levels[n.level])==null||(t=t.details)==null?void 0:t.partList;if(r){const{sn:a}=n;for(let u=r.length-1;u>=0;u--){const c=r[u];if(c.index===i&&c.fragment.sn===a)return r[u+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return fr.TIMED_TEXT;if(e.sn==="initSegment")return fr.INIT;if(t==="audio")return fr.AUDIO;if(t==="main")return this.hls.audioTracks.length?fr.VIDEO:fr.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===fr.AUDIO)i=n.audioTracks;else{const r=n.maxAutoLevel,a=r>-1?r+1:n.levels.length;i=n.levels.slice(0,a)}return i.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===fr.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ai.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,u){t(r),this.loader.load(r,a,u)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,u){t(r),this.loader.load(r,a,u)}}}}const y9=3e5;class v9 extends sa{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if(i?.action===Pn.SendAlternateToPenaltyBox&&i.flags===Pr.MoveAllAlternatesMatchingHost){const n=this.levels;let r=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:u,pathwayId:c,type:d}=t.context;u&&n?a=this.getPathwayForGroupId(u,d,a):c&&(a=c)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&n&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==a),t.details===Oe.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${n&&n.length} priorities: ${Cs(r)} penalized: ${Cs(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(r=>{n-i[r]>y9&&delete i[r]});for(let r=0;r0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,EL(t),this.hls.trigger($.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[u];c&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=u);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r{const{ID:a,"BASE-ID":u,"URI-REPLACEMENT":c}=r;if(t.some(f=>f.pathwayId===a))return;const d=this.getLevelsForPathway(u).map(f=>{const g=new zs(f.attrs);g["PATHWAY-ID"]=a;const y=g.AUDIO&&`${g.AUDIO}_clone_${a}`,v=g.SUBTITLES&&`${g.SUBTITLES}_clone_${a}`;y&&(i[g.AUDIO]=y,g.AUDIO=y),v&&(n[g.SUBTITLES]=v,g.SUBTITLES=v);const b=rR(f.uri,g["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),T=new $h({attrs:g,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:b,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let E=1;E{this.log(`Loaded steering manifest: "${n}"`);const b=f.data;if(b?.VERSION!==1){this.log(`Steering VERSION ${b.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=b.TTL;const{"RELOAD-URI":T,"PATHWAY-CLONES":E,"PATHWAY-PRIORITY":D}=b;if(T)try{this.uri=new self.URL(T,n).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${T}`);return}this.scheduleRefresh(this.uri||y.url),E&&this.clonePathways(E);const O={steeringManifest:b,url:n.toString()};this.hls.trigger($.STEERING_MANIFEST_LOADED,O),D&&this.updatePathwayPriority(D)},onError:(f,g,y,v)=>{if(this.log(`Error loading steering manifest: ${f.code} ${f.text} (${g.url})`),this.stopLoad(),f.code===410){this.enabled=!1,this.log(`Steering manifest ${g.url} no longer available`);return}let b=this.timeToLoad*1e3;if(f.code===429){const T=this.loader;if(typeof T?.getResponseHeader=="function"){const E=T.getResponseHeader("Retry-After");E&&(b=parseFloat(E)*1e3)}this.log(`Steering manifest ${g.url} rate limited`);return}this.scheduleRefresh(this.uri||g.url,b)},onTimeout:(f,g,y)=>{this.log(`Timeout loading steering manifest (${g.url})`),this.scheduleRefresh(this.uri||g.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,c,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Hw(s,e,t,i){s&&Object.keys(e).forEach(n=>{const r=s.filter(a=>a.groupId===n).map(a=>{const u=Ss({},a);return u.details=void 0,u.attrs=new zs(u.attrs),u.url=u.attrs.URI=rR(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),u.groupId=u.attrs["GROUP-ID"]=e[n],u.attrs["PATHWAY-ID"]=i,u});s.push(...r)})}function rR(s,e,t,i){const{HOST:n,PARAMS:r,[t]:a}=i;let u;e&&(u=a?.[e],u&&(s=u));const c=new self.URL(s);return n&&!u&&(c.host=n),r&&Object.keys(r).sort().forEach(d=>{d&&c.searchParams.set(d,r[d])}),c.href}class Lc extends sa{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=Lc.CDMCleanupPromise?[Lc.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,r=`"${t.type}" event: init data type: "${i}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=ph(this.config));const u=a.map(kv).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(u)}this.keyFormatPromise.then(a=>{const u=r0(a);if(i!=="sinf"||u!==Vs.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${u}`);return}let c;try{const v=xn(new Uint8Array(n)),b=l1(JSON.parse(v).sinf),T=JD(b);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(T.subarray(8,24))}catch(v){this.warn(`${r} Failed to parse sinf: ${v}`);return}const d=Bn(c),{keyIdToKeySessionPromise:f,mediaKeySessions:g}=this;let y=f[d];for(let v=0;vthis.generateRequestWithPreferredKeySession(b,i,n,"encrypted-event-key-match")),y.catch(D=>this.handleError(D));break}}y||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${g.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on($.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on($.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on($.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off($.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off($.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off($.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t?.[e];if(n)return n.licenseUrl;if(e===Vs.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t?.[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,u,c)=>!!a&&c.indexOf(a)===u,n=t.map(a=>a.audioCodec).filter(i),r=t.map(a=>a.videoCodec).filter(i);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise((a,u)=>{const c=d=>{const f=d.shift();this.getMediaKeysPromise(f,n,r).then(g=>a({keySystem:f,mediaKeys:g})).catch(g=>{d.length?c(d):g instanceof Mr?u(g):u(new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_ACCESS,error:g,fatal:!0},g.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return gL===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){var n;const r=ZU(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],u=(n=a)==null?void 0:n.keySystemAccess;if(!u){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Cs(r)}`),u=this.requestMediaKeySystemAccess(e,r);const c=a=this.keySystemAccessPromises[e]={keySystemAccess:u};return u.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),u.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const f=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const g=c.mediaKeys=d.createMediaKeys().then(y=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,f.then(v=>v?this.setMediaKeysServerCertificate(y,e,v):y)));return g.catch(y=>{this.error(`Failed to create media-keys for "${e}"}: ${y}`)}),g})}return u.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${Bn(e.keyId||[])} keyUri: ${e.uri}`);const n=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=jm(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${Bn(e.decryptdata.keyId||[])} + } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>kv(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const r=kv(n);r?t(r):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=ph(this.config),i=e.map(r0).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(c,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:d,decryptdata:t}))))).then(c=>{const d="cenc",f=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,d,f,"playlist-key")});return u.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[i]=u,u}return a.catch(u=>{if(u instanceof Mr){const c=gs({},u.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const d=new Mr(c,u.message);this.handleError(d,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Mr){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${Bn(i.keyId||[])})`:""}`),this.hls.trigger($.ERROR,e.data)}else this.error(e.message),this.hls.trigger($.ERROR,{type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=jm(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=r0(e.keyFormat),r=n?[n]:ph(this.config);return this.attemptKeySystemAccess(r)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=ph(this.config)),e.length===0)throw new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Cs({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((r,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(r).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>i.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var r;const a=(r=this.config.drmSystems)==null||(r=r[e.keySystem])==null?void 0:r.generateRequest;if(a)try{const b=a.call(this.hls,t,i,e);if(!b)throw new Error("Invalid response from configured generateRequest filter");t=b.initDataType,i=b.initData?b.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(b){if(this.warn(b.message),this.hls&&this.hls.config.debug)throw b}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const u=jm(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${u} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const d=new c1,f=e._onmessage=b=>{const T=e.mediaKeysSession;if(!T){d.emit("error",new Error("invalid state"));return}const{messageType:E,message:D}=b;this.log(`"${E}" message event for session "${T.sessionId}" message size: ${D.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,D).catch(O=>{d.eventNames().length?d.emit("error",O):this.handleError(O)}):E==="license-release"?e.keySystem===Vs.FAIRPLAY&&this.updateKeySession(e,Gx("acknowledged")).then(()=>this.removeSession(e)).catch(O=>this.handleError(O)):this.warn(`unhandled media key message type "${E}"`)},g=(b,T)=>{T.keyStatus=b;let E;b.startsWith("usable")?d.emit("resolved"):b==="internal-error"||b==="output-restricted"||b==="output-downscaled"?E=zw(b,T.decryptdata):b==="expired"?E=new Error(`key expired (keyId: ${u})`):b==="released"?E=new Error("key released"):b==="status-pending"||this.warn(`unhandled key status change "${b}" (keyId: ${u})`),E&&(d.eventNames().length?d.emit("error",E):this.handleError(E))},y=e._onkeystatuseschange=b=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const E=this.getKeyStatuses(e);if(!Object.keys(E).some(j=>E[j]!=="status-pending"))return;if(E[u]==="expired"){this.log(`Expired key ${Cs(E)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let O=E[u];if(O)g(O,e);else{var R;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(R=e.keyStatusTimeouts)[u]||(R[u]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const F=this.getKeyStatus(e.decryptdata);if(F&&F!=="status-pending")return this.log(`No status for keyId ${u} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${F} from other session.`),g(F,e);this.log(`key status for ${u} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),O="internal-error",g(O,e)},1e3)),this.log(`No status for keyId ${u} (${Cs(E)}).`)}};er(e.mediaKeysSession,"message",f),er(e.mediaKeysSession,"keystatuseschange",y);const v=new Promise((b,T)=>{d.on("error",T),d.on("resolved",b)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${u} URI: ${c}`)}).catch(b=>{throw new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_NO_SESSION,error:b,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${b}`)}).then(()=>v).catch(b=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw b}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const u=n;n=i,i=u}const r="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);if(e.keySystem===Vs.PLAYREADY&&r.length===16){const u=Bn(r);t[u]=i,mL(r)}const a=Bn(r);i==="internal-error"&&(this.bannedKeyIds[a]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,u)=>{const c={responseType:"arraybuffer",url:r},d=t.certLoadPolicy.default,f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},g={onSuccess:(y,v,b,T)=>{a(y.data)},onError:(y,v,b,T)=>{u(new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:gs({url:c.url,data:void 0},y)},`"${e}" certificate request failed (${r}). Status: ${y.code} (${y.text})`))},onTimeout:(y,v,b)=>{u(new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(y,v,b)=>{u(new Error("aborted"))}};n.load(c,f,g)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,r)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)}).catch(a=>{r(new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:n,fatal:!1},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0){let f;for(let g=0,y=r.length;g in key message");return Gx(atob(d))}setupLicenseXHR(e,t,i,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,n)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),r.call(this.hls,e,t,i,n)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,r)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(u.readyState===4)if(u.status===200){this._requestLicenseFailureCount=0;let c=u.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const d=this.config.licenseResponseCallback;if(d)try{c=d.call(this.hls,u,a,e)}catch(f){this.error(f)}n(c)}else{const c=i.errorRetry,d=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||u.status>=400&&u.status<500)r(new Mr({type:Jt.KEY_SYSTEM_ERROR,details:Oe.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:u,response:{url:a,data:void 0,code:u.status,text:u.statusText}},`License Request XHR failed (${a}). Status: ${u.status} (${u.statusText})`));else{const f=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=u,this.setupLicenseXHR(u,a,e,t).then(({xhr:c,licenseChallenge:d})=>{e.keySystem==Vs.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(c,d)),c.send(d)}).catch(r)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,er(i,"encrypted",this.onMediaEncrypted),er(i,"waitingforkey",this.onWaitingForKey);const n=this.mediaResolved;n?n():this.mediaKeys=i.mediaKeys}onMediaDetached(){const e=this.media;e&&(vr(e,"encrypted",this.onMediaEncrypted),vr(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,wl.clearKeyUriToKeyIdMap();const r=n.length;Lc.CDMCleanupPromise=Promise.all(n.map(a=>this.removeSession(a)).concat((i==null||(e=i.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,r)=>(n.indexOf(r.keyFormat)===-1&&n.push(r.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${Bn(n?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(d=>self.clearTimeout(a[d]));const{drmSystemOptions:u}=this.config;return(ej(u)?new Promise((d,f)=>{self.setTimeout(()=>f(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(d).catch(f)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>t.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}}Lc.CDMCleanupPromise=void 0;function jm(s){if(!s)throw new Error("Could not read keyId of undefined decryptdata");if(s.keyId===null)throw new Error("keyId is null");return Bn(s.keyId)}function x9(s,e){if(s.keyId&&e.mediaKeysSession.keyStatuses.has(s.keyId))return e.mediaKeysSession.keyStatuses.get(s.keyId);if(s.matches(e.decryptdata))return e.keyStatus}class Mr extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function zw(s,e){const t=s==="output-restricted",i=t?Oe.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Oe.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Mr({type:Jt.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${s}"`)}class b9{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on($.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off($.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const r=n-this.lastTime,a=i-this.lastDroppedFrames,u=t-this.lastDecodedFrames,c=1e3*a/r,d=this.hls;if(d.trigger($.FPS_DROP,{currentDropped:a,currentDecoded:u,totalDroppedFrames:i}),c>0&&a>d.config.fpsDroppedMonitoringThreshold*u){let f=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=f)&&(f=f-1,d.trigger($.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:d.currentLevel}),d.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function aR(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function oR(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){ys.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,s.addCue(n)}catch(n){ys.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(s.mode=t)}function gc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues)for(let i=s.cues.length;i--;)e&&s.cues[i].removeEventListener("enter",e),s.removeCue(s.cues[i]);t==="disabled"&&(s.mode=t)}function eb(s,e,t,i){const n=s.mode;if(n==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const r=S9(s.cues,e,t);for(let a=0;as[t].endTime)return-1;let i=0,n=t,r;for(;i<=n;)if(r=Math.floor((n+i)/2),es[r].startTime&&i-1)for(let r=n,a=s.length;r=e&&u.endTime<=t)i.push(u);else if(u.startTime>t)return i}return i}function u0(s){const e=[];for(let t=0;tthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=u0(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on($.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off($.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;u0(i.textTracks).forEach(a=>{gc(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${a?.groupId}`);return}const u=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,u)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||n?.length!==i?.length||i!=null&&i.some(a=>n?.indexOf(a)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(f=>!i||i.indexOf(f.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(f=>f.default)&&(this.selectDefaultTrack=!1),a.forEach((f,g)=>{f.id=g});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const u=this.hls.config.subtitlePreference;if(!r&&u){this.selectDefaultTrack=!1;const f=Ha(u,a);if(f>-1)r=a[f];else{const g=Ha(u,this.tracks);r=this.tracks[g]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i?.join(",")}" group-id`),this.hls.trigger($.SUBTITLE_TRACKS_UPDATED,d),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n-1){const r=this.tracksInGroup[n];return this.setSubtitleTrack(n),r}else{if(i)return null;{const r=Ha(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,u=a?.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${u&&a.live?" age "+u.toFixed(1)+(a.type&&" "+a.type||""):""} ${r}`),this.hls.trigger($.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=u0(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(r=>Xx(i,r))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==n&&(r.mode="disabled")}),n){const r=this.subtitleDisplay?"showing":"hidden";n.mode!==r&&(n.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Pt(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger($.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:a,groupId:u="",name:c,type:d,url:f}=n;this.hls.trigger($.SUBTITLE_TRACK_SWITCH,{id:a,groupId:u,name:c,type:d,url:f});const g=this.switchParams(n.url,i?.details,n.details);this.loadPlaylist(g)}}function E9(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?r:r&3|8).toString(16)})}}}function Rh(s){let e=5381,t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return(e>>>0).toString()}const Rc=.025;let Q0=(function(s){return s[s.Point=0]="Point",s[s.Range=1]="Range",s})({});function w9(s,e,t){return`${s.identifier}-${t+1}-${Rh(e)}`}class A9{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Pv(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=Pv(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=Pt(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Pv(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||this.assetListResponse!==null}toString(){return k9(this)}}function Pv(s,e){return s-e.start":s.cue.post?"":""}${s.timelineStart.toFixed(2)}-${s.resumeTime.toFixed(2)}]`}function hc(s){const e=s.timelineStart,t=s.duration||0;return`["${s.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class C9{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger($.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const a=()=>{this.hasDetails=!0};r.once($.LEVEL_LOADED,a),r.once($.AUDIO_TRACK_LOADED,a),r.once($.SUBTITLE_TRACK_LOADED,a),r.on($.MEDIA_ATTACHING,(u,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on($.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,r.trigger($.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=lR(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,r=Ai.bufferInfo(e,n,0);return this.getAssetTime(r.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Ai.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;(n=this.hls)==null||n.on(e,t)}once(e,t,i){var n;(n=this.hls)==null||n.once(e,t)}off(e,t,i){var n;(n=this.hls)==null||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${hc(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Vw=.033;class D9 extends sa{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(r=n[i])!=null&&r.event;){var r;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;nr.start&&e1)for(let r=0;ru&&(t!u.includes(d.identifier)):[];a.length&&a.sort((d,f)=>{const g=d.cue.pre,y=d.cue.post,v=f.cue.pre,b=f.cue.post;if(g&&!v)return-1;if(v&&!g||y&&!b)return 1;if(b&&!y)return-1;if(!g&&!v&&!y&&!b){const T=d.startTime,E=f.startTime;if(T!==E)return T-E}return d.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=a,c.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const r=this.items,a=this.parseSchedule(n,e);(i||t.length||r?.length!==a.length||a.some((c,d)=>Math.abs(c.playout.start-r[d].playout.start)>.005||Math.abs(c.playout.end-r[d].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const n=[],r=Object.keys(e);for(let a=0;a!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,d=0;if(e.forEach((f,g)=>{const y=f.cue.pre,v=f.cue.post,b=e[g-1]||null,T=f.appendInPlace,E=v?r:f.startOffset,D=f.duration,O=f.timelineOccupancy===Q0.Range?D:0,R=f.resumptionOffset,j=b?.startTime===E,F=E+f.cumulativeDuration;let G=T?F+D:E+R;if(y||!v&&E<=0){const W=d;d+=O,f.timelineStart=F;const I=a;a+=D,i.push({event:f,start:F,end:G,playout:{start:I,end:a},integrated:{start:W,end:d}})}else if(E<=r){if(!j){const N=E-c;if(N>Vw){const X=c,V=d;d+=N;const Y=a;a+=N;const ne={previousEvent:e[g-1]||null,nextEvent:f,start:X,end:X+N,playout:{start:Y,end:a},integrated:{start:V,end:d}};i.push(ne)}else N>0&&b&&(b.cumulativeDuration+=N,i[i.length-1].end=E)}v&&(G=F),f.timelineStart=F;const W=d;d+=O;const I=a;a+=D,i.push({event:f,start:F,end:G,playout:{start:I,end:a},integrated:{start:W,end:d}})}else return;const L=f.resumeTime;v||L>r?c=r:c=L}),c{const d=u.cue.pre,f=u.cue.post,g=d?0:f?n:u.startTime;this.updateAssetDurations(u),a===g?u.cumulativeDuration=r:(r=0,a=g),!f&&u.snapOptions.in&&(u.resumeAnchor=Eu(null,i.fragments,u.startOffset+u.resumptionOffset,0,0)||void 0),u.appendInPlace&&!u.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(u,t)||(u.appendInPlace=!1)),!u.appendInPlace&&c+1Rc?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):!Object.keys(t).some(a=>{const u=t[a].details,c=u.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${c}`),!1;const d=Eu(null,u.fragments,i);if(!d)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${u.fragStart}-${u.fragmentEnd})`),!0;const f=a==="audio"?.175:0;return Math.abs(d.start-i){const E=y.data,D=E?.ASSETS;if(!Array.isArray(D)){const O=this.assignAssetListError(e,Oe.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),b.url,v,T);this.hls.trigger($.ERROR,O);return}e.assetListResponse=E,this.hls.trigger($.ASSET_LIST_LOADED,{event:e,assetListResponse:E,networkDetails:T})},onError:(y,v,b,T)=>{const E=this.assignAssetListError(e,Oe.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${y.code} ${y.text} (${v.url})`),v.url,T,b);this.hls.trigger($.ERROR,E)},onTimeout:(y,v,b)=>{const T=this.assignAssetListError(e,Oe.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${v.url})`),v.url,y,b);this.hls.trigger($.ERROR,T)}};return u.load(c,f,g),this.hls.trigger($.ASSET_LIST_LOADING,{event:e}),u}assignAssetListError(e,t,i,n,r,a){return e.error=i,{type:Jt.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:a,stats:r}}}function Gw(s){var e;s==null||(e=s.play())==null||e.catch(()=>{})}function $m(s,e){return`[${s}] Advancing timeline position to ${e}`}class R9 extends sa{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const a=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const u=this.playingItem;if(!u){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(!0),this.checkBuffer(),a&&i=u.end){var c;const v=this.findItemIndex(u);let b=this.schedule.findItemIndexAtTime(i);if(b===-1&&(b=v+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${v} to ${b})`)),!this.isInterstitial(u)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!a&&b>v){const T=this.schedule.findJumpRestrictedIndex(v+1,b);if(T>v){this.setSchedulePosition(T);return}}this.setSchedulePosition(b);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(u)){const v=u.event.assetList[0];v&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,v))}return}const f=d.timelineStart,g=d.duration||0;if(a&&i=f+g){var y;(y=u.event)!=null&&y.appendInPlace&&(this.clearAssetPlayers(u.event,u),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,d)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const u=this.findItemIndex(n);this.setSchedulePosition(u+1)}const r=this.playingAsset;if(!r)return;const a=r.timelineStart+(r.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,r)},this.onScheduleUpdate=(i,n)=>{const r=this.schedule;if(!r)return;const a=this.playingItem,u=r.events||[],c=r.items||[],d=r.durations,f=i.map(T=>T.identifier),g=!!(u.length||f.length);(g||n)&&this.log(`INTERSTITIALS_UPDATED (${u.length}): ${u} +Schedule: ${c.map(T=>ca(T))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`);let y=null,v=null;a&&(y=this.updateItem(a,this.timelinePos),this.itemsMatch(a,y)?this.playingItem=y:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b&&(v=this.updateItem(b,this.bufferedPos),this.itemsMatch(b,v)?this.bufferingItem=v:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))),i.forEach(T=>{T.assetList.forEach(E=>{this.clearAssetPlayer(E.identifier,null)})}),this.playerQueue.forEach(T=>{if(T.interstitial.appendInPlace){const E=T.assetItem.timelineStart,D=T.timelineOffset-E;if(D)try{T.timelineOffset=E}catch(O){Math.abs(D)>Rc&&this.warn(`${O} ("${T.assetId}" ${T.timelineOffset}->${E})`)}}}),g||n){if(this.hls.trigger($.INTERSTITIALS_UPDATED,{events:u.slice(0),schedule:c.slice(0),durations:d,removedIds:f}),this.isInterstitial(a)&&f.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(y,a),b&&v!==y&&this.trimInPlace(v,b),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new L9(e),this.schedule=new D9(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on($.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on($.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on($.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on($.BUFFER_APPENDED,this.onBufferAppended,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on($.MEDIA_ENDED,this.onMediaEnded,this),e.on($.ERROR,this.onError,this),e.on($.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off($.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off($.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off($.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off($.BUFFER_CODECS,this.onBufferCodecs,this),e.off($.BUFFER_APPENDED,this.onBufferAppended,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off($.MEDIA_ENDED,this.onMediaEnded,this),e.off($.ERROR,this.onError,this),e.off($.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){vr(e,"play",this.onPlay),vr(e,"pause",this.onPause),vr(e,"seeking",this.onSeeking),vr(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;er(i,"seeking",this.onSeeking),er(i,"timeupdate",this.onTimeupdate),er(i,"play",this.onPlay),er(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const r=this.findItemIndex(i);this.setSchedulePosition(r)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.log(`Removing schedule state for detachedData and ${r}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=g=>g&&e.getAssetPlayer(g.identifier),n=(g,y,v,b,T)=>{if(g){let E=g[y].start;const D=g.event;if(D){if(y==="playout"||D.timelineOccupancy!==Q0.Point){const O=i(v);O?.interstitial===D&&(E+=O.assetItem.startOffset+O[T])}}else{const O=b==="bufferedPos"?a():e[b];E+=O-g.start}return E}return 0},r=(g,y)=>{var v;if(g!==0&&y!=="primary"&&(v=e.schedule)!=null&&v.length){var b;const T=e.schedule.findItemIndexAtTime(g),E=(b=e.schedule.items)==null?void 0:b[T];if(E){const D=E[y].start-E.start;return g+D}}return g},a=()=>{const g=e.bufferedPos;return g===Number.MAX_VALUE?u("primary"):Math.max(g,0)},u=g=>{var y,v;return(y=e.primaryDetails)!=null&&y.live?e.primaryDetails.edge:((v=e.schedule)==null?void 0:v.durations[g])||0},c=(g,y)=>{var v,b;const T=e.effectivePlayingItem;if(T!=null&&(v=T.event)!=null&&v.restrictions.skip||!e.schedule)return;e.log(`seek to ${g} "${y}"`);const E=e.effectivePlayingItem,D=e.schedule.findItemIndexAtTime(g,y),O=(b=e.schedule.items)==null?void 0:b[D],R=e.getBufferingPlayer(),j=R?.interstitial,F=j?.appendInPlace,G=E&&e.itemsMatch(E,O);if(E&&(F||G)){const L=i(e.playingAsset),W=L?.media||e.primaryMedia;if(W){const I=y==="primary"?W.currentTime:n(E,y,e.playingAsset,"timelinePos","currentTime"),N=g-I,X=(F?I:W.currentTime)+N;if(X>=0&&(!L||F||X<=L.duration)){W.currentTime=X;return}}}if(O){let L=g;if(y!=="primary"){const I=O[y].start,N=g-I;L=O.start+N}const W=!e.isInterstitial(O);if((!e.isInterstitial(E)||E.event.appendInPlace)&&(W||O.event.appendInPlace)){const I=e.media||(F?R?.media:null);I&&(I.currentTime=L)}else if(E){const I=e.findItemIndex(E);if(D>I){const X=e.schedule.findJumpRestrictedIndex(I+1,D);if(X>I){e.setSchedulePosition(X);return}}let N=0;if(W)e.timelinePos=L,e.checkBuffer();else{const X=O.event.assetList,V=g-(O[y]||O).start;for(let Y=X.length;Y--;){const ne=X[Y];if(ne.duration&&V>=ne.startOffset&&V{const g=e.effectivePlayingItem;if(e.isInterstitial(g))return g;const y=t();return e.isInterstitial(y)?y:null},f={get bufferedEnd(){const g=t(),y=e.bufferingItem;if(y&&y===g){var v;return n(y,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-y.playout.start||((v=e.bufferingAsset)==null?void 0:v.startOffset)||0}return 0},get currentTime(){const g=d(),y=e.effectivePlayingItem;return y&&y===g?n(y,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-y.playout.start:0},set currentTime(g){const y=d(),v=e.effectivePlayingItem;v&&v===y&&c(g+v.playout.start,"playout")},get duration(){const g=d();return g?g.playout.end-g.playout.start:0},get assetPlayers(){var g;const y=(g=d())==null?void 0:g.event.assetList;return y?y.map(v=>e.getAssetPlayer(v.identifier)):[]},get playingIndex(){var g;const y=(g=d())==null?void 0:g.event;return y&&e.effectivePlayingAsset?y.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var g;return((g=e.schedule)==null||(g=g.events)==null?void 0:g.slice(0))||[]},get schedule(){var g;return((g=e.schedule)==null||(g=g.items)==null?void 0:g.slice(0))||[]},get interstitialPlayer(){return d()?f:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const g=t();return e.findItemIndex(g)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const g=e.effectivePlayingItem;return e.findItemIndex(g)},primary:{get bufferedEnd(){return a()},get currentTime(){const g=e.timelinePos;return g>0?g:0},set currentTime(g){c(g,"primary")},get duration(){return u("primary")},get seekableStart(){var g;return((g=e.primaryDetails)==null?void 0:g.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(g){c(g,"integrated")},get duration(){return u("integrated")},get seekableStart(){var g;return r(((g=e.primaryDetails)==null?void 0:g.fragmentStart)||0,"integrated")}},skip:()=>{const g=e.effectivePlayingItem,y=g?.event;if(y&&!y.restrictions.skip){const v=e.findItemIndex(g);if(y.appendInPlace){const b=g.playout.start+g.event.duration;c(b+.001,"playout")}else e.advanceAfterAssetEnded(y,v,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);const r=(t=n)==null?void 0:t.currentTime;if(!(r===void 0||!Pt(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Cs(r)}`),this.detachedData=r}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let r=null;const a=this.hls,u=e!==a,c=u&&e.interstitial.appendInPlace,d=(i=this.detachedData)==null?void 0:i.mediaSource;let f;if(a.media)c&&(r=a.transferMedia(),this.detachedData=r),f="Primary";else if(d){const b=this.getBufferingPlayer();b?(r=b.transferMedia(),f=`${b}`):f="detached MediaSource"}else f="detached media";if(!r){if(d)r=this.detachedData,this.log(`using detachedData: MediaSource ${Cs(r)}`);else if(!this.detachedData||a.media===t){const b=this.playerQueue;b.length>1&&b.forEach(T=>{if(u&&T.interstitial.appendInPlace!==c){const E=T.interstitial;this.clearInterstitial(T.interstitial,null),E.appendInPlace=!1,E.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${E}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const g=r&&"mediaSource"in r&&((n=r.mediaSource)==null?void 0:n.readyState)!=="closed",y=g&&r?r:t;this.log(`${g?"transfering MediaSource":"attaching media"} to ${u?e:"Primary"} from ${f} (media.currentTime: ${t.currentTime})`);const v=this.schedule;if(y===r&&v){const b=u&&e.assetId===v.assetIdAtEnd;y.overrides={duration:v.duration,endOfStream:!u||b,cueRemoval:!u}}e.attachMedia(y)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const r=this.hls.startPosition;if(this.log($m("checkStart",r)),this.timelinePos=r,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(r>=0||!this.primaryLive){const a=this.timelinePos=r>0?r:0,u=e.findItemIndexAtTime(a);this.setSchedulePosition(u)}}else if(n&&!this.playingItem){const r=e.findItemIndex(n);this.setSchedulePosition(r)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),r=Fv(i,n);if(!i.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){var a;const u=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];u&&this.bufferedToItem(u)}}advanceAfterAssetEnded(e,t,i){const n=Fv(e,i);if(e.isAssetPastPlayoutLimit(n)){if(this.schedule){const r=this.schedule.items;if(r){const a=t+1,u=r.length;if(a>=u){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&ca(r)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,u=this.playingLastItem;if(this.isInterstitial(a)){const f=a.event,g=this.playingAsset,y=g?.identifier,v=y?this.getAssetPlayer(y):null;if(v&&y&&(!this.eventItemsMatch(a,r)||t!==void 0&&y!==f.assetList[t].identifier)){var c;const b=f.findAssetIndex(g);if(this.log(`INTERSTITIAL_ASSET_ENDED ${b+1}/${f.assetList.length} ${hc(g)}`),this.endedAsset=g,this.playingAsset=null,this.hls.trigger($.INTERSTITIAL_ASSET_ENDED,{asset:g,assetListIndex:b,event:f,schedule:n.slice(0),scheduleIndex:e,player:v}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),b);return}this.retreiveMediaSource(y,r),v.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&v.detachMedia()}if(!this.eventItemsMatch(a,r)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${ca(a)}`),f.hasPlayed=!0,this.hls.trigger($.INTERSTITIAL_ENDED,{event:f,schedule:n.slice(0),scheduleIndex:e}),f.cue.once)){var d;this.updateSchedule();const b=(d=this.schedule)==null?void 0:d.items;if(r&&b){const T=this.findItemIndex(r);this.advanceSchedule(T,b,t,a,u)}return}}this.advanceSchedule(e,n,t,a,u)}advanceSchedule(e,t,i,n,r){const a=this.schedule;if(!a)return;const u=t[e]||null,c=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(f=>{const g=f.interstitial,y=a.findEventIndex(g.identifier);(ye+1)&&this.clearInterstitial(g,u)}),this.isInterstitial(u)){this.timelinePos=Math.min(Math.max(this.timelinePos,u.start),u.end);const f=u.event;if(i===void 0){i=a.findAssetIndex(f,this.timelinePos);const b=Fv(f,i-1);if(f.isAssetPastPlayoutLimit(b)||f.appendInPlace&&this.timelinePos===u.end){this.advanceAfterAssetEnded(f,e,i);return}i=b}const g=this.waitingItem;this.assetsBuffered(u,c)||this.setBufferingItem(u);let y=this.preloadAssets(f,i);if(this.eventItemsMatch(u,g||n)||(this.waitingItem=u,this.log(`INTERSTITIAL_STARTED ${ca(u)} ${f.appendInPlace?"append in place":""}`),this.hls.trigger($.INTERSTITIAL_STARTED,{event:f,schedule:t.slice(0),scheduleIndex:e})),!f.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${f}`);return}if(f.assetListLoader&&(f.assetListLoader.destroy(),f.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${f}`);return}this.waitingItem=this.endedItem=null,this.playingItem=u;const v=f.assetList[i];if(!v){this.advanceAfterAssetEnded(f,e,i||0);return}if(y||(y=this.getAssetPlayer(v.identifier)),y===null||y.destroyed){const b=f.assetList.length;this.warn(`asset ${i+1}/${b} player destroyed ${f}`),y=this.createAssetPlayer(f,v,i),y.loadSource()}if(!this.eventItemsMatch(u,this.bufferingItem)&&f.appendInPlace&&this.isAssetBuffered(v))return;this.startAssetPlayer(y,i,t,e,c),this.shouldPlay&&Gw(y.media)}else u?(this.resumePrimary(u,e,n),this.shouldPlay&&Gw(this.hls.media)):r&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${ca(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let u=this.timelinePos;(u=e.end)&&(u=this.getPrimaryResumption(e,t),this.log($m("resumePrimary",u)),this.timelinePos=u),this.attachPrimary(u,e)}if(!i)return;const a=(r=this.schedule)==null?void 0:r.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${ca(e)}`),this.hls.trigger($.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(in.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Ai.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log($m("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off($.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on($.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const n=gs(gs({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=gs(gs({},this.altSelection),{},{audio:i});return}const r=gs(gs({},n),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=gs(gs({},this.altSelection),{},{subtitles:i});return}const r=gs(gs({},n),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(e,t){const i=ew(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=ew(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setSubtitleOption(t)||t.id!==-1&&n.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((r,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(r.identifier,null)});const i=e.end+.25,n=Ai.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${ca(e)} (was ${ca(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const n=Ai.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}const a=this.playingItem,u=this.findItemIndex(a);let c=n.findItemIndexAtTime(e);if(this.bufferedPos=r.end||(d=y.event)!=null&&d.appendInPlace&&e+.01>=y.start)&&(c=g),this.isInterstitial(r)){const v=r.event;if(g-u>1&&v.appendInPlace===!1||v.assetList.length===0&&v.assetListLoader)return}if(this.bufferedPos=e,c>f&&c>u)this.bufferedToItem(y);else{const v=this.primaryDetails;this.primaryLive&&v&&e>v.edge-v.targetduration&&y.start{const r=this.getAssetPlayer(n.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:r}=i;if(!n||!r)return t;const a=this.isInterstitial(e),u=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=u?u.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${ca(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const d=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((f,g)=>{const y=this.getAssetPlayer(f.identifier);y&&(g===d&&y.loadSource(),y.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger($.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,r=i.cue.once;if(n||!r){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const u=this.primaryMedia;u&&this.bufferAssetPlayer(a,u)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,r=n===0&&!e.assetListLoader,a=e.cue.once;if(r){const c=e.timelineStart;if(e.appendInPlace){var u;const y=this.playingItem;!this.isInterstitial(y)&&(y==null||(u=y.nextEvent)==null?void 0:u.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let d,f=0;if(!this.playingItem&&this.primaryLive&&(f=this.hls.startPosition,f===-1&&(f=this.hls.liveSyncPosition||0)),f&&!(e.cue.pre||e.cue.post)){const y=f-c;y>0&&(d=Math.round(y*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${d?` live-start: ${f} start-offset: ${d}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const g=this.assetListLoader.loadAssetList(e,d);g&&(e.assetListLoader=g)}else if(!a&&n){for(let d=t;d{this.hls.trigger($.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i1){const F=t.duration;F&&j{if(j.live){var F;const W=new Error(`Interstitials MUST be VOD assets ${e}`),I={fatal:!0,type:Jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:W},N=((F=this.schedule)==null?void 0:F.findEventIndex(e.identifier))||-1;this.handleAssetItemError(I,e,N,i,W.message);return}const G=j.edge-j.fragmentStart,L=t.duration;(T||L===null||G>L)&&(T=!1,this.log(`Interstitial asset "${g}" duration change ${L} > ${G}`),t.duration=G,this.updateSchedule())};b.on($.LEVEL_UPDATED,(j,{details:F})=>E(F)),b.on($.LEVEL_PTS_UPDATED,(j,{details:F})=>E(F)),b.on($.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const D=(j,F)=>{const G=this.getAssetPlayer(g);if(G&&F.tracks){G.off($.BUFFER_CODECS,D),G.tracks=F.tracks;const L=this.primaryMedia;this.bufferingAsset===G.assetItem&&L&&!G.media&&this.bufferAssetPlayer(G,L)}};b.on($.BUFFER_CODECS,D);const O=()=>{var j;const F=this.getAssetPlayer(g);if(this.log(`buffered to end of asset ${F}`),!F||!this.schedule)return;const G=this.schedule.findEventIndex(e.identifier),L=(j=this.schedule.items)==null?void 0:j[G];this.isInterstitial(L)&&this.advanceAssetBuffering(L,t)};b.on($.BUFFERED_TO_END,O);const R=j=>()=>{if(!this.getAssetPlayer(g)||!this.schedule)return;this.shouldPlay=!0;const G=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,G,j)};return b.once($.MEDIA_ENDED,R(i)),b.once($.PLAYOUT_LIMIT_REACHED,R(1/0)),b.on($.ERROR,(j,F)=>{if(!this.schedule)return;const G=this.getAssetPlayer(g);if(F.details===Oe.BUFFER_STALLED_ERROR){if(G!=null&&G.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(F,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${F.error} ${e}`)}),b.on($.DESTROYING,()=>{if(!this.getAssetPlayer(g)||!this.schedule)return;const F=new Error(`Asset player destroyed unexpectedly ${g}`),G={fatal:!0,type:Jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:F};this.handleAssetItemError(G,e,this.schedule.findEventIndex(e.identifier),i,F.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${hc(t)}`),this.hls.trigger($.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:b}),b}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const n=this.playerQueue[i];this.log(`clear ${n} toSegment: ${t&&ca(t)}`),this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,r){const{interstitial:a,assetItem:u,assetId:c}=e,d=a.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=u,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,i[n]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${hc(u)}`),this.hls.trigger($.INTERSTITIAL_ASSET_STARTED,{asset:u,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:r,assetItem:a}=e,u=this.schedule.findEventIndex(r.identifier),c=(i=this.schedule.items)==null?void 0:i[u];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const f=r.appendInPlace;if(f&&d?.interstitial.appendInPlace===!1)return;const g=d?.tracks||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(g&&!VD(g,e.tracks)){const y=new Error(`Asset ${hc(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(g)}')`),v={fatal:!0,type:Jt.OTHER_ERROR,details:Oe.INTERSTITIAL_ASSET_ITEM_ERROR,error:y},b=r.findAssetIndex(a);this.handleAssetItemError(v,r,u,b,y.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,r=t.findAssetIndex(e,n),a=e.assetList[r];if(a){const u=this.getAssetPlayer(a.identifier);if(u){const c=u.currentTime||n-a.timelineStart,d=u.duration-c;if(this.warn(`Stalled at ${c} of ${c+d} in ${u} ${e} (media.currentTime: ${n})`),c&&(d/i.playbackRate<.5||u.bufferedInPlaceToEnd(i))&&u.hls){const f=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,f,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime!T.error))t.error=b;else for(let T=n;T{const D=parseFloat(T.DURATION);this.createAsset(r,E,f,c+f,D,T.URI),f+=D}),r.duration=f,this.log(`Loaded asset-list with duration: ${f} (was: ${d}) ${r}`);const g=this.waitingItem,y=g?.event.identifier===a;this.updateSchedule();const v=(n=this.bufferingItem)==null?void 0:n.event;if(y){var b;const T=this.schedule.findEventIndex(a),E=(b=this.schedule.items)==null?void 0:b[T];if(E){if(!this.playingItem&&this.timelinePos>E.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==T){r.error=new Error(`Interstitial ${u.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(E)}this.setSchedulePosition(T)}else if(v?.identifier===a){const T=r.assetList[0];if(T){const E=this.getAssetPlayer(T.identifier);if(v.appendInPlace){const D=this.primaryMedia;E&&D&&this.bufferAssetPlayer(E,D)}else E&&E.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case Oe.ASSET_LIST_PARSING_ERROR:case Oe.ASSET_LIST_LOAD_ERROR:case Oe.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case Oe.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const qw=500;class I9 extends u1{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",$t.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on($.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off($.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off($.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off($.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=ot.IDLE,this.setInterval(qw),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(un(i)&&(this.fragPrevious=i),this.state=ot.IDLE),!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a;const u=i.start;for(let d=0;d=r[d].start&&u<=r[d].end){a=r[d];break}const c=i.start+i.duration;a?a.end=c:(a={start:u,end:c},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(a=>{for(let u=0;unew $h(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new $h(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,$t.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==ot.STOPPED&&this.setInterval(qw)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:r}=this,{details:a,id:u}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${u}`);return}const c=r[u];if(u>=r.length||!c)return;this.log(`Subtitle track ${u} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(a.live||(i=c.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const g=this.mainDetails;if(!g){this.startFragRequested=!1;return}const y=g.fragments[0];if(!c.details)a.hasProgramDateTime&&g.hasProgramDateTime?(Y0(a,g),d=a.fragmentStart):y&&(d=y.start,Kx(a,d));else{var f;d=this.alignPlaylists(a,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),d===0&&y&&(d=y.start,Kx(a,d))}g&&!this.startFragRequested&&this.setStartPosition(g,d)}c.details=a,this.levelLastLoaded=c,u===n&&(this.hls.trigger($.SUBTITLE_TRACK_UPDATED,{details:a,id:u,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===ot.IDLE&&(Eu(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&Dc(n.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,o1(n.method)).catch(u=>{throw r.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:t}),u}).then(u=>{const c=performance.now();r.trigger($.FRAG_DECRYPTED,{frag:t,payload:u,stats:{tstart:a,tdecrypt:c}})}).catch(u=>{this.warn(`${u.name}: ${u.message}`),this.state=ot.IDLE})}}doTick(){if(!this.media){this.state=ot.IDLE;return}if(this.state===ot.IDLE){const{currentTrackId:e,levels:t}=this,i=t?.[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,r=this.getLoadPosition(),a=Ai.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:u,len:c}=a,d=i.details,f=this.hls.maxBufferLength+d.levelTargetDuration;if(c>f)return;const g=d.fragments,y=g.length,v=d.edge;let b=null;const T=this.fragPrevious;if(uv-O?0:O;b=Eu(T,g,Math.max(g[0].start,u),R),!b&&T&&T.start{if(n=n>>>0,n>r-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const O9={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},uR=s=>String.fromCharCode(O9[s]||s),da=15,go=100,M9={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},P9={17:2,18:4,21:6,22:8,23:10,19:13,20:15},F9={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},B9={25:2,26:4,29:6,30:8,31:10,27:13,28:15},U9=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class j9{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;ys.log(`${this.time} [${e}] ${i}`)}}}const tu=function(e){const t=[];for(let i=0;igo&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=go)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i=144&&this.backSpace();const t=uR(e);if(this.pos>=go){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t"pacData = "+Cs(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+Cs(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let r=0;r0&&(e?i="["+t.join(" | ")+"]":i=t.join(` +`)),i}getTextAndFormat(){return this.rows}}class Kw{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Bv(i),this.nonDisplayedMemory=new Bv(i),this.lastOutputScreen=new Bv(i),this.currRollUpRow=this.displayedMemory.rows[da-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[da-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;it+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+Cs(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ww{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=V9(),this.logger=void 0;const n=this.logger=new j9;this.channels=[null,new Kw(e,t,n),new Kw(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i"["+tu([t[i],t[i+1]])+"] -> ("+tu([n,r])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(z9(n,r,c)){Hm(null,null,c),this.logger.log(3,()=>"Repeated command ("+tu([n,r])+") is dropped");continue}Hm(n,r,this.cmdHistory),a=this.parseCmd(n,r),a||(a=this.parseMidrow(n,r)),a||(a=this.parsePAC(n,r)),a||(a=this.parseBackgroundAttributes(n,r))}else Hm(null,null,c);if(!a&&(u=this.parseChars(n,r),u)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(u):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!u&&this.logger.log(2,()=>"Couldn't parse cleaned data "+tu([n,r])+" orig: "+tu([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const r=e===20||e===21||e===23?1:2,a=this.channels[r];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+tu([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(n||r))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?M9[e]:F9[e]:i=a===1?P9[e]:B9[e];const u=this.channels[a];return u?(u.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let a;r===17?a=t+80:r===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+uR(a)+"' in channel "+i),n=[a]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+tu(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let r;const a={};e===16||e===24?(r=Math.floor((t-32)/2),a.background=U9[r],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const u=e<=23?1:2;return this.channels[u].setBkgData(a),!0}reset(){for(let e=0;e100)throw new Error("Position must be between 0 and 100.");G=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",r({},g,{get:function(){return L},set:function(N){const X=n(N);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");L=X,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",r({},g,{get:function(){return W},set:function(N){if(N<0||N>100)throw new Error("Size must be between 0 and 100.");W=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",r({},g,{get:function(){return I},set:function(N){const X=n(N);if(!X)throw new SyntaxError("An invalid or illegal string was specified.");I=X,this.hasBeenReset=!0}})),f.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class G9{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function dR(s){function e(i,n,r,a){return(i|0)*3600+(n|0)*60+(r|0)+parseFloat(a||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class q9{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n=0&&i<=100)return this.set(e,i),!0}return!1}}function hR(s,e,t,i){const n=i?s.split(i):[s];for(const r in n){if(typeof n[r]!="string")continue;const a=n[r].split(t);if(a.length!==2)continue;const u=a[0],c=a[1];e(u,c)}}const tb=new T1(0,0,""),zm=tb.align==="middle"?"middle":"center";function K9(s,e,t){const i=s;function n(){const u=dR(s);if(u===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),u}function r(u,c){const d=new q9;hR(u,function(y,v){let b;switch(y){case"region":for(let T=t.length-1;T>=0;T--)if(t[T].id===v){d.set(y,t[T].region);break}break;case"vertical":d.alt(y,v,["rl","lr"]);break;case"line":b=v.split(","),d.integer(y,b[0]),d.percent(y,b[0])&&d.set("snapToLines",!1),d.alt(y,b[0],["auto"]),b.length===2&&d.alt("lineAlign",b[1],["start",zm,"end"]);break;case"position":b=v.split(","),d.percent(y,b[0]),b.length===2&&d.alt("positionAlign",b[1],["start",zm,"end","line-left","line-right","auto"]);break;case"size":d.percent(y,v);break;case"align":d.alt(y,v,["start",zm,"end","left","right"]);break}},/:/,/\s/),c.region=d.get("region",null),c.vertical=d.get("vertical","");let f=d.get("line","auto");f==="auto"&&tb.line===-1&&(f=-1),c.line=f,c.lineAlign=d.get("lineAlign","start"),c.snapToLines=d.get("snapToLines",!0),c.size=d.get("size",100),c.align=d.get("align",zm);let g=d.get("position","auto");g==="auto"&&tb.position===50&&(g=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=g}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),a(),e.endTime=n(),a(),r(s,e)}function fR(s){return s.replace(//gi,` +`)}class W9{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new G9,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let r=t.buffer,a=0;for(r=fR(r);a")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{I9(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const u=r.indexOf("-->")!==-1;if(!r||u&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` +`&&++a,t.buffer=r.slice(a),u}function n(r){hR(r,function(a,u){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=i();const u=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(u!=null&&u[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new T1(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{K9(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const u=r.indexOf("-->")!==-1;if(!r||u&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` `),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` -`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const O9=/\r\n|\n\r|\n|\r/g,Mv=function(e,t,i=0){return e.slice(i,i+t.length)===t},M9=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Dt(t)||!Dt(i)||!Dt(n)||!Dt(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=3600*1e3*r,t};function x1(s,e,t){return Lh(s.toString())+Lh(e.toString())+Lh(t)}const P9=function(e,t,i){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(a=r)!=null&&a.new;){var a;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=i};function B9(s,e,t,i,n,r,a){const u=new N9,c=Pr(new Uint8Array(s)).trim().replace(O9,` +`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Y9=/\r\n|\n\r|\n|\r/g,Uv=function(e,t,i=0){return e.slice(i,i+t.length)===t},X9=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Pt(t)||!Pt(i)||!Pt(n)||!Pt(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=3600*1e3*r,t};function S1(s,e,t){return Rh(s.toString())+Rh(e.toString())+Rh(t)}const Q9=function(e,t,i){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(a=r)!=null&&a.new;){var a;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=i};function Z9(s,e,t,i,n,r,a){const u=new W9,c=jr(new Uint8Array(s)).trim().replace(Y9,` `).split(` -`),d=[],f=e?zj(e.baseTime,e.timescale):0;let p="00:00.000",y=0,v=0,b,T=!0;u.oncue=function(E){const D=t[i];let O=t.ccOffset;const R=(y-f)/9e4;if(D!=null&&D.new&&(v!==void 0?O=t.ccOffset=D.start:P9(t,i,R)),R){if(!e){b=new Error("Missing initPTS for VTT MPEGTS");return}O=R-t.presentationOffset}const j=E.endTime-E.startTime,F=Nr((E.startTime+O-v)*9e4,n*9e4)/9e4;E.startTime=Math.max(F,0),E.endTime=Math.max(F+j,0);const z=E.text.trim();E.text=decodeURIComponent(encodeURIComponent(z)),E.id||(E.id=x1(E.startTime,E.endTime,z)),E.endTime>0&&d.push(E)},u.onparsingerror=function(E){b=E},u.onflush=function(){if(b){a(b);return}r(d)},c.forEach(E=>{if(T)if(Mv(E,"X-TIMESTAMP-MAP=")){T=!1,E.slice(16).split(",").forEach(D=>{Mv(D,"LOCAL:")?p=D.slice(6):Mv(D,"MPEGTS:")&&(y=parseInt(D.slice(7)))});try{v=M9(p)/1e3}catch(D){b=D}return}else E===""&&(T=!1);u.parse(E+` -`)}),u.flush()}const Pv="stpp.ttml.im1t",rR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,aR=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,F9={left:"start",center:"center",right:"end",start:"start",end:"end"};function Hw(s,e,t,i){const n=Pi(new Uint8Array(s),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=n.map(u=>Pr(u)),a=Hj(e.baseTime,1,e.timescale);try{r.forEach(u=>t(U9(u,a)))}catch(u){i(u)}}function U9(s,e){const n=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((p,y)=>(p[y]=n.getAttribute(`ttp:${y}`)||r[y],p),{}),u=n.getAttribute("xml:space")!=="preserve",c=zw(Bv(n,"styling","style")),d=zw(Bv(n,"layout","region")),f=Bv(n,"body","[begin]");return[].map.call(f,p=>{const y=oR(p,u);if(!y||!p.hasAttribute("begin"))return null;const v=Uv(p.getAttribute("begin"),a),b=Uv(p.getAttribute("dur"),a);let T=Uv(p.getAttribute("end"),a);if(v===null)throw Vw(p);if(T===null){if(b===null)throw Vw(p);T=v+b}const E=new v1(v-e,T-e,y);E.id=x1(E.startTime,E.endTime,E.text);const D=d[p.getAttribute("region")],O=c[p.getAttribute("style")],R=j9(D,O,c),{textAlign:j}=R;if(j){const F=F9[j];F&&(E.lineAlign=F),E.align=j}return gs(E,R),E}).filter(p=>p!==null)}function Bv(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function zw(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function oR(s,e){return[].slice.call(s.childNodes).reduce((t,i,n)=>{var r;return i.nodeName==="br"&&n?t+` -`:(r=i.childNodes)!=null&&r.length?oR(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function j9(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(n=t[a]),r.reduce((u,c)=>{const d=Fv(e,i,c)||Fv(s,i,c)||Fv(n,i,c);return d&&(u[c]=d),u},{})}function Fv(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Vw(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Uv(s,e){if(!s)return null;let t=iR(s);return t===null&&(rR.test(s)?t=$9(s,e):aR.test(s)&&(t=H9(s,e))),t}function $9(s,e){const t=rR.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function H9(s,e){const t=aR.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class $m{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class z9{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qw(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_LOADED,this.onFragLoaded,this),e.on($.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on($.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on($.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_LOADED,this.onFragLoaded,this),e.off($.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off($.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off($.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new $m(this,"textTrack1"),t=new $m(this,"textTrack2"),i=new $m(this,"textTrack3"),n=new $m(this,"textTrack4");this.cea608Parser1=new $w(1,e,t),this.cea608Parser2=new $w(3,i,n)}addCues(e,t,i,n,r){let a=!1;for(let u=r.length;u--;){const c=r[u],d=V9(c[0],c[1],t,i);if(d>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),a=!0,d/(i-t)>.5))return}if(a||r.push([t,i]),this.config.renderTextTracksNatively){const u=this.captionsTracks[e];this.Cues.newCue(u,t,i,n)}else{const u=this.Cues.newCue(null,t,i,n);this.hls.trigger($.CUES_PARSED,{type:"captions",cues:u,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:a}){const{unparsedVttFrags:u}=this;i===Ot.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:r,trackId:a}),u.length&&(this.unparsedVttFrags=[],u.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded($.FRAG_LOADED,c):this.hls.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n{mc(n[r]),delete n[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qw(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;ir.textCodec===Pv);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(FL(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,u=a?n0(a.textTracks):null;if(this.tracks.forEach((c,d)=>{let f;if(u){let p=null;for(let y=0;yd!==null).map(d=>d.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(u=>({label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}));this.hls.trigger($.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const r=`textTrack${n[1]}`,a=this.captionsProperties[r];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Ot.MAIN){var i,n;const{cea608Parser1:r,cea608Parser2:a,lastSn:u}=this,{cc:c,sn:d}=t.frag,f=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;r&&a&&(d!==u+1||d===u&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(r.reset(),a.reset()),this.lastCc=c,this.lastSn=d,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===Ot.SUBTITLE)if(n.byteLength){const r=i.decryptdata,a="stats"in t;if(r==null||!r.encrypted||a){const u=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),u&&u.textCodec===Pv?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Hw(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:r,unparsedVttFrags:a}=this,u=r.length-1;if(!r[i.cc]&&u===-1){a.push(e);return}const c=this.hls,d=(t=i.initSegment)!=null&&t.data?Xr(i.initSegment.data,new Uint8Array(n)).buffer:n;B9(d,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,f=>{this._appendCues(f,i.level),c.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},f=>{const p=f.message==="Missing initPTS for VTT MPEGTS";p?a.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${f}`),!(p&&u>i.cc)&&c.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:f})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Hw(t,this.initPTS[e.cc],()=>{i.textCodec=Pv,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(r=>ZL(n,r))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;i.trigger($.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ot.SUBTITLE&&this.onFragLoaded($.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===Ot.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;rQx(u[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:u}=this;Object.keys(u).forEach(c=>Qx(u[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let r=0;r=16?c--:c++;const v=nR(d.trim()),b=x1(e,t,v);s!=null&&(p=s.cues)!=null&&p.getCueById(b)||(a=new f(e,t,v),a.id=b,a.line=y+1,a.align="left",a.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(a))}return s&&n.length&&(n.sort((y,v)=>y.line==="auto"||v.line==="auto"?0:y.line>8&&v.line>8?v.line-y.line:y.line-v.line),n.forEach(y=>ZL(s,y))),n}};function K9(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const W9=/(\d+)-(\d+)\/(\d+)/;class Kw{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Z9,this.controller=new self.AbortController,this.stats=new Qb}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const r=Y9(e,this.controller.signal),a=e.responseType==="arraybuffer",u=a?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&Dt(c)?c:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(Hh(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(p=>{var y;this.response=this.loader=p;const v=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},d-(v-n.loading.start)),!p.ok){const{status:T,statusText:E}=p;throw new J9(E||"fetch, bad network response",T,p)}n.loading.first=v,n.total=Q9(p.headers)||n.total;const b=(y=this.callbacks)==null?void 0:y.onProgress;return b&&Dt(t.highWaterMark)?this.loadProgressively(p,n,e,t.highWaterMark,b):a?p.arrayBuffer():e.responseType==="json"?p.json():p.text()}).then(p=>{var y,v;const b=this.response;if(!b)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const T=p[u];T&&(n.loaded=n.total=T);const E={url:b.url,data:p,code:b.status},D=(y=this.callbacks)==null?void 0:y.onProgress;D&&!Dt(t.highWaterMark)&&D(n,e,p,b),(v=this.callbacks)==null||v.onSuccess(E,n,e,b)}).catch(p=>{var y;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const v=p&&p.code||0,b=p?p.message:null;(y=this.callbacks)==null||y.onError({code:v,text:b},e,p?p.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,r){const a=new vL,u=e.body.getReader(),c=()=>u.read().then(d=>{if(d.done)return a.dataLength&&r(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=d.value,p=f.length;return t.loaded+=p,p=n&&r(t,i,a.flush().buffer,e)):r(t,i,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Y9(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(gs({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function X9(s){const e=W9.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Q9(s){const e=s.get("Content-Range");if(e){const i=X9(e);if(Dt(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function Z9(s,e){return new self.Request(s.url,e)}class J9 extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const e$=/^age:\s*[\d.]+\s*$/im;class uR{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Qb,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var u;(u=this.callbacks)==null||u.onError({code:i.status,text:a.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=i.loadPolicy;if(n)for(const u in n)e.setRequestHeader(u,n[u]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Dt(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,f=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const b=f??t.response;if(b!=null){var a,u;i.loading.end=Math.max(self.performance.now(),i.loading.first);const T=t.responseType==="arraybuffer"?b.byteLength:b.length;i.loaded=i.total=T,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const E=(a=this.callbacks)==null?void 0:a.onProgress;E&&E(i,e,b,t);const D={url:t.responseURL,data:b,code:d};(u=this.callbacks)==null||u.onSuccess(D,i,e,t);return}}const p=r.loadPolicy.errorRetry,y=i.retry,v={url:e.url,data:void 0,code:d};if(H0(p,y,!1,v))this.retry(p);else{var c;cs.error(`${d} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:d,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(H0(e,t,!0))this.retry(e);else{var i;cs.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=t1(e,i.retry),i.retry++,cs.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&e$.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const t$={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},i$=us(us({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:uR,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:mU,bufferController:n7,capLevelController:p1,errorController:xU,fpsController:r9,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:oL,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:t$},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},s$()),{},{subtitleStreamController:y9,subtitleTrackController:l9,timelineController:z9,audioStreamController:e7,audioTrackController:t7,emeController:Cc,cmcdController:t9,contentSteeringController:s9,interstitialsController:g9});function s$(){return{cueHandler:q9,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function n$(s,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=Jx(s),n=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(a=>{const u=`${a==="level"?"playlist":a}LoadPolicy`,c=e[u]===void 0,d=[];r.forEach(f=>{const p=`${a}Loading${f}`,y=e[p];if(y!==void 0&&c){d.push(p);const v=i[u].default;switch(e[u]={default:v},f){case"TimeOut":v.maxLoadTimeMs=y,v.maxTimeToFirstByteMs=y;break;case"MaxRetry":v.errorRetry.maxNumRetry=y,v.timeoutRetry.maxNumRetry=y;break;case"RetryDelay":v.errorRetry.retryDelayMs=y,v.timeoutRetry.retryDelayMs=y;break;case"MaxRetryTimeout":v.errorRetry.maxRetryDelayMs=y,v.timeoutRetry.maxRetryDelayMs=y;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${u}": ${Ss(e[u])}`)}),us(us({},i),e)}function Jx(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Jx):Object.keys(s).reduce((e,t)=>(e[t]=Jx(s[t]),e),{}):s}function r$(s,e){const t=s.loader;t!==Kw&&t!==uR?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):K9()&&(s.loader=Kw,s.progressive=!0,s.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const r0=2,a$=.1,o$=.05,l$=100;class u$ extends iL{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(l$),this.mediaSource=t.mediaSource;const i=this.media=t.media;Qn(i,"playing",this.onMediaPlaying),Qn(i,"waiting",this.onMediaWaiting),Qn(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(pr(i,"playing",this.onMediaPlaying),pr(i,"waiting",this.onMediaWaiting),pr(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const a=this.media;if(!a)return;const{seeking:u}=a,c=this.seeking&&!u,d=!this.seeking&&u,f=a.paused&&!u||a.ended||a.playbackRate===0;if(this.seeking=u,e!==t){t&&(this.ended=0),this.moved=!0,u||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||c){c&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!1}));return}if(!vi.getBuffered(a).length){this.nudgeRetry=0;return}const p=vi.bufferInfo(a,e,0),y=p.nextStart||0,v=this.fragmentTracker;if(u&&v&&this.hls){const z=Ww(this.hls.inFlightFragments,e),N=p.len>r0,Y=!y||z||y-e>r0&&!v.getPartialFragment(e);if(N||Y)return;this.moved=!1}const b=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&v){if(!(p.len>0)&&!y)return;const N=Math.max(y,p.start||0)-e,L=!!(b!=null&&b.live)?b.targetduration*2:r0,I=Hm(e,v);if(N>0&&(N<=L||I)){a.paused||this._trySkipBufferHole(I);return}}const T=r.detectStallWithCurrentTimeMs,E=self.performance.now(),D=this.waiting;let O=this.stalled;if(O===null)if(D>0&&E-D=T||D)&&this.hls){var j;if(((j=this.mediaSource)==null?void 0:j.readyState)==="ended"&&!(b!=null&&b.live)&&Math.abs(e-(b?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(p),!this.media||!this.hls)return}const F=vi.bufferInfo(a,e,r.maxBufferHole);this._tryFixBufferStall(F,R,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger($.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const r=vi.bufferedInfo(vi.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const a=vi.timeRangesToArray(n),u=vi.bufferedInfo(a,t,0).bufferedIndex;if(u>-1&&uu)&&f-d<1&&e-d<2){const p=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${f} buffered index: ${c}`);this.warn(p.message),this.media.currentTime+=1e-6;let y=Hm(e,this.fragmentTracker);y&&"fragment"in y?y=y.fragment:y||(y=void 0);const v=vi.bufferInfo(this.media,e,0);this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,frag:y,buffer:v.len,bufferInfo:v})}}}}}_tryFixBufferStall(e,t,i){var n,r;const{fragmentTracker:a,media:u}=this,c=(n=this.hls)==null?void 0:n.config;if(!u||!a||!c)return;const d=(r=this.hls)==null?void 0:r.latestLevelDetails,f=Hm(i,a);if((f||d!=null&&d.live&&i1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-ic.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const r=i.getFragAtPos(t,Ot.MAIN),a=i.getFragAtPos(n,Ot.MAIN);if(r&&a)return a.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:r}=this;if(!n&&r!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Ss(e)})`);this.warn(a.message),t.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,r=(t=this.hls)==null?void 0:t.config;if(!n||!i||!r)return 0;const a=n.currentTime,u=vi.bufferInfo(n,a,0),c=a0&&u.len<1&&n.readyState<3,y=c-a;if(y>0&&(f||p)){if(y>r.maxBufferHole){let b=!1;if(a===0){const T=i.getAppendedFrag(0,Ot.MAIN);T&&c"u"))return self.VTTCue||self.TextTrackCue}function jv(s,e,t,i,n){let r=new s(e,t,"");try{r.value=i,n&&(r.type=n)}catch{r=new s(e,t,Ss(n?us({type:n},i):i))}return r}const zm=(()=>{const s=eb();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class d${constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger($.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&mc(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tzm&&(p=zm),p-f<=0&&(p=f+c$);for(let v=0;vf.type===Or.audioId3&&c:n==="video"?d=f=>f.type===Or.emsg&&u:d=f=>f.type===Or.audioId3&&c||f.type===Or.emsg&&u,Qx(r,t,i,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:n,enableDateRangeMetadataCues:r,interstitialsController:a}=this.hls.config;if(!r)return;const u=eb();if(i&&n&&!a){const{fragmentStart:T,fragmentEnd:E}=e;let D=this.assetCue;D?(D.startTime=T,D.endTime=E):u&&(D=this.assetCue=jv(u,T,E,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),D&&(D.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(D),D.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:d}=e,f=Object.keys(d);let p=this.dateRangeCuesAppended;if(c&&t){var y;if((y=c.cues)!=null&&y.length){const T=Object.keys(p).filter(E=>!f.includes(E));for(let E=T.length;E--;){var v;const D=T[E],O=(v=p[D])==null?void 0:v.cues;delete p[D],O&&Object.keys(O).forEach(R=>{const j=O[R];if(j){j.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(j)}catch{}}})}}else p=this.dateRangeCuesAppended={}}const b=e.fragments[e.fragments.length-1];if(!(f.length===0||!Dt(b?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let T=0;T{if(G!==D.id){const q=d[G];if(q.class===D.class&&q.startDate>D.startDate&&(!X||D.startDate.01&&(G.startTime=O,G.endTime=z);else if(u){let q=D.attr[X];NU(X)&&(q=PD(q));const ie=jv(u,O,z,{key:X,data:q},Or.dateRange);ie&&(ie.id=E,this.id3Track.addCue(ie),j[X]=ie,a&&(X==="X-ASSET-LIST"||X==="X-ASSET-URL")&&ie.addEventListener("enter",this.onEventCueEnter))}}p[E]={cues:j,dateRange:D,durationKnown:F}}}}}class h${constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||a===1||!i.live)return;const u=this.targetLatency;if(u===null)return;const c=n-u,d=Math.min(this.maxLatency,u+i.targetduration);if(c.05&&this.forwardBufferLength>1){const p=Math.min(2,Math.max(1,a)),y=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,v=Math.min(p,Math.max(1,y));this.changeMediaPlaybackRate(t,v)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:u}=this.config,c=this.hls.userConfig;let d=u&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:a*n);const f=n;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,f)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,r=e-t-this.edgeStalled,a=n-i.totalduration,u=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),u)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===Oe.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class f$ extends m1{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this),e.on($.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this),e.off($.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],r={},a={};let u=!1,c=!1,d=!1;t.levels.forEach(f=>{const p=f.attrs;let{audioCodec:y,videoCodec:v}=f;y&&(f.audioCodec=y=F0(y,i)||void 0),v&&(v=f.videoCodec=Y6(v));const{width:b,height:T,unknownCodecs:E}=f,D=E?.length||0;if(u||(u=!!(b&&T)),c||(c=!!v),d||(d=!!y),D||y&&!this.isAudioSupported(y)||v&&!this.isVideoSupported(v)){this.log(`Some or all CODECS not supported "${p.CODECS}"`);return}const{CODECS:O,"FRAME-RATE":R,"HDCP-LEVEL":j,"PATHWAY-ID":F,RESOLUTION:z,"VIDEO-RANGE":N}=p,L=`${`${F||"."}-`}${f.bitrate}-${z}-${R}-${O}-${N}-${j}`;if(r[L])if(r[L].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const I=a[L]+=1;f.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const X=this.createLevel(f);r[L]=X,n.push(X)}else r[L].addGroupId("audio",p.AUDIO),r[L].addGroupId("text",p.SUBTITLES);else{const I=this.createLevel(f);r[L]=I,a[L]=1,n.push(I)}}),this.filterAndSortMediaOptions(n,t,u,c,d)}createLevel(e){const t=new Uh(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=WD(n,[])}return t}isAudioSupported(e){return Bh(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Bh(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,r){var a;let u=[],c=[],d=e;const f=((a=t.stats)==null?void 0:a.parsing)||{};if((i||n)&&r&&(d=d.filter(({videoCodec:O,videoRange:R,width:j,height:F})=>(!!O||!!(j&&F))&&rU(R))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let O="no level with compatible codecs found in manifest",R=O;t.levels.length&&(R=`one or more CODECS in variant not supported: ${Ss(t.levels.map(F=>F.attrs.CODECS).filter((F,z,N)=>N.indexOf(F)===z))}`,this.warn(R),O+=` (${R})`);const j=new Error(O);this.hls.trigger($.ERROR,{type:jt.MEDIA_ERROR,details:Oe.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:j,reason:R})}}),f.end=performance.now();return}t.audioTracks&&(u=t.audioTracks.filter(O=>!O.audioCodec||this.isAudioSupported(O.audioCodec)),Xw(u)),t.subtitles&&(c=t.subtitles,Xw(c));const p=d.slice(0);d.sort((O,R)=>{if(O.attrs["HDCP-LEVEL"]!==R.attrs["HDCP-LEVEL"])return(O.attrs["HDCP-LEVEL"]||"")>(R.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&O.height!==R.height)return O.height-R.height;if(O.frameRate!==R.frameRate)return O.frameRate-R.frameRate;if(O.videoRange!==R.videoRange)return U0.indexOf(O.videoRange)-U0.indexOf(R.videoRange);if(O.videoCodec!==R.videoCodec){const j=$E(O.videoCodec),F=$E(R.videoCodec);if(j!==F)return F-j}if(O.uri===R.uri&&O.codecSet!==R.codecSet){const j=B0(O.codecSet),F=B0(R.codecSet);if(j!==F)return F-j}return O.averageBitrate!==R.averageBitrate?O.averageBitrate-R.averageBitrate:0});let y=p[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==p.length)){for(let O=0;Oj&&j===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=F)}break}const b=r&&!n,T=this.hls.config,E=!!(T.audioStreamController&&T.audioTrackController),D={levels:d,audioTracks:u,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:E&&!b&&u.some(O=>!!O.url)};f.end=performance.now(),this.hls.trigger($.MANIFEST_PARSED,D)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const f=new Error("invalid level idx"),p=e<0;if(this.hls.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.LEVEL_SWITCH_ERROR,level:e,fatal:p,error:f,reason:f.message}),p)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,a=t[e],u=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&n&&r===u)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${u?" with Pathway "+u:""} from level ${i}${r?" with Pathway "+r:""}`);const c={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger($.LEVEL_SWITCHING,c);const d=a.details;if(!d||d.live){const f=this.switchParams(a.uri,n?.details,d);this.loadPlaylist(f)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ji.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ot.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:r}=t,a=t.levelInfo;if(!a){var u;this.warn(`Invalid level index ${n}`),(u=t.deliveryDirectives)!=null&&u.skip&&(r.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let c=a.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],a=e.details,u=a?.age;this.log(`Loading level index ${n}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${u&&a.live?" age "+u.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger($.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((r,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(u=>u.level=-1)),!1));pL(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger($.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger($.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Xw(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function cR(){return self.SourceBuffer||self.WebKitSourceBuffer}function dR(){if(!kl())return!1;const e=cR();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function m$(){if(!dR())return!1;const s=kl();return typeof s?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Fh(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Fh(e,"audio"))))}function p$(){var s;const e=cR();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const g$=100;class y$ extends a1{constructor(e,t,i){super(e,t,i,"stream-controller",Ot.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,r=n?n.currentTime:null;if(r===null||!Dt(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const a=this.getFwdBufferInfoAtPos(n,r,Ot.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(g$),this.level=-1,!this.startFragRequested){let r=n.startLevel;r===-1&&(n.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=n.firstAutoLevel),n.nextLoadLevel=r,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=tt.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=tt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case tt.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e?.[t],n=i?.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=tt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=tt.IDLE;break}break}case tt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===tt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const a=i[r],u=this.getMainFwdBufferInfo();if(u===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(u,c)){const T={};this.altAudio===2&&(T.type="video"),this.hls.trigger($.BUFFER_EOS,T),this.state=tt.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const d=a.details;if(!d||this.state===tt.WAITING_LEVEL||this.waitForLive(a)){this.level=r,this.state=tt.WAITING_LEVEL,this.startFragRequested=!1;return}const f=u.len,p=this.getMaxBufferLength(a.maxBitrate);if(f>=p)return;this.backtrackFragment&&this.backtrackFragment.start>u.end&&(this.backtrackFragment=null);const y=this.backtrackFragment?this.backtrackFragment.start:u.end;let v=this.getNextFragment(y,d);if(this.couldBacktrack&&!this.fragPrevious&&v&&sn(v)&&this.fragmentTracker.getState(v)!==vn.OK){var b;const E=((b=this.backtrackFragment)!=null?b:v).sn-d.startSN,D=d.fragments[E-1];D&&v.cc===D.cc&&(v=D,this.fragmentTracker.removeFragment(D))}else this.backtrackFragment&&u.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,y)){if(!v.gap){const E=this.audioOnly&&!this.altAudio?bs.AUDIO:bs.VIDEO,D=(E===bs.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;D&&this.afterBufferFlushed(D,E,Ot.MAIN)}v=this.getNextFragmentLoopLoading(v,d,u,Ot.MAIN,p)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,a,y))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===vn.NOT_LOADED||n===vn.PARTIAL?sn(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ot.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const u=this.getMainFwdBufferInfo();if(!u||u.len=a-t.maxFragLookUpTolerance&&r<=u;if(n!==null&&i.duration>n&&(r{this.hls&&this.hls.trigger($.AUDIO_TRACK_SWITCHED,t)}),i.trigger($.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger($.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=j0(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,r,a=!1;for(const u in i){const c=i[u];if(c.id==="main"){if(r=u,n=c,u==="video"){const d=i[u];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,r=i.type===Ot.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===tt.PARSED&&(this.state=tt.IDLE);return}const u=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),sn(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const a=this.media;a&&(!this._hasEnoughToStart&&vi.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=tt.ERROR;return}switch(t.details){case Oe.FRAG_GAP:case Oe.FRAG_PARSING_ERROR:case Oe.FRAG_DECRYPT_ERROR:case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ot.MAIN,t);break;case Oe.LEVEL_LOAD_ERROR:case Oe.LEVEL_LOAD_TIMEOUT:case Oe.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===tt.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ji.LEVEL&&(this.state=tt.IDLE);break;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Oe.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case Oe.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=tt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==bs.AUDIO||!this.altAudio){const i=(t===bs.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,Ot.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(c{const{hls:n}=this,r=i?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=tt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger($.FRAG_LOADED,i),r.bitrateTest=!1}).catch(i=>{this.state===tt.STOPPED||this.state===tt.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:n,chunkMeta:r}=e,a=this.getCurrentContext(r);if(!a){this.resetWhenMissingContext(r);return}const{frag:u,part:c,level:d}=a,{video:f,text:p,id3:y,initSegment:v}=n,{details:b}=d,T=this.altAudio?void 0:n.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=tt.PARSING,v){const E=v.tracks;if(E){const j=u.initSegment||u;if(this.unhandledEncryptionError(v,u))return;this._bufferInitSegment(d,E,j,r),i.trigger($.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:t,tracks:E})}const D=v.initPTS,O=v.timescale,R=this.initPTS[u.cc];if(Dt(D)&&(!R||R.baseTime!==D||R.timescale!==O)){const j=v.trackId;this.initPTS[u.cc]={baseTime:D,timescale:O,trackId:j},i.trigger($.INIT_PTS_FOUND,{frag:u,id:t,initPTS:D,timescale:O,trackId:j})}}if(f&&b){T&&f.type==="audiovideo"&&this.logMuxedErr(u);const E=b.fragments[u.sn-1-b.startSN],D=u.sn===b.startSN,O=!E||u.cc>E.cc;if(n.independent!==!1){const{startPTS:R,endPTS:j,startDTS:F,endDTS:z}=f;if(c)c.elementaryStreams[f.type]={startPTS:R,endPTS:j,startDTS:F,endDTS:z};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!O&&(this.couldBacktrack=!0),f.dropped&&f.independent){const N=this.getMainFwdBufferInfo(),Y=(N?N.end:this.getLoadPosition())+this.config.maxBufferHole,L=f.firstKeyFramePTS?f.firstKeyFramePTS:R;if(!D&&Yr0&&(u.gap=!0);u.setElementaryStreamInfo(f.type,R,j,F,z),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(f,u,c,r,D||O)}else if(D||O)u.gap=!0;else{this.backtrack(u);return}}if(T){const{startPTS:E,endPTS:D,startDTS:O,endDTS:R}=T;c&&(c.elementaryStreams[bs.AUDIO]={startPTS:E,endPTS:D,startDTS:O,endDTS:R}),u.setElementaryStreamInfo(bs.AUDIO,E,D,O,R),this.bufferFragmentData(T,u,c,r)}if(b&&y!=null&&y.samples.length){const E={id:t,frag:u,details:b,samples:y.samples};i.trigger($.FRAG_PARSING_METADATA,E)}if(b&&p){const E={id:t,frag:u,details:b,samples:p.samples};i.trigger($.FRAG_PARSING_USERDATA,E)}}logMuxedErr(e){this.warn(`${sn(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==tt.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:a,audiovideo:u}=t;if(r){const d=e.audioCodec;let f=Zm(r.codec,d);f==="mp4a"&&(f="mp4a.40.5");const p=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){f&&(f.indexOf("mp4a.40.5")!==-1?f="mp4a.40.2":f="mp4a.40.5");const y=r.metadata;y&&"channelCount"in y&&(y.channelCount||1)!==1&&p.indexOf("firefox")===-1&&(f="mp4a.40.5")}f&&f.indexOf("mp4a.40.5")!==-1&&p.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(f="mp4a.40.2",this.log(`Android: force audio codec to ${f}`)),d&&d!==f&&this.log(`Swapping manifest audio codec "${d}" for "${f}"`),r.levelCodec=f,r.id=Ot.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${f||""}/${d||""}/${r.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=Ot.MAIN;const d=a.codec;if(d?.length===4)switch(d){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}u&&(this.log(`Init audiovideo buffer, container:${u.container}, codecs[level/parsed]=[${e.codecs}/${u.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger($.BUFFER_CODECS,t),!this.hls)return;c.forEach(d=>{const p=t[d].initSegment;p!=null&&p.byteLength&&this.hls.trigger($.BUFFER_APPENDING,{type:d,data:p,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Ot.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e?.[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=tt.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(vi.isBuffered(e,i)?t=this.getAppendedFrag(i):vi.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,r=t.level;(!n||t.sn!==n.sn||n.level!==r)&&(this.fragPlaying=t,this.hls.trigger($.FRAG_CHANGED,{frag:t}),(!n||n.level!==r)&&this.hls.trigger($.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Dt(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Dt(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?_u(null,i.fragments,t):null);if(n){const r=n.programDateTime;if(r!==null){const a=r+(t-n.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class v$ extends Jr{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=Oe.KEY_LOAD_ERROR,i,n,r){return new vo({type:jt.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,r=t.length;n{if(!this.emeController)return;a.setKeyFormat(u);const c=e0(u);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=mh(this.config);if(n.length)return this.emeController.getKeySystemAccess(n)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,d))}const a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const u=$v(r);let c=this.keyIdToKeyInfo[u];if((i=c)!=null&&i.decryptdata.key)return r.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(n=c)!=null&&n.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:p}=f;return r.key=p.decryptdata.key,{frag:e,keyInfo:p}})}switch(this.log(`${this.keyIdToKeyInfo[u]?"Rel":"L"}oading${r.keyId?" keyId: "+On(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[u]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&(n=t.initSegment)!=null&&n.data){const a=B6(t.initSegment.data);if(a.length){let u=a[0];u.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${On(u)}`),El.setKeyIdForUri(e.decryptdata.uri,u)):(u=El.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${On(u)}`)),e.decryptdata.keyId=u}}if(!e.decryptdata.keyId&&!sn(t))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(a=>(e.mediaKeySessionContext=a,i))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,r=new n(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,u)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=i.keyLoadPolicy.default,f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:(y,v,b,T)=>{const{frag:E,keyInfo:D}=b,O=$v(D.decryptdata);if(!E.decryptdata||D!==this.keyIdToKeyInfo[O])return u(this.createKeyLoadError(E,Oe.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),T));D.decryptdata.key=E.decryptdata.key=new Uint8Array(y.data),E.keyLoader=null,D.loader=null,a({frag:E,keyInfo:D})},onError:(y,v,b,T)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.KEY_LOAD_ERROR,new Error(`HTTP Error ${y.code} loading key ${y.text}`),b,us({url:c.url,data:void 0},y)))},onTimeout:(y,v,b)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),b))},onAbort:(y,v,b)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.INTERNAL_ABORTED,new Error("key loading aborted"),b))}};r.load(c,f,p)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const a=$v(i.decryptdata)||n;delete this.keyIdToKeyInfo[a],r&&r.destroy()}}function $v(s){if(s.keyFormat!==Mn.FAIRPLAY){const e=s.keyId;if(e)return On(e)}return s.uri}function Qw(s){const{type:e}=s;switch(e){case ji.AUDIO_TRACK:return Ot.AUDIO;case ji.SUBTITLE_TRACK:return Ot.SUBTITLE;default:return Ot.MAIN}}function Hv(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class x${constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on($.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off($.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,r=i||n,a=new r(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ji.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:r,url:a,deliveryDirectives:u,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:r,responseType:"text",type:ji.LEVEL,url:a,deliveryDirectives:u,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ji.AUDIO_TRACK,url:r,deliveryDirectives:a,levelOrTrack:u})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ji.SUBTITLE_TRACK,url:r,deliveryDirectives:a,levelOrTrack:u})}onLevelsUpdated(e,t){const i=this.loaders[ji.LEVEL];if(i){const n=i.context;n&&!t.levels.some(r=>r===n.levelOrTrack)&&(i.abort(),delete this.loaders[ji.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const d=this.hls.logger,f=n.context;if(f&&f.levelOrTrack===e.levelOrTrack&&(f.url===e.url||f.deliveryDirectives&&!e.deliveryDirectives)){f.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${f.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(e.type===ji.MANIFEST?r=i.manifestLoadPolicy.default:r=gs({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),Dt((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===ji.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===ji.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===ji.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const f=d.partTarget,p=d.targetduration;if(f&&p){const y=Math.max(f*3,p*.8)*1e3;r=gs({},r,{maxTimeToFirstByteMs:Math.min(y,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(y,r.maxTimeToFirstByteMs)})}}}const a=r.errorRetry||r.timeoutRetry||{},u={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},c={onSuccess:(d,f,p,y)=>{const v=this.getInternalLoader(p);this.resetInternalLoader(p.type);const b=d.data;f.parsing.start=performance.now(),Fa.isMediaPlaylist(b)||p.type!==ji.MANIFEST?this.handleTrackOrLevelPlaylist(d,f,p,y||null,v):this.handleMasterPlaylist(d,f,p,y)},onError:(d,f,p,y)=>{this.handleNetworkError(f,p,!1,d,y)},onTimeout:(d,f,p)=>{this.handleNetworkError(f,p,!0,void 0,d)}};n.load(e,u,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const r=this.hls,a=e.data,u=Hv(e,i),c=Fa.parseMasterPlaylist(a,u);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:d,levels:f,sessionData:p,sessionKeys:y,startTimeOffset:v,variableList:b}=c;this.variableList=b,f.forEach(O=>{const{unknownCodecs:R}=O;if(R){const{preferManagedMediaSource:j}=this.hls.config;let{audioCodec:F,videoCodec:z}=O;for(let N=R.length;N--;){const Y=R[N];Bh(Y,"audio",j)?(O.audioCodec=F=F?`${F},${Y}`:Y,Hc.audio[F.substring(0,4)]=2,R.splice(N,1)):Bh(Y,"video",j)&&(O.videoCodec=z=z?`${z},${Y}`:Y,Hc.video[z.substring(0,4)]=2,R.splice(N,1))}}});const{AUDIO:T=[],SUBTITLES:E,"CLOSED-CAPTIONS":D}=Fa.parseMasterPlaylistMedia(a,u,c);T.length&&!T.some(R=>!R.url)&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Bs({}),bitrate:0,url:""})),r.trigger($.MANIFEST_LOADED,{levels:f,audioTracks:T,subtitles:E,captions:D,contentSteering:d,url:u,stats:t,networkDetails:n,sessionData:p,sessionKeys:y,startTimeOffset:v,variableList:b})}handleTrackOrLevelPlaylist(e,t,i,n,r){const a=this.hls,{id:u,level:c,type:d}=i,f=Hv(e,i),p=Dt(c)?c:Dt(u)?u:0,y=Qw(i),v=Fa.parseLevelPlaylist(e.data,f,p,y,0,this.variableList);if(d===ji.MANIFEST){const b={attrs:new Bs({}),bitrate:0,details:v,name:"",url:f};v.requestScheduled=t.loading.start+hL(v,0),a.trigger($.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:f,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=v,this.handlePlaylistLoaded(v,e,t,i,n,r)}handleManifestParsingError(e,t,i,n,r){this.hls.trigger($.ERROR,{type:jt.NETWORK_ERROR,details:Oe.MANIFEST_PARSING_ERROR,fatal:t.type===ji.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,i=!1,n,r){let a=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ji.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===ji.AUDIO_TRACK||e.type===ji.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const u=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let c=Oe.UNKNOWN,d=!1;const f=this.getInternalLoader(e);switch(e.type){case ji.MANIFEST:c=i?Oe.MANIFEST_LOAD_TIMEOUT:Oe.MANIFEST_LOAD_ERROR,d=!0;break;case ji.LEVEL:c=i?Oe.LEVEL_LOAD_TIMEOUT:Oe.LEVEL_LOAD_ERROR,d=!1;break;case ji.AUDIO_TRACK:c=i?Oe.AUDIO_TRACK_LOAD_TIMEOUT:Oe.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case ji.SUBTITLE_TRACK:c=i?Oe.SUBTITLE_TRACK_LOAD_TIMEOUT:Oe.SUBTITLE_LOAD_ERROR,d=!1;break}f&&this.resetInternalLoader(e.type);const p={type:jt.NETWORK_ERROR,details:c,fatal:d,url:e.url,loader:f,context:e,error:u,networkDetails:t,stats:r};if(n){const y=t?.url||e.url;p.response=us({url:y,data:void 0},n)}this.hls.trigger($.ERROR,p)}handlePlaylistLoaded(e,t,i,n,r,a){const u=this.hls,{type:c,level:d,levelOrTrack:f,id:p,groupId:y,deliveryDirectives:v}=n,b=Hv(t,n),T=Qw(n);let E=typeof n.level=="number"&&T===Ot.MAIN?d:void 0;const D=e.playlistParsingError;if(D){if(this.hls.logger.warn(`${D} ${e.url}`),!u.config.ignorePlaylistParsingErrors){u.trigger($.ERROR,{type:jt.NETWORK_ERROR,details:Oe.LEVEL_PARSING_ERROR,fatal:!1,url:b,error:D,reason:D.message,response:t,context:n,level:E,parent:T,networkDetails:r,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const O=e.playlistParsingError=new Error("No Segments found in Playlist");u.trigger($.ERROR,{type:jt.NETWORK_ERROR,details:Oe.LEVEL_EMPTY_ERROR,fatal:!1,url:b,error:O,reason:O.message,response:t,context:n,level:E,parent:T,networkDetails:r,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ji.MANIFEST:case ji.LEVEL:if(E){if(!f)E=0;else if(f!==u.levels[E]){const O=u.levels.indexOf(f);O>-1&&(E=O)}}u.trigger($.LEVEL_LOADED,{details:e,levelInfo:f||u.levels[0],level:E||0,id:p||0,stats:i,networkDetails:r,deliveryDirectives:v,withoutMultiVariant:c===ji.MANIFEST});break;case ji.AUDIO_TRACK:u.trigger($.AUDIO_TRACK_LOADED,{details:e,track:f,id:p||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:v});break;case ji.SUBTITLE_TRACK:u.trigger($.SUBTITLE_TRACK_LOADED,{details:e,track:f,id:p||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:v});break}}}class Mr{static get version(){return jh}static isMSESupported(){return dR()}static isSupported(){return m$()}static getMediaSource(){return kl()}static get Events(){return $}static get MetadataSchema(){return Or}static get ErrorTypes(){return jt}static get ErrorDetails(){return Oe}static get DefaultConfig(){return Mr.defaultConfig?Mr.defaultConfig:i$}static set DefaultConfig(e){Mr.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new o1,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=w6(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=n$(Mr.DefaultConfig,e,t);this.userConfig=e,i.progressive&&r$(i,t);const{abrController:n,bufferController:r,capLevelController:a,errorController:u,fpsController:c}=i,d=new u(this),f=this.abrController=new n(this),p=new bU(this),y=i.interstitialsController,v=y?this.interstitialsController=new y(this,Mr):null,b=this.bufferController=new r(this,p),T=this.capLevelController=new a(this),E=new c(this),D=new x$(this),O=i.contentSteeringController,R=O?new O(this):null,j=this.levelController=new f$(this,R),F=new d$(this),z=new v$(this.config,this.logger),N=this.streamController=new y$(this,p,z),Y=this.gapController=new u$(this,p);T.setStreamController(N),E.setStreamController(N);const L=[D,j,N];v&&L.splice(1,0,v),R&&L.splice(1,0,R),this.networkControllers=L;const I=[f,b,Y,T,E,F,p];this.audioTrackController=this.createController(i.audioTrackController,L);const X=i.audioStreamController;X&&L.push(this.audioStreamController=new X(this,p,z)),this.subtitleTrackController=this.createController(i.subtitleTrackController,L);const G=i.subtitleStreamController;G&&L.push(this.subtititleStreamController=new G(this,p,z)),this.createController(i.timelineController,I),z.emeController=this.emeController=this.createController(i.emeController,I),this.cmcdController=this.createController(i.cmcdController,I),this.latencyController=this.createController(h$,I),this.coreComponents=I,L.push(d);const q=d.onErrorOut;typeof q=="function"&&this.on($.ERROR,q,d),this.on($.MANIFEST_LOADED,D.onManifestLoaded,D)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===$.ERROR;this.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger($.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger($.ERROR,{type:jt.OTHER_ERROR,details:Oe.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger($.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger($.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger($.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=Xb.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger($.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", ":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Ot.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Ot.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Ot.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=u9()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){nU(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let r=n;r--;){const a=e[r].attrs["HDCP-LEVEL"];if(a&&a<=i)return r}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=QD(t);return YD(e,i,navigator.mediaCapabilities)}}Mr.defaultConfig=void 0;function Zw(s,e){const t=s.includes("?")?"&":"?";return`${s}${t}v=${e}`}function hR({src:s,muted:e=m0,className:t}){const i=_.useRef(null),[n,r]=_.useState(!1),[a,u]=_.useState(null),[c,d]=_.useState(1),f=_.useMemo(()=>Zw(s,c),[s,c]);return _.useEffect(()=>{let p=!1,y=null,v=null,b=null;const T=i.current;if(!T)return;const E=T;r(!1),u(null),p0(E,{muted:e});const D=()=>{v&&window.clearTimeout(v),b&&window.clearInterval(b),v=null,b=null},O=()=>{p||(D(),d(z=>z+1))};async function R(){const z=Date.now();for(;!p&&Date.now()-z<9e4;){try{const N=Zw(s,Date.now()),Y=await fetch(N,{cache:"no-store"});if(Y.status===403)return{ok:!1,reason:"private"};if(Y.status===404)return{ok:!1,reason:"offline"};if(Y.ok&&(await Y.text()).includes("#EXTINF"))return{ok:!0}}catch{}await new Promise(N=>setTimeout(N,500))}return{ok:!1}}async function j(){const z=await R();if(!p){if(!z.ok){if(z.reason==="private"||z.reason==="offline"){u(z.reason),r(!0);return}window.setTimeout(()=>{p||O()},800);return}if(E.canPlayType("application/vnd.apple.mpegurl")){E.pause(),E.removeAttribute("src"),E.load(),E.src=f,E.load(),E.play().catch(()=>{});let N=Date.now(),Y=-1;const L=()=>{E.currentTime>Y+.01&&(Y=E.currentTime,N=Date.now())},I=()=>{v||(v=window.setTimeout(()=>{v=null,!p&&Date.now()-N>3500&&O()},800))};return E.addEventListener("timeupdate",L),E.addEventListener("waiting",I),E.addEventListener("stalled",I),E.addEventListener("error",I),b=window.setInterval(()=>{p||!E.paused&&Date.now()-N>6e3&&O()},2e3),()=>{E.removeEventListener("timeupdate",L),E.removeEventListener("waiting",I),E.removeEventListener("stalled",I),E.removeEventListener("error",I)}}if(!Mr.isSupported()){r(!0);return}y=new Mr({lowLatencyMode:!0,liveSyncDurationCount:2,maxBufferLength:8}),y.on(Mr.Events.ERROR,(N,Y)=>{if(y&&Y.fatal){if(Y.type===Mr.ErrorTypes.NETWORK_ERROR){y.startLoad();return}if(Y.type===Mr.ErrorTypes.MEDIA_ERROR){y.recoverMediaError();return}O()}}),y.loadSource(f),y.attachMedia(E),y.on(Mr.Events.MANIFEST_PARSED,()=>{E.play().catch(()=>{})})}}let F;return(async()=>{const z=await j();typeof z=="function"&&(F=z)})(),()=>{p=!0,D();try{F?.()}catch{}try{y?.destroy()}catch{}}},[s,e,f]),n?g.jsx("div",{className:"text-xs text-gray-400 italic",children:a==="private"?"Private":a==="offline"?"Offline":"–"}):g.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const p=i.current;p&&(p.muted=!1,p.play().catch(()=>{}))}})}const qr=s=>(s||"").replaceAll("\\","/").split("/").pop()||"",b1=s=>s.startsWith("HOT ")?s.slice(4):s,b$=s=>(s||"").trim().toLowerCase(),T$=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n.sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})),n};function S$(s){if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`}function _$(s){if(typeof s!="number"||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function Jw(s){if(!s)return"—";const e=s instanceof Date?s:new Date(s),t=e.getTime();return Number.isFinite(t)?e.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}const Vm=(...s)=>{for(const e of s){const t=typeof e=="string"?Number(e):e;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}return null};function E$(s){if(!s||!Number.isFinite(s))return"—";const e=s>=10?0:2;return`${s.toFixed(e)} fps`}function w$(s){return!s||!Number.isFinite(s)?"—":`${Math.round(s)}p`}function A$(s){const e=qr(s||""),t=b1(e);if(!t)return null;const n=t.replace(/\.[^.]+$/,"").match(/_(\d{1,2})_(\d{1,2})_(\d{4})__(\d{1,2})-(\d{2})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),a=Number(n[2]),u=Number(n[3]),c=Number(n[4]),d=Number(n[5]),f=Number(n[6]);return[r,a,u,c,d,f].every(p=>Number.isFinite(p))?new Date(u,r-1,a,c,d,f):null}const k$=s=>{const e=qr(s||""),t=b1(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i},C$=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function po(...s){return s.filter(Boolean).join(" ")}function D$(s){const[e,t]=_.useState(!1);return _.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(s),n=()=>t(i.matches);return n(),i.addEventListener?i.addEventListener("change",n):i.addListener(n),()=>{i.removeEventListener?i.removeEventListener("change",n):i.removeListener(n)}},[s]),e}function L$(s){!s||s.__absTimelineShimInstalled||(s.__absTimelineShimInstalled=!0,s.__origCurrentTime=s.currentTime.bind(s),s.__origDuration=s.duration.bind(s),s.__setRelativeTime=e=>{try{s.__origCurrentTime(Math.max(0,e||0))}catch{}},s.currentTime=function(e){const t=Number(this.__timeOffsetSec??0)||0;if(typeof e=="number"&&Number.isFinite(e)){const n=Math.max(0,e);return typeof this.__serverSeekAbs=="function"?(this.__serverSeekAbs(n),n):this.__origCurrentTime(Math.max(0,n-t))}const i=Number(this.__origCurrentTime()??0)||0;return Math.max(0,t+i)},s.duration=function(){const e=Number(this.__fullDurationSec??0)||0;if(e>0)return e;const t=Number(this.__timeOffsetSec??0)||0,i=Number(this.__origDuration()??0)||0;return Math.max(0,t+i)})}function R$({job:s,expanded:e,onClose:t,onToggleExpand:i,modelKey:n,modelsByKey:r,isHot:a=!1,isFavorite:u=!1,isLiked:c=!1,isWatching:d=!1,onKeep:f,onDelete:p,onToggleHot:y,onToggleFavorite:v,onToggleLike:b,onToggleWatch:T,onStopJob:E,startMuted:D=MM}){const O=_.useMemo(()=>qr(s.output?.trim()||"")||s.id,[s.output,s.id]),R=_.useMemo(()=>qr(s.output?.trim()||""),[s.output]),j=_.useMemo(()=>qr(s.output?.trim()||""),[s.output]),F=_.useMemo(()=>_$(C$(s)),[s]),z=s,[N,Y]=_.useState(()=>Number(s?.meta?.durationSeconds)||Number(s?.durationSeconds)||0),[L,I]=_.useState(()=>s.status==="running"),[X,G]=_.useState(()=>({h:0,fps:null})),q=s.status==="running",[ae,ie]=_.useState(!1),W=q&&ae,K=_.useMemo(()=>(j||"").replace(/\.[^.]+$/,""),[j]),Q=_.useMemo(()=>q?s.id:K||s.id,[q,s.id,K]);_.useEffect(()=>{if(q||N>0)return;const le=qr(s.output?.trim()||"");if(!le)return;let we=!0;const ut=new AbortController;return(async()=>{try{const At=ru(`/api/record/done/meta?file=${encodeURIComponent(le)}`),Ct=await vv(At,{signal:ut.signal,cache:"no-store"});if(!Ct.ok)return;const ce=await Ct.json(),ye=Number(ce?.durationSeconds||ce?.meta?.durationSeconds||0)||0;if(!we||ye<=0)return;Y(ye);const ve=Ke.current;if(ve&&!ve.isDisposed?.())try{ve.__fullDurationSec=ye,ve.trigger?.("durationchange"),ve.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{we=!1,ut.abort()}},[q,N,s.output]);const te=R.startsWith("HOT "),re=_.useMemo(()=>{const le=(n||"").trim();return le||k$(s.output)},[n,s.output]),U=_.useMemo(()=>b1(R),[R]),ne=_.useMemo(()=>{const le=Number(N||0)||0;return le>0?S$(le*1e3):"—"},[N]),Z=_.useMemo(()=>{const le=A$(s.output);if(le)return Jw(le);const we=z.startedAt??z.endedAt??z.createdAt??z.fileCreatedAt??z.ctime??null,ut=we?new Date(we):null;return Jw(ut&&Number.isFinite(ut.getTime())?ut:null)},[s.output,z.startedAt,z.endedAt,z.createdAt,z.fileCreatedAt,z.ctime]),fe=_.useMemo(()=>b$((n||re||"").trim()),[n,re]),xe=_.useMemo(()=>{const le=r?.[fe];return T$(le?.tags)},[r,fe]),ge=_.useMemo(()=>ru(`/api/preview?id=${encodeURIComponent(Q)}&file=thumbs.webp`),[Q]),Ce=_.useMemo(()=>ru(`/api/preview?id=${encodeURIComponent(Q)}&play=1&file=index_hq.m3u8`),[Q]),[Me,Re]=_.useState(ge);_.useEffect(()=>{Re(ge)},[ge]);const Ae=_.useMemo(()=>Vm(X.h,z.videoHeight,z.height,z.meta?.height),[X.h,z.videoHeight,z.height,z.meta?.height]),be=_.useMemo(()=>Vm(X.fps,z.fps,z.frameRate,z.meta?.fps,z.meta?.frameRate),[X.fps,z.fps,z.frameRate,z.meta?.fps,z.meta?.frameRate]),[Pe,gt]=_.useState(null),Ye=_.useMemo(()=>w$(Pe??Ae),[Pe,Ae]),lt=_.useMemo(()=>E$(be),[be]);_.useEffect(()=>{const le=we=>we.key==="Escape"&&t();return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[t]);const Ve=_.useMemo(()=>{const le=`/api/preview?id=${encodeURIComponent(Q)}&file=index_hq.m3u8&play=1`;return ru(q?`${le}&t=${Date.now()}`:le)},[Q,q]);_.useEffect(()=>{if(!q){ie(!1);return}let le=!0;const we=new AbortController;return ie(!1),(async()=>{for(let At=0;At<120&&le&&!we.signal.aborted;At++){try{const Ct=await vv(Ve,{method:"GET",cache:"no-store",signal:we.signal,headers:{"cache-control":"no-cache"}});if(Ct.ok){const ce=await Ct.text(),ye=ce.includes("#EXTM3U"),ve=/#EXTINF:/i.test(ce)||/\.ts(\?|$)/i.test(ce)||/\.m4s(\?|$)/i.test(ce);if(ye&&ve){le&&ie(!0);return}}}catch{}await new Promise(Ct=>setTimeout(Ct,500))}})(),()=>{le=!1,we.abort()}},[q,Ve]);const ht=_.useCallback(le=>{const we=new URLSearchParams;return le.file&&we.set("file",le.file),le.id&&we.set("id",le.id),ru(`/api/record/video?${we.toString()}`)},[]),st=_.useMemo(()=>{if(q)return{src:"",type:""};if(!L)return{src:"",type:""};const le=qr(s.output?.trim()||"");if(le){const we=le.toLowerCase().split(".").pop(),ut=we==="mp4"?"video/mp4":we==="ts"?"video/mp2t":"application/octet-stream";return{src:ht({file:le}),type:ut}}return{src:ht({id:s.id}),type:"video/mp4"}},[q,L,s.output,s.id,ht]),ct=_.useRef(null),Ke=_.useRef(null),_t=_.useRef(null),[pe,We]=_.useState(!1),Je=_.useCallback(()=>{const le=Ke.current;if(!le||le.isDisposed?.())return;const we=typeof le.videoHeight=="function"?le.videoHeight():0;typeof we=="number"&&we>0&&Number.isFinite(we)&>(we)},[]),ot=_.useCallback(()=>{try{const le=Ke.current?.tech?.(!0)?.el?.()||Ke.current?.el?.()?.querySelector?.("video.vjs-tech")||_t.current;if(!le||!(le instanceof HTMLVideoElement))return null;const we=Number(le.videoWidth||0),ut=Number(le.videoHeight||0);if(!Number.isFinite(we)||!Number.isFinite(ut)||we<=0||ut<=0)return null;let At=ei.current;At||(At=document.createElement("canvas"),ei.current=At);const ce=Math.min(1,640/we),ye=Math.max(1,Math.round(we*ce)),ve=Math.max(1,Math.round(ut*ce));At.width!==ye&&(At.width=ye),At.height!==ve&&(At.height=ve);const Ge=At.getContext("2d",{alpha:!1});return Ge?(Ge.drawImage(le,0,0,ye,ve),At.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),St=_.useMemo(()=>qr(s.output?.trim()||"")||s.id,[s.output,s.id]);_.useEffect(()=>{if(q){I(!0);return}const le=qr(s.output?.trim()||"");if(!le){I(!0);return}let we=!0;const ut=new AbortController;return I(!1),(async()=>{for(let At=0;At<80&&we&&!ut.signal.aborted;At++){try{const Ct=ru(`/api/record/done/meta?file=${encodeURIComponent(le)}`),ce=await vv(Ct,{signal:ut.signal,cache:"no-store"});if(ce.ok){const ye=await ce.json(),ve=!!ye?.metaExists,Ge=Number(ye?.durationSeconds||0)||0,De=Number(ye?.height||0)||0,rt=Number(ye?.fps||0)||0;if(Ge>0){Y(Ge);const dt=Ke.current;if(dt&&!dt.isDisposed?.())try{dt.__fullDurationSec=Ge,dt.trigger?.("durationchange"),dt.trigger?.("timeupdate")}catch{}}if(De>0&&G({h:De,fps:rt>0?rt:null}),ve){I(!0);return}}}catch{}await new Promise(Ct=>setTimeout(Ct,250))}we&&I(!0)})(),()=>{we=!1,ut.abort()}},[q,St,s.output]);const[,vt]=_.useState(0);_.useEffect(()=>{if(typeof window>"u")return;const le=window.visualViewport;if(!le)return;const we=()=>vt(ut=>ut+1);return we(),le.addEventListener("resize",we),le.addEventListener("scroll",we),window.addEventListener("resize",we),window.addEventListener("orientationchange",we),()=>{le.removeEventListener("resize",we),le.removeEventListener("scroll",we),window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we)}},[]);const[Vt,si]=_.useState(30),[$t,Pt]=_.useState(null),Ht=!e,ui=D$("(min-width: 640px)"),xt=Ht&&ui,ni="player_window_v1",Xt=420,Zi=280,Gt=12,Yi=320,Ri=200;_.useEffect(()=>{if(!pe)return;const le=Ke.current;if(!le||le.isDisposed?.())return;const we=le.el();if(!we)return;const ut=we.querySelector(".vjs-control-bar");if(!ut)return;const At=()=>{const ce=Math.round(ut.getBoundingClientRect().height||0);ce>0&&si(ce)};At();let Ct=null;return typeof ResizeObserver<"u"&&(Ct=new ResizeObserver(At),Ct.observe(ut)),window.addEventListener("resize",At),()=>{window.removeEventListener("resize",At),Ct?.disconnect()}},[pe,e]),_.useEffect(()=>We(!0),[]),_.useEffect(()=>{let le=document.getElementById("player-root");le||(le=document.createElement("div"),le.id="player-root");let we=null;if(ui){const ut=Array.from(document.querySelectorAll("dialog[open]"));we=ut.length?ut[ut.length-1]:null}we=we??document.body,we.appendChild(le),le.style.position="relative",le.style.zIndex="2147483647",Pt(le)},[ui]),_.useEffect(()=>{const le=Ke.current;if(!le||le.isDisposed?.()||q||(L$(le),!qr(s.output?.trim()||"")))return;const ut=Number(N||0)||0;return ut>0&&(le.__fullDurationSec=ut),le.__serverSeekAbs=At=>{const Ct=Math.max(0,Number(At)||0);try{le.__origCurrentTime?.(Ct);try{le.trigger?.("timeupdate")}catch{}}catch{try{le.currentTime?.(Ct)}catch{}}},()=>{try{delete le.__serverSeekAbs}catch{}}},[s.output,q]),_.useLayoutEffect(()=>{if(!pe||!ct.current||Ke.current||q||!L)return;const le=document.createElement("video");le.className="video-js vjs-big-play-centered w-full h-full",le.setAttribute("playsinline","true"),ct.current.appendChild(le),_t.current=le;const we=Be(le,{autoplay:!0,muted:D,controls:!0,preload:"metadata",playsinline:!0,responsive:!0,fluid:!1,fill:!0,liveui:!1,html5:{vhs:{lowLatencyMode:!0}},inactivityTimeout:0,controlBar:{skipButtons:{backward:10,forward:10},volumePanel:{inline:!1},children:["skipBackward","playToggle","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","spacer","playbackRateMenuButton","fullscreenToggle"]},playbackRates:[.5,1,1.25,1.5,2]});return Ke.current=we,we.one("loadedmetadata",()=>{Je()}),we.userActive(!0),we.on("userinactive",()=>we.userActive(!0)),()=>{try{Ke.current&&(Ke.current.dispose(),Ke.current=null)}finally{_t.current&&(_t.current.remove(),_t.current=null)}}},[pe,D,q,L,Ae,Je]),_.useEffect(()=>{const le=Ke.current;if(!le||le.isDisposed?.())return;const we=le.el();we&&we.classList.toggle("is-live-download",!!W)},[W]);const Si=_.useCallback(()=>{const le=Ke.current;if(!(!le||le.isDisposed?.())){try{le.pause(),le.reset?.()}catch{}try{le.src({src:"",type:"video/mp4"}),le.load?.()}catch{}}},[]);_.useEffect(()=>{if(!pe)return;if(!q&&!L){Si();return}const le=Ke.current;if(!le||le.isDisposed?.())return;const we=le.currentTime()||0;if(le.muted(D),!st.src){try{le.pause(),le.reset?.(),le.error(null)}catch{}return}le.__timeOffsetSec=0;const ut=Number(N||0)||0;le.__fullDurationSec=ut;const At=String(le.currentSrc?.()||"");if(At&&At===st.src){const ce=le.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{});return}le.src({src:st.src,type:st.type});const Ct=()=>{const ce=le.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{})};le.one("loadedmetadata",()=>{if(le.isDisposed?.())return;Je();try{const ye=Number(N||0)||0;ye>0&&(le.__fullDurationSec=ye)}catch{}try{le.playbackRate(1)}catch{}const ce=/mpegurl/i.test(st.type);if(we>0&&!ce)try{const ye=Number(le.__timeOffsetSec??0)||0,ve=Math.max(0,we-ye);le.__setRelativeTime?.(ve)}catch{}try{le.trigger?.("timeupdate")}catch{}Ct()}),Ct()},[pe,q,L,st.src,st.type,D,Je,N,Si]),_.useEffect(()=>{if(!pe)return;const le=Ke.current;if(!le||le.isDisposed?.())return;const we=()=>{s.status==="running"&&ie(!1)};return le.on("error",we),()=>{try{le.off("error",we)}catch{}}},[pe,s.status]),_.useEffect(()=>{const le=Ke.current;!le||le.isDisposed?.()||queueMicrotask(()=>le.trigger("resize"))},[e]),_.useEffect(()=>{const le=we=>{const At=(we.detail?.file??"").trim();if(!At)return;const Ct=qr(s.output?.trim()||"");Ct&&Ct===At&&Si()};return window.addEventListener("player:release",le),()=>window.removeEventListener("player:release",le)},[s.output,Si]),_.useEffect(()=>{const le=we=>{const At=(we.detail?.file??"").trim();if(!At)return;const Ct=qr(s.output?.trim()||"");Ct&&Ct===At&&(Si(),t())};return window.addEventListener("player:close",le),()=>window.removeEventListener("player:close",le)},[s.output,Si,t]);const kt=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const le=window.visualViewport;if(le&&Number.isFinite(le.width)&&Number.isFinite(le.height)){const Ct=Math.floor(le.width),ce=Math.floor(le.height),ye=Math.floor(le.offsetLeft||0),ve=Math.floor(le.offsetTop||0),Ge=Math.max(0,Math.floor(window.innerHeight-(le.height+le.offsetTop)));return{w:Ct,h:ce,ox:ye,oy:ve,bottomInset:Ge}}const we=document.documentElement,ut=we?.clientWidth||window.innerWidth,At=we?.clientHeight||window.innerHeight;return{w:ut,h:At,ox:0,oy:0,bottomInset:0}},V=_.useRef(null);_.useEffect(()=>{if(typeof window>"u")return;const{w:le,h:we}=kt();V.current={w:le,h:we}},[]);const H=_.useCallback(()=>{const le=s,we=Vm(Ke.current?.videoWidth?.(),le.videoWidth,le.width,le.meta?.width)??0,ut=Vm(Pe,Ke.current?.videoHeight?.(),le.videoHeight,le.height,le.meta?.height)??0;return we>0&&ut>0?we/ut:16/9},[s,Pe]),ee=_.useCallback(le=>{if(typeof window>"u")return le;const we=H(),ut=30,{w:At,h:Ct}=kt(),ce=At-Gt*2,ye=Math.max(1,Ct-Gt*2-ut),ve=Math.max(1,Ri-ut);let Ge=Math.max(Yi,Math.min(le.w,ce)),De=Ge/we;Deye&&(De=ye,Ge=De*we),Ge>ce&&(Ge=ce,De=Ge/we);const rt=Math.round(De+ut),dt=Math.max(Gt,Math.min(le.x,At-Ge-Gt)),at=Math.max(Gt,Math.min(le.y,Ct-rt-Gt));return{x:dt,y:at,w:Math.round(Ge),h:rt}},[H]),Te=_.useCallback(()=>{if(typeof window>"u")return{x:Gt,y:Gt,w:Xt,h:Zi};try{const ye=window.localStorage.getItem(ni);if(ye){const ve=JSON.parse(ye);if(typeof ve.x=="number"&&typeof ve.y=="number"&&typeof ve.w=="number"&&typeof ve.h=="number")return ee({x:ve.x,y:ve.y,w:ve.w,h:ve.h})}}catch{}const{w:le,h:we}=kt(),ut=Xt,At=Zi,Ct=Math.max(Gt,le-ut-Gt),ce=Math.max(Gt,we-At-Gt);return ee({x:Ct,y:ce,w:ut,h:At})},[ee]),[Ue,ft]=_.useState(()=>Te()),Et=xt&&Ue.w<380,pi=_.useCallback(le=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ni,JSON.stringify(le))}catch{}},[]),gi=_.useRef(Ue);_.useEffect(()=>{gi.current=Ue},[Ue]),_.useEffect(()=>{xt&&ft(Te())},[xt,Te]),_.useEffect(()=>{if(!xt)return;const le=()=>{const we=V.current,{w:ut,h:At}=kt();ft(Ct=>{if(!we)return ee(Ct);const ce=24,ye=Ct.x-Gt,ve=we.w-Gt-(Ct.x+Ct.w),Ge=we.h-Gt-(Ct.y+Ct.h),De=Math.abs(ye)<=ce,rt=Math.abs(ve)<=ce,dt=Math.abs(Ge)<=ce;let at=ee(Ct);return dt&&(at={...at,y:Math.max(Gt,At-at.h-Gt)}),rt?at={...at,x:Math.max(Gt,ut-at.w-Gt)}:De&&(at={...at,x:Gt}),ee(at)}),V.current={w:ut,h:At}};return V.current=(()=>{const{w:we,h:ut}=kt();return{w:we,h:ut}})(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[xt,ee]);const _i=_.useRef(null);_.useEffect(()=>{const le=Ke.current;if(!(!le||le.isDisposed?.()))return _i.current!=null&&cancelAnimationFrame(_i.current),_i.current=requestAnimationFrame(()=>{_i.current=null;try{le.trigger("resize")}catch{}}),()=>{_i.current!=null&&(cancelAnimationFrame(_i.current),_i.current=null)}},[xt,Ue.w,Ue.h]);const[Ei,fi]=_.useState(!1),[yi,$s]=_.useState(!1),[ns,Xi]=_.useState(null),[wi,Jt]=_.useState(null),ei=_.useRef(null),Qi=_.useRef(null),Ls=_.useRef(null),Hs=_.useRef(null),rn=_.useCallback(le=>{const{w:we,h:ut}=kt(),At=Gt,Ct=we-le.w-Gt,ce=ut-le.h-Gt,ve=le.x+le.w/2{const we=Hs.current;if(!we)return;const ut=le.clientX-we.sx,At=le.clientY-we.sy,Ct=we.start,ce=ee({x:Ct.x+ut,y:Ct.y+At,w:Ct.w,h:Ct.h});Ls.current={x:ce.x,y:ce.y},Xi(rn(ce)),Qi.current==null&&(Qi.current=requestAnimationFrame(()=>{Qi.current=null;const ye=Ls.current;ye&&ft(ve=>({...ve,x:ye.x,y:ye.y}))}))},[ee,rn]),xi=_.useCallback(()=>{Hs.current&&($s(!1),Xi(null),Qi.current!=null&&(cancelAnimationFrame(Qi.current),Qi.current=null),Hs.current=null,window.removeEventListener("pointermove",ys),window.removeEventListener("pointerup",xi),ft(le=>{const we=rn(ee(le));return queueMicrotask(()=>pi(we)),we}))},[ys,rn,ee,pi]),Cs=_.useCallback(le=>{if(!xt||Ei||le.button!==0)return;le.preventDefault(),le.stopPropagation();const we=gi.current;Hs.current={sx:le.clientX,sy:le.clientY,start:we},$s(!0);const ut=ot();Jt(ut),Xi(rn(we)),window.addEventListener("pointermove",ys),window.addEventListener("pointerup",xi)},[xt,Ei,ys,xi,rn,ot]),$i=_.useRef(null),Rs=_.useRef(null),Ji=_.useRef(null),Ai=_.useCallback(le=>{const we=Ji.current;if(!we)return;const ut=le.clientX-we.sx,At=le.clientY-we.sy,Ct=we.ratio,ce=we.dir.includes("w"),ye=we.dir.includes("e"),ve=we.dir.includes("n"),Ge=we.dir.includes("s");let De=we.start.w,rt=we.start.h,dt=we.start.x,at=we.start.y;const{w:wt,h:It}=kt(),zt=24,mt=we.start.x+we.start.w,pt=we.start.y+we.start.h,Bt=Math.abs(wt-Gt-mt)<=zt,oi=Math.abs(It-Gt-pt)<=zt,qt=Hi=>{Hi=Math.max(Yi,Hi);let ws=Hi/Ct;return ws{Hi=Math.max(Ri,Hi);let ws=Hi*Ct;return ws=Math.abs(At)){const ws=ye?we.start.w+ut:we.start.w-ut,{newW:Jn,newH:ea}=qt(ws);De=Jn,rt=ea}else{const ws=Ge?we.start.h+At:we.start.h-At,{newW:Jn,newH:ea}=Kt(ws);De=Jn,rt=ea}ce&&(dt=we.start.x+(we.start.w-De)),ve&&(at=we.start.y+(we.start.h-rt))}else if(ye||ce){const Hi=ye?we.start.w+ut:we.start.w-ut,{newW:ws,newH:Jn}=qt(Hi);De=ws,rt=Jn,ce&&(dt=we.start.x+(we.start.w-De)),at=oi?we.start.y+(we.start.h-rt):we.start.y}else if(ve||Ge){const Hi=Ge?we.start.h+At:we.start.h-At,{newW:ws,newH:Jn}=Kt(Hi);De=ws,rt=Jn,ve&&(at=we.start.y+(we.start.h-rt)),Bt?dt=we.start.x+(we.start.w-De):dt=we.start.x}const zs=ee({x:dt,y:at,w:De,h:rt});Rs.current=zs,$i.current==null&&($i.current=requestAnimationFrame(()=>{$i.current=null;const Hi=Rs.current;Hi&&ft(Hi)}))},[ee]),hn=_.useCallback(()=>{Ji.current&&(fi(!1),Xi(null),Jt(null),$i.current!=null&&(cancelAnimationFrame($i.current),$i.current=null),Ji.current=null,window.removeEventListener("pointermove",Ai),window.removeEventListener("pointerup",hn),pi(gi.current))},[Ai,pi]),_s=_.useCallback(le=>we=>{if(!xt||we.button!==0)return;we.preventDefault(),we.stopPropagation();const ut=gi.current;Ji.current={dir:le,sx:we.clientX,sy:we.clientY,start:ut,ratio:ut.w/ut.h},fi(!0),window.addEventListener("pointermove",Ai),window.addEventListener("pointerup",hn)},[xt,Ai,hn]),[$e,Mt]=_.useState(!1),[Nt,ri]=_.useState(!1);_.useEffect(()=>{const le=window.matchMedia?.("(hover: hover) and (pointer: fine)"),we=()=>Mt(!!le?.matches);return we(),le?.addEventListener?.("change",we),()=>le?.removeEventListener?.("change",we)},[]);const Wt=xt&&(Nt||yi||Ei),[bi,ci]=_.useState(!1);if(_.useEffect(()=>{s.status!=="running"&&ci(!1)},[s.id,s.status]),!pe||!$t)return null;const Bi="inline-flex items-center justify-center rounded-md p-2 transition bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 active:scale-[0.98] dark:bg-black/45 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500",Fi=String(s.phase??"").toLowerCase(),Es=Fi==="stopping"||Fi==="remuxing"||Fi==="moving",Qs=!E||!q||Es||bi,fn=g.jsx("div",{className:"flex items-center gap-1 min-w-0",children:q?g.jsxs(g.Fragment,{children:[g.jsx(di,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Qs,title:Es||bi?"Stoppe…":"Stop","aria-label":Es||bi?"Stoppe…":"Stop",onClick:async le=>{if(le.preventDefault(),le.stopPropagation(),!Qs)try{ci(!0),await E?.(s.id)}finally{ci(!1)}},className:po("shadow-none shrink-0",xt&&Et&&"px-2"),children:g.jsx("span",{className:"whitespace-nowrap",children:Es||bi?"Stoppe…":xt&&Et?"Stop":"Stoppen"})}),g.jsx(ja,{job:s,variant:"overlay",collapseToMenu:!0,busy:Es||bi,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?le=>T(le):void 0,onToggleFavorite:v?le=>v(le):void 0,onToggleLike:b?le=>b(le):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):g.jsx(ja,{job:s,variant:"overlay",collapseToMenu:!0,isHot:a||te,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?le=>T(le):void 0,onToggleFavorite:v?le=>v(le):void 0,onToggleLike:b?le=>b(le):void 0,onToggleHot:y?async le=>{Si(),await new Promise(ut=>setTimeout(ut,150)),await y(le),await new Promise(ut=>setTimeout(ut,0));const we=Ke.current;if(we&&!we.isDisposed?.()){const ut=we.play?.();ut&&typeof ut.catch=="function"&&ut.catch(()=>{})}}:void 0,onKeep:f?async le=>{Si(),t(),await new Promise(we=>setTimeout(we,150)),await f(le)}:void 0,onDelete:p?async le=>{Si(),t(),await new Promise(we=>setTimeout(we,150)),await p(le)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),Pn=e||xt,xn=q?"calc(4px + env(safe-area-inset-bottom))":`calc(${Vt+2}px + env(safe-area-inset-bottom))`,mn="top-2",ds=e&&ui,bn=g.jsx("div",{className:po("relative overflow-visible",e||xt?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!xt||!$e||ri(!0)},onMouseLeave:()=>{!xt||!$e||ri(!1)},children:g.jsxs("div",{className:po("relative w-full h-full",xt&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Vt}px`},children:[q?g.jsxs("div",{className:"absolute inset-0 bg-black",children:[g.jsx(hR,{src:Ce,muted:D,className:"w-full h-full object-contain object-bottom"}),g.jsxs("div",{className:"absolute right-2 bottom-2 z-[60] pointer-events-none inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[g.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]})]}):g.jsx("div",{ref:ct,className:"absolute inset-0"}),g.jsxs("div",{className:po("absolute inset-x-0 z-30 pointer-events-none","top-0"),children:[g.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-black/35 to-transparent"}),g.jsx("div",{className:po("absolute inset-x-2",mn),children:g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2",children:[g.jsx("div",{className:"min-w-0 pointer-events-auto overflow-visible",children:ds?null:fn}),xt?g.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:Cs,onClick:le=>{le.preventDefault(),le.stopPropagation()},className:po(Bi,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",Wt?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",yi&&"scale-[0.98] opacity-90"),children:[g.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),g.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),g.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"})]}):null,g.jsxs("div",{className:"shrink-0 flex items-center gap-1 pointer-events-auto",children:[g.jsx("button",{type:"button",className:Bi,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?g.jsx(LO,{className:"h-5 w-5"}):g.jsx(IO,{className:"h-5 w-5"})}),g.jsx("button",{type:"button",className:Bi,onClick:t,"aria-label":"Schließen",title:"Schließen",children:g.jsx(f0,{className:"h-5 w-5"})})]})]})})]}),g.jsxs("div",{className:po("player-ui pointer-events-none absolute inset-x-2 z-50","flex items-end justify-between gap-2","transition-all duration-200 ease-out"),style:{bottom:xn},children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-white",children:re}),g.jsx("div",{className:"truncate text-[11px] text-white/80",children:g.jsxs("span",{className:"inline-flex items-center gap-1 min-w-0 align-middle",children:[g.jsx("span",{className:"truncate",children:U||O}),a||te?g.jsx("span",{className:"shrink-0 rounded bg-amber-500/25 px-1.5 py-0.5 font-semibold text-white",children:"HOT"}):null]})})]}),g.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 text-[11px] text-white",children:[Ye!=="—"?g.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Ye}):null,q?null:g.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:ne}),F!=="—"?g.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:F}):null]})]})]})}),an=g.jsx("div",{className:"w-[360px] shrink-0 border-r border-white/10 bg-black/40 text-white",children:g.jsxs("div",{className:"h-full p-4 flex flex-col gap-3 overflow-y-auto",children:[g.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-white/10 bg-black/30",children:g.jsx("div",{className:"relative aspect-video",children:g.jsx("img",{src:Me,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}})})}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("div",{className:"text-lg font-semibold truncate",children:re}),g.jsx("div",{className:"text-xs text-white/70 break-all",children:U||O})]}),g.jsx("div",{className:"pointer-events-auto",children:g.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[q?g.jsx(di,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Qs,title:Es||bi?"Stoppe…":"Stop","aria-label":Es||bi?"Stoppe…":"Stop",onClick:async le=>{if(le.preventDefault(),le.stopPropagation(),!Qs)try{ci(!0),await E?.(s.id)}finally{ci(!1)}},className:"shadow-none",children:Es||bi?"Stoppe…":"Stoppen"}):null,g.jsx(ja,{job:s,variant:"table",collapseToMenu:!1,busy:Es||bi,isHot:a||te,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?le=>T(le):void 0,onToggleFavorite:v?le=>v(le):void 0,onToggleLike:b?le=>b(le):void 0,onToggleHot:y?async le=>{Si(),await new Promise(ut=>setTimeout(ut,150)),await y(le),await new Promise(ut=>setTimeout(ut,0));const we=Ke.current;if(we&&!we.isDisposed?.()){const ut=we.play?.();ut&&typeof ut.catch=="function"&&ut.catch(()=>{})}}:void 0,onKeep:f?async le=>{Si(),t(),await new Promise(we=>setTimeout(we,150)),await f(le)}:void 0,onDelete:p?async le=>{Si(),t(),await new Promise(we=>setTimeout(we,150)),await p(le)}:void 0,order:q?["watch","favorite","like","details"]:["watch","favorite","like","hot","details","keep","delete"],className:"flex items-center justify-start gap-1"})]})}),g.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-sm",children:[g.jsx("div",{className:"text-white/60",children:"Status"}),g.jsx("div",{className:"font-medium",children:s.status}),g.jsx("div",{className:"text-white/60",children:"Auflösung"}),g.jsx("div",{className:"font-medium",children:Ye}),g.jsx("div",{className:"text-white/60",children:"FPS"}),g.jsx("div",{className:"font-medium",children:lt}),g.jsx("div",{className:"text-white/60",children:"Laufzeit"}),g.jsx("div",{className:"font-medium",children:ne}),g.jsx("div",{className:"text-white/60",children:"Größe"}),g.jsx("div",{className:"font-medium",children:F}),g.jsx("div",{className:"text-white/60",children:"Datum"}),g.jsx("div",{className:"font-medium",children:Z}),g.jsx("div",{className:"col-span-2",children:xe.length?g.jsx("div",{className:"flex flex-wrap gap-1.5",children:xe.map(le=>g.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:le},le))}):g.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),Zn=xt&&yi&&ns?g.jsx("div",{className:"pointer-events-none absolute z-0 player-snap-ghost overflow-hidden rounded-lg border-2 border-dashed border-white/70 bg-black/55 shadow-2xl dark:border-white/60",style:{left:ns.x-Ue.x,top:ns.y-Ue.y,width:ns.w,height:ns.h},"aria-hidden":"true",children:g.jsxs("div",{className:"absolute inset-0 bg-black",children:[g.jsx("img",{src:wi||Me,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}}),g.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-black/55 to-transparent"}),g.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 opacity-80",children:[g.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"}),g.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"})]}),g.jsxs("div",{className:"absolute top-2 left-2 h-8 rounded-md bg-white/12 px-2 flex items-center gap-1 ring-1 ring-white/15",children:[g.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),g.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),g.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"})]}),g.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex items-end justify-between gap-2",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-white/95",children:re}),g.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[U||O,a||te?g.jsx("span",{className:"ml-1.5 rounded bg-amber-500/30 px-1.5 py-0.5 text-white",children:"HOT"}):null]})]}),g.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-[10px] text-white/90",children:[Ye!=="—"?g.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Ye}):null,!q&&ne!=="—"?g.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:ne}):null]})]}),g.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,Ii=g.jsx(ca,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:po("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",Pn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":xt?"rounded-lg":"rounded-none"),bodyClassName:"flex flex-col flex-1 min-h-0 p-0",children:g.jsxs("div",{className:"flex flex-1 min-h-0",children:[ds?an:null,bn]})}),{w:_e,h:Le,ox:Ne,oy:et,bottomInset:bt}=kt(),Qt={left:Ne+16,top:et+16,width:Math.max(0,_e-32),height:Math.max(0,Le-32)},ti=e?Qt:xt?{left:Ue.x,top:Ue.y,width:Ue.w,height:Ue.h}:void 0;return Lc.createPortal(g.jsxs(g.Fragment,{children:[g.jsx("style",{children:` +`),d=[],f=e?n7(e.baseTime,e.timescale):0;let g="00:00.000",y=0,v=0,b,T=!0;u.oncue=function(E){const D=t[i];let O=t.ccOffset;const R=(y-f)/9e4;if(D!=null&&D.new&&(v!==void 0?O=t.ccOffset=D.start:Q9(t,i,R)),R){if(!e){b=new Error("Missing initPTS for VTT MPEGTS");return}O=R-t.presentationOffset}const j=E.endTime-E.startTime,F=Fr((E.startTime+O-v)*9e4,n*9e4)/9e4;E.startTime=Math.max(F,0),E.endTime=Math.max(F+j,0);const G=E.text.trim();E.text=decodeURIComponent(encodeURIComponent(G)),E.id||(E.id=S1(E.startTime,E.endTime,G)),E.endTime>0&&d.push(E)},u.onparsingerror=function(E){b=E},u.onflush=function(){if(b){a(b);return}r(d)},c.forEach(E=>{if(T)if(Uv(E,"X-TIMESTAMP-MAP=")){T=!1,E.slice(16).split(",").forEach(D=>{Uv(D,"LOCAL:")?g=D.slice(6):Uv(D,"MPEGTS:")&&(y=parseInt(D.slice(7)))});try{v=X9(g)/1e3}catch(D){b=D}return}else E===""&&(T=!1);u.parse(E+` +`)}),u.flush()}const jv="stpp.ttml.im1t",mR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,pR=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,J9={left:"start",center:"center",right:"end",start:"start",end:"end"};function Yw(s,e,t,i){const n=Bi(new Uint8Array(s),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=n.map(u=>jr(u)),a=s7(e.baseTime,1,e.timescale);try{r.forEach(u=>t(e$(u,a)))}catch(u){i(u)}}function e$(s,e){const n=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((g,y)=>(g[y]=n.getAttribute(`ttp:${y}`)||r[y],g),{}),u=n.getAttribute("xml:space")!=="preserve",c=Xw($v(n,"styling","style")),d=Xw($v(n,"layout","region")),f=$v(n,"body","[begin]");return[].map.call(f,g=>{const y=gR(g,u);if(!y||!g.hasAttribute("begin"))return null;const v=zv(g.getAttribute("begin"),a),b=zv(g.getAttribute("dur"),a);let T=zv(g.getAttribute("end"),a);if(v===null)throw Qw(g);if(T===null){if(b===null)throw Qw(g);T=v+b}const E=new T1(v-e,T-e,y);E.id=S1(E.startTime,E.endTime,E.text);const D=d[g.getAttribute("region")],O=c[g.getAttribute("style")],R=t$(D,O,c),{textAlign:j}=R;if(j){const F=J9[j];F&&(E.lineAlign=F),E.align=j}return Ss(E,R),E}).filter(g=>g!==null)}function $v(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Xw(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function gR(s,e){return[].slice.call(s.childNodes).reduce((t,i,n)=>{var r;return i.nodeName==="br"&&n?t+` +`:(r=i.childNodes)!=null&&r.length?gR(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function t$(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(n=t[a]),r.reduce((u,c)=>{const d=Hv(e,i,c)||Hv(s,i,c)||Hv(n,i,c);return d&&(u[c]=d),u},{})}function Hv(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Qw(s){return new Error(`Could not parse ttml timestamp ${s}`)}function zv(s,e){if(!s)return null;let t=dR(s);return t===null&&(mR.test(s)?t=i$(s,e):pR.test(s)&&(t=s$(s,e))),t}function i$(s,e){const t=mR.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function s$(s,e){const t=pR.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Vm{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class n${constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Jw(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on($.FRAG_LOADING,this.onFragLoading,this),e.on($.FRAG_LOADED,this.onFragLoaded,this),e.on($.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on($.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on($.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off($.FRAG_LOADING,this.onFragLoading,this),e.off($.FRAG_LOADED,this.onFragLoaded,this),e.off($.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off($.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off($.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off($.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Vm(this,"textTrack1"),t=new Vm(this,"textTrack2"),i=new Vm(this,"textTrack3"),n=new Vm(this,"textTrack4");this.cea608Parser1=new Ww(1,e,t),this.cea608Parser2=new Ww(3,i,n)}addCues(e,t,i,n,r){let a=!1;for(let u=r.length;u--;){const c=r[u],d=r$(c[0],c[1],t,i);if(d>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),a=!0,d/(i-t)>.5))return}if(a||r.push([t,i]),this.config.renderTextTracksNatively){const u=this.captionsTracks[e];this.Cues.newCue(u,t,i,n)}else{const u=this.Cues.newCue(null,t,i,n);this.hls.trigger($.CUES_PARSED,{type:"captions",cues:u,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r,trackId:a}){const{unparsedVttFrags:u}=this;i===$t.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:r,trackId:a}),u.length&&(this.unparsedVttFrags=[],u.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded($.FRAG_LOADED,c):this.hls.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n{gc(n[r]),delete n[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Jw(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;ir.textCodec===jv);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(KL(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,u=a?u0(a.textTracks):null;if(this.tracks.forEach((c,d)=>{let f;if(u){let g=null;for(let y=0;yd!==null).map(d=>d.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(u=>({label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}));this.hls.trigger($.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const r=`textTrack${n[1]}`,a=this.captionsProperties[r];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===$t.MAIN){var i,n;const{cea608Parser1:r,cea608Parser2:a,lastSn:u}=this,{cc:c,sn:d}=t.frag,f=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;r&&a&&(d!==u+1||d===u&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(r.reset(),a.reset()),this.lastCc=c,this.lastSn=d,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===$t.SUBTITLE)if(n.byteLength){const r=i.decryptdata,a="stats"in t;if(r==null||!r.encrypted||a){const u=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),u&&u.textCodec===jv?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Yw(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:r,unparsedVttFrags:a}=this,u=r.length-1;if(!r[i.cc]&&u===-1){a.push(e);return}const c=this.hls,d=(t=i.initSegment)!=null&&t.data?ea(i.initSegment.data,new Uint8Array(n)).buffer:n;Z9(d,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,f=>{this._appendCues(f,i.level),c.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},f=>{const g=f.message==="Missing initPTS for VTT MPEGTS";g?a.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${f}`),!(g&&u>i.cc)&&c.trigger($.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:f})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Yw(t,this.initPTS[e.cc],()=>{i.textCodec=jv,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(r=>oR(n,r))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;i.trigger($.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===$t.SUBTITLE&&this.onFragLoaded($.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===$t.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;reb(u[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:u}=this;Object.keys(u).forEach(c=>eb(u[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let r=0;r=16?c--:c++;const v=fR(d.trim()),b=S1(e,t,v);s!=null&&(g=s.cues)!=null&&g.getCueById(b)||(a=new f(e,t,v),a.id=b,a.line=y+1,a.align="left",a.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(a))}return s&&n.length&&(n.sort((y,v)=>y.line==="auto"||v.line==="auto"?0:y.line>8&&v.line>8?v.line-y.line:y.line-v.line),n.forEach(y=>oR(s,y))),n}};function l$(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const u$=/(\d+)-(\d+)\/(\d+)/;class eA{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||f$,this.controller=new self.AbortController,this.stats=new e1}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const r=c$(e,this.controller.signal),a=e.responseType==="arraybuffer",u=a?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&Pt(c)?c:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(Vh(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(g=>{var y;this.response=this.loader=g;const v=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},d-(v-n.loading.start)),!g.ok){const{status:T,statusText:E}=g;throw new m$(E||"fetch, bad network response",T,g)}n.loading.first=v,n.total=h$(g.headers)||n.total;const b=(y=this.callbacks)==null?void 0:y.onProgress;return b&&Pt(t.highWaterMark)?this.loadProgressively(g,n,e,t.highWaterMark,b):a?g.arrayBuffer():e.responseType==="json"?g.json():g.text()}).then(g=>{var y,v;const b=this.response;if(!b)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const T=g[u];T&&(n.loaded=n.total=T);const E={url:b.url,data:g,code:b.status},D=(y=this.callbacks)==null?void 0:y.onProgress;D&&!Pt(t.highWaterMark)&&D(n,e,g,b),(v=this.callbacks)==null||v.onSuccess(E,n,e,b)}).catch(g=>{var y;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const v=g&&g.code||0,b=g?g.message:null;(y=this.callbacks)==null||y.onError({code:v,text:b},e,g?g.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,r){const a=new kL,u=e.body.getReader(),c=()=>u.read().then(d=>{if(d.done)return a.dataLength&&r(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=d.value,g=f.length;return t.loaded+=g,g=n&&r(t,i,a.flush().buffer,e)):r(t,i,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function c$(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ss({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function d$(s){const e=u$.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function h$(s){const e=s.get("Content-Range");if(e){const i=d$(e);if(Pt(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function f$(s,e){return new self.Request(s.url,e)}class m$ extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const p$=/^age:\s*[\d.]+\s*$/im;class vR{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new e1,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var u;(u=this.callbacks)==null||u.onError({code:i.status,text:a.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=i.loadPolicy;if(n)for(const u in n)e.setRequestHeader(u,n[u]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Pt(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,f=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const b=f??t.response;if(b!=null){var a,u;i.loading.end=Math.max(self.performance.now(),i.loading.first);const T=t.responseType==="arraybuffer"?b.byteLength:b.length;i.loaded=i.total=T,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const E=(a=this.callbacks)==null?void 0:a.onProgress;E&&E(i,e,b,t);const D={url:t.responseURL,data:b,code:d};(u=this.callbacks)==null||u.onSuccess(D,i,e,t);return}}const g=r.loadPolicy.errorRetry,y=i.retry,v={url:e.url,data:void 0,code:d};if(q0(g,y,!1,v))this.retry(g);else{var c;ys.error(`${d} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:d,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(q0(e,t,!0))this.retry(e);else{var i;ys.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=n1(e,i.retry),i.retry++,ys.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&p$.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const g$={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},y$=gs(gs({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:vR,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:DU,bufferController:x7,capLevelController:v1,errorController:OU,fpsController:b9,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:gL,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:g$},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},v$()),{},{subtitleStreamController:I9,subtitleTrackController:_9,timelineController:n$,audioStreamController:p7,audioTrackController:g7,emeController:Lc,cmcdController:g9,contentSteeringController:v9,interstitialsController:R9});function v$(){return{cueHandler:o$,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function x$(s,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=ib(s),n=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(a=>{const u=`${a==="level"?"playlist":a}LoadPolicy`,c=e[u]===void 0,d=[];r.forEach(f=>{const g=`${a}Loading${f}`,y=e[g];if(y!==void 0&&c){d.push(g);const v=i[u].default;switch(e[u]={default:v},f){case"TimeOut":v.maxLoadTimeMs=y,v.maxTimeToFirstByteMs=y;break;case"MaxRetry":v.errorRetry.maxNumRetry=y,v.timeoutRetry.maxNumRetry=y;break;case"RetryDelay":v.errorRetry.retryDelayMs=y,v.timeoutRetry.retryDelayMs=y;break;case"MaxRetryTimeout":v.errorRetry.maxRetryDelayMs=y,v.timeoutRetry.maxRetryDelayMs=y;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${u}": ${Cs(e[u])}`)}),gs(gs({},i),e)}function ib(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(ib):Object.keys(s).reduce((e,t)=>(e[t]=ib(s[t]),e),{}):s}function b$(s,e){const t=s.loader;t!==eA&&t!==vR?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):l$()&&(s.loader=eA,s.progressive=!0,s.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const c0=2,T$=.1,S$=.05,_$=100;class E$ extends dL{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(_$),this.mediaSource=t.mediaSource;const i=this.media=t.media;er(i,"playing",this.onMediaPlaying),er(i,"waiting",this.onMediaWaiting),er(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(vr(i,"playing",this.onMediaPlaying),vr(i,"waiting",this.onMediaWaiting),vr(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const a=this.media;if(!a)return;const{seeking:u}=a,c=this.seeking&&!u,d=!this.seeking&&u,f=a.paused&&!u||a.ended||a.playbackRate===0;if(this.seeking=u,e!==t){t&&(this.ended=0),this.moved=!0,u||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||c){c&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!1}));return}if(!Ai.getBuffered(a).length){this.nudgeRetry=0;return}const g=Ai.bufferInfo(a,e,0),y=g.nextStart||0,v=this.fragmentTracker;if(u&&v&&this.hls){const G=tA(this.hls.inFlightFragments,e),L=g.len>c0,W=!y||G||y-e>c0&&!v.getPartialFragment(e);if(L||W)return;this.moved=!1}const b=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&v){if(!(g.len>0)&&!y)return;const L=Math.max(y,g.start||0)-e,I=!!(b!=null&&b.live)?b.targetduration*2:c0,N=Gm(e,v);if(L>0&&(L<=I||N)){a.paused||this._trySkipBufferHole(N);return}}const T=r.detectStallWithCurrentTimeMs,E=self.performance.now(),D=this.waiting;let O=this.stalled;if(O===null)if(D>0&&E-D=T||D)&&this.hls){var j;if(((j=this.mediaSource)==null?void 0:j.readyState)==="ended"&&!(b!=null&&b.live)&&Math.abs(e-(b?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger($.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(g),!this.media||!this.hls)return}const F=Ai.bufferInfo(a,e,r.maxBufferHole);this._tryFixBufferStall(F,R,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger($.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const r=Ai.bufferedInfo(Ai.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const a=Ai.timeRangesToArray(n),u=Ai.bufferedInfo(a,t,0).bufferedIndex;if(u>-1&&uu)&&f-d<1&&e-d<2){const g=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${f} buffered index: ${c}`);this.warn(g.message),this.media.currentTime+=1e-6;let y=Gm(e,this.fragmentTracker);y&&"fragment"in y?y=y.fragment:y||(y=void 0);const v=Ai.bufferInfo(this.media,e,0);this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:g,reason:g.message,frag:y,buffer:v.len,bufferInfo:v})}}}}}_tryFixBufferStall(e,t,i){var n,r;const{fragmentTracker:a,media:u}=this,c=(n=this.hls)==null?void 0:n.config;if(!u||!a||!c)return;const d=(r=this.hls)==null?void 0:r.latestLevelDetails,f=Gm(i,a);if((f||d!=null&&d.live&&i1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-ic.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const r=i.getFragAtPos(t,$t.MAIN),a=i.getFragAtPos(n,$t.MAIN);if(r&&a)return a.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:r}=this;if(!n&&r!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Cs(e)})`);this.warn(a.message),t.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,r=(t=this.hls)==null?void 0:t.config;if(!n||!i||!r)return 0;const a=n.currentTime,u=Ai.bufferInfo(n,a,0),c=a0&&u.len<1&&n.readyState<3,y=c-a;if(y>0&&(f||g)){if(y>r.maxBufferHole){let b=!1;if(a===0){const T=i.getAppendedFrag(0,$t.MAIN);T&&c"u"))return self.VTTCue||self.TextTrackCue}function Vv(s,e,t,i,n){let r=new s(e,t,"");try{r.value=i,n&&(r.type=n)}catch{r=new s(e,t,Cs(n?gs({type:n},i):i))}return r}const qm=(()=>{const s=sb();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class A${constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger($.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off($.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&gc(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tqm&&(g=qm),g-f<=0&&(g=f+w$);for(let v=0;vf.type===Br.audioId3&&c:n==="video"?d=f=>f.type===Br.emsg&&u:d=f=>f.type===Br.audioId3&&c||f.type===Br.emsg&&u,eb(r,t,i,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:n,enableDateRangeMetadataCues:r,interstitialsController:a}=this.hls.config;if(!r)return;const u=sb();if(i&&n&&!a){const{fragmentStart:T,fragmentEnd:E}=e;let D=this.assetCue;D?(D.startTime=T,D.endTime=E):u&&(D=this.assetCue=Vv(u,T,E,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),D&&(D.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(D),D.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:d}=e,f=Object.keys(d);let g=this.dateRangeCuesAppended;if(c&&t){var y;if((y=c.cues)!=null&&y.length){const T=Object.keys(g).filter(E=>!f.includes(E));for(let E=T.length;E--;){var v;const D=T[E],O=(v=g[D])==null?void 0:v.cues;delete g[D],O&&Object.keys(O).forEach(R=>{const j=O[R];if(j){j.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(j)}catch{}}})}}else g=this.dateRangeCuesAppended={}}const b=e.fragments[e.fragments.length-1];if(!(f.length===0||!Pt(b?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let T=0;T{if(V!==D.id){const Y=d[V];if(Y.class===D.class&&Y.startDate>D.startDate&&(!X||D.startDate.01&&(V.startTime=O,V.endTime=G);else if(u){let Y=D.attr[X];WU(X)&&(Y=GD(Y));const ie=Vv(u,O,G,{key:X,data:Y},Br.dateRange);ie&&(ie.id=E,this.id3Track.addCue(ie),j[X]=ie,a&&(X==="X-ASSET-LIST"||X==="X-ASSET-URL")&&ie.addEventListener("enter",this.onEventCueEnter))}}g[E]={cues:j,dateRange:D,durationKnown:F}}}}}class k${constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||a===1||!i.live)return;const u=this.targetLatency;if(u===null)return;const c=n-u,d=Math.min(this.maxLatency,u+i.targetduration);if(c.05&&this.forwardBufferLength>1){const g=Math.min(2,Math.max(1,a)),y=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,v=Math.min(g,Math.max(1,y));this.changeMediaPlaybackRate(t,v)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:u}=this.config,c=this.hls.userConfig;let d=u&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||d===0)&&(d=r!==void 0?r:a*n);const f=n;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,f)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,r=e-t-this.edgeStalled,a=n-i.totalduration,u=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),u)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on($.MEDIA_ATTACHED,this.onMediaAttached,this),e.on($.MEDIA_DETACHING,this.onMediaDetaching,this),e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_UPDATED,this.onLevelUpdated,this),e.on($.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off($.MEDIA_ATTACHED,this.onMediaAttached,this),e.off($.MEDIA_DETACHING,this.onMediaDetaching,this),e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_UPDATED,this.onLevelUpdated,this),e.off($.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===Oe.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class C$ extends y1{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.MANIFEST_LOADED,this.onManifestLoaded,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this),e.on($.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.MANIFEST_LOADED,this.onManifestLoaded,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this),e.off($.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],r={},a={};let u=!1,c=!1,d=!1;t.levels.forEach(f=>{const g=f.attrs;let{audioCodec:y,videoCodec:v}=f;y&&(f.audioCodec=y=H0(y,i)||void 0),v&&(v=f.videoCodec=cU(v));const{width:b,height:T,unknownCodecs:E}=f,D=E?.length||0;if(u||(u=!!(b&&T)),c||(c=!!v),d||(d=!!y),D||y&&!this.isAudioSupported(y)||v&&!this.isVideoSupported(v)){this.log(`Some or all CODECS not supported "${g.CODECS}"`);return}const{CODECS:O,"FRAME-RATE":R,"HDCP-LEVEL":j,"PATHWAY-ID":F,RESOLUTION:G,"VIDEO-RANGE":L}=g,I=`${`${F||"."}-`}${f.bitrate}-${G}-${R}-${O}-${L}-${j}`;if(r[I])if(r[I].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const N=a[I]+=1;f.attrs["PATHWAY-ID"]=new Array(N+1).join(".");const X=this.createLevel(f);r[I]=X,n.push(X)}else r[I].addGroupId("audio",g.AUDIO),r[I].addGroupId("text",g.SUBTITLES);else{const N=this.createLevel(f);r[I]=N,a[I]=1,n.push(N)}}),this.filterAndSortMediaOptions(n,t,u,c,d)}createLevel(e){const t=new $h(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=sL(n,[])}return t}isAudioSupported(e){return Uh(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Uh(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,r){var a;let u=[],c=[],d=e;const f=((a=t.stats)==null?void 0:a.parsing)||{};if((i||n)&&r&&(d=d.filter(({videoCodec:O,videoRange:R,width:j,height:F})=>(!!O||!!(j&&F))&&bU(R))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let O="no level with compatible codecs found in manifest",R=O;t.levels.length&&(R=`one or more CODECS in variant not supported: ${Cs(t.levels.map(F=>F.attrs.CODECS).filter((F,G,L)=>L.indexOf(F)===G))}`,this.warn(R),O+=` (${R})`);const j=new Error(O);this.hls.trigger($.ERROR,{type:Jt.MEDIA_ERROR,details:Oe.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:j,reason:R})}}),f.end=performance.now();return}t.audioTracks&&(u=t.audioTracks.filter(O=>!O.audioCodec||this.isAudioSupported(O.audioCodec)),sA(u)),t.subtitles&&(c=t.subtitles,sA(c));const g=d.slice(0);d.sort((O,R)=>{if(O.attrs["HDCP-LEVEL"]!==R.attrs["HDCP-LEVEL"])return(O.attrs["HDCP-LEVEL"]||"")>(R.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&O.height!==R.height)return O.height-R.height;if(O.frameRate!==R.frameRate)return O.frameRate-R.frameRate;if(O.videoRange!==R.videoRange)return z0.indexOf(O.videoRange)-z0.indexOf(R.videoRange);if(O.videoCodec!==R.videoCodec){const j=WE(O.videoCodec),F=WE(R.videoCodec);if(j!==F)return F-j}if(O.uri===R.uri&&O.codecSet!==R.codecSet){const j=$0(O.codecSet),F=$0(R.codecSet);if(j!==F)return F-j}return O.averageBitrate!==R.averageBitrate?O.averageBitrate-R.averageBitrate:0});let y=g[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==g.length)){for(let O=0;Oj&&j===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=F)}break}const b=r&&!n,T=this.hls.config,E=!!(T.audioStreamController&&T.audioTrackController),D={levels:d,audioTracks:u,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:E&&!b&&u.some(O=>!!O.url)};f.end=performance.now(),this.hls.trigger($.MANIFEST_PARSED,D)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const f=new Error("invalid level idx"),g=e<0;if(this.hls.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.LEVEL_SWITCH_ERROR,level:e,fatal:g,error:f,reason:f.message}),g)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,a=t[e],u=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&n&&r===u)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${u?" with Pathway "+u:""} from level ${i}${r?" with Pathway "+r:""}`);const c={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger($.LEVEL_SWITCHING,c);const d=a.details;if(!d||d.live){const f=this.switchParams(a.uri,n?.details,d);this.loadPlaylist(f)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===Hi.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===$t.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:r}=t,a=t.levelInfo;if(!a){var u;this.warn(`Invalid level index ${n}`),(u=t.deliveryDirectives)!=null&&u.skip&&(r.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let c=a.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],a=e.details,u=a?.age;this.log(`Loading level index ${n}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${u&&a.live?" age "+u.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger($.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((r,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(u=>u.level=-1)),!1));EL(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger($.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger($.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function sA(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function xR(){return self.SourceBuffer||self.WebKitSourceBuffer}function bR(){if(!Cl())return!1;const e=xR();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function D$(){if(!bR())return!1;const s=Cl();return typeof s?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(jh(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(jh(e,"audio"))))}function L$(){var s;const e=xR();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const R$=100;class I$ extends u1{constructor(e,t,i){super(e,t,i,"stream-controller",$t.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,r=n?n.currentTime:null;if(r===null||!Pt(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const a=this.getFwdBufferInfoAtPos(n,r,$t.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on($.MANIFEST_PARSED,this.onManifestParsed,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.LEVEL_LOADED,this.onLevelLoaded,this),e.on($.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on($.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on($.BUFFER_CREATED,this.onBufferCreated,this),e.on($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on($.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off($.MANIFEST_PARSED,this.onManifestParsed,this),e.off($.LEVEL_LOADED,this.onLevelLoaded,this),e.off($.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off($.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off($.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off($.BUFFER_CREATED,this.onBufferCreated,this),e.off($.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off($.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(R$),this.level=-1,!this.startFragRequested){let r=n.startLevel;r===-1&&(n.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=n.firstAutoLevel),n.nextLoadLevel=r,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=ot.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=ot.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ot.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e?.[t],n=i?.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=ot.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ot.IDLE;break}break}case ot.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===ot.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const a=i[r],u=this.getMainFwdBufferInfo();if(u===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(u,c)){const T={};this.altAudio===2&&(T.type="video"),this.hls.trigger($.BUFFER_EOS,T),this.state=ot.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const d=a.details;if(!d||this.state===ot.WAITING_LEVEL||this.waitForLive(a)){this.level=r,this.state=ot.WAITING_LEVEL,this.startFragRequested=!1;return}const f=u.len,g=this.getMaxBufferLength(a.maxBitrate);if(f>=g)return;this.backtrackFragment&&this.backtrackFragment.start>u.end&&(this.backtrackFragment=null);const y=this.backtrackFragment?this.backtrackFragment.start:u.end;let v=this.getNextFragment(y,d);if(this.couldBacktrack&&!this.fragPrevious&&v&&un(v)&&this.fragmentTracker.getState(v)!==bn.OK){var b;const E=((b=this.backtrackFragment)!=null?b:v).sn-d.startSN,D=d.fragments[E-1];D&&v.cc===D.cc&&(v=D,this.fragmentTracker.removeFragment(D))}else this.backtrackFragment&&u.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,y)){if(!v.gap){const E=this.audioOnly&&!this.altAudio?As.AUDIO:As.VIDEO,D=(E===As.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;D&&this.afterBufferFlushed(D,E,$t.MAIN)}v=this.getNextFragmentLoopLoading(v,d,u,$t.MAIN,g)}v&&(v.initSegment&&!v.initSegment.data&&!this.bitrateTest&&(v=v.initSegment),this.loadFragment(v,a,y))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===bn.NOT_LOADED||n===bn.PARTIAL?un(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,$t.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const u=this.getMainFwdBufferInfo();if(!u||u.len=a-t.maxFragLookUpTolerance&&r<=u;if(n!==null&&i.duration>n&&(r{this.hls&&this.hls.trigger($.AUDIO_TRACK_SWITCHED,t)}),i.trigger($.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger($.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=V0(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,r,a=!1;for(const u in i){const c=i[u];if(c.id==="main"){if(r=u,n=c,u==="video"){const d=i[u];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,r=i.type===$t.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===ot.PARSED&&(this.state=ot.IDLE);return}const u=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*u.total/(u.buffering.end-u.loading.first)),un(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const a=this.media;a&&(!this._hasEnoughToStart&&Ai.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=ot.ERROR;return}switch(t.details){case Oe.FRAG_GAP:case Oe.FRAG_PARSING_ERROR:case Oe.FRAG_DECRYPT_ERROR:case Oe.FRAG_LOAD_ERROR:case Oe.FRAG_LOAD_TIMEOUT:case Oe.KEY_LOAD_ERROR:case Oe.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($t.MAIN,t);break;case Oe.LEVEL_LOAD_ERROR:case Oe.LEVEL_LOAD_TIMEOUT:case Oe.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===ot.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Hi.LEVEL&&(this.state=ot.IDLE);break;case Oe.BUFFER_ADD_CODEC_ERROR:case Oe.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case Oe.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case Oe.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=ot.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==As.AUDIO||!this.altAudio){const i=(t===As.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,$t.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(c{const{hls:n}=this,r=i?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=ot.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger($.FRAG_LOADED,i),r.bitrateTest=!1}).catch(i=>{this.state===ot.STOPPED||this.state===ot.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:n,chunkMeta:r}=e,a=this.getCurrentContext(r);if(!a){this.resetWhenMissingContext(r);return}const{frag:u,part:c,level:d}=a,{video:f,text:g,id3:y,initSegment:v}=n,{details:b}=d,T=this.altAudio?void 0:n.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=ot.PARSING,v){const E=v.tracks;if(E){const j=u.initSegment||u;if(this.unhandledEncryptionError(v,u))return;this._bufferInitSegment(d,E,j,r),i.trigger($.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:t,tracks:E})}const D=v.initPTS,O=v.timescale,R=this.initPTS[u.cc];if(Pt(D)&&(!R||R.baseTime!==D||R.timescale!==O)){const j=v.trackId;this.initPTS[u.cc]={baseTime:D,timescale:O,trackId:j},i.trigger($.INIT_PTS_FOUND,{frag:u,id:t,initPTS:D,timescale:O,trackId:j})}}if(f&&b){T&&f.type==="audiovideo"&&this.logMuxedErr(u);const E=b.fragments[u.sn-1-b.startSN],D=u.sn===b.startSN,O=!E||u.cc>E.cc;if(n.independent!==!1){const{startPTS:R,endPTS:j,startDTS:F,endDTS:G}=f;if(c)c.elementaryStreams[f.type]={startPTS:R,endPTS:j,startDTS:F,endDTS:G};else if(f.firstKeyFrame&&f.independent&&r.id===1&&!O&&(this.couldBacktrack=!0),f.dropped&&f.independent){const L=this.getMainFwdBufferInfo(),W=(L?L.end:this.getLoadPosition())+this.config.maxBufferHole,I=f.firstKeyFramePTS?f.firstKeyFramePTS:R;if(!D&&Wc0&&(u.gap=!0);u.setElementaryStreamInfo(f.type,R,j,F,G),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(f,u,c,r,D||O)}else if(D||O)u.gap=!0;else{this.backtrack(u);return}}if(T){const{startPTS:E,endPTS:D,startDTS:O,endDTS:R}=T;c&&(c.elementaryStreams[As.AUDIO]={startPTS:E,endPTS:D,startDTS:O,endDTS:R}),u.setElementaryStreamInfo(As.AUDIO,E,D,O,R),this.bufferFragmentData(T,u,c,r)}if(b&&y!=null&&y.samples.length){const E={id:t,frag:u,details:b,samples:y.samples};i.trigger($.FRAG_PARSING_METADATA,E)}if(b&&g){const E={id:t,frag:u,details:b,samples:g.samples};i.trigger($.FRAG_PARSING_USERDATA,E)}}logMuxedErr(e){this.warn(`${un(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==ot.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:a,audiovideo:u}=t;if(r){const d=e.audioCodec;let f=s0(r.codec,d);f==="mp4a"&&(f="mp4a.40.5");const g=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){f&&(f.indexOf("mp4a.40.5")!==-1?f="mp4a.40.2":f="mp4a.40.5");const y=r.metadata;y&&"channelCount"in y&&(y.channelCount||1)!==1&&g.indexOf("firefox")===-1&&(f="mp4a.40.5")}f&&f.indexOf("mp4a.40.5")!==-1&&g.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(f="mp4a.40.2",this.log(`Android: force audio codec to ${f}`)),d&&d!==f&&this.log(`Swapping manifest audio codec "${d}" for "${f}"`),r.levelCodec=f,r.id=$t.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${f||""}/${d||""}/${r.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=$t.MAIN;const d=a.codec;if(d?.length===4)switch(d){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}u&&(this.log(`Init audiovideo buffer, container:${u.container}, codecs[level/parsed]=[${e.codecs}/${u.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger($.BUFFER_CODECS,t),!this.hls)return;c.forEach(d=>{const g=t[d].initSegment;g!=null&&g.byteLength&&this.hls.trigger($.BUFFER_APPENDING,{type:d,data:g,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,$t.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e?.[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=ot.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ai.isBuffered(e,i)?t=this.getAppendedFrag(i):Ai.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,r=t.level;(!n||t.sn!==n.sn||n.level!==r)&&(this.fragPlaying=t,this.hls.trigger($.FRAG_CHANGED,{frag:t}),(!n||n.level!==r)&&this.hls.trigger($.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Pt(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Pt(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?Eu(null,i.fragments,t):null);if(n){const r=n.programDateTime;if(r!==null){const a=r+(t-n.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class N$ extends sa{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=Oe.KEY_LOAD_ERROR,i,n,r){return new bo({type:Jt.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,r=t.length;n{if(!this.emeController)return;a.setKeyFormat(u);const c=r0(u);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=ph(this.config);if(n.length)return this.emeController.getKeySystemAccess(n)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,d))}const a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const u=Gv(r);let c=this.keyIdToKeyInfo[u];if((i=c)!=null&&i.decryptdata.key)return r.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(n=c)!=null&&n.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:g}=f;return r.key=g.decryptdata.key,{frag:e,keyInfo:g}})}switch(this.log(`${this.keyIdToKeyInfo[u]?"Rel":"L"}oading${r.keyId?" keyId: "+Bn(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[u]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,Oe.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&(n=t.initSegment)!=null&&n.data){const a=Z6(t.initSegment.data);if(a.length){let u=a[0];u.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${Bn(u)}`),wl.setKeyIdForUri(e.decryptdata.uri,u)):(u=wl.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Bn(u)}`)),e.decryptdata.keyId=u}}if(!e.decryptdata.keyId&&!un(t))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(a=>(e.mediaKeySessionContext=a,i))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,r=new n(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,u)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=i.keyLoadPolicy.default,f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},g={onSuccess:(y,v,b,T)=>{const{frag:E,keyInfo:D}=b,O=Gv(D.decryptdata);if(!E.decryptdata||D!==this.keyIdToKeyInfo[O])return u(this.createKeyLoadError(E,Oe.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),T));D.decryptdata.key=E.decryptdata.key=new Uint8Array(y.data),E.keyLoader=null,D.loader=null,a({frag:E,keyInfo:D})},onError:(y,v,b,T)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.KEY_LOAD_ERROR,new Error(`HTTP Error ${y.code} loading key ${y.text}`),b,gs({url:c.url,data:void 0},y)))},onTimeout:(y,v,b)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),b))},onAbort:(y,v,b)=>{this.resetLoader(v),u(this.createKeyLoadError(t,Oe.INTERNAL_ABORTED,new Error("key loading aborted"),b))}};r.load(c,f,g)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const a=Gv(i.decryptdata)||n;delete this.keyIdToKeyInfo[a],r&&r.destroy()}}function Gv(s){if(s.keyFormat!==Un.FAIRPLAY){const e=s.keyId;if(e)return Bn(e)}return s.uri}function nA(s){const{type:e}=s;switch(e){case Hi.AUDIO_TRACK:return $t.AUDIO;case Hi.SUBTITLE_TRACK:return $t.SUBTITLE;default:return $t.MAIN}}function qv(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class O${constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on($.MANIFEST_LOADING,this.onManifestLoading,this),e.on($.LEVEL_LOADING,this.onLevelLoading,this),e.on($.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on($.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on($.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off($.MANIFEST_LOADING,this.onManifestLoading,this),e.off($.LEVEL_LOADING,this.onLevelLoading,this),e.off($.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off($.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off($.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,r=i||n,a=new r(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Hi.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:r,url:a,deliveryDirectives:u,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:r,responseType:"text",type:Hi.LEVEL,url:a,deliveryDirectives:u,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:Hi.AUDIO_TRACK,url:r,deliveryDirectives:a,levelOrTrack:u})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:a,track:u}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:Hi.SUBTITLE_TRACK,url:r,deliveryDirectives:a,levelOrTrack:u})}onLevelsUpdated(e,t){const i=this.loaders[Hi.LEVEL];if(i){const n=i.context;n&&!t.levels.some(r=>r===n.levelOrTrack)&&(i.abort(),delete this.loaders[Hi.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const d=this.hls.logger,f=n.context;if(f&&f.levelOrTrack===e.levelOrTrack&&(f.url===e.url||f.deliveryDirectives&&!e.deliveryDirectives)){f.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${f.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(e.type===Hi.MANIFEST?r=i.manifestLoadPolicy.default:r=Ss({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),Pt((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===Hi.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===Hi.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===Hi.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const f=d.partTarget,g=d.targetduration;if(f&&g){const y=Math.max(f*3,g*.8)*1e3;r=Ss({},r,{maxTimeToFirstByteMs:Math.min(y,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(y,r.maxTimeToFirstByteMs)})}}}const a=r.errorRetry||r.timeoutRetry||{},u={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},c={onSuccess:(d,f,g,y)=>{const v=this.getInternalLoader(g);this.resetInternalLoader(g.type);const b=d.data;f.parsing.start=performance.now(),za.isMediaPlaylist(b)||g.type!==Hi.MANIFEST?this.handleTrackOrLevelPlaylist(d,f,g,y||null,v):this.handleMasterPlaylist(d,f,g,y)},onError:(d,f,g,y)=>{this.handleNetworkError(f,g,!1,d,y)},onTimeout:(d,f,g)=>{this.handleNetworkError(f,g,!0,void 0,d)}};n.load(e,u,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const r=this.hls,a=e.data,u=qv(e,i),c=za.parseMasterPlaylist(a,u);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:d,levels:f,sessionData:g,sessionKeys:y,startTimeOffset:v,variableList:b}=c;this.variableList=b,f.forEach(O=>{const{unknownCodecs:R}=O;if(R){const{preferManagedMediaSource:j}=this.hls.config;let{audioCodec:F,videoCodec:G}=O;for(let L=R.length;L--;){const W=R[L];Uh(W,"audio",j)?(O.audioCodec=F=F?`${F},${W}`:W,Vc.audio[F.substring(0,4)]=2,R.splice(L,1)):Uh(W,"video",j)&&(O.videoCodec=G=G?`${G},${W}`:W,Vc.video[G.substring(0,4)]=2,R.splice(L,1))}}});const{AUDIO:T=[],SUBTITLES:E,"CLOSED-CAPTIONS":D}=za.parseMasterPlaylistMedia(a,u,c);T.length&&!T.some(R=>!R.url)&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new zs({}),bitrate:0,url:""})),r.trigger($.MANIFEST_LOADED,{levels:f,audioTracks:T,subtitles:E,captions:D,contentSteering:d,url:u,stats:t,networkDetails:n,sessionData:g,sessionKeys:y,startTimeOffset:v,variableList:b})}handleTrackOrLevelPlaylist(e,t,i,n,r){const a=this.hls,{id:u,level:c,type:d}=i,f=qv(e,i),g=Pt(c)?c:Pt(u)?u:0,y=nA(i),v=za.parseLevelPlaylist(e.data,f,g,y,0,this.variableList);if(d===Hi.MANIFEST){const b={attrs:new zs({}),bitrate:0,details:v,name:"",url:f};v.requestScheduled=t.loading.start+TL(v,0),a.trigger($.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:f,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=v,this.handlePlaylistLoaded(v,e,t,i,n,r)}handleManifestParsingError(e,t,i,n,r){this.hls.trigger($.ERROR,{type:Jt.NETWORK_ERROR,details:Oe.MANIFEST_PARSING_ERROR,fatal:t.type===Hi.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,i=!1,n,r){let a=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===Hi.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===Hi.AUDIO_TRACK||e.type===Hi.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const u=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let c=Oe.UNKNOWN,d=!1;const f=this.getInternalLoader(e);switch(e.type){case Hi.MANIFEST:c=i?Oe.MANIFEST_LOAD_TIMEOUT:Oe.MANIFEST_LOAD_ERROR,d=!0;break;case Hi.LEVEL:c=i?Oe.LEVEL_LOAD_TIMEOUT:Oe.LEVEL_LOAD_ERROR,d=!1;break;case Hi.AUDIO_TRACK:c=i?Oe.AUDIO_TRACK_LOAD_TIMEOUT:Oe.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case Hi.SUBTITLE_TRACK:c=i?Oe.SUBTITLE_TRACK_LOAD_TIMEOUT:Oe.SUBTITLE_LOAD_ERROR,d=!1;break}f&&this.resetInternalLoader(e.type);const g={type:Jt.NETWORK_ERROR,details:c,fatal:d,url:e.url,loader:f,context:e,error:u,networkDetails:t,stats:r};if(n){const y=t?.url||e.url;g.response=gs({url:y,data:void 0},n)}this.hls.trigger($.ERROR,g)}handlePlaylistLoaded(e,t,i,n,r,a){const u=this.hls,{type:c,level:d,levelOrTrack:f,id:g,groupId:y,deliveryDirectives:v}=n,b=qv(t,n),T=nA(n);let E=typeof n.level=="number"&&T===$t.MAIN?d:void 0;const D=e.playlistParsingError;if(D){if(this.hls.logger.warn(`${D} ${e.url}`),!u.config.ignorePlaylistParsingErrors){u.trigger($.ERROR,{type:Jt.NETWORK_ERROR,details:Oe.LEVEL_PARSING_ERROR,fatal:!1,url:b,error:D,reason:D.message,response:t,context:n,level:E,parent:T,networkDetails:r,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const O=e.playlistParsingError=new Error("No Segments found in Playlist");u.trigger($.ERROR,{type:Jt.NETWORK_ERROR,details:Oe.LEVEL_EMPTY_ERROR,fatal:!1,url:b,error:O,reason:O.message,response:t,context:n,level:E,parent:T,networkDetails:r,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case Hi.MANIFEST:case Hi.LEVEL:if(E){if(!f)E=0;else if(f!==u.levels[E]){const O=u.levels.indexOf(f);O>-1&&(E=O)}}u.trigger($.LEVEL_LOADED,{details:e,levelInfo:f||u.levels[0],level:E||0,id:g||0,stats:i,networkDetails:r,deliveryDirectives:v,withoutMultiVariant:c===Hi.MANIFEST});break;case Hi.AUDIO_TRACK:u.trigger($.AUDIO_TRACK_LOADED,{details:e,track:f,id:g||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:v});break;case Hi.SUBTITLE_TRACK:u.trigger($.SUBTITLE_TRACK_LOADED,{details:e,track:f,id:g||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:v});break}}}class Ur{static get version(){return Hh}static isMSESupported(){return bR()}static isSupported(){return D$()}static getMediaSource(){return Cl()}static get Events(){return $}static get MetadataSchema(){return Br}static get ErrorTypes(){return Jt}static get ErrorDetails(){return Oe}static get DefaultConfig(){return Ur.defaultConfig?Ur.defaultConfig:y$}static set DefaultConfig(e){Ur.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c1,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=j6(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=x$(Ur.DefaultConfig,e,t);this.userConfig=e,i.progressive&&b$(i,t);const{abrController:n,bufferController:r,capLevelController:a,errorController:u,fpsController:c}=i,d=new u(this),f=this.abrController=new n(this),g=new MU(this),y=i.interstitialsController,v=y?this.interstitialsController=new y(this,Ur):null,b=this.bufferController=new r(this,g),T=this.capLevelController=new a(this),E=new c(this),D=new O$(this),O=i.contentSteeringController,R=O?new O(this):null,j=this.levelController=new C$(this,R),F=new A$(this),G=new N$(this.config,this.logger),L=this.streamController=new I$(this,g,G),W=this.gapController=new E$(this,g);T.setStreamController(L),E.setStreamController(L);const I=[D,j,L];v&&I.splice(1,0,v),R&&I.splice(1,0,R),this.networkControllers=I;const N=[f,b,W,T,E,F,g];this.audioTrackController=this.createController(i.audioTrackController,I);const X=i.audioStreamController;X&&I.push(this.audioStreamController=new X(this,g,G)),this.subtitleTrackController=this.createController(i.subtitleTrackController,I);const V=i.subtitleStreamController;V&&I.push(this.subtititleStreamController=new V(this,g,G)),this.createController(i.timelineController,N),G.emeController=this.emeController=this.createController(i.emeController,N),this.cmcdController=this.createController(i.cmcdController,N),this.latencyController=this.createController(k$,N),this.coreComponents=N,I.push(d);const Y=d.onErrorOut;typeof Y=="function"&&this.on($.ERROR,Y,d),this.on($.MANIFEST_LOADED,D.onManifestLoaded,D)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===$.ERROR;this.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger($.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger($.ERROR,{type:Jt.OTHER_ERROR,details:Oe.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger($.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger($.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger($.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=Jb.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger($.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", ":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[$t.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[$t.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[$t.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=E9()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){xU(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let r=n;r--;){const a=e[r].attrs["HDCP-LEVEL"];if(a&&a<=i)return r}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=aL(t);return nL(e,i,navigator.mediaCapabilities)}}Ur.defaultConfig=void 0;function rA(s,e){const t=s.includes("?")?"&":"?";return`${s}${t}v=${e}`}function TR({src:s,muted:e=x0,className:t}){const i=_.useRef(null),[n,r]=_.useState(!1),[a,u]=_.useState(null),[c,d]=_.useState(1),f=_.useMemo(()=>rA(s,c),[s,c]);return _.useEffect(()=>{let g=!1,y=null,v=null,b=null;const T=i.current;if(!T)return;const E=T;r(!1),u(null),Nh(E,{muted:e});const D=()=>{v&&window.clearTimeout(v),b&&window.clearInterval(b),v=null,b=null},O=()=>{g||(D(),d(G=>G+1))};async function R(){const G=Date.now();for(;!g&&Date.now()-G<9e4;){try{const L=rA(s,Date.now()),W=await fetch(L,{cache:"no-store"});if(W.status===403)return{ok:!1,reason:"private"};if(W.status===404)return{ok:!1,reason:"offline"};if(W.ok&&(await W.text()).includes("#EXTINF"))return{ok:!0}}catch{}await new Promise(L=>setTimeout(L,500))}return{ok:!1}}async function j(){const G=await R();if(!g){if(!G.ok){if(G.reason==="private"||G.reason==="offline"){u(G.reason),r(!0);return}window.setTimeout(()=>{g||O()},800);return}if(E.canPlayType("application/vnd.apple.mpegurl")){E.pause(),E.removeAttribute("src"),E.load(),E.src=f,E.load(),E.play().catch(()=>{});let L=Date.now(),W=-1;const I=()=>{E.currentTime>W+.01&&(W=E.currentTime,L=Date.now())},N=()=>{v||(v=window.setTimeout(()=>{v=null,!g&&Date.now()-L>3500&&O()},800))};return E.addEventListener("timeupdate",I),E.addEventListener("waiting",N),E.addEventListener("stalled",N),E.addEventListener("error",N),b=window.setInterval(()=>{g||!E.paused&&Date.now()-L>6e3&&O()},2e3),()=>{E.removeEventListener("timeupdate",I),E.removeEventListener("waiting",N),E.removeEventListener("stalled",N),E.removeEventListener("error",N)}}if(!Ur.isSupported()){r(!0);return}y=new Ur({lowLatencyMode:!0,liveSyncDurationCount:2,maxBufferLength:8}),y.on(Ur.Events.ERROR,(L,W)=>{if(y&&W.fatal){if(W.type===Ur.ErrorTypes.NETWORK_ERROR){y.startLoad();return}if(W.type===Ur.ErrorTypes.MEDIA_ERROR){y.recoverMediaError();return}O()}}),y.loadSource(f),y.attachMedia(E),y.on(Ur.Events.MANIFEST_PARSED,()=>{E.play().catch(()=>{})})}}let F;return(async()=>{const G=await j();typeof G=="function"&&(F=G)})(),()=>{g=!0,D();try{F?.()}catch{}try{y?.destroy()}catch{}}},[s,e,f]),n?p.jsx("div",{className:"text-xs text-gray-400 italic",children:a==="private"?"Private":a==="offline"?"Offline":"–"}):p.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const g=i.current;g&&(g.muted=!1,g.play().catch(()=>{}))}})}const Xr=s=>(s||"").replaceAll("\\","/").split("/").pop()||"",_1=s=>s.startsWith("HOT ")?s.slice(4):s,M$=s=>(s||"").trim().toLowerCase(),P$=s=>{const e=String(s??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(r=>r.trim()).filter(Boolean),i=new Set,n=[];for(const r of t){const a=r.toLowerCase();i.has(a)||(i.add(a),n.push(r))}return n.sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})),n};function F$(s){if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`}function B$(s){if(typeof s!="number"||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function aA(s){if(!s)return"—";const e=s instanceof Date?s:new Date(s),t=e.getTime();return Number.isFinite(t)?e.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}const Km=(...s)=>{for(const e of s){const t=typeof e=="string"?Number(e):e;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}return null};function U$(s){if(!s||!Number.isFinite(s))return"—";const e=s>=10?0:2;return`${s.toFixed(e)} fps`}function j$(s){return!s||!Number.isFinite(s)?"—":`${Math.round(s)}p`}function $$(s){const e=Xr(s||""),t=_1(e);if(!t)return null;const n=t.replace(/\.[^.]+$/,"").match(/_(\d{1,2})_(\d{1,2})_(\d{4})__(\d{1,2})-(\d{2})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),a=Number(n[2]),u=Number(n[3]),c=Number(n[4]),d=Number(n[5]),f=Number(n[6]);return[r,a,u,c,d,f].every(g=>Number.isFinite(g))?new Date(u,r-1,a,c,d,f):null}const H$=s=>{const e=Xr(s||""),t=_1(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i},z$=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function yo(...s){return s.filter(Boolean).join(" ")}function V$(s){const[e,t]=_.useState(!1);return _.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(s),n=()=>t(i.matches);return n(),i.addEventListener?i.addEventListener("change",n):i.addListener(n),()=>{i.removeEventListener?i.removeEventListener("change",n):i.removeListener(n)}},[s]),e}function G$(s){!s||s.__absTimelineShimInstalled||(s.__absTimelineShimInstalled=!0,s.__origCurrentTime=s.currentTime.bind(s),s.__origDuration=s.duration.bind(s),s.__setRelativeTime=e=>{try{s.__origCurrentTime(Math.max(0,e||0))}catch{}},s.currentTime=function(e){const t=Number(this.__timeOffsetSec??0)||0;if(typeof e=="number"&&Number.isFinite(e)){const n=Math.max(0,e);return typeof this.__serverSeekAbs=="function"?(this.__serverSeekAbs(n),n):this.__origCurrentTime(Math.max(0,n-t))}const i=Number(this.__origCurrentTime()??0)||0;return Math.max(0,t+i)},s.duration=function(){const e=Number(this.__fullDurationSec??0)||0;if(e>0)return e;const t=Number(this.__timeOffsetSec??0)||0,i=Number(this.__origDuration()??0)||0;return Math.max(0,t+i)})}function q$({job:s,expanded:e,onClose:t,onToggleExpand:i,modelKey:n,modelsByKey:r,isHot:a=!1,isFavorite:u=!1,isLiked:c=!1,isWatching:d=!1,onKeep:f,onDelete:g,onToggleHot:y,onToggleFavorite:v,onToggleLike:b,onToggleWatch:T,onStopJob:E,startMuted:D=zM,startAtSec:O=0}){const R=_.useMemo(()=>Xr(s.output?.trim()||"")||s.id,[s.output,s.id]),j=_.useMemo(()=>Xr(s.output?.trim()||""),[s.output]),F=_.useMemo(()=>Xr(s.output?.trim()||""),[s.output]),G=_.useMemo(()=>B$(z$(s)),[s]),L=s,[W,I]=_.useState(()=>Number(s?.meta?.durationSeconds)||Number(s?.durationSeconds)||0),[N,X]=_.useState(()=>s.status==="running"),[V,Y]=_.useState(()=>({h:0,fps:null})),ne=s.status==="running",[ie,K]=_.useState(!1),q=ne&&ie,Z=_.useMemo(()=>(F||"").replace(/\.[^.]+$/,""),[F]),te=_.useMemo(()=>ne?s.id:Z||s.id,[ne,s.id,Z]);_.useEffect(()=>{if(ne||W>0)return;const oe=Xr(s.output?.trim()||"");if(!oe)return;let Se=!0;const ct=new AbortController;return(async()=>{try{const ue=au(`/api/record/done/meta?file=${encodeURIComponent(oe)}`),fe=await Sv(ue,{signal:ct.signal,cache:"no-store"});if(!fe.ok)return;const ge=await fe.json(),Be=Number(ge?.durationSeconds||ge?.meta?.durationSeconds||0)||0;if(!Se||Be<=0)return;I(Be);const Ee=Re.current;if(Ee&&!Ee.isDisposed?.())try{Ee.__fullDurationSec=Be,Ee.trigger?.("durationchange"),Ee.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{Se=!1,ct.abort()}},[ne,W,s.output]);const le=j.startsWith("HOT "),z=_.useMemo(()=>{const oe=(n||"").trim();return oe||H$(s.output)},[n,s.output]),re=_.useMemo(()=>_1(j),[j]),Q=_.useMemo(()=>{const oe=Number(W||0)||0;return oe>0?F$(oe*1e3):"—"},[W]),pe=_.useMemo(()=>{const oe=$$(s.output);if(oe)return aA(oe);const Se=L.startedAt??L.endedAt??L.createdAt??L.fileCreatedAt??L.ctime??null,ct=Se?new Date(Se):null;return aA(ct&&Number.isFinite(ct.getTime())?ct:null)},[s.output,L.startedAt,L.endedAt,L.createdAt,L.fileCreatedAt,L.ctime]),be=_.useMemo(()=>M$((n||z||"").trim()),[n,z]),ve=_.useMemo(()=>{const oe=r?.[be];return P$(oe?.tags)},[r,be]),we=_.useMemo(()=>au(`/api/preview?id=${encodeURIComponent(te)}&file=thumbs.webp`),[te]),He=_.useMemo(()=>au(`/api/preview?id=${encodeURIComponent(te)}&play=1&file=index_hq.m3u8`),[te]),[Fe,Ze]=_.useState(we);_.useEffect(()=>{Ze(we)},[we]);const De=_.useMemo(()=>Km(V.h,L.videoHeight,L.height,L.meta?.height),[V.h,L.videoHeight,L.height,L.meta?.height]),Ye=_.useMemo(()=>Km(V.fps,L.fps,L.frameRate,L.meta?.fps,L.meta?.frameRate),[V.fps,L.fps,L.frameRate,L.meta?.fps,L.meta?.frameRate]),[wt,vt]=_.useState(null),Ge=_.useMemo(()=>j$(wt??De),[wt,De]),ke=_.useMemo(()=>U$(Ye),[Ye]);_.useEffect(()=>{const oe=Se=>Se.key==="Escape"&&t();return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[t]);const ut=_.useMemo(()=>{const oe=`/api/preview?id=${encodeURIComponent(te)}&file=index_hq.m3u8&play=1`;return au(ne?`${oe}&t=${Date.now()}`:oe)},[te,ne]);_.useEffect(()=>{if(!ne){K(!1);return}let oe=!0;const Se=new AbortController;return K(!1),(async()=>{for(let ue=0;ue<120&&oe&&!Se.signal.aborted;ue++){try{const fe=await Sv(ut,{method:"GET",cache:"no-store",signal:Se.signal,headers:{"cache-control":"no-cache"}});if(fe.ok){const ge=await fe.text(),Be=ge.includes("#EXTM3U"),Ee=/#EXTINF:/i.test(ge)||/\.ts(\?|$)/i.test(ge)||/\.m4s(\?|$)/i.test(ge);if(Be&&Ee){oe&&K(!0);return}}}catch{}await new Promise(fe=>setTimeout(fe,500))}})(),()=>{oe=!1,Se.abort()}},[ne,ut]);const rt=_.useCallback(oe=>{const Se=new URLSearchParams;return oe.file&&Se.set("file",oe.file),oe.id&&Se.set("id",oe.id),au(`/api/record/video?${Se.toString()}`)},[]),Je=_.useMemo(()=>{if(ne)return{src:"",type:""};if(!N)return{src:"",type:""};const oe=Xr(s.output?.trim()||"");if(oe){const Se=oe.toLowerCase().split(".").pop(),ct=Se==="mp4"?"video/mp4":Se==="ts"?"video/mp2t":"application/octet-stream";return{src:rt({file:oe}),type:ct}}return{src:rt({id:s.id}),type:"video/mp4"}},[ne,N,s.output,s.id,rt]),at=_.useRef(null),Re=_.useRef(null),ze=_.useRef(null),[Ue,de]=_.useState(!1),qe=_.useCallback(()=>{const oe=Re.current;if(!oe||oe.isDisposed?.())return;const Se=typeof oe.videoHeight=="function"?oe.videoHeight():0;typeof Se=="number"&&Se>0&&Number.isFinite(Se)&&vt(Se)},[]),ht=_.useCallback(()=>{try{const oe=Re.current?.tech?.(!0)?.el?.()||Re.current?.el?.()?.querySelector?.("video.vjs-tech")||ze.current;if(!oe||!(oe instanceof HTMLVideoElement))return null;const Se=Number(oe.videoWidth||0),ct=Number(oe.videoHeight||0);if(!Number.isFinite(Se)||!Number.isFinite(ct)||Se<=0||ct<=0)return null;let ue=Is.current;ue||(ue=document.createElement("canvas"),Is.current=ue);const ge=Math.min(1,640/Se),Be=Math.max(1,Math.round(Se*ge)),Ee=Math.max(1,Math.round(ct*ge));ue.width!==Be&&(ue.width=Be),ue.height!==Ee&&(ue.height=Ee);const et=ue.getContext("2d",{alpha:!1});return et?(et.drawImage(oe,0,0,Be,Ee),ue.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),tt=_.useMemo(()=>Xr(s.output?.trim()||"")||s.id,[s.output,s.id]),At=_.useMemo(()=>{const oe=Number(O);return Number.isFinite(oe)&&oe>=0?oe:0},[O]),ft=_.useRef("");_.useEffect(()=>{if(ne){X(!0);return}const oe=Xr(s.output?.trim()||"");if(!oe){X(!0);return}let Se=!0;const ct=new AbortController;return X(!1),(async()=>{for(let ue=0;ue<80&&Se&&!ct.signal.aborted;ue++){try{const fe=au(`/api/record/done/meta?file=${encodeURIComponent(oe)}`),ge=await Sv(fe,{signal:ct.signal,cache:"no-store"});if(ge.ok){const Be=await ge.json(),Ee=!!Be?.metaExists,et=Number(Be?.durationSeconds||0)||0,pt=Number(Be?.height||0)||0,mt=Number(Be?.fps||0)||0;if(et>0){I(et);const yt=Re.current;if(yt&&!yt.isDisposed?.())try{yt.__fullDurationSec=et,yt.trigger?.("durationchange"),yt.trigger?.("timeupdate")}catch{}}if(pt>0&&Y({h:pt,fps:mt>0?mt:null}),Ee){X(!0);return}}}catch{}await new Promise(fe=>setTimeout(fe,250))}Se&&X(!0)})(),()=>{Se=!1,ct.abort()}},[ne,tt,s.output]);const[,Et]=_.useState(0);_.useEffect(()=>{if(typeof window>"u")return;const oe=window.visualViewport;if(!oe)return;const Se=()=>Et(ct=>ct+1);return Se(),oe.addEventListener("resize",Se),oe.addEventListener("scroll",Se),window.addEventListener("resize",Se),window.addEventListener("orientationchange",Se),()=>{oe.removeEventListener("resize",Se),oe.removeEventListener("scroll",Se),window.removeEventListener("resize",Se),window.removeEventListener("orientationchange",Se)}},[]);const[Lt,Rt]=_.useState(30),[qt,Wt]=_.useState(null),yi=!e,Ct=V$("(min-width: 640px)"),It=yi&&Ct,oi="player_window_v1",wi=420,Di=280,Yt=12,Nt=320,H=200;_.useEffect(()=>{if(!Ue)return;const oe=Re.current;if(!oe||oe.isDisposed?.())return;const Se=oe.el();if(!Se)return;const ct=Se.querySelector(".vjs-control-bar");if(!ct)return;const ue=()=>{const ge=Math.round(ct.getBoundingClientRect().height||0);ge>0&&Rt(ge)};ue();let fe=null;return typeof ResizeObserver<"u"&&(fe=new ResizeObserver(ue),fe.observe(ct)),window.addEventListener("resize",ue),()=>{window.removeEventListener("resize",ue),fe?.disconnect()}},[Ue,e]),_.useEffect(()=>de(!0),[]),_.useEffect(()=>{let oe=document.getElementById("player-root");oe||(oe=document.createElement("div"),oe.id="player-root");let Se=null;if(Ct){const ct=Array.from(document.querySelectorAll("dialog[open]"));Se=ct.length?ct[ct.length-1]:null}Se=Se??document.body,Se.appendChild(oe),oe.style.position="relative",oe.style.zIndex="2147483647",Wt(oe)},[Ct]),_.useEffect(()=>{const oe=Re.current;if(!oe||oe.isDisposed?.()||ne||(G$(oe),!Xr(s.output?.trim()||"")))return;const ct=Number(W||0)||0;return ct>0&&(oe.__fullDurationSec=ct),oe.__serverSeekAbs=ue=>{const fe=Math.max(0,Number(ue)||0);try{oe.__origCurrentTime?.(fe);try{oe.trigger?.("timeupdate")}catch{}}catch{try{oe.currentTime?.(fe)}catch{}}},()=>{try{delete oe.__serverSeekAbs}catch{}}},[s.output,ne]),_.useLayoutEffect(()=>{if(!Ue||!at.current||Re.current||ne||!N)return;const oe=document.createElement("video");oe.className="video-js vjs-big-play-centered w-full h-full",oe.setAttribute("playsinline","true"),at.current.appendChild(oe),ze.current=oe;const Se=Pe(oe,{autoplay:!0,muted:D,controls:!0,preload:"metadata",playsinline:!0,responsive:!0,fluid:!1,fill:!0,liveui:!1,html5:{vhs:{lowLatencyMode:!0}},inactivityTimeout:0,controlBar:{skipButtons:{backward:10,forward:10},volumePanel:{inline:!1},children:["skipBackward","playToggle","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","spacer","playbackRateMenuButton","fullscreenToggle"]},playbackRates:[.5,1,1.25,1.5,2]});return Re.current=Se,Se.one("loadedmetadata",()=>{qe()}),Se.userActive(!0),Se.on("userinactive",()=>Se.userActive(!0)),()=>{try{Re.current&&(Re.current.dispose(),Re.current=null)}finally{ze.current&&(ze.current.remove(),ze.current=null)}}},[Ue,D,ne,N,De,qe]),_.useEffect(()=>{const oe=Re.current;if(!oe||oe.isDisposed?.())return;const Se=oe.el();Se&&Se.classList.toggle("is-live-download",!!q)},[q]);const U=_.useCallback(()=>{const oe=Re.current;if(!(!oe||oe.isDisposed?.())){try{oe.pause(),oe.reset?.()}catch{}try{oe.src({src:"",type:"video/mp4"}),oe.load?.()}catch{}}},[]),ee=_.useCallback(oe=>{const Se=Re.current;if(!Se||Se.isDisposed?.())return;const ct=Math.max(0,Number(oe)||0);try{const ue=Number(Se.duration?.()??0),fe=Number.isFinite(ue)&&ue>0?Math.max(0,ue-.05):ct;Se.currentTime(Math.min(ct,fe)),Se.trigger?.("timeupdate")}catch{try{Se.currentTime(ct)}catch{}}},[]);_.useEffect(()=>{if(!Ue)return;if(!ne&&!N){U();return}const oe=Re.current;if(!oe||oe.isDisposed?.())return;const Se=oe.currentTime()||0;if(oe.muted(D),!Je.src){try{oe.pause(),oe.reset?.(),oe.error(null)}catch{}return}oe.__timeOffsetSec=0;const ct=Number(W||0)||0;oe.__fullDurationSec=ct;const ue=String(oe.currentSrc?.()||"");if(ft.current="",ue&&ue===Je.src){const ge=oe.play?.();ge&&typeof ge.catch=="function"&&ge.catch(()=>{});return}oe.src({src:Je.src,type:Je.type});const fe=()=>{const ge=oe.play?.();ge&&typeof ge.catch=="function"&&ge.catch(()=>{})};oe.one("loadedmetadata",()=>{if(oe.isDisposed?.())return;qe();try{const Be=Number(W||0)||0;Be>0&&(oe.__fullDurationSec=Be)}catch{}try{oe.playbackRate(1)}catch{}const ge=/mpegurl/i.test(Je.type);if(Se>0&&!ge)try{const Be=Number(oe.__timeOffsetSec??0)||0,Ee=Math.max(0,Se-Be);oe.__setRelativeTime?.(Ee)}catch{}try{oe.trigger?.("timeupdate")}catch{}fe()}),fe()},[Ue,ne,N,Je.src,Je.type,D,qe,W,U]),_.useEffect(()=>{if(!Ue||ne||!N||!Je.src)return;const oe=Re.current;if(!oe||oe.isDisposed?.())return;if(!(At>0)){ft.current="";return}const Se=`${tt}|${Je.src}|${At.toFixed(3)}`;if(ft.current===Se)return;let ct=!1;const ue=()=>{if(ct)return;const Ee=Re.current;if(!Ee||Ee.isDisposed?.())return;const et=String(Ee.currentSrc?.()||"");if(!et||et!==Je.src)return;const pt=Ee.tech?.(!0)?.el?.()||Ee.el?.()?.querySelector?.("video.vjs-tech");if(!((pt instanceof HTMLVideoElement?Number(pt.readyState||0):0)<1)){ee(At),ft.current=Se;try{const yt=Ee.play?.();yt&&typeof yt.catch=="function"&&yt.catch(()=>{})}catch{}}};if(ue(),ft.current===Se)return;const fe=()=>ue();oe.one?.("loadedmetadata",fe),oe.one?.("canplay",fe),oe.one?.("durationchange",fe);const ge=window.setTimeout(ue,0),Be=window.setTimeout(ue,120);return()=>{ct=!0,window.clearTimeout(ge),window.clearTimeout(Be);try{oe.off?.("loadedmetadata",fe)}catch{}try{oe.off?.("canplay",fe)}catch{}try{oe.off?.("durationchange",fe)}catch{}}},[Ue,ne,N,Je.src,tt,At,ee]),_.useEffect(()=>{if(!Ue)return;const oe=Re.current;if(!oe||oe.isDisposed?.())return;const Se=()=>{s.status==="running"&&K(!1)};return oe.on("error",Se),()=>{try{oe.off("error",Se)}catch{}}},[Ue,s.status]),_.useEffect(()=>{const oe=Re.current;!oe||oe.isDisposed?.()||queueMicrotask(()=>oe.trigger("resize"))},[e]),_.useEffect(()=>{const oe=Se=>{const ue=(Se.detail?.file??"").trim();if(!ue)return;const fe=Xr(s.output?.trim()||"");fe&&fe===ue&&U()};return window.addEventListener("player:release",oe),()=>window.removeEventListener("player:release",oe)},[s.output,U]),_.useEffect(()=>{const oe=Se=>{const ue=(Se.detail?.file??"").trim();if(!ue)return;const fe=Xr(s.output?.trim()||"");fe&&fe===ue&&(U(),t())};return window.addEventListener("player:close",oe),()=>window.removeEventListener("player:close",oe)},[s.output,U,t]);const Te=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const oe=window.visualViewport;if(oe&&Number.isFinite(oe.width)&&Number.isFinite(oe.height)){const fe=Math.floor(oe.width),ge=Math.floor(oe.height),Be=Math.floor(oe.offsetLeft||0),Ee=Math.floor(oe.offsetTop||0),et=Math.max(0,Math.floor(window.innerHeight-(oe.height+oe.offsetTop)));return{w:fe,h:ge,ox:Be,oy:Ee,bottomInset:et}}const Se=document.documentElement,ct=Se?.clientWidth||window.innerWidth,ue=Se?.clientHeight||window.innerHeight;return{w:ct,h:ue,ox:0,oy:0,bottomInset:0}},Me=_.useRef(null);_.useEffect(()=>{if(typeof window>"u")return;const{w:oe,h:Se}=Te();Me.current={w:oe,h:Se}},[]);const gt=_.useCallback(()=>{const oe=s,Se=Km(Re.current?.videoWidth?.(),oe.videoWidth,oe.width,oe.meta?.width)??0,ct=Km(wt,Re.current?.videoHeight?.(),oe.videoHeight,oe.height,oe.meta?.height)??0;return Se>0&&ct>0?Se/ct:16/9},[s,wt]),Tt=_.useCallback(oe=>{if(typeof window>"u")return oe;const Se=gt(),ct=30,{w:ue,h:fe}=Te(),ge=ue-Yt*2,Be=Math.max(1,fe-Yt*2-ct),Ee=Math.max(1,H-ct);let et=Math.max(Nt,Math.min(oe.w,ge)),pt=et/Se;ptBe&&(pt=Be,et=pt*Se),et>ge&&(et=ge,pt=et/Se);const mt=Math.round(pt+ct),yt=Math.max(Yt,Math.min(oe.x,ue-et-Yt)),Dt=Math.max(Yt,Math.min(oe.y,fe-mt-Yt));return{x:yt,y:Dt,w:Math.round(et),h:mt}},[gt]),gi=_.useCallback(()=>{if(typeof window>"u")return{x:Yt,y:Yt,w:wi,h:Di};try{const Be=window.localStorage.getItem(oi);if(Be){const Ee=JSON.parse(Be);if(typeof Ee.x=="number"&&typeof Ee.y=="number"&&typeof Ee.w=="number"&&typeof Ee.h=="number")return Tt({x:Ee.x,y:Ee.y,w:Ee.w,h:Ee.h})}}catch{}const{w:oe,h:Se}=Te(),ct=wi,ue=Di,fe=Math.max(Yt,oe-ct-Yt),ge=Math.max(Yt,Se-ue-Yt);return Tt({x:fe,y:ge,w:ct,h:ue})},[Tt]),[si,xi]=_.useState(()=>gi()),Ri=It&&si.w<380,hi=_.useCallback(oe=>{if(!(typeof window>"u"))try{window.localStorage.setItem(oi,JSON.stringify(oe))}catch{}},[]),li=_.useRef(si);_.useEffect(()=>{li.current=si},[si]),_.useEffect(()=>{It&&xi(gi())},[It,gi]),_.useEffect(()=>{if(!It)return;const oe=()=>{const Se=Me.current,{w:ct,h:ue}=Te();xi(fe=>{if(!Se)return Tt(fe);const ge=24,Be=fe.x-Yt,Ee=Se.w-Yt-(fe.x+fe.w),et=Se.h-Yt-(fe.y+fe.h),pt=Math.abs(Be)<=ge,mt=Math.abs(Ee)<=ge,yt=Math.abs(et)<=ge;let Dt=Tt(fe);return yt&&(Dt={...Dt,y:Math.max(Yt,ue-Dt.h-Yt)}),mt?Dt={...Dt,x:Math.max(Yt,ct-Dt.w-Yt)}:pt&&(Dt={...Dt,x:Yt}),Tt(Dt)}),Me.current={w:ct,h:ue}};return Me.current=(()=>{const{w:Se,h:ct}=Te();return{w:Se,h:ct}})(),window.addEventListener("resize",oe),()=>window.removeEventListener("resize",oe)},[It,Tt]);const Kt=_.useRef(null);_.useEffect(()=>{const oe=Re.current;if(!(!oe||oe.isDisposed?.()))return Kt.current!=null&&cancelAnimationFrame(Kt.current),Kt.current=requestAnimationFrame(()=>{Kt.current=null;try{oe.trigger("resize")}catch{}}),()=>{Kt.current!=null&&(cancelAnimationFrame(Kt.current),Kt.current=null)}},[It,si.w,si.h]);const[Si,jt]=_.useState(!1),[ui,ei]=_.useState(!1),[ti,Ui]=_.useState(null),[rs,Ks]=_.useState(null),Is=_.useRef(null),qi=_.useRef(null),_i=_.useRef(null),Ns=_.useRef(null),Ji=_.useCallback(oe=>{const{w:Se,h:ct}=Te(),ue=Yt,fe=Se-oe.w-Yt,ge=ct-oe.h-Yt,Ee=oe.x+oe.w/2{const Se=Ns.current;if(!Se)return;const ct=oe.clientX-Se.sx,ue=oe.clientY-Se.sy,fe=Se.start,ge=Tt({x:fe.x+ct,y:fe.y+ue,w:fe.w,h:fe.h});_i.current={x:ge.x,y:ge.y},Ui(Ji(ge)),qi.current==null&&(qi.current=requestAnimationFrame(()=>{qi.current=null;const Be=_i.current;Be&&xi(Ee=>({...Ee,x:Be.x,y:Be.y}))}))},[Tt,Ji]),Ms=_.useCallback(()=>{Ns.current&&(ei(!1),Ui(null),qi.current!=null&&(cancelAnimationFrame(qi.current),qi.current=null),Ns.current=null,window.removeEventListener("pointermove",as),window.removeEventListener("pointerup",Ms),xi(oe=>{const Se=Ji(Tt(oe));return queueMicrotask(()=>hi(Se)),Se}))},[as,Ji,Tt,hi]),ji=_.useCallback(oe=>{if(!It||Si||oe.button!==0)return;oe.preventDefault(),oe.stopPropagation();const Se=li.current;Ns.current={sx:oe.clientX,sy:oe.clientY,start:Se},ei(!0);const ct=ht();Ks(ct),Ui(Ji(Se)),window.addEventListener("pointermove",as),window.addEventListener("pointerup",Ms)},[It,Si,as,Ms,Ji,ht]),ds=_.useRef(null),Ki=_.useRef(null),Mi=_.useRef(null),ss=_.useCallback(oe=>{const Se=Mi.current;if(!Se)return;const ct=oe.clientX-Se.sx,ue=oe.clientY-Se.sy,fe=Se.ratio,ge=Se.dir.includes("w"),Be=Se.dir.includes("e"),Ee=Se.dir.includes("n"),et=Se.dir.includes("s");let pt=Se.start.w,mt=Se.start.h,yt=Se.start.x,Dt=Se.start.y;const{w:ri,h:St}=Te(),bt=24,Ht=Se.start.x+Se.start.w,bi=Se.start.y+Se.start.h,Vt=Math.abs(ri-Yt-Ht)<=bt,Qt=Math.abs(St-Yt-bi)<=bt,Zi=_s=>{_s=Math.max(Nt,_s);let us=_s/fe;return us{_s=Math.max(H,_s);let us=_s*fe;return us=Math.abs(ue)){const us=Be?Se.start.w+ct:Se.start.w-ct,{newW:$n,newH:Sr}=Zi(us);pt=$n,mt=Sr}else{const us=et?Se.start.h+ue:Se.start.h-ue,{newW:$n,newH:Sr}=nn(us);pt=$n,mt=Sr}ge&&(yt=Se.start.x+(Se.start.w-pt)),Ee&&(Dt=Se.start.y+(Se.start.h-mt))}else if(Be||ge){const _s=Be?Se.start.w+ct:Se.start.w-ct,{newW:us,newH:$n}=Zi(_s);pt=us,mt=$n,ge&&(yt=Se.start.x+(Se.start.w-pt)),Dt=Qt?Se.start.y+(Se.start.h-mt):Se.start.y}else if(Ee||et){const _s=et?Se.start.h+ue:Se.start.h-ue,{newW:us,newH:$n}=nn(_s);pt=us,mt=$n,Ee&&(Dt=Se.start.y+(Se.start.h-mt)),Vt?yt=Se.start.x+(Se.start.w-pt):yt=Se.start.x}const Lo=Tt({x:yt,y:Dt,w:pt,h:mt});Ki.current=Lo,ds.current==null&&(ds.current=requestAnimationFrame(()=>{ds.current=null;const _s=Ki.current;_s&&xi(_s)}))},[Tt]),Ps=_.useCallback(()=>{Mi.current&&(jt(!1),Ui(null),Ks(null),ds.current!=null&&(cancelAnimationFrame(ds.current),ds.current=null),Mi.current=null,window.removeEventListener("pointermove",ss),window.removeEventListener("pointerup",Ps),hi(li.current))},[ss,hi]),ni=_.useCallback(oe=>Se=>{if(!It||Se.button!==0)return;Se.preventDefault(),Se.stopPropagation();const ct=li.current;Mi.current={dir:oe,sx:Se.clientX,sy:Se.clientY,start:ct,ratio:ct.w/ct.h},jt(!0),window.addEventListener("pointermove",ss),window.addEventListener("pointerup",Ps)},[It,ss,Ps]),[Fs,tn]=_.useState(!1),[We,Mt]=_.useState(!1);_.useEffect(()=>{const oe=window.matchMedia?.("(hover: hover) and (pointer: fine)"),Se=()=>tn(!!oe?.matches);return Se(),oe?.addEventListener?.("change",Se),()=>oe?.removeEventListener?.("change",Se)},[]);const Ot=It&&(We||ui||Si),[zt,Xt]=_.useState(!1);if(_.useEffect(()=>{s.status!=="running"&&Xt(!1)},[s.id,s.status]),!Ue||!qt)return null;const Qi="inline-flex items-center justify-center rounded-md p-2 transition bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 active:scale-[0.98] dark:bg-black/45 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500",Ni=String(s.phase??"").toLowerCase(),Wi=Ni==="stopping"||Ni==="remuxing"||Ni==="moving",Ds=!E||!ne||Wi||zt,os=p.jsx("div",{className:"flex items-center gap-1 min-w-0",children:ne?p.jsxs(p.Fragment,{children:[p.jsx(mi,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Ds,title:Wi||zt?"Stoppe…":"Stop","aria-label":Wi||zt?"Stoppe…":"Stop",onClick:async oe=>{if(oe.preventDefault(),oe.stopPropagation(),!Ds)try{Xt(!0),await E?.(s.id)}finally{Xt(!1)}},className:yo("shadow-none shrink-0",It&&Ri&&"px-2"),children:p.jsx("span",{className:"whitespace-nowrap",children:Wi||zt?"Stoppe…":It&&Ri?"Stop":"Stoppen"})}),p.jsx(pa,{job:s,variant:"overlay",collapseToMenu:!0,busy:Wi||zt,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?oe=>T(oe):void 0,onToggleFavorite:v?oe=>v(oe):void 0,onToggleLike:b?oe=>b(oe):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):p.jsx(pa,{job:s,variant:"overlay",collapseToMenu:!0,isHot:a||le,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?oe=>T(oe):void 0,onToggleFavorite:v?oe=>v(oe):void 0,onToggleLike:b?oe=>b(oe):void 0,onToggleHot:y?async oe=>{U(),await new Promise(ct=>setTimeout(ct,150)),await y(oe),await new Promise(ct=>setTimeout(ct,0));const Se=Re.current;if(Se&&!Se.isDisposed?.()){const ct=Se.play?.();ct&&typeof ct.catch=="function"&&ct.catch(()=>{})}}:void 0,onKeep:f?async oe=>{U(),t(),await new Promise(Se=>setTimeout(Se,150)),await f(oe)}:void 0,onDelete:g?async oe=>{U(),t(),await new Promise(Se=>setTimeout(Se,150)),await g(oe)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),jn=e||It,Dn=ne?"calc(4px + env(safe-area-inset-bottom))":`calc(${Lt+2}px + env(safe-area-inset-bottom))`,Tn="top-2",ls=e&&Ct,tr=p.jsx("div",{className:yo("relative overflow-visible",e||It?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!It||!Fs||Mt(!0)},onMouseLeave:()=>{!It||!Fs||Mt(!1)},children:p.jsxs("div",{className:yo("relative w-full h-full",It&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Lt}px`},children:[ne?p.jsxs("div",{className:"absolute inset-0 bg-black",children:[p.jsx(TR,{src:He,muted:D,className:"w-full h-full object-contain object-bottom"}),p.jsxs("div",{className:"absolute right-2 bottom-2 z-[60] pointer-events-none inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[p.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]})]}):p.jsx("div",{ref:at,className:"absolute inset-0"}),p.jsxs("div",{className:yo("absolute inset-x-0 z-30 pointer-events-none","top-0"),children:[p.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-black/35 to-transparent"}),p.jsx("div",{className:yo("absolute inset-x-2",Tn),children:p.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2",children:[p.jsx("div",{className:"min-w-0 pointer-events-auto overflow-visible",children:ls?null:os}),It?p.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:ji,onClick:oe=>{oe.preventDefault(),oe.stopPropagation()},className:yo(Qi,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",Ot?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",ui&&"scale-[0.98] opacity-90"),children:[p.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),p.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),p.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"})]}):null,p.jsxs("div",{className:"shrink-0 flex items-center gap-1 pointer-events-auto",children:[p.jsx("button",{type:"button",className:Qi,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?p.jsx(BO,{className:"h-5 w-5"}):p.jsx(jO,{className:"h-5 w-5"})}),p.jsx("button",{type:"button",className:Qi,onClick:t,"aria-label":"Schließen",title:"Schließen",children:p.jsx(v0,{className:"h-5 w-5"})})]})]})})]}),p.jsxs("div",{className:yo("player-ui pointer-events-none absolute inset-x-2 z-50","flex items-end justify-between gap-2","transition-all duration-200 ease-out"),style:{bottom:Dn},children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-white",children:z}),p.jsx("div",{className:"truncate text-[11px] text-white/80",children:p.jsxs("span",{className:"inline-flex items-center gap-1 min-w-0 align-middle",children:[p.jsx("span",{className:"truncate",children:re||R}),a||le?p.jsx("span",{className:"shrink-0 rounded bg-amber-500/25 px-1.5 py-0.5 font-semibold text-white",children:"HOT"}):null]})})]}),p.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 text-[11px] text-white",children:[Ge!=="—"?p.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Ge}):null,ne?null:p.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Q}),G!=="—"?p.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:G}):null]})]})]})}),dn=p.jsx("div",{className:"w-[360px] shrink-0 border-r border-white/10 bg-black/40 text-white",children:p.jsxs("div",{className:"h-full p-4 flex flex-col gap-3 overflow-y-auto",children:[p.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-white/10 bg-black/30",children:p.jsx("div",{className:"relative aspect-video",children:p.jsx("img",{src:Fe,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}})})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"text-lg font-semibold truncate",children:z}),p.jsx("div",{className:"text-xs text-white/70 break-all",children:re||R})]}),p.jsx("div",{className:"pointer-events-auto",children:p.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[ne?p.jsx(mi,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Ds,title:Wi||zt?"Stoppe…":"Stop","aria-label":Wi||zt?"Stoppe…":"Stop",onClick:async oe=>{if(oe.preventDefault(),oe.stopPropagation(),!Ds)try{Xt(!0),await E?.(s.id)}finally{Xt(!1)}},className:"shadow-none",children:Wi||zt?"Stoppe…":"Stoppen"}):null,p.jsx(pa,{job:s,variant:"table",collapseToMenu:!1,busy:Wi||zt,isHot:a||le,isFavorite:u,isLiked:c,isWatching:d,onToggleWatch:T?oe=>T(oe):void 0,onToggleFavorite:v?oe=>v(oe):void 0,onToggleLike:b?oe=>b(oe):void 0,onToggleHot:y?async oe=>{U(),await new Promise(ct=>setTimeout(ct,150)),await y(oe),await new Promise(ct=>setTimeout(ct,0));const Se=Re.current;if(Se&&!Se.isDisposed?.()){const ct=Se.play?.();ct&&typeof ct.catch=="function"&&ct.catch(()=>{})}}:void 0,onKeep:f?async oe=>{U(),t(),await new Promise(Se=>setTimeout(Se,150)),await f(oe)}:void 0,onDelete:g?async oe=>{U(),t(),await new Promise(Se=>setTimeout(Se,150)),await g(oe)}:void 0,order:ne?["watch","favorite","like","details"]:["watch","favorite","like","hot","details","keep","delete"],className:"flex items-center justify-start gap-1"})]})}),p.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-sm",children:[p.jsx("div",{className:"text-white/60",children:"Status"}),p.jsx("div",{className:"font-medium",children:s.status}),p.jsx("div",{className:"text-white/60",children:"Auflösung"}),p.jsx("div",{className:"font-medium",children:Ge}),p.jsx("div",{className:"text-white/60",children:"FPS"}),p.jsx("div",{className:"font-medium",children:ke}),p.jsx("div",{className:"text-white/60",children:"Laufzeit"}),p.jsx("div",{className:"font-medium",children:Q}),p.jsx("div",{className:"text-white/60",children:"Größe"}),p.jsx("div",{className:"font-medium",children:G}),p.jsx("div",{className:"text-white/60",children:"Datum"}),p.jsx("div",{className:"font-medium",children:pe}),p.jsx("div",{className:"col-span-2",children:ve.length?p.jsx("div",{className:"flex flex-wrap gap-1.5",children:ve.map(oe=>p.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:oe},oe))}):p.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),sn=It&&ui&&ti?p.jsx("div",{className:"pointer-events-none absolute z-0 player-snap-ghost overflow-hidden rounded-lg border-2 border-dashed border-white/70 bg-black/55 shadow-2xl dark:border-white/60",style:{left:ti.x-si.x,top:ti.y-si.y,width:ti.w,height:ti.h},"aria-hidden":"true",children:p.jsxs("div",{className:"absolute inset-0 bg-black",children:[p.jsx("img",{src:rs||Fe,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}}),p.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-black/55 to-transparent"}),p.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 opacity-80",children:[p.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"}),p.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"})]}),p.jsxs("div",{className:"absolute top-2 left-2 h-8 rounded-md bg-white/12 px-2 flex items-center gap-1 ring-1 ring-white/15",children:[p.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),p.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),p.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"})]}),p.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex items-end justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-white/95",children:z}),p.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[re||R,a||le?p.jsx("span",{className:"ml-1.5 rounded bg-amber-500/30 px-1.5 py-0.5 text-white",children:"HOT"}):null]})]}),p.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-[10px] text-white/90",children:[Ge!=="—"?p.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Ge}):null,!ne&&Q!=="—"?p.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Q}):null]})]}),p.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,hs=p.jsx(ma,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:yo("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",jn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":It?"rounded-lg":"rounded-none"),bodyClassName:"flex flex-col flex-1 min-h-0 p-0",children:p.jsxs("div",{className:"flex flex-1 min-h-0",children:[ls?dn:null,tr]})}),{w:xe,h:Ce,ox:Ie,oy:Xe,bottomInset:xt}=Te(),Ft={left:Ie+16,top:Xe+16,width:Math.max(0,xe-32),height:Math.max(0,Ce-32)},ii=e?Ft:It?{left:si.x,top:si.y,width:si.w,height:si.h}:void 0;return Ic.createPortal(p.jsxs(p.Fragment,{children:[p.jsx("style",{children:` /* Live-Download: Progress/Seek-Bar ausblenden */ .is-live-download .vjs-progress-control { display: none !important; @@ -373,44 +373,50 @@ Schedule: ${c.map(T=>oa(T))} pos: ${this.timelinePos}`),f.length&&this.log(`Remo box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); pointer-events: none; } - `}),e||xt?g.jsxs("div",{className:po("fixed z-[2147483647]",!Ei&&!yi&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...ti,willChange:Ei?"left, top, width, height":void 0},children:[Zn,Ii,xt?g.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[g.jsx("div",{className:"pointer-events-auto absolute -left-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:_s("w")}),g.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:_s("e")}),g.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:_s("n")}),g.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:_s("s")}),g.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:_s("nw")}),g.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:_s("ne")}),g.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:_s("sw")}),g.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:_s("se")})]}):null]}):g.jsx("div",{className:`\r + `}),e||It?p.jsxs("div",{className:yo("fixed z-[2147483647]",!Si&&!ui&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...ii,willChange:Si?"left, top, width, height":void 0},children:[sn,hs,It?p.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[p.jsx("div",{className:"pointer-events-auto absolute -left-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:ni("w")}),p.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:ni("e")}),p.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:ni("n")}),p.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:ni("s")}),p.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:ni("nw")}),p.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:ni("ne")}),p.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:ni("sw")}),p.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:ni("se")})]}):null]}):p.jsx("div",{className:`\r fixed z-[2147483647] inset-x-0 w-full\r shadow-2xl\r md:bottom-4 md:left-1/2 md:right-auto md:inset-x-auto md:w-[min(760px,calc(100vw-32px))] md:-translate-x-1/2\r - `,style:{bottom:`calc(${bt}px + env(safe-area-inset-bottom))`},children:Ii})]}),$t)}function fR({jobId:s,thumbTick:e,autoTickMs:t=1e4,blur:i=!1,className:n,alignStartAt:r,alignEndAt:a=null,alignEveryMs:u,fastRetryMs:c,fastRetryMax:d,fastRetryWindowMs:f,thumbsWebpUrl:p,thumbsCandidates:y}){const v=i?"blur-md":"",b=30,T=_.useRef(null),E=_.useRef(!0),[D,O]=_.useState(!1),R=_.useRef(!1),[j,F]=_.useState(0),[z,N]=_.useState(!1),[Y,L]=_.useState(!1),I=_.useRef(null),X=_.useRef(0),G=_.useRef(!1),q=_.useRef(!1),[ae,ie]=_.useState(!0),W=Re=>{if(typeof Re=="number"&&Number.isFinite(Re))return Re;if(Re instanceof Date)return Re.getTime();const Ae=Date.parse(String(Re??""));return Number.isFinite(Ae)?Ae:NaN},K=Re=>{const Ae=String(Re??"").trim();return Ae?/^https?:\/\//i.test(Ae)||Ae.startsWith("/")?Ae:`/${Ae}`:""},Q=_.useMemo(()=>{const Re=[p,...Array.isArray(y)?y:[]].map(K).filter(Boolean);return Array.from(new Set(Re)).join("|")},[p,y]);_.useEffect(()=>{const Re=()=>{const be=!document.hidden;E.current=be,ie(be)},Ae=!document.hidden;return E.current=Ae,ie(Ae),document.addEventListener("visibilitychange",Re),()=>document.removeEventListener("visibilitychange",Re)},[]),_.useEffect(()=>()=>{I.current&&window.clearTimeout(I.current)},[]),_.useEffect(()=>{const Re=T.current;if(!Re)return;const Ae=new IntersectionObserver(be=>{const Pe=be[0],gt=!!(Pe&&(Pe.isIntersecting||Pe.intersectionRatio>0));gt!==R.current&&(R.current=gt,O(gt))},{root:null,threshold:0,rootMargin:"300px 0px"});return Ae.observe(Re),()=>Ae.disconnect()},[]),_.useEffect(()=>{typeof e!="number"&&D&&E.current&&(q.current||(q.current=!0,F(Re=>Re+1)))},[D,e]),_.useEffect(()=>{if(typeof e=="number"||!D||!E.current)return;const Re=Number(u??t??1e4);if(!Number.isFinite(Re)||Re<=0)return;const Ae=r?W(r):NaN,be=a?W(a):NaN;if(Number.isFinite(Ae)){let gt;const Ye=()=>{if(!E.current)return;const lt=Date.now();if(Number.isFinite(be)&<>=be)return;const ht=Math.max(0,lt-Ae)%Re,st=ht===0?Re:Re-ht;gt=window.setTimeout(()=>{R.current&&E.current&&(F(ct=>ct+1),Ye())},st)};return Ye(),()=>{gt&&window.clearTimeout(gt)}}const Pe=window.setInterval(()=>{R.current&&E.current&&F(gt=>gt+1)},Re);return()=>window.clearInterval(Pe)},[e,t,D,ae,r,a,u]);const te=typeof e=="number"?e:j,re=_.useRef(0),[U,ne]=_.useState(0);_.useEffect(()=>{D&&E.current&&(re.current=te,ne(te))},[te,D]),_.useEffect(()=>{N(!1),L(!1)},[U]),_.useEffect(()=>{G.current=!1,X.current=0,q.current=!1,N(!1),L(!1),R.current&&E.current&&F(Re=>Re+1)},[s,Q]);const Z=_.useMemo(()=>`/api/preview?id=${encodeURIComponent(s)}&v=${U}`,[s,U]),fe=_.useMemo(()=>`/api/preview?id=${encodeURIComponent(s)}&hover=1&file=index_hq.m3u8`,[s]),ge=_.useMemo(()=>Q?Q.split("|"):[],[Q])[0]||"",Ce=!!ge&&!z,Me=_.useMemo(()=>{if(Ce){const Re=ge.includes("?")?"&":"?";return`${ge}${Re}v=${encodeURIComponent(String(U))}`}return Z},[Ce,ge,U,Z]);return g.jsx(VA,{content:(Re,{close:Ae})=>Re&&g.jsx("div",{className:"w-[420px] max-w-[calc(100vw-1.5rem)]",children:g.jsx("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{paddingBottom:`calc(56.25% + ${b}px)`},children:g.jsxs("div",{className:"absolute inset-0",children:[g.jsx(hR,{src:fe,muted:!1,className:"w-full h-full object-contain object-bottom relative z-0"}),g.jsxs("div",{className:"absolute left-2 top-2 inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[g.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]}),g.jsx("button",{type:"button",className:"absolute right-2 top-2 z-20 inline-flex items-center justify-center rounded-md p-1.5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70 bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/55","aria-label":"Live-Vorschau schließen",title:"Vorschau schließen",onClick:be=>{be.preventDefault(),be.stopPropagation(),Ae()},children:g.jsx(f0,{className:"h-4 w-4"})})]})})}),children:g.jsx("div",{ref:T,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",n||"w-full h-full"].join(" "),children:Y?g.jsx("div",{className:"absolute inset-0 grid place-items-center px-1 text-center text-[10px] text-gray-500 dark:text-gray-400",children:"keine Vorschau"}):g.jsx("img",{src:Me,loading:D?"eager":"lazy",fetchPriority:D?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",v].filter(Boolean).join(" "),onLoad:()=>{G.current=!0,X.current=0,I.current&&window.clearTimeout(I.current),Ce?N(!1):L(!1)},onError:()=>{if(Ce){N(!0);return}if(L(!0),!c||!R.current||!E.current||G.current)return;const Re=r?W(r):NaN,Ae=Number(f??6e4);if(!(!Number.isFinite(Re)||Date.now()-Re=Pe||(I.current&&window.clearTimeout(I.current),I.current=window.setTimeout(()=>{X.current+=1,L(!1),F(gt=>gt+1)},c))}})})})}function Vh({label:s,value:e=0,indeterminate:t=!1,showPercent:i=!1,rightLabel:n,steps:r,currentStep:a,size:u="md",className:c}){const d=Math.max(0,Math.min(100,Number(e)||0)),f=u==="sm"?"h-1.5":"h-2",p=Array.isArray(r)&&r.length>0,y=p?r.length:0,v=E=>E===0?"text-left":E===y-1?"text-right":"text-center",b=E=>typeof a!="number"||!Number.isFinite(a)?!1:E<=a,T=i&&!t;return g.jsxs("div",{className:c,children:[s||T?g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s?g.jsx("p",{className:"flex-1 min-w-0 truncate text-xs font-medium text-gray-900 dark:text-white",children:s}):g.jsx("span",{className:"flex-1"}),T?g.jsxs("span",{className:"shrink-0 text-xs font-medium text-gray-700 dark:text-gray-300",children:[Math.round(d),"%"]}):null]}):null,g.jsxs("div",{"aria-hidden":"true",className:s||T?"mt-2":"",children:[g.jsx("div",{className:"overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:t?g.jsx("div",{className:`${f} w-full rounded-full bg-indigo-600/70 dark:bg-indigo-500/70 animate-pulse`}):g.jsx("div",{className:`${f} rounded-full bg-indigo-600 dark:bg-indigo-500 transition-[width] duration-200`,style:{width:`${d}%`}})}),n?g.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:n}):null,p?g.jsx("div",{className:"mt-3 hidden text-sm font-medium text-gray-600 sm:grid dark:text-gray-400",style:{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},children:r.map((E,D)=>g.jsx("div",{className:[v(D),b(D)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:E},`${D}-${E}`))}):null]})]})}function I$(s){const[e,t]=_.useState(s),i=_.useRef(s.length);return _.useEffect(()=>{const n=rp("/api/record/stream","jobs",r=>{Array.isArray(r)&&(r.length,i.current,i.current=r.length,t(r))});return()=>n()},[]),e}function N$(s,e=!1){const[t,i]=_.useState(e);return _.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(s),r=()=>{i(n.matches)};return r(),typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[s]),t}const W0=s=>{const e=s;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},mR=s=>{const e=s;return e.sourceUrl??e.url??e.roomUrl??""},pR=s=>{const e=s;return String(e.imageUrl??e.image_url??"").trim()},oc=s=>{const e=s;return String(e.key??e.id??W0(s))},Ys=s=>{if(typeof s=="number"&&Number.isFinite(s))return s<1e12?s*1e3:s;if(typeof s=="string"){const e=Date.parse(s);return Number.isFinite(e)?e:0}return s instanceof Date?s.getTime():0},O$=s=>{const e=String(s??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},gR=s=>{const e=s,t=[e.thumbsWebpUrl,e.thumbsUrl,e.previewThumbsUrl,e.thumbnailSheetUrl],i=[e.previewBaseUrl?`${String(e.previewBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:"",e.assetBaseUrl?`${String(e.assetBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:"",e.thumbsBaseUrl?`${String(e.thumbsBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:""];return[...t,...i].map(n=>O$(String(n??""))).filter(Boolean)},lc=s=>{if(s.kind==="job"){const t=s.job;return Ys(t.addedAt)||Ys(t.createdAt)||Ys(t.enqueuedAt)||Ys(t.queuedAt)||Ys(t.requestedAt)||Ys(t.startedAt)||0}const e=s.pending;return Ys(e.addedAt)||Ys(e.createdAt)||Ys(e.enqueuedAt)||Ys(e.queuedAt)||Ys(e.requestedAt)||0},yR=s=>{switch((s??"").toLowerCase()){case"stopping":return"Stop wird angefordert…";case"probe":return"Analysiere Datei (Dauer/Streams)…";case"remuxing":return"Konvertiere Container zu MP4…";case"moving":return"Verschiebe nach Done…";case"assets":return"Erstelle Vorschau/Thumbnails…";case"postwork":return"Nacharbeiten laufen…";default:return""}};async function M$(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function vR(s,e){const t=s.postWork;if(!t)return"Warte auf Nacharbeiten…";if(t.state==="running"){const i=typeof t.running=="number"?t.running:0,n=typeof t.maxParallel=="number"?t.maxParallel:0;return n>0?`Nacharbeiten laufen… (${i}/${n} parallel)`:"Nacharbeiten laufen…"}if(t.state==="queued"){const i=typeof t.position=="number"?t.position:0,n=typeof t.waiting=="number"?t.waiting:0,r=typeof t.running=="number"?t.running:0,a=Math.max(n+r,i),u=typeof e?.pos=="number"&&Number.isFinite(e.pos)&&e.pos>0?e.pos:i,c=typeof e?.total=="number"&&Number.isFinite(e.total)&&e.total>0?e.total:a;return u>0&&c>0?`Warte auf Nacharbeiten… ${u} / ${c}`:"Warte auf Nacharbeiten…"}return"Warte auf Nacharbeiten…"}function P$({job:s,postworkInfo:e}){const t=String(s?.phase??"").trim(),i=Number(s?.progress??0),n=t.toLowerCase(),r=n==="recording";let a=t?yR(t)||t:"";n==="postwork"&&(a=vR(s,e)),r&&(a="Recording läuft…");const u=a||String(s?.status??"").trim().toLowerCase(),c=!r&&Number.isFinite(i)&&i>0&&i<100,d=!r&&!c&&!!t&&(!Number.isFinite(i)||i<=0||i>=100);return g.jsx("div",{className:"min-w-0",children:c?g.jsx(Vh,{label:u,value:Math.max(0,Math.min(100,i)),showPercent:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):d?g.jsx(Vh,{label:u,indeterminate:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):g.jsx("div",{className:"truncate",children:g.jsx("span",{className:"font-medium",children:u})})})}function zv({r:s,nowMs:e,blurPreviews:t,modelsByKey:i,stopRequestedIds:n,postworkInfoOf:r,markStopRequested:a,onOpenPlayer:u,onStopJob:c,onToggleFavorite:d,onToggleLike:f,onToggleWatch:p}){if(s.kind==="pending"){const K=s.pending,Q=W0(K),te=mR(K),re=(K.currentShow||"unknown").toLowerCase();return g.jsxs("div",{className:` + `,style:{bottom:`calc(${xt}px + env(safe-area-inset-bottom))`},children:hs})]}),qt)}function SR({jobId:s,thumbTick:e,autoTickMs:t=1e4,blur:i=!1,className:n,alignStartAt:r,alignEndAt:a=null,alignEveryMs:u,fastRetryMs:c,fastRetryMax:d,fastRetryWindowMs:f,thumbsWebpUrl:g,thumbsCandidates:y}){const v=i?"blur-md":"",b=30,T=_.useRef(null),E=_.useRef(!0),[D,O]=_.useState(!1),R=_.useRef(!1),[j,F]=_.useState(0),[G,L]=_.useState(!1),[W,I]=_.useState(!1),N=_.useRef(null),X=_.useRef(0),V=_.useRef(!1),Y=_.useRef(!1),[ne,ie]=_.useState(!0),K=Fe=>{if(typeof Fe=="number"&&Number.isFinite(Fe))return Fe;if(Fe instanceof Date)return Fe.getTime();const Ze=Date.parse(String(Fe??""));return Number.isFinite(Ze)?Ze:NaN},q=Fe=>{const Ze=String(Fe??"").trim();return Ze?/^https?:\/\//i.test(Ze)||Ze.startsWith("/")?Ze:`/${Ze}`:""},Z=_.useMemo(()=>{const Fe=[g,...Array.isArray(y)?y:[]].map(q).filter(Boolean);return Array.from(new Set(Fe)).join("|")},[g,y]);_.useEffect(()=>{const Fe=()=>{const De=!document.hidden;E.current=De,ie(De)},Ze=!document.hidden;return E.current=Ze,ie(Ze),document.addEventListener("visibilitychange",Fe),()=>document.removeEventListener("visibilitychange",Fe)},[]),_.useEffect(()=>()=>{N.current&&window.clearTimeout(N.current)},[]),_.useEffect(()=>{const Fe=T.current;if(!Fe)return;const Ze=new IntersectionObserver(De=>{const Ye=De[0],wt=!!(Ye&&(Ye.isIntersecting||Ye.intersectionRatio>0));wt!==R.current&&(R.current=wt,O(wt))},{root:null,threshold:0,rootMargin:"300px 0px"});return Ze.observe(Fe),()=>Ze.disconnect()},[]),_.useEffect(()=>{typeof e!="number"&&D&&E.current&&(Y.current||(Y.current=!0,F(Fe=>Fe+1)))},[D,e]),_.useEffect(()=>{if(typeof e=="number"||!D||!E.current)return;const Fe=Number(u??t??1e4);if(!Number.isFinite(Fe)||Fe<=0)return;const Ze=r?K(r):NaN,De=a?K(a):NaN;if(Number.isFinite(Ze)){let wt;const vt=()=>{if(!E.current)return;const Ge=Date.now();if(Number.isFinite(De)&&Ge>=De)return;const ut=Math.max(0,Ge-Ze)%Fe,rt=ut===0?Fe:Fe-ut;wt=window.setTimeout(()=>{R.current&&E.current&&(F(Je=>Je+1),vt())},rt)};return vt(),()=>{wt&&window.clearTimeout(wt)}}const Ye=window.setInterval(()=>{R.current&&E.current&&F(wt=>wt+1)},Fe);return()=>window.clearInterval(Ye)},[e,t,D,ne,r,a,u]);const te=typeof e=="number"?e:j,le=_.useRef(0),[z,re]=_.useState(0);_.useEffect(()=>{D&&E.current&&(le.current=te,re(te))},[te,D]),_.useEffect(()=>{L(!1),I(!1)},[z]),_.useEffect(()=>{V.current=!1,X.current=0,Y.current=!1,L(!1),I(!1),R.current&&E.current&&F(Fe=>Fe+1)},[s,Z]);const Q=_.useMemo(()=>`/api/preview?id=${encodeURIComponent(s)}&v=${z}`,[s,z]),pe=_.useMemo(()=>`/api/preview?id=${encodeURIComponent(s)}&hover=1&file=index_hq.m3u8`,[s]),ve=_.useMemo(()=>Z?Z.split("|"):[],[Z])[0]||"",we=!!ve&&!G,He=_.useMemo(()=>{if(we){const Fe=ve.includes("?")?"&":"?";return`${ve}${Fe}v=${encodeURIComponent(String(z))}`}return Q},[we,ve,z,Q]);return p.jsx(JA,{content:(Fe,{close:Ze})=>Fe&&p.jsx("div",{className:"w-[420px] max-w-[calc(100vw-1.5rem)]",children:p.jsx("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{paddingBottom:`calc(56.25% + ${b}px)`},children:p.jsxs("div",{className:"absolute inset-0",children:[p.jsx(TR,{src:pe,muted:!1,className:"w-full h-full object-contain object-bottom relative z-0"}),p.jsxs("div",{className:"absolute left-2 top-2 inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[p.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]}),p.jsx("button",{type:"button",className:"absolute right-2 top-2 z-20 inline-flex items-center justify-center rounded-md p-1.5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70 bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/55","aria-label":"Live-Vorschau schließen",title:"Vorschau schließen",onClick:De=>{De.preventDefault(),De.stopPropagation(),Ze()},children:p.jsx(v0,{className:"h-4 w-4"})})]})})}),children:p.jsx("div",{ref:T,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",n||"w-full h-full"].join(" "),children:W?p.jsx("div",{className:"absolute inset-0 grid place-items-center px-1 text-center text-[10px] text-gray-500 dark:text-gray-400",children:"keine Vorschau"}):p.jsx("img",{src:He,loading:D?"eager":"lazy",fetchPriority:D?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",v].filter(Boolean).join(" "),onLoad:()=>{V.current=!0,X.current=0,N.current&&window.clearTimeout(N.current),we?L(!1):I(!1)},onError:()=>{if(we){L(!0);return}if(I(!0),!c||!R.current||!E.current||V.current)return;const Fe=r?K(r):NaN,Ze=Number(f??6e4);if(!(!Number.isFinite(Fe)||Date.now()-Fe=Ye||(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{X.current+=1,I(!1),F(wt=>wt+1)},c))}})})})}function qh({label:s,value:e=0,indeterminate:t=!1,showPercent:i=!1,rightLabel:n,steps:r,currentStep:a,size:u="md",className:c}){const d=Math.max(0,Math.min(100,Number(e)||0)),f=u==="sm"?"h-1.5":"h-2",g=Array.isArray(r)&&r.length>0,y=g?r.length:0,v=E=>E===0?"text-left":E===y-1?"text-right":"text-center",b=E=>typeof a!="number"||!Number.isFinite(a)?!1:E<=a,T=i&&!t;return p.jsxs("div",{className:c,children:[s||T?p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s?p.jsx("p",{className:"flex-1 min-w-0 truncate text-xs font-medium text-gray-900 dark:text-white",children:s}):p.jsx("span",{className:"flex-1"}),T?p.jsxs("span",{className:"shrink-0 text-xs font-medium text-gray-700 dark:text-gray-300",children:[Math.round(d),"%"]}):null]}):null,p.jsxs("div",{"aria-hidden":"true",className:s||T?"mt-2":"",children:[p.jsx("div",{className:"overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:t?p.jsx("div",{className:`${f} w-full rounded-full bg-indigo-600/70 dark:bg-indigo-500/70 animate-pulse`}):p.jsx("div",{className:`${f} rounded-full bg-indigo-600 dark:bg-indigo-500 transition-[width] duration-200`,style:{width:`${d}%`}})}),n?p.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:n}):null,g?p.jsx("div",{className:"mt-3 hidden text-sm font-medium text-gray-600 sm:grid dark:text-gray-400",style:{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},children:r.map((E,D)=>p.jsx("div",{className:[v(D),b(D)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:E},`${D}-${E}`))}):null]})]})}function K$(s){const[e,t]=_.useState(s),i=_.useRef(s.length);return _.useEffect(()=>{const n=up("/api/record/stream","jobs",r=>{Array.isArray(r)&&(r.length,i.current,i.current=r.length,t(r))});return()=>n()},[]),e}function W$(s,e=!1){const[t,i]=_.useState(e);return _.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(s),r=()=>{i(n.matches)};return r(),typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[s]),t}const Z0=s=>{const e=s;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},_R=s=>{const e=s;return e.sourceUrl??e.url??e.roomUrl??""},ER=s=>{const e=s;return String(e.imageUrl??e.image_url??"").trim()},uc=s=>{const e=s;return String(e.key??e.id??Z0(s))},Js=s=>{if(typeof s=="number"&&Number.isFinite(s))return s<1e12?s*1e3:s;if(typeof s=="string"){const e=Date.parse(s);return Number.isFinite(e)?e:0}return s instanceof Date?s.getTime():0},Y$=s=>{const e=String(s??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},wR=s=>{const e=s,t=[e.thumbsWebpUrl,e.thumbsUrl,e.previewThumbsUrl,e.thumbnailSheetUrl],i=[e.previewBaseUrl?`${String(e.previewBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:"",e.assetBaseUrl?`${String(e.assetBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:"",e.thumbsBaseUrl?`${String(e.thumbsBaseUrl).replace(/\/+$/,"")}/thumbs.webp`:""];return[...t,...i].map(n=>Y$(String(n??""))).filter(Boolean)},cc=s=>{if(s.kind==="job"){const t=s.job;return Js(t.addedAt)||Js(t.createdAt)||Js(t.enqueuedAt)||Js(t.queuedAt)||Js(t.requestedAt)||Js(t.startedAt)||0}const e=s.pending;return Js(e.addedAt)||Js(e.createdAt)||Js(e.enqueuedAt)||Js(e.queuedAt)||Js(e.requestedAt)||0},AR=s=>{switch((s??"").toLowerCase()){case"stopping":return"Stop wird angefordert…";case"probe":return"Analysiere Datei (Dauer/Streams)…";case"remuxing":return"Konvertiere Container zu MP4…";case"moving":return"Verschiebe nach Done…";case"assets":return"Erstelle Vorschau/Thumbnails…";case"postwork":return"Nacharbeiten laufen…";default:return""}};async function X$(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function kR(s,e){const t=s.postWork;if(!t)return"Warte auf Nacharbeiten…";if(t.state==="running"){const i=typeof t.running=="number"?t.running:0,n=typeof t.maxParallel=="number"?t.maxParallel:0;return n>0?`Nacharbeiten laufen… (${i}/${n} parallel)`:"Nacharbeiten laufen…"}if(t.state==="queued"){const i=typeof t.position=="number"?t.position:0,n=typeof t.waiting=="number"?t.waiting:0,r=typeof t.running=="number"?t.running:0,a=Math.max(n+r,i),u=typeof e?.pos=="number"&&Number.isFinite(e.pos)&&e.pos>0?e.pos:i,c=typeof e?.total=="number"&&Number.isFinite(e.total)&&e.total>0?e.total:a;return u>0&&c>0?`Warte auf Nacharbeiten… ${u} / ${c}`:"Warte auf Nacharbeiten…"}return"Warte auf Nacharbeiten…"}function Q$({job:s,postworkInfo:e}){const t=String(s?.phase??"").trim(),i=Number(s?.progress??0),n=t.toLowerCase(),r=n==="recording";let a=t?AR(t)||t:"";n==="postwork"&&(a=kR(s,e)),r&&(a="Recording läuft…");const u=a||String(s?.status??"").trim().toLowerCase(),c=!r&&Number.isFinite(i)&&i>0&&i<100,d=!r&&!c&&!!t&&(!Number.isFinite(i)||i<=0||i>=100);return p.jsx("div",{className:"min-w-0",children:c?p.jsx(qh,{label:u,value:Math.max(0,Math.min(100,i)),showPercent:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):d?p.jsx(qh,{label:u,indeterminate:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):p.jsx("div",{className:"truncate",children:p.jsx("span",{className:"font-medium",children:u})})})}function Kv({r:s,nowMs:e,blurPreviews:t,modelsByKey:i,stopRequestedIds:n,postworkInfoOf:r,markStopRequested:a,onOpenPlayer:u,onStopJob:c,onToggleFavorite:d,onToggleLike:f,onToggleWatch:g}){if(s.kind==="pending"){const q=s.pending,Z=Z0(q),te=_R(q),le=(q.currentShow||"unknown").toLowerCase();return p.jsxs("div",{className:` relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm backdrop-blur-xl supports-[backdrop-filter]:bg-white/25 ring-1 ring-black/5 transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0 dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25 - `,children:[g.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),g.jsxs("div",{className:"relative p-3",children:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",title:Q,children:Q}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[g.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-900/5 px-2 py-0.5 font-medium dark:bg-white/10",children:"Wartend"}),g.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:bg-white/10 dark:text-gray-200",children:re})]})]}),g.jsx("span",{className:"shrink-0 rounded-full bg-gray-900/5 px-2.5 py-1 text-xs font-medium text-gray-800 dark:bg-white/10 dark:text-gray-200",children:"⏳"})]}),g.jsx("div",{className:"mt-3",children:(()=>{const U=pR(K);return g.jsx("div",{className:"relative aspect-[16/9] w-full overflow-hidden rounded-xl bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:U?g.jsx("img",{src:U,alt:Q,className:["h-full w-full object-cover",t?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:ne=>{ne.currentTarget.style.display="none"}}):g.jsx("div",{className:"grid h-full w-full place-items-center",children:g.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-300",children:"Waiting…"})})})})()}),te?g.jsx("a",{href:te,target:"_blank",rel:"noreferrer",className:"mt-3 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:U=>U.stopPropagation(),title:te,children:te}):null]})]})}const y=s.job,v=tb(y.output),b=T1(y.output||""),T=String(y.phase??"").trim(),E=T.toLowerCase(),D=E==="recording",O=!!n[y.id],R=String(y.status??"").toLowerCase(),F=E!==""&&E!=="recording"||R!=="running"||O;let z=T?yR(T)||T:"";E==="recording"?z="Recording läuft…":E==="postwork"&&(z=vR(y,r(y)));const N=R||"unknown",Y=z||N,L=Number(y.progress??0),I=!D&&Number.isFinite(L)&&L>0&&L<100,X=!D&&!I&&!!T&&(!Number.isFinite(L)||L<=0||L>=100),G=v&&v!=="—"?v.toLowerCase():"",q=G?i[G]:void 0,ae=!!q?.favorite,ie=q?.liked===!0,W=!!q?.watching;return g.jsxs("div",{className:` + `,children:[p.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),p.jsxs("div",{className:"relative p-3",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",title:Z,children:Z}),p.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[p.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-900/5 px-2 py-0.5 font-medium dark:bg-white/10",children:"Wartend"}),p.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:bg-white/10 dark:text-gray-200",children:le})]})]}),p.jsx("span",{className:"shrink-0 rounded-full bg-gray-900/5 px-2.5 py-1 text-xs font-medium text-gray-800 dark:bg-white/10 dark:text-gray-200",children:"⏳"})]}),p.jsx("div",{className:"mt-3",children:(()=>{const z=ER(q);return p.jsx("div",{className:"relative aspect-[16/9] w-full overflow-hidden rounded-xl bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:z?p.jsx("img",{src:z,alt:Z,className:["h-full w-full object-cover",t?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:re=>{re.currentTarget.style.display="none"}}):p.jsx("div",{className:"grid h-full w-full place-items-center",children:p.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-300",children:"Waiting…"})})})})()}),te?p.jsx("a",{href:te,target:"_blank",rel:"noreferrer",className:"mt-3 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:z=>z.stopPropagation(),title:te,children:te}):null]})]})}const y=s.job,v=nb(y.output),b=E1(y.output||""),T=String(y.phase??"").trim(),E=T.toLowerCase(),D=E==="recording",O=!!n[y.id],R=String(y.status??"").toLowerCase(),F=E!==""&&E!=="recording"||R!=="running"||O;let G=T?AR(T)||T:"";E==="recording"?G="Recording läuft…":E==="postwork"&&(G=kR(y,r(y)));const L=R||"unknown",W=G||L,I=Number(y.progress??0),N=!D&&Number.isFinite(I)&&I>0&&I<100,X=!D&&!N&&!!T&&(!Number.isFinite(I)||I<=0||I>=100),V=v&&v!=="—"?v.toLowerCase():"",Y=V?i[V]:void 0,ne=!!Y?.favorite,ie=Y?.liked===!0,K=!!Y?.watching;return p.jsxs("div",{className:` group relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm backdrop-blur-xl supports-[backdrop-filter]:bg-white/25 ring-1 ring-black/5 transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0 dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25 - `,onClick:()=>u(y),role:"button",tabIndex:0,onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&u(y)},children:[g.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),g.jsx("div",{className:"pointer-events-none absolute -inset-10 opacity-0 blur-2xl transition-opacity duration-300 group-hover:opacity-100 bg-white/40 dark:bg-white/10"}),g.jsxs("div",{className:"relative p-3",children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:` + `,onClick:()=>u(y),role:"button",tabIndex:0,onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&u(y)},children:[p.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),p.jsx("div",{className:"pointer-events-none absolute -inset-10 opacity-0 blur-2xl transition-opacity duration-300 group-hover:opacity-100 bg-white/40 dark:bg-white/10"}),p.jsxs("div",{className:"relative p-3",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:` relative shrink-0 overflow-hidden rounded-lg w-[112px] h-[64px] bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10 - `,children:g.jsx(fR,{jobId:y.id,blur:t,alignStartAt:y.startedAt,alignEndAt:y.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:gR(y),className:"w-full h-full"})}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("div",{className:"truncate text-base font-semibold text-gray-900 dark:text-white",title:v,children:v}),g.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold","bg-gray-900/5 text-gray-800 dark:bg-white/10 dark:text-gray-200",F?"ring-1 ring-amber-500/30":"ring-1 ring-emerald-500/25"].join(" "),title:N,children:N})]}),g.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-600 dark:text-gray-300",title:y.output,children:b||"—"})]}),g.jsxs("div",{className:"shrink-0 flex flex-col items-end gap-1",children:[g.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:xR(y,e)}),g.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:TR(bR(y))})]})]}),y.sourceUrl?g.jsx("a",{href:y.sourceUrl,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:K=>K.stopPropagation(),title:y.sourceUrl,children:y.sourceUrl}):null]})]}),I||X?g.jsx("div",{className:"mt-3",children:I?g.jsx(Vh,{label:Y,value:Math.max(0,Math.min(100,L)),showPercent:!0,size:"sm",className:"w-full"}):g.jsx(Vh,{label:Y,indeterminate:!0,size:"sm",className:"w-full"})}):null,g.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/30 pt-3 dark:border-white/10",children:[g.jsx("div",{className:"flex items-center gap-1",onClick:K=>K.stopPropagation(),onMouseDown:K=>K.stopPropagation(),children:g.jsx(ja,{job:y,variant:"table",busy:F,isFavorite:ae,isLiked:ie,isWatching:W,onToggleFavorite:d,onToggleLike:f,onToggleWatch:p,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),g.jsx(di,{size:"sm",variant:"primary",disabled:F,className:"shrink-0",onClick:K=>{K.stopPropagation(),!F&&(a(y.id),c(y.id))},children:F?"Stoppe…":"Stop"})]})]})]})}const T1=s=>(s||"").replaceAll("\\","/").trim().split("/").pop()||"",tb=s=>{const e=T1(s||"");if(!e)return"—";const t=e.replace(/\.[^.]+$/,""),i=t.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(i?.[1])return i[1];const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t},B$=s=>{if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`},xR=(s,e)=>{const t=s,i=Ys(t.startedAtMs)||Ys(s.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const n=s.endedAt?Ys(t.endedAtMs)||Ys(s.endedAt):e;return!Number.isFinite(n)||n<=0?"—":B$(n-i)},bR=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null},TR=s=>{if(!s||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=10?1:2;return`${t.toFixed(n).replace(/\.0+$/,"")} ${e[i]}`},Vv=s=>{const e=s,t=String(e.phase??"").trim(),i=e.postWork;return!!(String(e.postWorkKey??"").trim()||i&&(i.state==="queued"||i.state==="running")||s.endedAt&&t||t==="postwork")},eA=s=>{const e=String(s??"").trim().toLowerCase();return e==="stopped"||e==="finished"||e==="failed"||e==="done"||e==="completed"||e==="canceled"||e==="cancelled"};function F$({jobs:s,pending:e=[],onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a,onAddToDownloads:u,modelsByKey:c={},blurPreviews:d}){const f=I$(s),p=N$("(min-width: 640px)",!0),[y,v]=_.useState(!1),[b,T]=_.useState(!1),E=_.useRef(null),[D,O]=_.useState(!1),R=_.useCallback(async()=>{try{const fe=!!(await M$("/api/autostart/state",{cache:"no-store"}))?.paused;E.current=fe,T(fe)}catch{}},[]);_.useEffect(()=>{R();const Z=rp("/api/autostart/state/stream","autostart",fe=>{const xe=!!fe?.paused;E.current!==xe&&(E.current=xe,T(xe))});return()=>{Z()}},[R]);const j=_.useCallback(async()=>{if(!(D||b)){O(!0);try{await fetch("/api/autostart/pause",{method:"POST"}),T(!0)}catch{}finally{O(!1)}}},[D,b]),F=_.useCallback(async()=>{if(!(D||!b)){O(!0);try{await fetch("/api/autostart/resume",{method:"POST"}),T(!1)}catch{}finally{O(!1)}}},[D,b]),[z,N]=_.useState({}),[Y,L]=_.useState({}),I=_.useCallback(Z=>{const fe=Array.isArray(Z)?Z:[Z];N(xe=>{const ge={...xe};for(const Ce of fe)Ce&&(ge[Ce]=!0);return ge}),L(xe=>{const ge={...xe};for(const Ce of fe)Ce&&(ge[Ce]=!0);return ge})},[]);_.useEffect(()=>{N(Z=>{const fe=Object.keys(Z);if(fe.length===0)return Z;const xe={};for(const ge of fe){const Ce=f.find(be=>be.id===ge);if(!Ce)continue;const Me=String(Ce.phase??"").trim().toLowerCase();Me!==""&&Me!=="recording"||Ce.status!=="running"||(xe[ge]=!0)}return xe})},[f]);const[X,G]=_.useState(()=>Date.now()),q=_.useMemo(()=>f.some(Z=>!Z.endedAt&&Z.status==="running"),[f]),ae=_.useMemo(()=>{const Z=new Map,fe=Re=>{const Ae=Re,be=Ae.postWork;return Ys(be?.enqueuedAt)||Ys(Ae.enqueuedAt)||Ys(Ae.queuedAt)||Ys(Ae.createdAt)||Ys(Ae.addedAt)||Ys(Re.endedAt)||Ys(Re.startedAt)||0},xe=[],ge=[];for(const Re of f){const Ae=Re?.postWork;if(!Ae)continue;const be=String(Ae.state??"").toLowerCase();be==="running"?xe.push(Re):be==="queued"&&ge.push(Re)}xe.sort((Re,Ae)=>fe(Re)-fe(Ae)),ge.sort((Re,Ae)=>fe(Re)-fe(Ae));const Ce=xe.length,Me=Ce+ge.length;for(let Re=0;Re{const fe=String(Z?.id??"");return fe?ae.get(fe):void 0},[ae]);_.useEffect(()=>{if(!q)return;const Z=window.setInterval(()=>G(Date.now()),1e3);return()=>window.clearInterval(Z)},[q]);const W=_.useMemo(()=>f.filter(Z=>{if(Vv(Z)||Z.endedAt)return!1;const fe=String(Z.phase??"").trim(),xe=!!z[Z.id],ge=fe.trim().toLowerCase();return!(ge!==""&&ge!=="recording"||Z.status!=="running"||xe)}).map(Z=>Z.id),[f,z]),K=_.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:Z=>{if(Z.kind==="job"){const Ce=Z.job;return g.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:g.jsx(fR,{jobId:Ce.id,blur:d,alignStartAt:Ce.startedAt,alignEndAt:Ce.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:gR(Ce),className:"w-full h-full"})})}const fe=Z.pending,xe=W0(fe),ge=pR(fe);return ge?g.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:g.jsx("img",{src:ge,alt:xe,className:["h-full w-full object-cover",d?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:Ce=>{Ce.currentTarget.style.display="none"}})}):g.jsx("div",{className:"h-[60px] w-[96px] rounded-md bg-gray-100 dark:bg-white/10 grid place-items-center text-sm text-gray-500",children:"⏳"})}},{key:"model",header:"Modelname",widthClassName:"w-[170px]",cell:Z=>{if(Z.kind==="job"){const Ce=Z.job,Me=T1(Ce.output||""),Re=tb(Ce.output),Ae=String(Ce.status??"").toLowerCase(),be=!!z[Ce.id],Pe=!!Y[Ce.id],gt=Ae==="stopped"||Pe&&!!Ce.endedAt,Ye=gt?"stopped":Ae||"unknown",lt=!gt&&be,Ve=lt?"stopping":Ye;return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("span",{className:"min-w-0 block max-w-[170px] truncate font-medium",title:Re,children:Re}),g.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",Ae==="running"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":gt?"bg-slate-500/15 text-slate-900 ring-slate-500/30 dark:bg-slate-400/10 dark:text-slate-200 dark:ring-slate-400/25":Ae==="failed"?"bg-red-500/15 text-red-900 ring-red-500/30 dark:bg-red-400/10 dark:text-red-200 dark:ring-red-400/25":Ae==="finished"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":lt?"bg-amber-500/15 text-amber-900 ring-amber-500/30 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25":"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"].join(" "),title:Ve,children:Ve})]}),g.jsx("span",{className:"block max-w-[220px] truncate",title:Ce.output,children:Me}),Ce.sourceUrl?g.jsx("a",{href:Ce.sourceUrl,target:"_blank",rel:"noreferrer",title:Ce.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:ht=>ht.stopPropagation(),children:Ce.sourceUrl}):g.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const fe=Z.pending,xe=W0(fe),ge=mR(fe);return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:xe,children:xe}),ge?g.jsx("a",{href:ge,target:"_blank",rel:"noreferrer",title:ge,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:Ce=>Ce.stopPropagation(),children:ge}):g.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}},{key:"status",header:"Status",widthClassName:"w-[260px] min-w-[240px]",cell:Z=>{if(Z.kind==="job"){const ge=Z.job;return g.jsx(P$,{job:ge,postworkInfo:ie(ge)})}const xe=(Z.pending.currentShow||"unknown").toLowerCase();return g.jsx("div",{className:"min-w-0",children:g.jsx("div",{className:"truncate",children:g.jsx("span",{className:"font-medium",children:xe})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:Z=>Z.kind==="job"?xR(Z.job,X):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:Z=>Z.kind==="job"?g.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:TR(bR(Z.job))}):g.jsx("span",{className:"tabular-nums text-sm text-gray-500 dark:text-gray-400",children:"—"})},{key:"actions",header:"Aktion",srOnlyHeader:!0,align:"right",widthClassName:"w-[320px] min-w-[300px]",cell:Z=>{if(Z.kind!=="job")return g.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const fe=Z.job,xe=String(fe.phase??"").trim(),ge=!!z[fe.id],Ce=xe.trim().toLowerCase(),Re=Ce!==""&&Ce!=="recording"||fe.status!=="running"||ge,Ae=tb(fe.output||""),be=Ae&&Ae!=="—"?c[Ae.toLowerCase()]:void 0,Pe=!!be?.favorite,gt=be?.liked===!0,Ye=!!be?.watching;return g.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[g.jsx(ja,{job:fe,variant:"table",busy:Re,isFavorite:Pe,isLiked:gt,isWatching:Ye,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a,onAddToDownloads:u,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const lt=String(fe.phase??"").trim(),Ve=!!z[fe.id],ht=lt.trim().toLowerCase(),ct=ht!==""&&ht!=="recording"||fe.status!=="running"||Ve;return g.jsx(di,{size:"sm",variant:"primary",disabled:ct,className:"shrink-0",onClick:Ke=>{Ke.stopPropagation(),!ct&&(I(fe.id),i(fe.id))},children:ct?"Stoppe…":"Stop"})})()]})}}],[d,I,c,X,i,n,r,a,z,Y,ie]),Q=_.useMemo(()=>{const Z=f.filter(fe=>!(Vv(fe)||eA(fe?.status)||fe?.endedAt)).map(fe=>({kind:"job",job:fe}));return Z.sort((fe,xe)=>lc(xe)-lc(fe)),Z},[f]),te=_.useMemo(()=>{const Z=f.filter(ge=>!(!Vv(ge)||eA(ge?.status))).map(ge=>({kind:"job",job:ge})),fe=ge=>{const Ce=ge?.postWork,Me=String(Ce?.state??"").toLowerCase();return Me==="running"?0:Me==="queued"?1:2},xe=ge=>{const Ce=String(ge?.id??""),Me=Ce?ae.get(Ce):void 0;return typeof Me?.pos=="number"&&Number.isFinite(Me.pos)?Me.pos:Number.MAX_SAFE_INTEGER};return Z.sort((ge,Ce)=>{const Me=ge.job,Re=Ce.job,Ae=fe(Me)-fe(Re);if(Ae!==0)return Ae;const be=xe(Me),Pe=xe(Re);return be!==Pe?be-Pe:lc(ge)-lc(Ce)}),Z},[f,ae]),re=_.useMemo(()=>{const Z=e.map(fe=>({kind:"pending",pending:fe}));return Z.sort((fe,xe)=>lc(xe)-lc(fe)),Z},[e]),U=Q.length+te.length+re.length,ne=_.useCallback(async()=>{if(!y&&W.length!==0){v(!0);try{I(W),await Promise.allSettled(W.map(Z=>Promise.resolve(i(Z))))}finally{v(!1)}}},[y,W,I,i]);return g.jsxs("div",{className:"grid gap-3",children:[g.jsx("div",{className:"sticky top-[56px] z-20",children:g.jsx("div",{className:` + `,children:p.jsx(SR,{jobId:y.id,blur:t,alignStartAt:y.startedAt,alignEndAt:y.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:wR(y),className:"w-full h-full"})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("div",{className:"truncate text-base font-semibold text-gray-900 dark:text-white",title:v,children:v}),p.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold","bg-gray-900/5 text-gray-800 dark:bg-white/10 dark:text-gray-200",F?"ring-1 ring-amber-500/30":"ring-1 ring-emerald-500/25"].join(" "),title:L,children:L})]}),p.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-600 dark:text-gray-300",title:y.output,children:b||"—"})]}),p.jsxs("div",{className:"shrink-0 flex flex-col items-end gap-1",children:[p.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:CR(y,e)}),p.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:LR(DR(y))})]})]}),y.sourceUrl?p.jsx("a",{href:y.sourceUrl,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:q=>q.stopPropagation(),title:y.sourceUrl,children:y.sourceUrl}):null]})]}),N||X?p.jsx("div",{className:"mt-3",children:N?p.jsx(qh,{label:W,value:Math.max(0,Math.min(100,I)),showPercent:!0,size:"sm",className:"w-full"}):p.jsx(qh,{label:W,indeterminate:!0,size:"sm",className:"w-full"})}):null,p.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/30 pt-3 dark:border-white/10",children:[p.jsx("div",{className:"flex items-center gap-1",onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:p.jsx(pa,{job:y,variant:"table",busy:F,isFavorite:ne,isLiked:ie,isWatching:K,onToggleFavorite:d,onToggleLike:f,onToggleWatch:g,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),p.jsx(mi,{size:"sm",variant:"primary",disabled:F,className:"shrink-0",onClick:q=>{q.stopPropagation(),!F&&(a(y.id),c(y.id))},children:F?"Stoppe…":"Stop"})]})]})]})}const E1=s=>(s||"").replaceAll("\\","/").trim().split("/").pop()||"",nb=s=>{const e=E1(s||"");if(!e)return"—";const t=e.replace(/\.[^.]+$/,""),i=t.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(i?.[1])return i[1];const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t},Z$=s=>{if(!Number.isFinite(s)||s<=0)return"—";const e=Math.floor(s/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${n}s`:`${n}s`},CR=(s,e)=>{const t=s,i=Js(t.startedAtMs)||Js(s.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const n=s.endedAt?Js(t.endedAtMs)||Js(s.endedAt):e;return!Number.isFinite(n)||n<=0?"—":Z$(n-i)},DR=s=>{const e=s,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null},LR=s=>{if(!s||!Number.isFinite(s)||s<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=10?1:2;return`${t.toFixed(n).replace(/\.0+$/,"")} ${e[i]}`},Wv=s=>{const e=s,t=String(e.phase??"").trim(),i=e.postWork;return!!(String(e.postWorkKey??"").trim()||i&&(i.state==="queued"||i.state==="running")||s.endedAt&&t||t==="postwork")},oA=s=>{const e=String(s??"").trim().toLowerCase();return e==="stopped"||e==="finished"||e==="failed"||e==="done"||e==="completed"||e==="canceled"||e==="cancelled"};function J$({jobs:s,pending:e=[],onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a,onAddToDownloads:u,modelsByKey:c={},blurPreviews:d}){const f=K$(s),g=W$("(min-width: 640px)",!0),[y,v]=_.useState(!1),[b,T]=_.useState(!1),E=_.useRef(null),[D,O]=_.useState(!1),R=_.useCallback(async()=>{try{const pe=!!(await X$("/api/autostart/state",{cache:"no-store"}))?.paused;E.current=pe,T(pe)}catch{}},[]);_.useEffect(()=>{R();const Q=up("/api/autostart/state/stream","autostart",pe=>{const be=!!pe?.paused;E.current!==be&&(E.current=be,T(be))});return()=>{Q()}},[R]);const j=_.useCallback(async()=>{if(!(D||b)){O(!0);try{await fetch("/api/autostart/pause",{method:"POST"}),T(!0)}catch{}finally{O(!1)}}},[D,b]),F=_.useCallback(async()=>{if(!(D||!b)){O(!0);try{await fetch("/api/autostart/resume",{method:"POST"}),T(!1)}catch{}finally{O(!1)}}},[D,b]),[G,L]=_.useState({}),[W,I]=_.useState({}),N=_.useCallback(Q=>{const pe=Array.isArray(Q)?Q:[Q];L(be=>{const ve={...be};for(const we of pe)we&&(ve[we]=!0);return ve}),I(be=>{const ve={...be};for(const we of pe)we&&(ve[we]=!0);return ve})},[]);_.useEffect(()=>{L(Q=>{const pe=Object.keys(Q);if(pe.length===0)return Q;const be={};for(const ve of pe){const we=f.find(De=>De.id===ve);if(!we)continue;const He=String(we.phase??"").trim().toLowerCase();He!==""&&He!=="recording"||we.status!=="running"||(be[ve]=!0)}return be})},[f]);const[X,V]=_.useState(()=>Date.now()),Y=_.useMemo(()=>f.some(Q=>!Q.endedAt&&Q.status==="running"),[f]),ne=_.useMemo(()=>{const Q=new Map,pe=Fe=>{const Ze=Fe,De=Ze.postWork;return Js(De?.enqueuedAt)||Js(Ze.enqueuedAt)||Js(Ze.queuedAt)||Js(Ze.createdAt)||Js(Ze.addedAt)||Js(Fe.endedAt)||Js(Fe.startedAt)||0},be=[],ve=[];for(const Fe of f){const Ze=Fe?.postWork;if(!Ze)continue;const De=String(Ze.state??"").toLowerCase();De==="running"?be.push(Fe):De==="queued"&&ve.push(Fe)}be.sort((Fe,Ze)=>pe(Fe)-pe(Ze)),ve.sort((Fe,Ze)=>pe(Fe)-pe(Ze));const we=be.length,He=we+ve.length;for(let Fe=0;Fe{const pe=String(Q?.id??"");return pe?ne.get(pe):void 0},[ne]);_.useEffect(()=>{if(!Y)return;const Q=window.setInterval(()=>V(Date.now()),1e3);return()=>window.clearInterval(Q)},[Y]);const K=_.useMemo(()=>f.filter(Q=>{if(Wv(Q)||Q.endedAt)return!1;const pe=String(Q.phase??"").trim(),be=!!G[Q.id],ve=pe.trim().toLowerCase();return!(ve!==""&&ve!=="recording"||Q.status!=="running"||be)}).map(Q=>Q.id),[f,G]),q=_.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:Q=>{if(Q.kind==="job"){const we=Q.job;return p.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:p.jsx(SR,{jobId:we.id,blur:d,alignStartAt:we.startedAt,alignEndAt:we.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:wR(we),className:"w-full h-full"})})}const pe=Q.pending,be=Z0(pe),ve=ER(pe);return ve?p.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:p.jsx("img",{src:ve,alt:be,className:["h-full w-full object-cover",d?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:we=>{we.currentTarget.style.display="none"}})}):p.jsx("div",{className:"h-[60px] w-[96px] rounded-md bg-gray-100 dark:bg-white/10 grid place-items-center text-sm text-gray-500",children:"⏳"})}},{key:"model",header:"Modelname",widthClassName:"w-[170px]",cell:Q=>{if(Q.kind==="job"){const we=Q.job,He=E1(we.output||""),Fe=nb(we.output),Ze=String(we.status??"").toLowerCase(),De=!!G[we.id],Ye=!!W[we.id],wt=Ze==="stopped"||Ye&&!!we.endedAt,vt=wt?"stopped":Ze||"unknown",Ge=!wt&&De,ke=Ge?"stopping":vt;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("span",{className:"min-w-0 block max-w-[170px] truncate font-medium",title:Fe,children:Fe}),p.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",Ze==="running"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":wt?"bg-slate-500/15 text-slate-900 ring-slate-500/30 dark:bg-slate-400/10 dark:text-slate-200 dark:ring-slate-400/25":Ze==="failed"?"bg-red-500/15 text-red-900 ring-red-500/30 dark:bg-red-400/10 dark:text-red-200 dark:ring-red-400/25":Ze==="finished"?"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25":Ge?"bg-amber-500/15 text-amber-900 ring-amber-500/30 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25":"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"].join(" "),title:ke,children:ke})]}),p.jsx("span",{className:"block max-w-[220px] truncate",title:we.output,children:He}),we.sourceUrl?p.jsx("a",{href:we.sourceUrl,target:"_blank",rel:"noreferrer",title:we.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:ut=>ut.stopPropagation(),children:we.sourceUrl}):p.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const pe=Q.pending,be=Z0(pe),ve=_R(pe);return p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:be,children:be}),ve?p.jsx("a",{href:ve,target:"_blank",rel:"noreferrer",title:ve,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:we=>we.stopPropagation(),children:ve}):p.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}},{key:"status",header:"Status",widthClassName:"w-[260px] min-w-[240px]",cell:Q=>{if(Q.kind==="job"){const ve=Q.job;return p.jsx(Q$,{job:ve,postworkInfo:ie(ve)})}const be=(Q.pending.currentShow||"unknown").toLowerCase();return p.jsx("div",{className:"min-w-0",children:p.jsx("div",{className:"truncate",children:p.jsx("span",{className:"font-medium",children:be})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:Q=>Q.kind==="job"?CR(Q.job,X):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:Q=>Q.kind==="job"?p.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:LR(DR(Q.job))}):p.jsx("span",{className:"tabular-nums text-sm text-gray-500 dark:text-gray-400",children:"—"})},{key:"actions",header:"Aktion",srOnlyHeader:!0,align:"right",widthClassName:"w-[320px] min-w-[300px]",cell:Q=>{if(Q.kind!=="job")return p.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const pe=Q.job,be=String(pe.phase??"").trim(),ve=!!G[pe.id],we=be.trim().toLowerCase(),Fe=we!==""&&we!=="recording"||pe.status!=="running"||ve,Ze=nb(pe.output||""),De=Ze&&Ze!=="—"?c[Ze.toLowerCase()]:void 0,Ye=!!De?.favorite,wt=De?.liked===!0,vt=!!De?.watching;return p.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[p.jsx(pa,{job:pe,variant:"table",busy:Fe,isFavorite:Ye,isLiked:wt,isWatching:vt,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a,onAddToDownloads:u,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const Ge=String(pe.phase??"").trim(),ke=!!G[pe.id],ut=Ge.trim().toLowerCase(),Je=ut!==""&&ut!=="recording"||pe.status!=="running"||ke;return p.jsx(mi,{size:"sm",variant:"primary",disabled:Je,className:"shrink-0",onClick:at=>{at.stopPropagation(),!Je&&(N(pe.id),i(pe.id))},children:Je?"Stoppe…":"Stop"})})()]})}}],[d,N,c,X,i,n,r,a,G,W,ie]),Z=_.useMemo(()=>{const Q=f.filter(pe=>!(Wv(pe)||oA(pe?.status)||pe?.endedAt)).map(pe=>({kind:"job",job:pe}));return Q.sort((pe,be)=>cc(be)-cc(pe)),Q},[f]),te=_.useMemo(()=>{const Q=f.filter(ve=>!(!Wv(ve)||oA(ve?.status))).map(ve=>({kind:"job",job:ve})),pe=ve=>{const we=ve?.postWork,He=String(we?.state??"").toLowerCase();return He==="running"?0:He==="queued"?1:2},be=ve=>{const we=String(ve?.id??""),He=we?ne.get(we):void 0;return typeof He?.pos=="number"&&Number.isFinite(He.pos)?He.pos:Number.MAX_SAFE_INTEGER};return Q.sort((ve,we)=>{const He=ve.job,Fe=we.job,Ze=pe(He)-pe(Fe);if(Ze!==0)return Ze;const De=be(He),Ye=be(Fe);return De!==Ye?De-Ye:cc(ve)-cc(we)}),Q},[f,ne]),le=_.useMemo(()=>{const Q=e.map(pe=>({kind:"pending",pending:pe}));return Q.sort((pe,be)=>cc(be)-cc(pe)),Q},[e]),z=Z.length+te.length+le.length,re=_.useCallback(async()=>{if(!y&&K.length!==0){v(!0);try{N(K),await Promise.allSettled(K.map(Q=>Promise.resolve(i(Q))))}finally{v(!1)}}},[y,K,N,i]);return p.jsxs("div",{className:"grid gap-3",children:[p.jsx("div",{className:"sticky top-[56px] z-20",children:p.jsx("div",{className:` rounded-xl border border-gray-200/70 bg-white/80 shadow-sm backdrop-blur supports-[backdrop-filter]:bg-white/60 dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40 - `,children:g.jsxs("div",{className:"flex items-center justify-between gap-2 p-3",children:[g.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Downloads"}),g.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:U})]}),g.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[g.jsx(di,{size:"sm",variant:b?"secondary":"primary",disabled:D,onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),b?F():j()},className:"hidden sm:inline-flex",title:b?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:b?g.jsx(AM,{className:"size-4 shrink-0"}):g.jsx(CM,{className:"size-4 shrink-0"}),children:"Autostart"}),g.jsx(di,{size:"sm",variant:"primary",disabled:y||W.length===0,onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),ne()},className:"hidden sm:inline-flex",title:W.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:y?"Stoppe alle…":`Alle stoppen (${W.length})`})]})]})})}),Q.length>0||te.length>0||re.length>0?g.jsx(g.Fragment,{children:p?g.jsxs("div",{className:"mt-3 space-y-4",children:[Q.length>0?g.jsxs("div",{className:"overflow-x-auto",children:[g.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Downloads (",Q.length,")"]}),g.jsx(Th,{rows:Q,columns:K,getRowKey:Z=>Z.kind==="job"?`dl:job:${Z.job.id}`:`dl:pending:${oc(Z.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Z=>{Z.kind==="job"&&t(Z.job)}})]}):null,te.length>0?g.jsxs("div",{className:"overflow-x-auto",children:[g.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Nacharbeiten (",te.length,")"]}),g.jsx(Th,{rows:te,columns:K,getRowKey:Z=>Z.kind==="job"?`pw:job:${Z.job.id}`:`pw:pending:${oc(Z.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Z=>{Z.kind==="job"&&t(Z.job)}})]}):null,re.length>0?g.jsxs("div",{className:"overflow-x-auto",children:[g.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Wartend (",re.length,")"]}),g.jsx(Th,{rows:re,columns:K,getRowKey:Z=>Z.kind==="job"?`wa:job:${Z.job.id}`:`wa:pending:${oc(Z.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):g.jsxs("div",{className:"mt-3 grid gap-4",children:[Q.length>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Downloads (",Q.length,")"]}),Q.map(Z=>g.jsx(zv,{r:Z,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:z,markStopRequested:I,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`dl:${Z.kind==="job"?Z.job.id:oc(Z.pending)}`))]}):null,te.length>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Nacharbeiten (",te.length,")"]}),te.map(Z=>g.jsx(zv,{r:Z,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:z,markStopRequested:I,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`pw:${Z.kind==="job"?Z.job.id:oc(Z.pending)}`))]}):null,re.length>0?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Wartend (",re.length,")"]}),re.map(Z=>g.jsx(zv,{r:Z,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:z,markStopRequested:I,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`wa:${Z.kind==="job"?Z.job.id:oc(Z.pending)}`))]}):null]})}):g.jsx(ca,{grayBody:!0,children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:g.jsx("span",{className:"text-lg",children:"⏸️"})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine laufenden Downloads"}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Starte oben eine URL – hier siehst du Live-Status und kannst Jobs stoppen."})]})]})})]})}function Rn(...s){return s.filter(Boolean).join(" ")}function ib({open:s,onClose:e,title:t,children:i,footer:n,icon:r,width:a="max-w-lg",layout:u="single",left:c,leftWidthClass:d="lg:w-80",scroll:f,bodyClassName:p,leftClassName:y,rightClassName:v,rightHeader:b,rightBodyClassName:T,mobileCollapsedImageSrc:E,mobileCollapsedImageAlt:D}){const O=f??(u==="split"?"right":"body"),R=_.useRef(null),[j,F]=_.useState(!1);return _.useEffect(()=>{if(!s)return;const z=document.documentElement,N=document.body,Y=z.style.overflow,L=N.style.overflow,I=N.style.paddingRight,X=window.innerWidth-z.clientWidth;return z.style.overflow="hidden",N.style.overflow="hidden",X>0&&(N.style.paddingRight=`${X}px`),()=>{z.style.overflow=Y,N.style.overflow=L,N.style.paddingRight=I}},[s]),_.useEffect(()=>{s&&F(!1)},[s]),_.useEffect(()=>{if(!s)return;const z=R.current;if(!z)return;const N=72,Y=()=>{const L=z.scrollTop||0;F(I=>{const X=L>N;return I===X?I:X})};return Y(),z.addEventListener("scroll",Y,{passive:!0}),()=>z.removeEventListener("scroll",Y)},[s]),g.jsx(xh,{show:s,as:_.Fragment,children:g.jsxs(pc,{open:s,as:"div",className:"relative z-50",onClose:e,children:[g.jsx(xh.Child,{as:_.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:g.jsx("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/50"})}),g.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden px-4 py-6 sm:px-6",children:g.jsx("div",{className:"min-h-full flex items-start justify-center sm:items-center",children:g.jsx(xh.Child,{as:_.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:g.jsxs(pc.Panel,{className:Rn("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",a),children:[r?g.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:r}):null,g.jsxs("div",{className:Rn("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",u==="split"?"hidden lg:flex":"flex"),children:[g.jsx("div",{className:"min-w-0",children:t?g.jsx(pc.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),g.jsx("button",{type:"button",onClick:e,className:Rn("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:g.jsx(f0,{className:"size-5"})})]}),u==="single"?g.jsx("div",{className:Rn("flex-1 min-h-0 h-full",O==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",v),children:i}):g.jsxs("div",{className:Rn("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",p),children:[g.jsxs("div",{ref:R,className:Rn("lg:hidden flex-1 min-h-0 relative",O==="right"||O==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[g.jsxs("div",{className:Rn("sticky top-0 z-50","bg-white/95 backdrop-blur dark:bg-gray-800/95","border-b border-gray-200/70 dark:border-white/10"),children:[g.jsxs("div",{className:Rn("flex items-center justify-between gap-3 px-3",j?"py-2":"py-3"),children:[g.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[E?g.jsx("img",{src:E,alt:D||t||"",className:Rn("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",j?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,g.jsx("div",{className:"min-w-0",children:t?g.jsx("div",{className:Rn("truncate font-semibold text-gray-900 dark:text-white",j?"text-sm":"text-base"),children:t}):null})]}),g.jsx("button",{type:"button",onClick:e,className:Rn("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:g.jsx(f0,{className:"size-5"})})]}),b?g.jsx("div",{children:b}):null]}),c?g.jsx("div",{className:Rn("lg:hidden px-2 pb-2",y),children:c}):null,g.jsx("div",{className:Rn("px-2 pt-0 min-h-0",v),children:g.jsx("div",{className:Rn("min-h-0",T),children:i})})]}),g.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[g.jsx("div",{className:Rn("min-h-0",d,"shrink-0","overflow-hidden",y),children:c}),g.jsxs("div",{className:Rn("flex-1 min-h-0 flex flex-col",v),children:[b?g.jsx("div",{className:"shrink-0",children:b}):null,g.jsx("div",{className:Rn("flex-1 min-h-0",O==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",T),children:i})]})]})]}),n?g.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:n}):null]})})})})]})})}async function Gv(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const tA=(s,e)=>g.jsx("span",{className:Mi("inline-flex items-center rounded-md px-2 py-0.5 text-xs","bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-200"),children:e});function U$(s){let e=(s??"").trim();if(!e)return null;/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function qv(s){if(!s)return[];const e=s.split(/[\n,;|]+/g).map(i=>i.trim()).filter(Boolean),t=Array.from(new Set(e));return t.sort((i,n)=>i.localeCompare(n,void 0,{sensitivity:"base"})),t}function j$(s){return String(s??"").trim().toLowerCase().replace(/^www\./,"")}function $$(s){const t=String(s||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function H$(s){const e=String(s||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function z$(s){const e=$$(s||""),t=H$(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i}function Kv(s){if(s.isUrl&&/^https?:\/\//i.test(String(s.input??"")))return String(s.input);const e=j$(s.host),t=String(s.modelKey??"").trim();return!e||!t?null:e.includes("chaturbate.com")||e.includes("chaturbate")?`https://chaturbate.com/${encodeURIComponent(t)}/`:e.includes("myfreecams.com")||e.includes("myfreecams")?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:null}function iA({title:s,active:e,hiddenUntilHover:t,onClick:i,icon:n}){return g.jsx("span",{className:Mi(t&&!e?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:g.jsx(di,{variant:e?"soft":"secondary",size:"xs",className:Mi("px-2 py-1 leading-none",e?"":"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:s,onClick:i,children:g.jsx("span",{className:"text-base leading-none",children:n})})})}function sA(s){return s==null?{isNull:!0,kind:"string",value:""}:s instanceof Date?{isNull:!1,kind:"number",value:s.getTime()}:typeof s=="number"?{isNull:!1,kind:"number",value:s}:typeof s=="boolean"?{isNull:!1,kind:"number",value:s?1:0}:typeof s=="bigint"?{isNull:!1,kind:"number",value:Number(s)}:{isNull:!1,kind:"string",value:String(s).toLocaleLowerCase()}}function V$(){const[s,e]=_.useState([]),t=_.useRef({}),[i,n]=_.useState(!1),[r,a]=_.useState(null),[u,c]=_.useState(""),[d,f]=_.useState(1),p=10,[y,v]=_.useState([]),[b,T]=_.useState({}),[E,D]=_.useState(!1),[O,R]=_.useState(),j=_.useCallback(async()=>{D(!0);try{const pe=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!pe.ok)return;const We=await pe.json().catch(()=>null),Je=Array.isArray(We?.items)?We.items:Array.isArray(We)?We:[],ot={};for(const St of Je){const vt=z$(St.output);if(!vt||vt==="—")continue;const Vt=vt.trim().toLowerCase();Vt&&(ot[Vt]=(ot[Vt]??0)+1)}T(ot)}finally{D(!1)}},[]),F=_.useMemo(()=>new Set(y.map(pe=>pe.toLowerCase())),[y]),z=_.useCallback(pe=>{const We=pe.toLowerCase();v(Je=>Je.some(St=>St.toLowerCase()===We)?Je.filter(St=>St.toLowerCase()!==We):[...Je,pe])},[]),N=_.useCallback(()=>v([]),[]);_.useEffect(()=>{const pe=We=>{const Je=We,ot=Array.isArray(Je.detail?.tags)?Je.detail.tags:[];v(ot)};return window.addEventListener("models:set-tag-filter",pe),()=>window.removeEventListener("models:set-tag-filter",pe)},[]),_.useEffect(()=>{try{const pe=localStorage.getItem("models_pendingTags");if(!pe)return;const We=JSON.parse(pe);Array.isArray(We)&&v(We),localStorage.removeItem("models_pendingTags")}catch{}},[]);const[Y,L]=_.useState(""),[I,X]=_.useState(null),[G,q]=_.useState(null),[ae,ie]=_.useState(!1),[W,K]=_.useState(!1),[Q,te]=_.useState(null),[re,U]=_.useState(null),[ne,Z]=_.useState("favorite"),[fe,xe]=_.useState(!1),[ge,Ce]=_.useState(null);async function Me(){if(Q){xe(!0),U(null),a(null);try{const pe=new FormData;pe.append("file",Q),pe.append("kind",ne);const We=await fetch("/api/models/import",{method:"POST",body:pe});if(!We.ok)throw new Error(await We.text());const Je=await We.json();U(`✅ Import: ${Je.inserted} neu, ${Je.updated} aktualisiert, ${Je.skipped} übersprungen`),K(!1),te(null),await be(),window.dispatchEvent(new Event("models-changed"))}catch(pe){Ce(pe?.message??String(pe))}finally{xe(!1)}}}function Re(pe){const We=Kv(pe)??void 0;return{output:`${pe.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:We}}const Ae=()=>{Ce(null),U(null),te(null),Z("favorite"),K(!0)},be=_.useCallback(async()=>{n(!0),a(null);try{const pe=await Gv("/api/models/list",{cache:"no-store"});e(Array.isArray(pe)?pe:[]),j()}catch(pe){a(pe?.message??String(pe))}finally{n(!1)}},[j]);_.useEffect(()=>{j()},[j]),_.useEffect(()=>{be()},[be]),_.useEffect(()=>{const pe=We=>{const ot=We?.detail??{};if(ot?.model){const St=ot.model;e(vt=>{const Vt=vt.findIndex($t=>$t.id===St.id);if(Vt===-1)return vt;const si=vt.slice();return si[Vt]=St,si});return}if(ot?.removed&&ot?.id){const St=String(ot.id);e(vt=>vt.filter(Vt=>Vt.id!==St));return}be()};return window.addEventListener("models-changed",pe),()=>window.removeEventListener("models-changed",pe)},[be]),_.useEffect(()=>{const pe=Y.trim();if(!pe){X(null),q(null);return}const We=U$(pe);if(!We){X(null),q("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const Je=window.setTimeout(async()=>{try{const ot=await Gv("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:We})});if(!ot?.isUrl){X(null),q("Bitte nur URLs einfügen (keine Modelnamen).");return}X(ot),q(null)}catch(ot){X(null),q(ot?.message??String(ot))}},300);return()=>window.clearTimeout(Je)},[Y]);const Pe=_.useMemo(()=>s.map(pe=>({m:pe,hay:`${pe.modelKey} ${pe.host??""} ${pe.input??""} ${pe.tags??""}`.toLowerCase()})),[s]),gt=_.useDeferredValue(u),Ye=_.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:pe=>{const We=pe.liked===!0,Je=pe.favorite===!0,ot=pe.watching===!0,St=!ot&&!Je&&!We;return g.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[g.jsx("span",{className:Mi(St&&!ot?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:g.jsx(di,{variant:ot?"soft":"secondary",size:"xs",className:Mi("px-2 py-1 leading-none",!ot&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:ot?"Nicht mehr beobachten":"Beobachten",onClick:vt=>{vt.stopPropagation(),_t(pe.id,{watched:!ot})},children:g.jsx("span",{className:Mi("text-base leading-none",ot?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),g.jsx(iA,{title:Je?"Favorit entfernen":"Als Favorit markieren",active:Je,hiddenUntilHover:St,onClick:vt=>{vt.stopPropagation(),Je?_t(pe.id,{favorite:!1}):_t(pe.id,{favorite:!0,liked:!1})},icon:g.jsx("span",{className:Je?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),g.jsx(iA,{title:We?"Gefällt mir entfernen":"Gefällt mir",active:We,hiddenUntilHover:St,onClick:vt=>{vt.stopPropagation(),We?_t(pe.id,{liked:!1}):_t(pe.id,{liked:!0,favorite:!1})},icon:g.jsx("span",{className:We?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:pe=>(pe.modelKey||"").toLowerCase(),cell:pe=>{const We=Kv(pe);return g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("div",{className:"font-medium truncate",children:pe.modelKey}),We?g.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:We,onClick:Je=>{Je.stopPropagation(),window.open(We,"_blank","noreferrer")},children:"↗"}):null]}),g.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:pe.host??"—"}),We?g.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:We}):null]})}},{key:"videos",header:"Videos",sortable:!0,sortValue:pe=>{const We=String(pe.modelKey||"").trim().toLowerCase(),Je=b[We];return typeof Je=="number"?Je:0},align:"right",cell:pe=>{const We=String(pe.modelKey||"").trim().toLowerCase(),Je=b[We];return g.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white w-[64px] inline-block text-right",children:typeof Je=="number"?Je:E?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:pe=>qv(pe.tags).length,cell:pe=>{const We=qv(pe.tags),Je=We.slice(0,6),ot=We.length-Je.length,St=We.join(", ");return g.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:St||void 0,children:[pe.hot?tA(!0,"🔥 HOT"):null,pe.keep?tA(!0,"📌 Behalten"):null,Je.map(vt=>g.jsx($a,{tag:vt,title:vt,active:F.has(vt.toLowerCase()),onClick:z},vt)),ot>0?g.jsxs($a,{title:St,children:["+",ot]}):null,!pe.hot&&!pe.keep&&We.length===0?g.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"}):null]})}},{key:"actions",header:"",align:"right",cell:pe=>g.jsx("div",{className:"flex justify-end w-[92px]",children:g.jsx(ja,{job:Re(pe),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[F,z,b,E]),lt=_.useMemo(()=>{const pe=gt.trim().toLowerCase(),We=pe?Pe.filter(Je=>Je.hay.includes(pe)).map(Je=>Je.m):s;return F.size===0?We:We.filter(Je=>{const ot=qv(Je.tags);if(ot.length===0)return!1;const St=new Set(ot.map(vt=>vt.toLowerCase()));for(const vt of F)if(!St.has(vt))return!1;return!0})},[s,Pe,gt,F]),Ve=_.useMemo(()=>{if(!O)return lt;const pe=Ye.find(ot=>ot.key===O.key);if(!pe)return lt;const We=O.direction==="asc"?1:-1,Je=lt.map((ot,St)=>({r:ot,i:St}));return Je.sort((ot,St)=>{let vt=0;if(pe.sortFn)vt=pe.sortFn(ot.r,St.r);else{const Vt=pe.sortValue?pe.sortValue(ot.r):ot.r?.[pe.key],si=pe.sortValue?pe.sortValue(St.r):St.r?.[pe.key],$t=sA(Vt),Pt=sA(si);$t.isNull&&!Pt.isNull?vt=1:!$t.isNull&&Pt.isNull?vt=-1:$t.kind==="number"&&Pt.kind==="number"?vt=$t.valuePt.value?1:0:vt=String($t.value).localeCompare(String(Pt.value),void 0,{numeric:!0})}return vt===0?ot.i-St.i:vt*We}),Je.map(ot=>ot.r)},[lt,O,Ye]);_.useEffect(()=>{f(1)},[u,y]);const ht=Ve.length,st=_.useMemo(()=>Math.max(1,Math.ceil(ht/p)),[ht,p]);_.useEffect(()=>{d>st&&f(st)},[d,st]);const ct=_.useMemo(()=>{const pe=(d-1)*p;return Ve.slice(pe,pe+p)},[Ve,d,p]),Ke=async()=>{if(I){if(!I.isUrl){q("Bitte nur URLs einfügen (keine Modelnamen).");return}ie(!0),a(null);try{const pe=await Gv("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)});e(We=>{const Je=We.filter(ot=>ot.id!==pe.id);return[pe,...Je]}),L(""),X(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:pe}}))}catch(pe){a(pe?.message??String(pe))}finally{ie(!1)}}};async function _t(pe,We){if(a(null),t.current[pe])return;t.current[pe]=!0;const Je=s.find(ot=>ot.id===pe)??null;if(Je){const ot={...Je,...We};typeof We?.watched=="boolean"&&(ot.watching=We.watched),We?.favorite===!0&&(ot.liked=!1),We?.liked===!0&&(ot.favorite=!1),e(St=>St.map(vt=>vt.id===pe?ot:vt)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ot}}))}try{const ot=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:pe,...We})});if(ot.status===204){e(vt=>vt.filter(Vt=>Vt.id!==pe)),Je?window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Je.id,modelKey:Je.modelKey}})):window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:pe}}));return}if(!ot.ok){const vt=await ot.text().catch(()=>"");throw new Error(vt||`HTTP ${ot.status}`)}const St=await ot.json();e(vt=>{const Vt=vt.findIndex($t=>$t.id===St.id);if(Vt===-1)return vt;const si=vt.slice();return si[Vt]=St,si}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:St}}))}catch(ot){Je&&(e(St=>St.map(vt=>vt.id===pe?Je:vt)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Je}}))),a(ot?.message??String(ot))}finally{delete t.current[pe]}}return g.jsxs("div",{className:"space-y-4",children:[g.jsx(ca,{header:g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Model hinzufügen"}),grayBody:!0,children:g.jsxs("div",{className:"grid gap-2",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[g.jsx("input",{value:Y,onChange:pe=>L(pe.target.value),placeholder:"https://…",className:"flex-1 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),g.jsx(di,{className:"px-3 py-2 text-sm",onClick:Ke,disabled:!I||ae,title:I?"In Models speichern":"Bitte gültige URL einfügen",children:"Hinzufügen"}),g.jsx(di,{className:"px-3 py-2 text-sm",onClick:be,disabled:i,children:"Aktualisieren"})]}),G?g.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:G}):I?g.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Gefunden: ",g.jsx("span",{className:"font-medium",children:I.modelKey}),I.host?g.jsxs("span",{className:"opacity-70",children:[" • ",I.host]}):null]}):null,r?g.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:r}):null]})}),g.jsxs(ca,{header:g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"grid gap-2 sm:flex sm:items-center sm:justify-between",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Models ",g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",lt.length,")"]})]}),g.jsx("div",{className:"sm:hidden",children:g.jsx(di,{variant:"secondary",size:"md",onClick:Ae,children:"Import"})})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("div",{className:"hidden sm:block",children:g.jsx(di,{variant:"secondary",size:"md",onClick:Ae,children:"Importieren"})}),g.jsx("input",{value:u,onChange:pe=>c(pe.target.value),placeholder:"Suchen…",className:`\r + `,children:p.jsxs("div",{className:"flex items-center justify-between gap-2 p-3",children:[p.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Downloads"}),p.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:z})]}),p.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[p.jsx(mi,{size:"sm",variant:b?"secondary":"primary",disabled:D,onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),b?F():j()},className:"hidden sm:inline-flex",title:b?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:b?p.jsx(OM,{className:"size-4 shrink-0"}):p.jsx(PM,{className:"size-4 shrink-0"}),children:"Autostart"}),p.jsx(mi,{size:"sm",variant:"primary",disabled:y||K.length===0,onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),re()},className:"hidden sm:inline-flex",title:K.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:y?"Stoppe alle…":`Alle stoppen (${K.length})`})]})]})})}),Z.length>0||te.length>0||le.length>0?p.jsx(p.Fragment,{children:g?p.jsxs("div",{className:"mt-3 space-y-4",children:[Z.length>0?p.jsxs("div",{className:"overflow-x-auto",children:[p.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Downloads (",Z.length,")"]}),p.jsx(Sh,{rows:Z,columns:q,getRowKey:Q=>Q.kind==="job"?`dl:job:${Q.job.id}`:`dl:pending:${uc(Q.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Q=>{Q.kind==="job"&&t(Q.job)}})]}):null,te.length>0?p.jsxs("div",{className:"overflow-x-auto",children:[p.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Nacharbeiten (",te.length,")"]}),p.jsx(Sh,{rows:te,columns:q,getRowKey:Q=>Q.kind==="job"?`pw:job:${Q.job.id}`:`pw:pending:${uc(Q.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Q=>{Q.kind==="job"&&t(Q.job)}})]}):null,le.length>0?p.jsxs("div",{className:"overflow-x-auto",children:[p.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Wartend (",le.length,")"]}),p.jsx(Sh,{rows:le,columns:q,getRowKey:Q=>Q.kind==="job"?`wa:job:${Q.job.id}`:`wa:pending:${uc(Q.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):p.jsxs("div",{className:"mt-3 grid gap-4",children:[Z.length>0?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Downloads (",Z.length,")"]}),Z.map(Q=>p.jsx(Kv,{r:Q,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:G,markStopRequested:N,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`dl:${Q.kind==="job"?Q.job.id:uc(Q.pending)}`))]}):null,te.length>0?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Nacharbeiten (",te.length,")"]}),te.map(Q=>p.jsx(Kv,{r:Q,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:G,markStopRequested:N,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`pw:${Q.kind==="job"?Q.job.id:uc(Q.pending)}`))]}):null,le.length>0?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Wartend (",le.length,")"]}),le.map(Q=>p.jsx(Kv,{r:Q,nowMs:X,blurPreviews:d,modelsByKey:c,postworkInfoOf:ie,stopRequestedIds:G,markStopRequested:N,onOpenPlayer:t,onStopJob:i,onToggleFavorite:n,onToggleLike:r,onToggleWatch:a},`wa:${Q.kind==="job"?Q.job.id:uc(Q.pending)}`))]}):null]})}):p.jsx(ma,{grayBody:!0,children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:p.jsx("span",{className:"text-lg",children:"⏸️"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine laufenden Downloads"}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Starte oben eine URL – hier siehst du Live-Status und kannst Jobs stoppen."})]})]})})]})}function Mn(...s){return s.filter(Boolean).join(" ")}function rb({open:s,onClose:e,title:t,children:i,footer:n,icon:r,width:a="max-w-lg",layout:u="single",left:c,leftWidthClass:d="lg:w-80",scroll:f,bodyClassName:g,leftClassName:y,rightClassName:v,rightHeader:b,rightBodyClassName:T,mobileCollapsedImageSrc:E,mobileCollapsedImageAlt:D}){const O=f??(u==="split"?"right":"body"),R=_.useRef(null),[j,F]=_.useState(!1);return _.useEffect(()=>{if(!s)return;const G=document.documentElement,L=document.body,W=G.style.overflow,I=L.style.overflow,N=L.style.paddingRight,X=window.innerWidth-G.clientWidth;return G.style.overflow="hidden",L.style.overflow="hidden",X>0&&(L.style.paddingRight=`${X}px`),()=>{G.style.overflow=W,L.style.overflow=I,L.style.paddingRight=N}},[s]),_.useEffect(()=>{s&&F(!1)},[s]),_.useEffect(()=>{if(!s)return;const G=R.current;if(!G)return;const L=72,W=()=>{const I=G.scrollTop||0;F(N=>{const X=I>L;return N===X?N:X})};return W(),G.addEventListener("scroll",W,{passive:!0}),()=>G.removeEventListener("scroll",W)},[s]),p.jsx(bh,{show:s,as:_.Fragment,children:p.jsxs(yc,{open:s,as:"div",className:"relative z-50",onClose:e,children:[p.jsx(bh.Child,{as:_.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:p.jsx("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/50"})}),p.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden px-4 py-6 sm:px-6",children:p.jsx("div",{className:"min-h-full flex items-start justify-center sm:items-center",children:p.jsx(bh.Child,{as:_.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:p.jsxs(yc.Panel,{className:Mn("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",a),children:[r?p.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:r}):null,p.jsxs("div",{className:Mn("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",u==="split"?"hidden lg:flex":"flex"),children:[p.jsx("div",{className:"min-w-0",children:t?p.jsx(yc.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),p.jsx("button",{type:"button",onClick:e,className:Mn("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:p.jsx(v0,{className:"size-5"})})]}),u==="single"?p.jsx("div",{className:Mn("flex-1 min-h-0 h-full",O==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",v),children:i}):p.jsxs("div",{className:Mn("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",g),children:[p.jsxs("div",{ref:R,className:Mn("lg:hidden flex-1 min-h-0 relative",O==="right"||O==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[p.jsxs("div",{className:Mn("sticky top-0 z-50","bg-white/95 backdrop-blur dark:bg-gray-800/95","border-b border-gray-200/70 dark:border-white/10"),children:[p.jsxs("div",{className:Mn("flex items-center justify-between gap-3 px-3",j?"py-2":"py-3"),children:[p.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[E?p.jsx("img",{src:E,alt:D||t||"",className:Mn("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",j?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,p.jsx("div",{className:"min-w-0",children:t?p.jsx("div",{className:Mn("truncate font-semibold text-gray-900 dark:text-white",j?"text-sm":"text-base"),children:t}):null})]}),p.jsx("button",{type:"button",onClick:e,className:Mn("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:p.jsx(v0,{className:"size-5"})})]}),b?p.jsx("div",{children:b}):null]}),c?p.jsx("div",{className:Mn("lg:hidden px-2 pb-2",y),children:c}):null,p.jsx("div",{className:Mn("px-2 pt-0 min-h-0",v),children:p.jsx("div",{className:Mn("min-h-0",T),children:i})})]}),p.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[p.jsx("div",{className:Mn("min-h-0",d,"shrink-0","overflow-hidden",y),children:c}),p.jsxs("div",{className:Mn("flex-1 min-h-0 flex flex-col",v),children:[b?p.jsx("div",{className:"shrink-0",children:b}):null,p.jsx("div",{className:Mn("flex-1 min-h-0",O==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",T),children:i})]})]})]}),n?p.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:n}):null]})})})})]})})}async function Yv(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const lA=(s,e)=>p.jsx("span",{className:vi("inline-flex items-center rounded-md px-2 py-0.5 text-xs","bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-200"),children:e});function eH(s){let e=(s??"").trim();if(!e)return null;/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function Wm(s){if(!s)return[];const e=s.split(/[\n,;|]+/g).map(i=>i.trim()).filter(Boolean),t=Array.from(new Set(e));return t.sort((i,n)=>i.localeCompare(n,void 0,{sensitivity:"base"})),t}function tH(s){return String(s??"").trim().toLowerCase().replace(/^www\./,"")}function iH(s){const t=String(s||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function sH(s){const e=String(s||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function nH(s){const e=iH(s||""),t=sH(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i}function Ym(s){if(s.isUrl&&/^https?:\/\//i.test(String(s.input??"")))return String(s.input);const e=tH(s.host),t=String(s.modelKey??"").trim();return!e||!t?null:e.includes("chaturbate.com")||e.includes("chaturbate")?`https://chaturbate.com/${encodeURIComponent(t)}/`:e.includes("myfreecams.com")||e.includes("myfreecams")?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:null}function uA(s){const e=String(s.profileImageCached??"").trim();if(e)return e;const t=String(s.profileImageUrl??"").trim();return/^https?:\/\//i.test(t)?t:null}function cA({title:s,active:e,hiddenUntilHover:t,onClick:i,icon:n}){return p.jsx("span",{className:vi(t&&!e?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:p.jsx(mi,{variant:e?"soft":"secondary",size:"xs",className:vi("px-2 py-1 leading-none",e?"":"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:s,onClick:i,children:p.jsx("span",{className:"text-base leading-none",children:n})})})}function dA(s){return s==null?{isNull:!0,kind:"string",value:""}:s instanceof Date?{isNull:!1,kind:"number",value:s.getTime()}:typeof s=="number"?{isNull:!1,kind:"number",value:s}:typeof s=="boolean"?{isNull:!1,kind:"number",value:s?1:0}:typeof s=="bigint"?{isNull:!1,kind:"number",value:Number(s)}:{isNull:!1,kind:"string",value:String(s).toLocaleLowerCase()}}function rH(){return p.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),p.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),p.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),p.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]})}function aH(){return p.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[p.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p.jsx("path",{d:"M3 10h18"}),p.jsx("path",{d:"M9 10v10"}),p.jsx("path",{d:"M15 10v10"})]})}function oH(){const[s,e]=_.useState([]),t=_.useRef({}),[i,n]=_.useState(!1),[r,a]=_.useState(null),[u,c]=_.useState(""),[d,f]=_.useState(1),g=10,[y,v]=_.useState("gallery"),[b,T]=_.useState([]),[E,D]=_.useState({}),[O,R]=_.useState(!1),[j,F]=_.useState({key:"model",direction:"asc"}),G=_.useCallback(async()=>{R(!0);try{const de=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!de.ok)return;const qe=await de.json().catch(()=>null),ht=Array.isArray(qe?.items)?qe.items:Array.isArray(qe)?qe:[],tt={};for(const At of ht){const ft=nH(At.output);if(!ft||ft==="—")continue;const Et=ft.trim().toLowerCase();Et&&(tt[Et]=(tt[Et]??0)+1)}D(tt)}finally{R(!1)}},[]),L=_.useMemo(()=>new Set(b.map(de=>de.toLowerCase())),[b]),W=_.useCallback(de=>{const qe=de.toLowerCase();T(ht=>ht.some(At=>At.toLowerCase()===qe)?ht.filter(At=>At.toLowerCase()!==qe):[...ht,de])},[]),I=_.useCallback(()=>T([]),[]);_.useEffect(()=>{const de=qe=>{const ht=qe,tt=Array.isArray(ht.detail?.tags)?ht.detail.tags:[];T(tt)};return window.addEventListener("models:set-tag-filter",de),()=>window.removeEventListener("models:set-tag-filter",de)},[]),_.useEffect(()=>{try{const de=localStorage.getItem("models_pendingTags");if(!de)return;const qe=JSON.parse(de);Array.isArray(qe)&&T(qe),localStorage.removeItem("models_pendingTags")}catch{}},[]),_.useEffect(()=>{try{const de=localStorage.getItem("models_viewMode");(de==="table"||de==="gallery")&&v(de)}catch{}},[]),_.useEffect(()=>{try{localStorage.setItem("models_viewMode",y)}catch{}},[y]);const[N,X]=_.useState(""),[V,Y]=_.useState(null),[ne,ie]=_.useState(null),[K,q]=_.useState(!1),[Z,te]=_.useState(!1),[le,z]=_.useState(null),[re,Q]=_.useState(null),[pe,be]=_.useState("favorite"),[ve,we]=_.useState(!1),[He,Fe]=_.useState(null);async function Ze(){if(le){we(!0),Q(null),a(null);try{const de=new FormData;de.append("file",le),de.append("kind",pe);const qe=await fetch("/api/models/import",{method:"POST",body:de});if(!qe.ok)throw new Error(await qe.text());const ht=await qe.json();Q(`✅ Import: ${ht.inserted} neu, ${ht.updated} aktualisiert, ${ht.skipped} übersprungen`),te(!1),z(null),await wt(),window.dispatchEvent(new Event("models-changed"))}catch(de){Fe(de?.message??String(de))}finally{we(!1)}}}function De(de){const qe=Ym(de)??void 0;return{output:`${de.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:qe}}const Ye=()=>{Fe(null),Q(null),z(null),be("favorite"),te(!0)},wt=_.useCallback(async()=>{n(!0),a(null);try{const de=await Yv("/api/models",{cache:"no-store"});e(Array.isArray(de)?de:[]),G()}catch(de){a(de?.message??String(de))}finally{n(!1)}},[G]);_.useEffect(()=>{G()},[G]),_.useEffect(()=>{wt()},[wt]),_.useEffect(()=>{const de=qe=>{const tt=qe?.detail??{};if(tt?.model){const At=tt.model;e(ft=>{const Et=ft.findIndex(Rt=>Rt.id===At.id);if(Et===-1)return[At,...ft];const Lt=ft.slice();return Lt[Et]=At,Lt});return}if(tt?.removed&&tt?.id){const At=String(tt.id);e(ft=>ft.filter(Et=>Et.id!==At));return}wt()};return window.addEventListener("models-changed",de),()=>window.removeEventListener("models-changed",de)},[wt]),_.useEffect(()=>{const de=N.trim();if(!de){Y(null),ie(null);return}const qe=eH(de);if(!qe){Y(null),ie("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const ht=window.setTimeout(async()=>{try{const tt=await Yv("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:qe})});if(!tt?.isUrl){Y(null),ie("Bitte nur URLs einfügen (keine Modelnamen).");return}Y(tt),ie(null)}catch(tt){Y(null),ie(tt?.message??String(tt))}},300);return()=>window.clearTimeout(ht)},[N]);const vt=_.useMemo(()=>s.map(de=>({m:de,hay:`${de.modelKey} ${de.host??""} ${de.input??""} ${de.tags??""}`.toLowerCase()})),[s]),Ge=_.useDeferredValue(u);async function ke(de,qe){if(a(null),t.current[de])return;t.current[de]=!0;const ht=s.find(tt=>tt.id===de)??null;if(ht){const tt={...ht,...qe};typeof qe?.watched=="boolean"&&(tt.watching=qe.watched),qe?.favorite===!0&&(tt.liked=!1),qe?.liked===!0&&(tt.favorite=!1),e(At=>At.map(ft=>ft.id===de?tt:ft)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:tt}}))}try{const tt=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:de,...qe})});if(tt.status===204){e(ft=>ft.filter(Et=>Et.id!==de)),ht?window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ht.id,modelKey:ht.modelKey}})):window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:de}}));return}if(!tt.ok){const ft=await tt.text().catch(()=>"");throw new Error(ft||`HTTP ${tt.status}`)}const At=await tt.json();e(ft=>{const Et=ft.findIndex(Rt=>Rt.id===At.id);if(Et===-1)return ft;const Lt=ft.slice();return Lt[Et]=At,Lt}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:At}}))}catch(tt){ht&&(e(At=>At.map(ft=>ft.id===de?ht:ft)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ht}}))),a(tt?.message??String(tt))}finally{delete t.current[de]}}const ut=_.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:de=>{const qe=de.liked===!0,ht=de.favorite===!0,tt=de.watching===!0,At=!tt&&!ht&&!qe;return p.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[p.jsx("span",{className:vi(At&&!tt?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:p.jsx(mi,{variant:tt?"soft":"secondary",size:"xs",className:vi("px-2 py-1 leading-none",!tt&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:tt?"Nicht mehr beobachten":"Beobachten",onClick:ft=>{ft.stopPropagation(),ke(de.id,{watched:!tt})},children:p.jsx("span",{className:vi("text-base leading-none",tt?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),p.jsx(cA,{title:ht?"Favorit entfernen":"Als Favorit markieren",active:ht,hiddenUntilHover:At,onClick:ft=>{ft.stopPropagation(),ht?ke(de.id,{favorite:!1}):ke(de.id,{favorite:!0,liked:!1})},icon:p.jsx("span",{className:ht?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),p.jsx(cA,{title:qe?"Gefällt mir entfernen":"Gefällt mir",active:qe,hiddenUntilHover:At,onClick:ft=>{ft.stopPropagation(),qe?ke(de.id,{liked:!1}):ke(de.id,{liked:!0,favorite:!1})},icon:p.jsx("span",{className:qe?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:de=>(de.modelKey||"").toLowerCase(),cell:de=>{const qe=Ym(de),ht=uA(de);return p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[p.jsx("div",{className:"shrink-0 mt-0.5",children:ht?p.jsx("img",{src:ht,alt:de.modelKey,loading:"lazy",className:"w-10 h-10 rounded-full object-cover bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10",onClick:tt=>{tt.stopPropagation(),qe&&window.open(qe,"_blank","noreferrer")},onError:tt=>{tt.currentTarget.style.display="none"}}):p.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10 flex items-center justify-center text-xs text-gray-500 dark:text-gray-400",children:String(de.modelKey||"?").slice(0,1).toUpperCase()})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("div",{className:"font-medium truncate",children:de.modelKey}),qe?p.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:qe,onClick:tt=>{tt.stopPropagation(),window.open(qe,"_blank","noreferrer")},children:"↗"}):null]}),p.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:de.host??"—"}),qe?p.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:qe}):null]})]})})}},{key:"videos",header:"Videos",sortable:!0,sortValue:de=>{const qe=String(de.modelKey||"").trim().toLowerCase(),ht=E[qe];return typeof ht=="number"?ht:0},align:"right",cell:de=>{const qe=String(de.modelKey||"").trim().toLowerCase(),ht=E[qe];return p.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white w-[64px] inline-block text-right",children:typeof ht=="number"?ht:O?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:de=>Wm(de.tags).length,cell:de=>{const qe=Wm(de.tags),ht=qe.slice(0,6),tt=qe.length-ht.length,At=qe.join(", ");return p.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:At||void 0,children:[de.hot?lA(!0,"🔥 HOT"):null,de.keep?lA(!0,"📌 Behalten"):null,ht.map(ft=>p.jsx(fa,{tag:ft,title:ft,active:L.has(ft.toLowerCase()),onClick:W},ft)),tt>0?p.jsxs(fa,{title:At,children:["+",tt]}):null,!de.hot&&!de.keep&&qe.length===0?p.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"}):null]})}},{key:"actions",header:"",align:"right",cell:de=>p.jsx("div",{className:"flex justify-end w-[92px]",children:p.jsx(pa,{job:De(de),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[L,W,E,O]),rt=_.useMemo(()=>{const de=Ge.trim().toLowerCase(),qe=de?vt.filter(ht=>ht.hay.includes(de)).map(ht=>ht.m):s;return L.size===0?qe:qe.filter(ht=>{const tt=Wm(ht.tags);if(tt.length===0)return!1;const At=new Set(tt.map(ft=>ft.toLowerCase()));for(const ft of L)if(!At.has(ft))return!1;return!0})},[s,vt,Ge,L]),Je=_.useMemo(()=>{if(!j)return rt;const de=ut.find(tt=>tt.key===j.key);if(!de)return rt;const qe=j.direction==="asc"?1:-1,ht=rt.map((tt,At)=>({r:tt,i:At}));return ht.sort((tt,At)=>{let ft=0;if(de.sortFn)ft=de.sortFn(tt.r,At.r);else{const Et=de.sortValue?de.sortValue(tt.r):tt.r?.[de.key],Lt=de.sortValue?de.sortValue(At.r):At.r?.[de.key],Rt=dA(Et),qt=dA(Lt);Rt.isNull&&!qt.isNull?ft=1:!Rt.isNull&&qt.isNull?ft=-1:Rt.kind==="number"&&qt.kind==="number"?ft=Rt.valueqt.value?1:0:ft=String(Rt.value).localeCompare(String(qt.value),void 0,{numeric:!0})}return ft===0?tt.i-At.i:ft*qe}),ht.map(tt=>tt.r)},[rt,j,ut]);_.useEffect(()=>{f(1)},[u,b,y]);const at=Je.length,Re=_.useMemo(()=>Math.max(1,Math.ceil(at/g)),[at,g]);_.useEffect(()=>{d>Re&&f(Re)},[d,Re]);const ze=_.useMemo(()=>{const de=(d-1)*g;return Je.slice(de,de+g)},[Je,d,g]),Ue=async()=>{if(V){if(!V.isUrl){ie("Bitte nur URLs einfügen (keine Modelnamen).");return}q(!0),a(null);try{const de=await Yv("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});e(qe=>{const ht=qe.filter(tt=>tt.id!==de.id);return[de,...ht]}),X(""),Y(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:de}}))}catch(de){a(de?.message??String(de))}finally{q(!1)}}};return p.jsxs("div",{className:"space-y-4",children:[p.jsx(ma,{header:p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Model hinzufügen"}),grayBody:!0,children:p.jsxs("div",{className:"grid gap-2",children:[p.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[p.jsx("input",{value:N,onChange:de=>X(de.target.value),placeholder:"https://…",className:"flex-1 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),p.jsx(mi,{className:"px-3 py-2 text-sm",onClick:Ue,disabled:!V||K,title:V?"In Models speichern":"Bitte gültige URL einfügen",children:"Hinzufügen"}),p.jsx(mi,{className:"px-3 py-2 text-sm",onClick:wt,disabled:i,children:"Aktualisieren"})]}),ne?p.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:ne}):V?p.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Gefunden: ",p.jsx("span",{className:"font-medium",children:V.modelKey}),V.host?p.jsxs("span",{className:"opacity-70",children:[" • ",V.host]}):null]}):null,r?p.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:r}):null]})}),p.jsx(ma,{header:p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"grid gap-2 sm:flex sm:items-center sm:justify-between",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Models ",p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",rt.length,")"]})]}),p.jsx("div",{className:"sm:hidden",children:p.jsx(mi,{variant:"secondary",size:"md",onClick:Ye,children:"Import"})})]}),p.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ZA,{ariaLabel:"Ansicht umschalten",size:"lg",value:y,onChange:de=>{(de==="table"||de==="gallery")&&v(de)},items:[{id:"gallery",label:"Gallery",icon:p.jsx(rH,{})},{id:"table",label:"Tabelle",icon:p.jsx(aH,{})}]}),p.jsx("div",{className:"hidden sm:block",children:p.jsx(mi,{variant:"secondary",size:"md",onClick:Ye,children:"Importieren"})})]}),p.jsx("input",{value:u,onChange:de=>c(de.target.value),placeholder:"Suchen…",className:`\r w-full sm:w-[260px]\r rounded-md px-3 py-2 text-sm\r bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10\r - `})]})]}),y.length>0?g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Tag-Filter:"}),g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y.map(pe=>g.jsx($a,{tag:pe,active:!0,onClick:z,title:pe},pe)),g.jsx(di,{size:"sm",variant:"soft",className:"text-xs font-medium text-gray-600 hover:underline dark:text-gray-300",onClick:N,children:"Zurücksetzen"})]})]}):null]}),noBodyPadding:!0,children:[g.jsx("div",{className:"overflow-x-auto",children:g.jsx("div",{className:"min-w-[980px]",children:g.jsx(Th,{rows:ct,columns:Ye,getRowKey:pe=>pe.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:O,onSortChange:pe=>R(pe),onRowClick:pe=>{const We=Kv(pe);We&&window.open(We,"_blank","noreferrer")}})})}),g.jsx(KA,{page:d,pageSize:p,totalItems:ht,onPageChange:f})]}),g.jsx(ib,{open:W,onClose:()=>!fe&&K(!1),title:"Models importieren",footer:g.jsxs(g.Fragment,{children:[g.jsx(di,{variant:"secondary",onClick:()=>K(!1),disabled:fe,children:"Abbrechen"}),g.jsx(di,{variant:"primary",onClick:Me,isLoading:fe,disabled:!Q||fe,children:"Import starten"})]}),children:g.jsxs("div",{className:"space-y-3",children:[g.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Wähle eine CSV-Datei zum Import aus."}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Import-Typ"}),g.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[g.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[g.jsx("input",{type:"radio",name:"import-kind",value:"favorite",checked:ne==="favorite",onChange:()=>Z("favorite"),disabled:fe}),"Favoriten (★)"]}),g.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[g.jsx("input",{type:"radio",name:"import-kind",value:"liked",checked:ne==="liked",onChange:()=>Z("liked"),disabled:fe}),"Gefällt mir (♥)"]})]})]}),g.jsx("input",{type:"file",accept:".csv,text/csv",onChange:pe=>{const We=pe.target.files?.[0]??null;Ce(null),te(We)},className:"block w-full text-sm text-gray-700 file:mr-4 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-gray-900 hover:file:bg-gray-200 dark:text-gray-200 dark:file:bg-white/10 dark:file:text-white dark:hover:file:bg-white/20"}),Q?g.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",g.jsx("span",{className:"font-medium",children:Q.name})]}):null,ge?g.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:ge}):null,re?g.jsx("div",{className:"rounded-md bg-green-50 px-3 py-2 text-xs text-green-700 dark:bg-green-500/10 dark:text-green-200",children:re}):null]})})]})}function is(...s){return s.filter(Boolean).join(" ")}const G$=new Intl.NumberFormat("de-DE");function tu(s){return s==null||!Number.isFinite(s)?"—":G$.format(s)}function q$(s){if(s==null||!Number.isFinite(s))return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i0?`${t}:${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${i}:${String(n).padStart(2,"0")}`}function nh(s){if(!s)return"—";const e=typeof s=="string"?new Date(s):s;return Number.isNaN(e.getTime())?String(s):e.toLocaleString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function K$(s){return s?s.split(",").map(e=>e.trim()).filter(Boolean):[]}function ph(s){return(s||"").split(/[\\/]/).pop()||""}function SR(s){if(!s)return"—";const e=typeof s=="string"?new Date(s):s;return Number.isNaN(e.getTime())?String(s):e.toLocaleDateString("de-DE",{year:"2-digit",month:"2-digit",day:"2-digit"})}function S1(s){return s.startsWith("HOT ")?s.slice(4):s}function _R(s){return String(s||"").startsWith("HOT ")}function W$(s,e){const t=String(s||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function Y$(s){return _R(s)?S1(s):`HOT ${s}`}function X$(s){const e=ph(s||""),t=S1(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i}function a0(s){return s?String(s).replace(/[\s\S]*?<\/script>/gi,"").replace(/[\s\S]*?<\/style>/gi,"").replace(/<\/?[^>]+>/g," ").replace(/\s+/g," ").trim():""}function nA(s){const e=String(s??"").trim();if(!e)return"";const t=e.match(/HTTP\s+(\d{3})/i);if(t?.[1])return`HTTP ${t[1]}`;const i=e.toLowerCase();if(i.includes("80?n.slice(0,77)+"…":n}function rA(s){const e=String(s??"").trim();if(!e)return"";const t=a0(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function Q$(s){if(!s)return"";const e=String(s).trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/")?`https://chaturbate.com${e}`:`https://chaturbate.com/${e}`:""}function Lr(s){return is("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",s)}const rh=s=>s?"blur-md scale-[1.03] brightness-90":"";function Z$(s){return S1(s||"").trim()||"—"}function J$(s){const e=s.endedAt??s.completedAt??s.endedAt;return e?SR(e):"—"}function eH(s){let e=String(s??"").trim();if(!e)return"";if(e=e.replace(/^https?:\/\//i,""),e.includes("/")){const t=e.split("/").filter(Boolean);e=t[t.length-1]||e}return e.includes(":")&&(e=e.split(":").pop()||e),e.trim().toLowerCase()}function tH(s){const e=s??{},t=e.cf_clearance||e["cf-clearance"]||e.cfclearance||"",i=e.sessionId||e.sessionid||e.session_id||e["session-id"]||"",n=[];return t&&n.push(`cf_clearance=${t}`),i&&n.push(`sessionid=${i}`),n.join("; ")}function iH({open:s,modelKey:e,onClose:t,onOpenPlayer:i,cookies:n,runningJobs:r,blurPreviews:a,onToggleWatch:u,onToggleFavorite:c,onToggleLike:d,onToggleHot:f,onDelete:p}){const[y,v]=_.useState([]),[,b]=_.useState(!1),[T,E]=_.useState(null),[D,O]=_.useState(null),[R,j]=_.useState(null),[F,z]=_.useState(null),[N,Y]=_.useState(!1),[L,I]=_.useState([]),[X,G]=_.useState(!1),[q,ae]=_.useState([]),[ie,W]=_.useState(!1),[K,Q]=_.useState(0),[te,re]=_.useState(null),[U,ne]=_.useState(0),[Z,fe]=_.useState(1),xe=25,ge=eH(e),Ce=_.useCallback(async()=>{try{const ee=await(await fetch("/api/models/list",{cache:"no-store"})).json().catch(()=>null);v(Array.isArray(ee)?ee:[])}catch{}},[]),Me=_.useCallback(async()=>{if(ge){G(!0);try{const H=`/api/record/done?model=${encodeURIComponent(ge)}&page=${Z}&pageSize=${xe}&sort=completed_desc&includeKeep=1&withCount=1`,Te=await(await fetch(H,{cache:"no-store"})).json().catch(()=>null),Ue=Array.isArray(Te?.items)?Te.items:[],ft=Number(Te?.count??Ue.length);I(Ue),ne(Number.isFinite(ft)?ft:Ue.length)}catch{}finally{G(!1)}}},[ge,Z]);function Re(H){return{id:`model:${H}`,output:`${H}_01_01_2000__00-00-00.mp4`,status:"finished"}}const Ae=_.useCallback((H,ee)=>{const Te=String(H??"").trim();Te&&re({src:Te,alt:ee})},[]);_.useEffect(()=>{s||Q(0)},[s]);const be=_.useMemo(()=>Array.isArray(r)?r:q,[r,q]);_.useEffect(()=>{s&&fe(1)},[s,e]),_.useEffect(()=>{if(!s)return;let H=!0;return b(!0),fetch("/api/models/list",{cache:"no-store"}).then(ee=>ee.json()).then(ee=>{H&&v(Array.isArray(ee)?ee:[])}).catch(()=>{H&&v([])}).finally(()=>{H&&b(!1)}),()=>{H=!1}},[s]),_.useEffect(()=>{if(!s||!ge)return;let H=!0,ee=null,Te=null;const Ue=async()=>{try{Te?.abort(),Te=new AbortController;const Et=await(await fetch("/api/chaturbate/online",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:Te.signal,body:JSON.stringify({q:[ge],show:[],refresh:!1})})).json().catch(()=>null);if(!H)return;O({enabled:Et?.enabled,fetchedAt:Et?.fetchedAt,lastError:Et?.lastError});const pi=Array.isArray(Et?.rooms)?Et.rooms:[];E(pi[0]??null)}catch(ft){if(ft?.name==="AbortError"||!H)return;O({enabled:void 0,fetchedAt:void 0,lastError:"Fetch fehlgeschlagen"}),E(null)}};return Ue(),ee=window.setInterval(Ue,8e3),()=>{H=!1,ee&&window.clearInterval(ee),Te?.abort()}},[s,ge]),_.useEffect(()=>{if(!s||!ge)return;let H=!0;Y(!0),j(null),z(null);const ee=tH(n),Te=`/api/chaturbate/biocontext?model=${encodeURIComponent(ge)}${K>0?"&refresh=1":""}`;return fetch(Te,{cache:"no-store",headers:ee?{"X-Chaturbate-Cookie":ee}:void 0}).then(async Ue=>{if(!Ue.ok){const ft=await Ue.text().catch(()=>"");throw new Error(ft||`HTTP ${Ue.status}`)}return Ue.json()}).then(Ue=>{H&&(z({enabled:Ue?.enabled,fetchedAt:Ue?.fetchedAt,lastError:Ue?.lastError}),j(Ue?.bio??null))}).catch(Ue=>{H&&(z({enabled:void 0,fetchedAt:void 0,lastError:Ue?.message||"Fetch fehlgeschlagen"}),j(null))}).finally(()=>{H&&Y(!1)}),()=>{H=!1}},[s,ge,K,n]),_.useEffect(()=>{!s||!ge||Me()},[s,ge,Me]),_.useEffect(()=>{if(!s||Array.isArray(r))return;let H=!0;return W(!0),fetch("/api/record/jobs",{cache:"no-store"}).then(ee=>ee.json()).then(ee=>{H&&ae(Array.isArray(ee)?ee:[])}).catch(()=>{H&&ae([])}).finally(()=>{H&&W(!1)}),()=>{H=!1}},[s,r]);const Pe=_.useMemo(()=>ge?y.find(H=>(H.modelKey||"").toLowerCase()===ge)??null:null,[y,ge]),gt=L,Ye=_.useMemo(()=>Math.max(1,Math.ceil(U/xe)),[U]),lt=_.useMemo(()=>ge?be.filter(H=>{const ee=X$(H.output);return ee!=="—"&&ee.trim().toLowerCase()===ge}):[],[be,ge]),Ve=_.useMemo(()=>{const H=K$(Pe?.tags),ee=Array.isArray(T?.tags)?T.tags:[],Te=new Map;for(const Ue of[...H,...ee]){const ft=String(Ue).trim().toLowerCase();ft&&(Te.has(ft)||Te.set(ft,String(Ue).trim()))}return Array.from(Te.values()).sort((Ue,ft)=>Ue.localeCompare(ft,"de"))},[Pe?.tags,T?.tags]),ht=T?.display_name||Pe?.modelKey||ge||"Model",st=T?.image_url_360x270||T?.image_url||"",ct=T?.image_url||st,Ke=T?.chat_room_url_revshare||T?.chat_room_url||"",_t=(T?.current_show||"").trim().toLowerCase(),pe=_t?_t==="public"?"Public":_t==="private"?"Private":_t:"",We=(R?.location||"").trim(),Je=R?.follower_count,ot=R?.display_age,St=(R?.room_status||"").trim(),vt=R?.last_broadcast?nh(R.last_broadcast):"—",Vt=a0(R?.about_me),si=a0(R?.wish_list),$t=Pe?.lastSeenOnline==null?"":Pe.lastSeenOnline?"online":"offline",Pt=(St||_t||$t||"").trim(),Ht=Array.isArray(R?.social_medias)?R.social_medias:[],ui=Array.isArray(R?.photo_sets)?R.photo_sets:[],xt=Array.isArray(R?.interested_in)?R.interested_in:[],ni=({icon:H,label:ee,value:Te})=>g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-2.5 py-2 sm:px-3 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] sm:text-xs text-gray-600 dark:text-gray-300",children:[H,ee]}),g.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:Te})]}),Xt=_.useCallback(async H=>{const ee=H.output||"",Te=ph(ee);if(!Te){await f?.(H);return}const Ue=Y$(Te);I(ft=>ft.map(Et=>Et.id&&H.id&&Et.id===H.id||Et.output&&H.output&&Et.output===H.output?{...Et,output:W$(Et.output||"",Ue)}:Et)),await f?.(H),Me()},[f,Me]),Zi=_.useCallback(async H=>{const ee=H.output||"";ph(ee)&&I(Ue=>Ue.filter(ft=>!(ft.id&&H.id&&ft.id===H.id||ft.output&&H.output&&ft.output===H.output))),await p?.(H),Me()},[p,Me]),Gt=_.useCallback(async()=>{ge&&(v(H=>H.map(ee=>(ee.modelKey||"").toLowerCase()===ge?{...ee,favorite:!ee.favorite}:ee)),await c?.(Re(ge)),Ce())},[ge,c,Ce]),Yi=_.useCallback(async()=>{ge&&(v(H=>H.map(ee=>(ee.modelKey||"").toLowerCase()===ge?{...ee,liked:ee.liked!==!0}:ee)),await d?.(Re(ge)),Ce())},[ge,d,Ce]),Ri=_.useCallback(async()=>{ge&&(v(H=>H.map(ee=>(ee.modelKey||"").toLowerCase()===ge?{...ee,watching:!ee.watching}:ee)),await u?.(Re(ge)),Ce())},[ge,u,Ce]),[Si,kt]=_.useState("info");_.useEffect(()=>{s&&kt("info")},[s,ge]);const V=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:U?tu(U):void 0,disabled:X},{id:"running",label:"Running",count:lt.length?tu(lt.length):void 0,disabled:ie}];return g.jsxs(ib,{open:s,onClose:t,title:ht,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:st||void 0,mobileCollapsedImageAlt:ht,rightBodyClassName:"pt-0 sm:pt-2",left:g.jsx("div",{className:"space-y-3 sm:space-y-4",children:g.jsxs("div",{className:"hidden sm:block space-y-2",children:[g.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/70 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"relative",children:[st?g.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Ae(ct,ht),"aria-label":"Bild vergrößern",children:g.jsx("img",{src:st,alt:ht,className:is("h-24 sm:h-52 w-full object-cover transition",rh(a))})}):g.jsx("div",{className:"h-24 sm:h-52 w-full bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),g.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/40 via-black/0 to-black/0"}),g.jsxs("div",{className:"absolute left-3 top-3 flex flex-wrap items-center gap-2",children:[pe?g.jsx("span",{className:Lr("bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20"),children:pe}):null,Pt?g.jsx("span",{className:Lr(Pt.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 backdrop-blur dark:text-gray-200 dark:ring-white/15"),children:Pt}):null,T?.is_hd?g.jsx("span",{className:Lr("bg-indigo-500/10 text-indigo-900 ring-indigo-200 backdrop-blur dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,T?.is_new?g.jsx("span",{className:Lr("bg-amber-500/10 text-amber-900 ring-amber-200 backdrop-blur dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),g.jsxs("div",{className:"absolute bottom-3 left-3 right-3",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow",children:T?.display_name||T?.username||Pe?.modelKey||ge||"—"}),g.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:T?.username?`@${T.username}`:Pe?.modelKey?`@${Pe.modelKey}`:""})]}),g.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Ri()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Pe?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:Pe?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!Pe?.watching,"aria-label":Pe?.watching?"Watch entfernen":"Auf Watch setzen",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(d0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),g.jsx(xu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Gt()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Pe?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:Pe?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!Pe?.favorite,"aria-label":Pe?.favorite?"Favorit entfernen":"Als Favorit markieren",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(h0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),g.jsx(Ic,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Yi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Pe?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:Pe?.liked?"Like entfernen":"Liken","aria-pressed":Pe?.liked===!0,"aria-label":Pe?.liked?"Like entfernen":"Liken",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(bh,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),g.jsx(bu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-200")})]})})]})]}),g.jsxs("div",{className:"p-3 sm:p-4",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[g.jsx(ni,{icon:g.jsx(Q_,{className:"size-4"}),label:"Viewer",value:tu(T?.num_users)}),g.jsx(ni,{icon:g.jsx(Oy,{className:"size-4"}),label:"Follower",value:tu(T?.num_followers??Je)})]}),g.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-xs",children:[g.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[g.jsx(sM,{className:"size-4"}),"Location"]}),g.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:T?.location||We||"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[g.jsx(ZO,{className:"size-4"}),"Sprache"]}),g.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:T?.spoken_languages||"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[g.jsx(Tm,{className:"size-4"}),"Online"]}),g.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:Wv(T?.seconds_online)})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[g.jsx(bh,{className:"size-4"}),"Alter"]}),g.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:ot!=null?String(ot):T?.age!=null?String(T.age):"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[g.jsx(Tm,{className:"size-4"}),"Last broadcast"]}),g.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:vt})]})]}),D?.enabled===!1?g.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):D?.lastError?g.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[g.jsxs("div",{className:"font-medium",children:["Online-Info: ",nA(D.lastError)]}),g.jsxs("details",{className:"mt-1",children:[g.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),g.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:rA(D.lastError)})]})]}):null,F?.enabled===!1?g.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):F?.lastError?g.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["BioContext: ",F.lastError]}):null]})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Tags"}),Ve.length?g.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Ve.map(H=>g.jsx($a,{tag:H},H))}):g.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:g.jsxs("div",{className:is("border-b border-gray-200/70 dark:border-white/10","bg-white/95 backdrop-blur dark:bg-gray-800/95"),children:[g.jsxs("div",{className:"sm:hidden px-2 pb-2 space-y-1.5",children:[g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsxs("button",{type:"button",className:"relative shrink-0 overflow-hidden rounded-lg ring-1 ring-black/5 dark:ring-white/10",onClick:()=>ct&&Ae(ct,ht),"aria-label":"Bild vergrößern",children:[st?g.jsx("img",{src:st,alt:ht,className:is("size-10 object-cover",rh(a))}):g.jsx("div",{className:"size-10 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),g.jsx("span",{"aria-hidden":!0,className:is("absolute bottom-1.5 right-1.5 size-2.5 rounded-full ring-2 ring-white/80 dark:ring-gray-900/60",(Pt||"").toLowerCase()==="online"?"bg-emerald-400":"bg-gray-400")})]}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-start justify-between gap-2",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:T?.display_name||T?.username||Pe?.modelKey||ge||"—"}),g.jsx("div",{className:"truncate text-xs text-gray-600 dark:text-gray-300",children:T?.username?`@${T.username}`:Pe?.modelKey?`@${Pe.modelKey}`:""})]}),g.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Ri()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Pe?.watching?"bg-sky-500/15 ring-sky-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Pe?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!Pe?.watching,"aria-label":Pe?.watching?"Watch entfernen":"Auf Watch setzen",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(d0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),g.jsx(xu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-500")})]})}),g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Gt()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Pe?.favorite?"bg-amber-500/15 ring-amber-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Pe?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!Pe?.favorite,"aria-label":Pe?.favorite?"Favorit entfernen":"Als Favorit markieren",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(h0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),g.jsx(Ic,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-500")})]})}),g.jsx("button",{type:"button",onClick:H=>{H.preventDefault(),H.stopPropagation(),Yi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Pe?.liked?"bg-rose-500/15 ring-rose-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Pe?.liked?"Like entfernen":"Liken","aria-pressed":Pe?.liked===!0,"aria-label":Pe?.liked?"Like entfernen":"Liken",children:g.jsxs("span",{className:"relative inline-block size-4",children:[g.jsx(bh,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),g.jsx(bu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Pe?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-500")})]})})]})]}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[pe?g.jsx("span",{className:Lr("bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20"),children:pe}):null,St?g.jsx("span",{className:Lr(St.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:St}):null,T?.is_hd?g.jsx("span",{className:Lr("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,T?.is_new?g.jsx("span",{className:Lr("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),Ke?g.jsx("div",{className:"mt-1.5 flex justify-end",children:g.jsxs("a",{href:Ke,target:"_blank",rel:"noreferrer",className:is("inline-flex h-8 items-center justify-center gap-1 rounded-lg px-3 text-sm font-medium","border border-gray-200/70 bg-white/70 text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white"),title:"Room öffnen",children:[g.jsx(bm,{className:"size-4"}),g.jsx("span",{children:"Room"})]})}):null]})]}),g.jsxs("div",{className:"mt-1 flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[12px] text-gray-700 dark:text-gray-200",children:[g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(Q_,{className:"size-3.5 text-gray-400"}),g.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:tu(T?.num_users)})]}),g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(Oy,{className:"size-3.5 text-gray-400"}),g.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:tu(T?.num_followers??Je)})]}),g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(q_,{className:"size-3.5 text-gray-400"}),g.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:Wv(T?.seconds_online)})]}),g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(Tm,{className:"size-3.5 text-gray-400"}),g.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:R?.last_broadcast?SR(R.last_broadcast):"—"})]})]}),D?.enabled===!1?g.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):D?.lastError?g.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["Online-Info: ",D.lastError]}):null,F?.enabled===!1?g.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):F?.lastError?g.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[g.jsx("div",{className:"flex items-start justify-between gap-2",children:g.jsxs("div",{className:"font-medium",children:["BioContext: ",nA(F.lastError)]})}),g.jsxs("details",{className:"mt-1",children:[g.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),g.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:rA(F.lastError)})]})]}):null]}),Ve.length?g.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-2 py-1.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("div",{className:"shrink-0 text-xs font-semibold text-gray-900 dark:text-white",children:["Tags ",g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",Ve.length,")"]})]}),g.jsx("div",{className:"-mx-1 flex-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:g.jsxs("div",{className:"flex min-w-max items-center gap-1.5",children:[Ve.slice(0,20).map(H=>g.jsx($a,{tag:H},H)),Ve.length>20?g.jsxs("span",{className:Lr("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:["+",Ve.length-20]}):null]})})]})}):null]}),g.jsxs("div",{className:"flex items-start justify-between gap-2 px-2 py-2 sm:px-4",children:[g.jsx("div",{className:"min-w-0",children:g.jsx("div",{className:"text-[11px] leading-snug text-gray-600 dark:text-gray-300",children:ge?g.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[D?.fetchedAt?g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",nh(D.fetchedAt)]}):null,F?.fetchedAt?g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",nh(F.fetchedAt)]}):null,Pe?.lastSeenOnlineAt?g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",g.jsx("span",{className:"font-medium",children:Pe.lastSeenOnline==null?"—":Pe.lastSeenOnline?"online":"offline"})," ","(",nh(Pe.lastSeenOnlineAt),")"]}):null]}):"—"})}),g.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[Si==="info"?g.jsx(di,{variant:"secondary",className:is("h-9 px-3 text-sm","whitespace-nowrap"),disabled:N||!e,onClick:()=>Q(H=>H+1),title:"BioContext neu abrufen",children:g.jsxs("span",{className:"inline-flex items-center gap-2",children:[g.jsx(kO,{className:is("size-4",N?"animate-spin":"")}),g.jsx("span",{className:"hidden sm:inline",children:"Bio aktualisieren"})]})}):null,Ke?g.jsxs("a",{href:Ke,target:"_blank",rel:"noreferrer",className:is("inline-flex h-8 items-center justify-center gap-1 rounded-lg","border border-gray-200/70 bg-white/70 px-3 text-sm font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white","whitespace-nowrap"),title:"Room öffnen",children:[g.jsx(bm,{className:"size-4"}),g.jsx("span",{className:"hidden sm:inline",children:"Room öffnen"})]}):null]})]}),g.jsx("div",{className:"px-2 pb-2",children:g.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:g.jsx("div",{className:"min-w-max",children:g.jsx(ax,{tabs:V,value:Si,onChange:H=>kt(H),variant:"pillsBrand",ariaLabel:"Bereich auswählen"})})})})]}),footer:g.jsx("div",{className:"w-full",children:g.jsx(di,{variant:"secondary",className:"w-full sm:w-auto",onClick:t,children:"Schließen"})}),children:[g.jsxs("div",{className:"min-h-0",children:[Si==="info"?g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-3 sm:p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsx("div",{className:"flex items-center justify-between gap-3",children:g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Room Subject"})}),g.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:T?.room_subject?g.jsx("p",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:T.room_subject}):g.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Keine Subject-Info vorhanden."})})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Bio"}),N?g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),g.jsxs("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:[g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[g.jsx(WO,{className:"size-4"}),"Über mich"]}),g.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:Vt?g.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:Vt}):g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[g.jsx(Oy,{className:"size-4"}),"Wishlist"]}),g.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:si?g.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:si}):g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]})]}),g.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Real name:"})," ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.real_name?a0(R.real_name):"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Body type:"})," ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.body_type||"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Smoke/Drink:"})," ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.smoke_drink||"—"})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[g.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Sex:"})," ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.sex||"—"})]})]}),xt.length?g.jsxs("div",{className:"mt-2",children:[g.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Interested in"}),g.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:xt.map(H=>g.jsx("span",{className:Lr("bg-sky-500/10 text-sky-900 ring-sky-200 dark:text-sky-200 dark:ring-sky-400/20"),children:H},H))})]}):null]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Socials"}),Ht.length?g.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Ht.length," Links"]}):null]}),Ht.length?g.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:Ht.map(H=>{const ee=Q$(H.link);return g.jsxs("a",{href:ee,target:"_blank",rel:"noreferrer",className:is("group flex min-w-0 w-full items-center gap-3 overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-gray-900","transition hover:border-indigo-200 hover:bg-gray-50/80 hover:text-gray-900 dark:border-white/10 dark:bg-white/5 dark:text-white dark:hover:border-indigo-400/30 dark:hover:bg-white/10 dark:hover:text-white"),title:H.title_name,children:[g.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:H.image_url?g.jsx("img",{src:H.image_url,alt:"",className:"size-5"}):g.jsx(eM,{className:"size-5"})}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:H.title_name}),g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:H.label_text?H.label_text:H.tokens!=null?`${H.tokens} token(s)`:"Link"})]}),g.jsx(bm,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},H.id)})}):g.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Social-Medias vorhanden."})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Photo sets"}),ui.length?g.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[ui.length," Sets"]}):null]}),ui.length?g.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:ui.slice(0,6).map(H=>g.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"relative",children:[H.cover_url?g.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Ae(H.cover_url,H.name),"aria-label":"Bild vergrößern",children:g.jsx("img",{src:H.cover_url,alt:H.name,className:is("h-28 w-full object-cover transition",rh(a))})}):g.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:g.jsx(Y_,{className:"size-6 text-gray-500"})}),g.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[H.is_video?g.jsx("span",{className:Lr("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"Video"}):g.jsx("span",{className:Lr("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:"Photos"}),H.fan_club_only?g.jsx("span",{className:Lr("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"FanClub"}):null]})]}),g.jsxs("div",{className:"p-3",children:[g.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:H.name}),g.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Tokens: ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:tu(H.tokens)}),H.user_can_access===!0?g.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},H.id))}):g.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,Si==="downloads"?g.jsx("div",{className:"min-h-0",children:g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"shrink-0 flex flex-wrap items-center justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),g.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Inkl. Dateien aus ",g.jsx("span",{className:"font-medium",children:"/done/keep/"})]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(di,{size:"sm",variant:"secondary",disabled:X||Z<=1,onClick:()=>fe(H=>Math.max(1,H-1)),children:"Zurück"}),g.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Seite ",Z," / ",Ye]}),g.jsx(di,{size:"sm",variant:"secondary",disabled:X||Z>=Ye,onClick:()=>fe(H=>Math.min(Ye,H+1)),children:"Weiter"})]})]}),g.jsx("div",{className:"mt-2",children:X?g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):gt.length===0?g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine abgeschlossenen Downloads für dieses Model gefunden."}):g.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:gt.map(H=>{const ee=ph(H.output||""),Te=_R(ee),Ue=Z$(ee),ft=Wv(H.durationSeconds),Et=q$(H.sizeBytes),pi=J$(H);return g.jsxs("div",{role:i?"button":void 0,tabIndex:i?0:void 0,className:is("group relative overflow-hidden rounded-lg outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-lg dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",i?"cursor-pointer":""),onClick:()=>i?.(H),onKeyDown:gi=>{i&&(gi.key==="Enter"||gi.key===" ")&&i(H)},children:[g.jsxs("div",{className:"relative aspect-video bg-black/5 dark:bg-white/5",children:[g.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),g.jsx("div",{className:is("absolute inset-0",rh(a))}),g.jsx("div",{className:"absolute inset-x-3 top-3 z-10 flex justify-end",onClick:gi=>gi.stopPropagation(),onMouseDown:gi=>gi.stopPropagation(),children:g.jsx(ja,{job:H,variant:"overlay",collapseToMenu:!0,isHot:Te,isFavorite:!!Pe?.favorite,isLiked:Pe?.liked===!0,isWatching:!!Pe?.watching,onToggleHot:Xt,onDelete:Zi,order:["hot","delete"],className:"w-full justify-end gap-2"})}),g.jsx("div",{className:"absolute inset-0 grid place-items-center",children:g.jsxs("div",{className:"rounded-lg bg-black/10 px-4 py-3 text-gray-700 dark:bg-white/10 dark:text-gray-200",children:[g.jsx(VO,{className:"mx-auto size-8 opacity-80"}),g.jsx("div",{className:"mt-1 text-sm font-medium opacity-80",children:"Preview"})]})})]}),g.jsxs("div",{className:"border-t border-gray-200/60 bg-white px-5 py-4 dark:border-white/10 dark:bg-gray-900",children:[g.jsx("div",{className:"flex items-center justify-between gap-2",children:g.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[Te?g.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-2 py-0.5 text-xs font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,g.jsx("div",{className:"min-w-0 truncate text-base font-semibold text-gray-900 dark:text-white",children:Ue})]})}),g.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-gray-600 dark:text-gray-300",children:[g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(Tm,{className:"size-5 text-gray-400"}),pi]}),g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(q_,{className:"size-5 text-gray-400"}),ft]}),g.jsxs("span",{className:"inline-flex items-center gap-1",children:[g.jsx(Y_,{className:"size-5 text-gray-400"}),Et]})]})]})]},`${H.id}-${ee}`)})})})]})}):null,Si==="running"?g.jsx("div",{className:"min-h-0",children:g.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Laufende Jobs"}),ie?g.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),g.jsx("div",{className:"mt-2",children:ie?g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):lt.length===0?g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine laufenden Jobs."}):g.jsx("div",{className:"grid gap-2",children:lt.map(H=>g.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-sm dark:border-white/10 dark:bg-white/5",children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("div",{className:"break-words line-clamp-2 font-medium text-gray-900 dark:text-white",children:ph(H.output||"")}),g.jsxs("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:["Start:"," ",g.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:nh(H.startedAt)})]})]}),i?g.jsx(di,{size:"sm",variant:"secondary",className:"shrink-0",onClick:()=>i(H),children:"Öffnen"}):null]})},H.id))})})]})}):null]}),g.jsx(ib,{open:!!te,onClose:()=>re(null),title:te?.alt||"Bild",width:"max-w-4xl",layout:"single",scroll:"body",footer:g.jsxs("div",{className:"flex items-center justify-end gap-2",children:[te?.src?g.jsxs("a",{href:te.src,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg border border-gray-200/70 bg-white/70 px-3 py-1.5 text-xs font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white dark:border-white/10 dark:bg-white/5 dark:text-white",children:[g.jsx(bm,{className:"size-4"}),"In neuem Tab"]}):null,g.jsx(di,{variant:"secondary",onClick:()=>re(null),children:"Schließen"})]}),children:g.jsx("div",{className:"grid place-items-center",children:te?.src?g.jsx("img",{src:te.src,alt:te.alt||"",className:is("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",rh(a))}):null})})]})}const Gm=s=>Math.max(0,Math.min(1,s));function qm(s){return s==="good"?"bg-emerald-500":s==="warn"?"bg-amber-500":"bg-red-500"}function sH(s){return s==null?"–":`${Math.round(s)}ms`}function aA(s){return s==null?"–":`${Math.round(s)}%`}function Yv(s){if(s==null||!Number.isFinite(s)||s<=0)return"–";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function nH(s=1e3){const[e,t]=Zt.useState(null);return Zt.useEffect(()=>{let i=0,n=performance.now(),r=0,a=!0,u=!1;const c=y=>{if(!a||!u)return;r+=1;const v=y-n;if(v>=s){const b=Math.round(r*1e3/v);t(b),r=0,n=y}i=requestAnimationFrame(c)},d=()=>{a&&(document.hidden||u||(u=!0,n=performance.now(),r=0,i=requestAnimationFrame(c)))},f=()=>{u=!1,cancelAnimationFrame(i)},p=()=>{document.hidden?f():d()};return d(),document.addEventListener("visibilitychange",p),()=>{a=!1,document.removeEventListener("visibilitychange",p),f()}},[s]),e}function oA({mode:s="inline",className:e,pollMs:t=3e3}){const i=nH(1e3),[n,r]=Zt.useState(null),[a,u]=Zt.useState(null),[c,d]=Zt.useState(null),[f,p]=Zt.useState(null),[y,v]=Zt.useState(null),b=5*1024*1024*1024,T=8*1024*1024*1024,E=Zt.useRef(!1);Zt.useEffect(()=>{const q=`/api/perf/stream?ms=${encodeURIComponent(String(t))}`,ae=rp(q,"perf",ie=>{const W=typeof ie?.cpuPercent=="number"?ie.cpuPercent:null,K=typeof ie?.diskFreeBytes=="number"?ie.diskFreeBytes:null,Q=typeof ie?.diskTotalBytes=="number"?ie.diskTotalBytes:null,te=typeof ie?.diskUsedPercent=="number"?ie.diskUsedPercent:null;u(W),d(K),p(Q),v(te);const re=typeof ie?.serverMs=="number"?ie.serverMs:null;r(re!=null?Math.max(0,Date.now()-re):null)});return()=>ae()},[t]);const D=n==null?"bad":n<=120?"good":n<=300?"warn":"bad",O=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",R=a==null?"bad":a<=60?"good":a<=85?"warn":"bad",j=Gm((n??999)/500),F=Gm((i??0)/60),z=Gm((a??0)/100),N=c!=null&&f!=null&&f>0?c/f:null,Y=y??(N!=null?(1-N)*100:null),L=Gm((Y??0)/100);c==null?E.current=!1:E.current?c>=T&&(E.current=!1):c<=b&&(E.current=!0);const I=c==null||E.current||N==null?"bad":N>=.15?"good":N>=.07?"warn":"bad",X=c==null?"Disk: –":`Free: ${Yv(c)} / Total: ${Yv(f)} · Used: ${aA(Y)}`,G=s==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return g.jsx("div",{className:`${G} ${e??""}`,children:g.jsxs("div",{className:`\r + `})]})]}),b.length>0?p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Tag-Filter:"}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[b.map(de=>p.jsx(fa,{tag:de,active:!0,onClick:W,title:de},de)),p.jsx(mi,{size:"sm",variant:"soft",className:"text-xs font-medium text-gray-600 hover:underline dark:text-gray-300",onClick:I,children:"Zurücksetzen"})]})]}):null]}),noBodyPadding:!0,children:y==="table"?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"overflow-x-auto",children:p.jsx("div",{className:"min-w-[980px]",children:p.jsx(Sh,{rows:ze,columns:ut,getRowKey:de=>de.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:j,onSortChange:de=>F(de),onRowClick:de=>{const qe=Ym(de);qe&&window.open(qe,"_blank","noreferrer")}})})}),p.jsx(dx,{page:d,pageSize:g,totalItems:at,onPageChange:f})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"p-2 sm:p-3",children:ze.length===0?p.jsx("div",{className:"rounded-lg border border-dashed border-gray-200 p-8 text-center text-sm text-gray-500 dark:border-white/10 dark:text-gray-400",children:"Keine Models gefunden."}):p.jsx("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-5",children:ze.map(de=>{const qe=Ym(de),ht=uA(de),tt=Wm(de.tags),At=tt.slice(0,3),ft=de.liked===!0,Et=de.favorite===!0,Lt=de.watching===!0,Rt=!Lt&&!Et&&!ft,qt=E[String(de.modelKey||"").trim().toLowerCase()]??0,Wt=String(de.modelKey||"?"),yi=Wt.length;return p.jsxs("div",{className:"group overflow-hidden rounded-md border border-gray-200 bg-slate-900/80 shadow-sm transition hover:shadow-md dark:border-white/10",children:[p.jsx("div",{className:"relative cursor-pointer bg-slate-950",onClick:()=>{qe&&window.open(qe,"_blank","noreferrer")},children:p.jsxs("div",{className:"relative aspect-[3/4] w-full overflow-hidden bg-[#12202c]",children:[ht?p.jsx("img",{src:ht,alt:de.modelKey,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]",onError:Ct=>{Ct.currentTarget.style.display="none";const It=Ct.currentTarget.nextElementSibling;It&&(It.style.display="flex")}}):null,p.jsx("div",{className:vi("absolute inset-0 items-center justify-center px-3 text-center font-semibold text-slate-500 leading-tight",ht?"hidden":"flex"),style:{display:ht?"none":"flex",fontSize:yi<=10?"clamp(1rem, 1.4vw + 0.4rem, 2.1rem)":yi<=18?"clamp(0.95rem, 1.15vw + 0.3rem, 1.7rem)":"clamp(0.8rem, 0.9vw + 0.25rem, 1.25rem)",lineHeight:1.1,overflowWrap:"anywhere",wordBreak:"break-word"},title:Wt,children:Wt}),p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-black/70 via-black/20 to-transparent"}),p.jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 p-2.5",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.7)]",title:de.modelKey,children:de.modelKey}),de.host?p.jsx("div",{className:"truncate text-[11px] text-white/70",children:de.host}):null]}),p.jsx("div",{className:vi("absolute left-2 z-10 flex items-center gap-1",de.hot||de.keep?"top-12":"top-2"),onClick:Ct=>Ct.stopPropagation(),children:p.jsx(pa,{job:De(de),variant:"table",order:["add","details"],className:`\r + flex items-center gap-1\r + [&_button]:h-7 [&_button]:w-7 [&_button]:min-w-0 [&_button]:p-0\r + [&_button]:bg-transparent [&_button]:shadow-none\r + [&_button:hover]:bg-white/10\r + [&_button]:border-0\r + `})}),p.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5 pointer-events-none select-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.75)]",children:[Lt?p.jsx("span",{className:"inline-flex items-center justify-center text-[18px] leading-none text-indigo-300",title:"Beobachtet","aria-hidden":"true",children:"👁"}):null,Et?p.jsx("span",{className:"inline-flex items-center justify-center text-[18px] leading-none text-amber-300",title:"Favorit","aria-hidden":"true",children:"★"}):null,ft?p.jsx("span",{className:"inline-flex items-center justify-center text-[18px] leading-none text-rose-300",title:"Gefällt mir","aria-hidden":"true",children:"♥"}):null]}),(de.hot||de.keep)&&p.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-1",children:[de.hot?p.jsx("span",{className:"rounded bg-amber-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow",children:"HOT"}):null,de.keep?p.jsx("span",{className:"rounded bg-indigo-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white shadow",children:"KEEP"}):null]})]})}),p.jsxs("div",{className:"border-t border-white/5 bg-slate-800/70 px-2.5 py-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 text-slate-300",children:[p.jsxs("span",{className:"inline-flex items-center rounded-md bg-white/5 px-1.5 py-0.5 tabular-nums",children:[O?"…":qt," Videos"]}),tt.length>0?p.jsxs("span",{className:"inline-flex items-center rounded-md bg-white/5 px-1.5 py-0.5 tabular-nums",children:[tt.length," Tags"]}):null]}),p.jsxs("div",{className:"flex items-center gap-1 shrink-0",onClick:Ct=>Ct.stopPropagation(),children:[p.jsx("span",{className:vi(Rt&&!Lt?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:p.jsx(mi,{variant:Lt?"soft":"secondary",size:"xs",rounded:"full",className:vi("h-7 w-7 p-0 min-w-0",Lt?"bg-indigo-500/20 text-indigo-300 hover:bg-indigo-500/30 shadow-none":"bg-white/5 text-indigo-200/80 shadow-none hover:bg-white/10 hover:text-indigo-200"),title:Lt?"Nicht mehr beobachten":"Beobachten",onClick:Ct=>{Ct.stopPropagation(),ke(de.id,{watched:!Lt})},children:p.jsx("span",{className:vi("text-sm leading-none",Lt?"text-indigo-300":"text-slate-300 group-hover:text-indigo-200"),children:"👁"})})}),p.jsx(mi,{variant:Et?"soft":"secondary",size:"xs",rounded:"full",className:vi("h-7 w-7 p-0 min-w-0",Rt&&!Et?"opacity-0 group-hover:opacity-100 transition-opacity":"",Et?"bg-amber-500/20 text-amber-300 hover:bg-amber-500/30 shadow-none":"bg-white/5 text-amber-200/80 shadow-none hover:bg-white/10 hover:text-amber-200"),title:Et?"Favorit entfernen":"Als Favorit markieren",onClick:Ct=>{Ct.stopPropagation(),Et?ke(de.id,{favorite:!1}):ke(de.id,{favorite:!0,liked:!1})},children:p.jsx("span",{className:vi("text-sm leading-none",Et?"text-amber-300":"text-slate-300 group-hover:text-amber-200"),children:"★"})}),p.jsx(mi,{variant:ft?"soft":"secondary",size:"xs",rounded:"full",className:vi("h-7 w-7 p-0 min-w-0",Rt&&!ft?"opacity-0 group-hover:opacity-100 transition-opacity":"",ft?"bg-rose-500/20 text-rose-300 hover:bg-rose-500/30 shadow-none":"bg-white/5 text-rose-200/80 shadow-none hover:bg-white/10 hover:text-rose-200"),title:ft?"Gefällt mir entfernen":"Gefällt mir",onClick:Ct=>{Ct.stopPropagation(),ft?ke(de.id,{liked:!1}):ke(de.id,{liked:!0,favorite:!1})},children:p.jsx("span",{className:vi("text-sm leading-none",ft?"text-rose-300":"text-slate-300 group-hover:text-rose-200"),children:"♥"})})]})]}),p.jsx("div",{className:"mt-2 min-h-[24px] flex flex-wrap items-start gap-1.5",children:At.length>0?At.map(Ct=>p.jsx(fa,{tag:Ct,title:Ct,active:L.has(Ct.toLowerCase()),onClick:W},`${de.id}:${Ct}`)):p.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]})]},de.id)})})}),p.jsx(dx,{page:d,pageSize:g,totalItems:at,onPageChange:f})]})}),p.jsx(rb,{open:Z,onClose:()=>!ve&&te(!1),title:"Models importieren",footer:p.jsxs(p.Fragment,{children:[p.jsx(mi,{variant:"secondary",onClick:()=>te(!1),disabled:ve,children:"Abbrechen"}),p.jsx(mi,{variant:"primary",onClick:Ze,isLoading:ve,disabled:!le||ve,children:"Import starten"})]}),children:p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Wähle eine CSV-Datei zum Import aus."}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Import-Typ"}),p.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[p.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[p.jsx("input",{type:"radio",name:"import-kind",value:"favorite",checked:pe==="favorite",onChange:()=>be("favorite"),disabled:ve}),"Favoriten (★)"]}),p.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[p.jsx("input",{type:"radio",name:"import-kind",value:"liked",checked:pe==="liked",onChange:()=>be("liked"),disabled:ve}),"Gefällt mir (♥)"]})]})]}),p.jsx("input",{type:"file",accept:".csv,text/csv",onChange:de=>{const qe=de.target.files?.[0]??null;Fe(null),z(qe)},className:"block w-full text-sm text-gray-700 file:mr-4 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-gray-900 hover:file:bg-gray-200 dark:text-gray-200 dark:file:bg-white/10 dark:file:text-white dark:hover:file:bg-white/20"}),le?p.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",p.jsx("span",{className:"font-medium",children:le.name})]}):null,He?p.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:He}):null,re?p.jsx("div",{className:"rounded-md bg-green-50 px-3 py-2 text-xs text-green-700 dark:bg-green-500/10 dark:text-green-200",children:re}):null]})})]})}function is(...s){return s.filter(Boolean).join(" ")}const lH=new Intl.NumberFormat("de-DE");function iu(s){return s==null||!Number.isFinite(s)?"—":lH.format(s)}function uH(s){if(s==null||!Number.isFinite(s))return"—";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i0?`${t}:${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${i}:${String(n).padStart(2,"0")}`}function rh(s){if(!s)return"—";const e=typeof s=="string"?new Date(s):s;return Number.isNaN(e.getTime())?String(s):e.toLocaleString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function cH(s){return s?s.split(",").map(e=>e.trim()).filter(Boolean):[]}function gh(s){return(s||"").split(/[\\/]/).pop()||""}function RR(s){if(!s)return"—";const e=typeof s=="string"?new Date(s):s;return Number.isNaN(e.getTime())?String(s):e.toLocaleDateString("de-DE",{year:"2-digit",month:"2-digit",day:"2-digit"})}function w1(s){return s.startsWith("HOT ")?s.slice(4):s}function IR(s){return String(s||"").startsWith("HOT ")}function dH(s,e){const t=String(s||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function hH(s){return IR(s)?w1(s):`HOT ${s}`}function fH(s){const e=gh(s||""),t=w1(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),n=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(n?.[1])return n[1];const r=i.lastIndexOf("_");return r>0?i.slice(0,r):i}function d0(s){return s?String(s).replace(/[\s\S]*?<\/script>/gi,"").replace(/[\s\S]*?<\/style>/gi,"").replace(/<\/?[^>]+>/g," ").replace(/\s+/g," ").trim():""}function hA(s){const e=String(s??"").trim();if(!e)return"";const t=e.match(/HTTP\s+(\d{3})/i);if(t?.[1])return`HTTP ${t[1]}`;const i=e.toLowerCase();if(i.includes("80?n.slice(0,77)+"…":n}function fA(s){const e=String(s??"").trim();if(!e)return"";const t=d0(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function mH(s){if(!s)return"";const e=String(s).trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/")?`https://chaturbate.com${e}`:`https://chaturbate.com/${e}`:""}function Or(s){return is("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",s)}const ah=s=>s?"blur-md scale-[1.03] brightness-90":"";function pH(s){return w1(s||"").trim()||"—"}function gH(s){const e=s.endedAt??s.completedAt??s.endedAt;return e?RR(e):"—"}function yH(s){let e=String(s??"").trim();if(!e)return"";if(e=e.replace(/^https?:\/\//i,""),e.includes("/")){const t=e.split("/").filter(Boolean);e=t[t.length-1]||e}return e.includes(":")&&(e=e.split(":").pop()||e),e.trim().toLowerCase()}function vH(s){const e=s??{},t=e.cf_clearance||e["cf-clearance"]||e.cfclearance||"",i=e.sessionId||e.sessionid||e.session_id||e["session-id"]||"",n=[];return t&&n.push(`cf_clearance=${t}`),i&&n.push(`sessionid=${i}`),n.join("; ")}function xH({open:s,modelKey:e,onClose:t,onOpenPlayer:i,cookies:n,runningJobs:r,blurPreviews:a,onToggleWatch:u,onToggleFavorite:c,onToggleLike:d,onToggleHot:f,onDelete:g}){const[y,v]=_.useState([]),[,b]=_.useState(!1),[T,E]=_.useState(null),[D,O]=_.useState(null),[R,j]=_.useState(null),[F,G]=_.useState(null),[L,W]=_.useState(!1),[I,N]=_.useState([]),[X,V]=_.useState(!1),[Y,ne]=_.useState([]),[ie,K]=_.useState(!1),[q,Z]=_.useState(0),[te,le]=_.useState(null),[z,re]=_.useState(0),[Q,pe]=_.useState(1),be=25,ve=yH(e),we=_.useCallback(async()=>{try{const ee=await(await fetch("/api/models",{cache:"no-store"})).json().catch(()=>null);v(Array.isArray(ee)?ee:[])}catch{}},[]),He=_.useCallback(async()=>{if(ve){V(!0);try{const U=`/api/record/done?model=${encodeURIComponent(ve)}&page=${Q}&pageSize=${be}&sort=completed_desc&includeKeep=1&withCount=1`,Te=await(await fetch(U,{cache:"no-store"})).json().catch(()=>null),Me=Array.isArray(Te?.items)?Te.items:[],gt=Number(Te?.count??Me.length);N(Me),re(Number.isFinite(gt)?gt:Me.length)}catch{}finally{V(!1)}}},[ve,Q]);function Fe(U){return{id:`model:${U}`,output:`${U}_01_01_2000__00-00-00.mp4`,status:"finished"}}const Ze=_.useCallback((U,ee)=>{const Te=String(U??"").trim();Te&&le({src:Te,alt:ee})},[]);_.useEffect(()=>{s||Z(0)},[s]);const De=_.useMemo(()=>Array.isArray(r)?r:Y,[r,Y]);_.useEffect(()=>{s&&pe(1)},[s,e]),_.useEffect(()=>{if(!s)return;let U=!0;return b(!0),fetch("/api/models",{cache:"no-store"}).then(ee=>ee.json()).then(ee=>{U&&v(Array.isArray(ee)?ee:[])}).catch(()=>{U&&v([])}).finally(()=>{U&&b(!1)}),()=>{U=!1}},[s]),_.useEffect(()=>{if(!s||!ve)return;let U=!0,ee=null,Te=null;const Me=async()=>{try{Te?.abort(),Te=new AbortController;const Tt=await(await fetch("/api/chaturbate/online",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store",signal:Te.signal,body:JSON.stringify({q:[ve],show:[],refresh:!1})})).json().catch(()=>null);if(!U)return;O({enabled:Tt?.enabled,fetchedAt:Tt?.fetchedAt,lastError:Tt?.lastError});const gi=Array.isArray(Tt?.rooms)?Tt.rooms:[];E(gi[0]??null)}catch(gt){if(gt?.name==="AbortError"||!U)return;O({enabled:void 0,fetchedAt:void 0,lastError:"Fetch fehlgeschlagen"}),E(null)}};return Me(),ee=window.setInterval(Me,8e3),()=>{U=!1,ee&&window.clearInterval(ee),Te?.abort()}},[s,ve]),_.useEffect(()=>{if(!s||!ve)return;let U=!0;W(!0),j(null),G(null);const ee=vH(n),Te=`/api/chaturbate/biocontext?model=${encodeURIComponent(ve)}${q>0?"&refresh=1":""}`;return fetch(Te,{cache:"no-store",headers:ee?{"X-Chaturbate-Cookie":ee}:void 0}).then(async Me=>{if(!Me.ok){const gt=await Me.text().catch(()=>"");throw new Error(gt||`HTTP ${Me.status}`)}return Me.json()}).then(Me=>{U&&(G({enabled:Me?.enabled,fetchedAt:Me?.fetchedAt,lastError:Me?.lastError}),j(Me?.bio??null))}).catch(Me=>{U&&(G({enabled:void 0,fetchedAt:void 0,lastError:Me?.message||"Fetch fehlgeschlagen"}),j(null))}).finally(()=>{U&&W(!1)}),()=>{U=!1}},[s,ve,q,n]),_.useEffect(()=>{!s||!ve||He()},[s,ve,He]),_.useEffect(()=>{if(!s||Array.isArray(r))return;let U=!0;return K(!0),fetch("/api/record/jobs",{cache:"no-store"}).then(ee=>ee.json()).then(ee=>{U&&ne(Array.isArray(ee)?ee:[])}).catch(()=>{U&&ne([])}).finally(()=>{U&&K(!1)}),()=>{U=!1}},[s,r]);const Ye=_.useMemo(()=>ve?y.find(U=>(U.modelKey||"").toLowerCase()===ve)??null:null,[y,ve]),wt=I,vt=_.useMemo(()=>Math.max(1,Math.ceil(z/be)),[z]),Ge=_.useMemo(()=>ve?De.filter(U=>{const ee=fH(U.output);return ee!=="—"&&ee.trim().toLowerCase()===ve}):[],[De,ve]),ke=_.useMemo(()=>{const U=cH(Ye?.tags),ee=Array.isArray(T?.tags)?T.tags:[],Te=new Map;for(const Me of[...U,...ee]){const gt=String(Me).trim().toLowerCase();gt&&(Te.has(gt)||Te.set(gt,String(Me).trim()))}return Array.from(Te.values()).sort((Me,gt)=>Me.localeCompare(gt,"de"))},[Ye?.tags,T?.tags]),ut=T?.display_name||Ye?.modelKey||ve||"Model",rt=T?.image_url_360x270||T?.image_url||"",Je=T?.image_url||rt,at=T?.chat_room_url_revshare||T?.chat_room_url||"",Re=(T?.current_show||"").trim().toLowerCase(),ze=Re?Re==="public"?"Public":Re==="private"?"Private":Re:"",Ue=(R?.location||"").trim(),de=R?.follower_count,qe=R?.display_age,ht=(R?.room_status||"").trim(),tt=R?.last_broadcast?rh(R.last_broadcast):"—",At=d0(R?.about_me),ft=d0(R?.wish_list),Et=Ye?.lastSeenOnline==null?"":Ye.lastSeenOnline?"online":"offline",Lt=(ht||Re||Et||"").trim(),Rt=Array.isArray(R?.social_medias)?R.social_medias:[],qt=Array.isArray(R?.photo_sets)?R.photo_sets:[],Wt=Array.isArray(R?.interested_in)?R.interested_in:[],yi=({icon:U,label:ee,value:Te})=>p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-2.5 py-2 sm:px-3 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] sm:text-xs text-gray-600 dark:text-gray-300",children:[U,ee]}),p.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:Te})]}),Ct=_.useCallback(async U=>{const ee=U.output||"",Te=gh(ee);if(!Te){await f?.(U);return}const Me=hH(Te);N(gt=>gt.map(Tt=>Tt.id&&U.id&&Tt.id===U.id||Tt.output&&U.output&&Tt.output===U.output?{...Tt,output:dH(Tt.output||"",Me)}:Tt)),await f?.(U),He()},[f,He]),It=_.useCallback(async U=>{const ee=U.output||"";gh(ee)&&N(Me=>Me.filter(gt=>!(gt.id&&U.id&>.id===U.id||gt.output&&U.output&>.output===U.output))),await g?.(U),He()},[g,He]),oi=_.useCallback(async()=>{ve&&(v(U=>U.map(ee=>(ee.modelKey||"").toLowerCase()===ve?{...ee,favorite:!ee.favorite}:ee)),await c?.(Fe(ve)),we())},[ve,c,we]),wi=_.useCallback(async()=>{ve&&(v(U=>U.map(ee=>(ee.modelKey||"").toLowerCase()===ve?{...ee,liked:ee.liked!==!0}:ee)),await d?.(Fe(ve)),we())},[ve,d,we]),Di=_.useCallback(async()=>{ve&&(v(U=>U.map(ee=>(ee.modelKey||"").toLowerCase()===ve?{...ee,watching:!ee.watching}:ee)),await u?.(Fe(ve)),we())},[ve,u,we]),[Yt,Nt]=_.useState("info");_.useEffect(()=>{s&&Nt("info")},[s,ve]);const H=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:z?iu(z):void 0,disabled:X},{id:"running",label:"Running",count:Ge.length?iu(Ge.length):void 0,disabled:ie}];return p.jsxs(rb,{open:s,onClose:t,title:ut,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:rt||void 0,mobileCollapsedImageAlt:ut,rightBodyClassName:"pt-0 sm:pt-2",left:p.jsx("div",{className:"space-y-3 sm:space-y-4",children:p.jsxs("div",{className:"hidden sm:block space-y-2",children:[p.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/70 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"relative",children:[rt?p.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Ze(Je,ut),"aria-label":"Bild vergrößern",children:p.jsx("img",{src:rt,alt:ut,className:is("h-24 sm:h-52 w-full object-cover transition",ah(a))})}):p.jsx("div",{className:"h-24 sm:h-52 w-full bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),p.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/40 via-black/0 to-black/0"}),p.jsxs("div",{className:"absolute left-3 top-3 flex flex-wrap items-center gap-2",children:[ze?p.jsx("span",{className:Or("bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20"),children:ze}):null,Lt?p.jsx("span",{className:Or(Lt.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 backdrop-blur dark:text-gray-200 dark:ring-white/15"),children:Lt}):null,T?.is_hd?p.jsx("span",{className:Or("bg-indigo-500/10 text-indigo-900 ring-indigo-200 backdrop-blur dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,T?.is_new?p.jsx("span",{className:Or("bg-amber-500/10 text-amber-900 ring-amber-200 backdrop-blur dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),p.jsxs("div",{className:"absolute bottom-3 left-3 right-3",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow",children:T?.display_name||T?.username||Ye?.modelKey||ve||"—"}),p.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:T?.username?`@${T.username}`:Ye?.modelKey?`@${Ye.modelKey}`:""})]}),p.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),Di()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Ye?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:Ye?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!Ye?.watching,"aria-label":Ye?.watching?"Watch entfernen":"Auf Watch setzen",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(g0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),p.jsx(bu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),oi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Ye?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:Ye?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!Ye?.favorite,"aria-label":Ye?.favorite?"Favorit entfernen":"Als Favorit markieren",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(y0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),p.jsx(Oc,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),wi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",Ye?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:Ye?.liked?"Like entfernen":"Liken","aria-pressed":Ye?.liked===!0,"aria-label":Ye?.liked?"Like entfernen":"Liken",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(Th,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),p.jsx(Tu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-200")})]})})]})]}),p.jsxs("div",{className:"p-3 sm:p-4",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[p.jsx(yi,{icon:p.jsx(e2,{className:"size-4"}),label:"Viewer",value:iu(T?.num_users)}),p.jsx(yi,{icon:p.jsx(Py,{className:"size-4"}),label:"Follower",value:iu(T?.num_followers??de)})]}),p.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-xs",children:[p.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[p.jsx(dM,{className:"size-4"}),"Location"]}),p.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:T?.location||Ue||"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[p.jsx(aM,{className:"size-4"}),"Sprache"]}),p.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:T?.spoken_languages||"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[p.jsx(Em,{className:"size-4"}),"Online"]}),p.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:Xv(T?.seconds_online)})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[p.jsx(Th,{className:"size-4"}),"Alter"]}),p.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:qe!=null?String(qe):T?.age!=null?String(T.age):"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[p.jsx(Em,{className:"size-4"}),"Last broadcast"]}),p.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:tt})]})]}),D?.enabled===!1?p.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):D?.lastError?p.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[p.jsxs("div",{className:"font-medium",children:["Online-Info: ",hA(D.lastError)]}),p.jsxs("details",{className:"mt-1",children:[p.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),p.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:fA(D.lastError)})]})]}):null,F?.enabled===!1?p.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):F?.lastError?p.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["BioContext: ",F.lastError]}):null]})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Tags"}),ke.length?p.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:ke.map(U=>p.jsx(fa,{tag:U},U))}):p.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:p.jsxs("div",{className:is("border-b border-gray-200/70 dark:border-white/10","bg-white/95 backdrop-blur dark:bg-gray-800/95"),children:[p.jsxs("div",{className:"sm:hidden px-2 pb-2 space-y-1.5",children:[p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("button",{type:"button",className:"relative shrink-0 overflow-hidden rounded-lg ring-1 ring-black/5 dark:ring-white/10",onClick:()=>Je&&Ze(Je,ut),"aria-label":"Bild vergrößern",children:[rt?p.jsx("img",{src:rt,alt:ut,className:is("size-10 object-cover",ah(a))}):p.jsx("div",{className:"size-10 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),p.jsx("span",{"aria-hidden":!0,className:is("absolute bottom-1.5 right-1.5 size-2.5 rounded-full ring-2 ring-white/80 dark:ring-gray-900/60",(Lt||"").toLowerCase()==="online"?"bg-emerald-400":"bg-gray-400")})]}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:T?.display_name||T?.username||Ye?.modelKey||ve||"—"}),p.jsx("div",{className:"truncate text-xs text-gray-600 dark:text-gray-300",children:T?.username?`@${T.username}`:Ye?.modelKey?`@${Ye.modelKey}`:""})]}),p.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),Di()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Ye?.watching?"bg-sky-500/15 ring-sky-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Ye?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!Ye?.watching,"aria-label":Ye?.watching?"Watch entfernen":"Auf Watch setzen",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(g0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),p.jsx(bu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-500")})]})}),p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),oi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Ye?.favorite?"bg-amber-500/15 ring-amber-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Ye?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!Ye?.favorite,"aria-label":Ye?.favorite?"Favorit entfernen":"Als Favorit markieren",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(y0,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),p.jsx(Oc,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-500")})]})}),p.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),wi()},className:is("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",Ye?.liked?"bg-rose-500/15 ring-rose-200/30":"bg-black/5 ring-black/10 dark:bg-white/5 dark:ring-white/10"),title:Ye?.liked?"Like entfernen":"Liken","aria-pressed":Ye?.liked===!0,"aria-label":Ye?.liked?"Like entfernen":"Liken",children:p.jsxs("span",{className:"relative inline-block size-4",children:[p.jsx(Th,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-gray-700 dark:text-white/70")}),p.jsx(Tu,{className:is("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",Ye?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-500")})]})})]})]}),p.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[ze?p.jsx("span",{className:Or("bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20"),children:ze}):null,ht?p.jsx("span",{className:Or(ht.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:ht}):null,T?.is_hd?p.jsx("span",{className:Or("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,T?.is_new?p.jsx("span",{className:Or("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),at?p.jsx("div",{className:"mt-1.5 flex justify-end",children:p.jsxs("a",{href:at,target:"_blank",rel:"noreferrer",className:is("inline-flex h-8 items-center justify-center gap-1 rounded-lg px-3 text-sm font-medium","border border-gray-200/70 bg-white/70 text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white"),title:"Room öffnen",children:[p.jsx(_m,{className:"size-4"}),p.jsx("span",{children:"Room"})]})}):null]})]}),p.jsxs("div",{className:"mt-1 flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[12px] text-gray-700 dark:text-gray-200",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(e2,{className:"size-3.5 text-gray-400"}),p.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:iu(T?.num_users)})]}),p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Py,{className:"size-3.5 text-gray-400"}),p.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:iu(T?.num_followers??de)})]}),p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Y_,{className:"size-3.5 text-gray-400"}),p.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:Xv(T?.seconds_online)})]}),p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Em,{className:"size-3.5 text-gray-400"}),p.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:R?.last_broadcast?RR(R.last_broadcast):"—"})]})]}),D?.enabled===!1?p.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):D?.lastError?p.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["Online-Info: ",D.lastError]}):null,F?.enabled===!1?p.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):F?.lastError?p.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[p.jsx("div",{className:"flex items-start justify-between gap-2",children:p.jsxs("div",{className:"font-medium",children:["BioContext: ",hA(F.lastError)]})}),p.jsxs("details",{className:"mt-1",children:[p.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),p.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:fA(F.lastError)})]})]}):null]}),ke.length?p.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-2 py-1.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"shrink-0 text-xs font-semibold text-gray-900 dark:text-white",children:["Tags ",p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",ke.length,")"]})]}),p.jsx("div",{className:"-mx-1 flex-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:p.jsxs("div",{className:"flex min-w-max items-center gap-1.5",children:[ke.slice(0,20).map(U=>p.jsx(fa,{tag:U},U)),ke.length>20?p.jsxs("span",{className:Or("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:["+",ke.length-20]}):null]})})]})}):null]}),p.jsxs("div",{className:"flex items-start justify-between gap-2 px-2 py-2 sm:px-4",children:[p.jsx("div",{className:"min-w-0",children:p.jsx("div",{className:"text-[11px] leading-snug text-gray-600 dark:text-gray-300",children:ve?p.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[D?.fetchedAt?p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",rh(D.fetchedAt)]}):null,F?.fetchedAt?p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",rh(F.fetchedAt)]}):null,Ye?.lastSeenOnlineAt?p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",p.jsx("span",{className:"font-medium",children:Ye.lastSeenOnline==null?"—":Ye.lastSeenOnline?"online":"offline"})," ","(",rh(Ye.lastSeenOnlineAt),")"]}):null]}):"—"})}),p.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[Yt==="info"?p.jsx(mi,{variant:"secondary",className:is("h-9 px-3 text-sm","whitespace-nowrap"),disabled:L||!e,onClick:()=>Z(U=>U+1),title:"BioContext neu abrufen",children:p.jsxs("span",{className:"inline-flex items-center gap-2",children:[p.jsx(MO,{className:is("size-4",L?"animate-spin":"")}),p.jsx("span",{className:"hidden sm:inline",children:"Bio aktualisieren"})]})}):null,at?p.jsxs("a",{href:at,target:"_blank",rel:"noreferrer",className:is("inline-flex h-8 items-center justify-center gap-1 rounded-lg","border border-gray-200/70 bg-white/70 px-3 text-sm font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white","whitespace-nowrap"),title:"Room öffnen",children:[p.jsx(_m,{className:"size-4"}),p.jsx("span",{className:"hidden sm:inline",children:"Room öffnen"})]}):null]})]}),p.jsx("div",{className:"px-2 pb-2",children:p.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:p.jsx("div",{className:"min-w-max",children:p.jsx(lx,{tabs:H,value:Yt,onChange:U=>Nt(U),variant:"pillsBrand",ariaLabel:"Bereich auswählen"})})})})]}),footer:p.jsx("div",{className:"w-full",children:p.jsx(mi,{variant:"secondary",className:"w-full sm:w-auto",onClick:t,children:"Schließen"})}),children:[p.jsxs("div",{className:"min-h-0",children:[Yt==="info"?p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-3 sm:p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsx("div",{className:"flex items-center justify-between gap-3",children:p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Room Subject"})}),p.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:T?.room_subject?p.jsx("p",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:T.room_subject}):p.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Keine Subject-Info vorhanden."})})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Bio"}),L?p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),p.jsxs("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[p.jsx(iM,{className:"size-4"}),"Über mich"]}),p.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:At?p.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:At}):p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[p.jsx(Py,{className:"size-4"}),"Wishlist"]}),p.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:ft?p.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:ft}):p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]})]}),p.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Real name:"})," ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.real_name?d0(R.real_name):"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Body type:"})," ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.body_type||"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Smoke/Drink:"})," ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.smoke_drink||"—"})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[p.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Sex:"})," ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:R?.sex||"—"})]})]}),Wt.length?p.jsxs("div",{className:"mt-2",children:[p.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Interested in"}),p.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Wt.map(U=>p.jsx("span",{className:Or("bg-sky-500/10 text-sky-900 ring-sky-200 dark:text-sky-200 dark:ring-sky-400/20"),children:U},U))})]}):null]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Socials"}),Rt.length?p.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Rt.length," Links"]}):null]}),Rt.length?p.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:Rt.map(U=>{const ee=mH(U.link);return p.jsxs("a",{href:ee,target:"_blank",rel:"noreferrer",className:is("group flex min-w-0 w-full items-center gap-3 overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-gray-900","transition hover:border-indigo-200 hover:bg-gray-50/80 hover:text-gray-900 dark:border-white/10 dark:bg-white/5 dark:text-white dark:hover:border-indigo-400/30 dark:hover:bg-white/10 dark:hover:text-white"),title:U.title_name,children:[p.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:U.image_url?p.jsx("img",{src:U.image_url,alt:"",className:"size-5"}):p.jsx(lM,{className:"size-5"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:U.title_name}),p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:U.label_text?U.label_text:U.tokens!=null?`${U.tokens} token(s)`:"Link"})]}),p.jsx(_m,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},U.id)})}):p.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Social-Medias vorhanden."})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Photo sets"}),qt.length?p.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[qt.length," Sets"]}):null]}),qt.length?p.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:qt.slice(0,6).map(U=>p.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"relative",children:[U.cover_url?p.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Ze(U.cover_url,U.name),"aria-label":"Bild vergrößern",children:p.jsx("img",{src:U.cover_url,alt:U.name,className:is("h-28 w-full object-cover transition",ah(a))})}):p.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:p.jsx(Z_,{className:"size-6 text-gray-500"})}),p.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[U.is_video?p.jsx("span",{className:Or("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"Video"}):p.jsx("span",{className:Or("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:"Photos"}),U.fan_club_only?p.jsx("span",{className:Or("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"FanClub"}):null]})]}),p.jsxs("div",{className:"p-3",children:[p.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:U.name}),p.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Tokens: ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:iu(U.tokens)}),U.user_can_access===!0?p.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},U.id))}):p.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,Yt==="downloads"?p.jsx("div",{className:"min-h-0",children:p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"shrink-0 flex flex-wrap items-center justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),p.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Inkl. Dateien aus ",p.jsx("span",{className:"font-medium",children:"/done/keep/"})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(mi,{size:"sm",variant:"secondary",disabled:X||Q<=1,onClick:()=>pe(U=>Math.max(1,U-1)),children:"Zurück"}),p.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Seite ",Q," / ",vt]}),p.jsx(mi,{size:"sm",variant:"secondary",disabled:X||Q>=vt,onClick:()=>pe(U=>Math.min(vt,U+1)),children:"Weiter"})]})]}),p.jsx("div",{className:"mt-2",children:X?p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):wt.length===0?p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine abgeschlossenen Downloads für dieses Model gefunden."}):p.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:wt.map(U=>{const ee=gh(U.output||""),Te=IR(ee),Me=pH(ee),gt=Xv(U.durationSeconds),Tt=uH(U.sizeBytes),gi=gH(U);return p.jsxs("div",{role:i?"button":void 0,tabIndex:i?0:void 0,className:is("group relative overflow-hidden rounded-lg outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-lg dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",i?"cursor-pointer":""),onClick:()=>i?.(U),onKeyDown:si=>{i&&(si.key==="Enter"||si.key===" ")&&i(U)},children:[p.jsxs("div",{className:"relative aspect-video bg-black/5 dark:bg-white/5",children:[p.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),p.jsx("div",{className:is("absolute inset-0",ah(a))}),p.jsx("div",{className:"absolute inset-x-3 top-3 z-10 flex justify-end",onClick:si=>si.stopPropagation(),onMouseDown:si=>si.stopPropagation(),children:p.jsx(pa,{job:U,variant:"overlay",collapseToMenu:!0,isHot:Te,isFavorite:!!Ye?.favorite,isLiked:Ye?.liked===!0,isWatching:!!Ye?.watching,onToggleHot:Ct,onDelete:It,order:["hot","delete"],className:"w-full justify-end gap-2"})}),p.jsx("div",{className:"absolute inset-0 grid place-items-center",children:p.jsxs("div",{className:"rounded-lg bg-black/10 px-4 py-3 text-gray-700 dark:bg-white/10 dark:text-gray-200",children:[p.jsx(ZO,{className:"mx-auto size-8 opacity-80"}),p.jsx("div",{className:"mt-1 text-sm font-medium opacity-80",children:"Preview"})]})})]}),p.jsxs("div",{className:"border-t border-gray-200/60 bg-white px-5 py-4 dark:border-white/10 dark:bg-gray-900",children:[p.jsx("div",{className:"flex items-center justify-between gap-2",children:p.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[Te?p.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-2 py-0.5 text-xs font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,p.jsx("div",{className:"min-w-0 truncate text-base font-semibold text-gray-900 dark:text-white",children:Me})]})}),p.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm text-gray-600 dark:text-gray-300",children:[p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Em,{className:"size-5 text-gray-400"}),gi]}),p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Y_,{className:"size-5 text-gray-400"}),gt]}),p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx(Z_,{className:"size-5 text-gray-400"}),Tt]})]})]})]},`${U.id}-${ee}`)})})})]})}):null,Yt==="running"?p.jsx("div",{className:"min-h-0",children:p.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Laufende Jobs"}),ie?p.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),p.jsx("div",{className:"mt-2",children:ie?p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):Ge.length===0?p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine laufenden Jobs."}):p.jsx("div",{className:"grid gap-2",children:Ge.map(U=>p.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-sm dark:border-white/10 dark:bg-white/5",children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"break-words line-clamp-2 font-medium text-gray-900 dark:text-white",children:gh(U.output||"")}),p.jsxs("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:["Start:"," ",p.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:rh(U.startedAt)})]})]}),i?p.jsx(mi,{size:"sm",variant:"secondary",className:"shrink-0",onClick:()=>i(U),children:"Öffnen"}):null]})},U.id))})})]})}):null]}),p.jsx(rb,{open:!!te,onClose:()=>le(null),title:te?.alt||"Bild",width:"max-w-4xl",layout:"single",scroll:"body",footer:p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[te?.src?p.jsxs("a",{href:te.src,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg border border-gray-200/70 bg-white/70 px-3 py-1.5 text-xs font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white dark:border-white/10 dark:bg-white/5 dark:text-white",children:[p.jsx(_m,{className:"size-4"}),"In neuem Tab"]}):null,p.jsx(mi,{variant:"secondary",onClick:()=>le(null),children:"Schließen"})]}),children:p.jsx("div",{className:"grid place-items-center",children:te?.src?p.jsx("img",{src:te.src,alt:te.alt||"",className:is("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",ah(a))}):null})})]})}const Xm=s=>Math.max(0,Math.min(1,s));function Qm(s){return s==="good"?"bg-emerald-500":s==="warn"?"bg-amber-500":"bg-red-500"}function bH(s){return s==null?"–":`${Math.round(s)}ms`}function mA(s){return s==null?"–":`${Math.round(s)}%`}function Qv(s){if(s==null||!Number.isFinite(s)||s<=0)return"–";const e=["B","KB","MB","GB","TB"];let t=s,i=0;for(;t>=1024&&i=10?1:2;return`${t.toFixed(n)} ${e[i]}`}function TH(s=1e3){const[e,t]=ci.useState(null);return ci.useEffect(()=>{let i=0,n=performance.now(),r=0,a=!0,u=!1;const c=y=>{if(!a||!u)return;r+=1;const v=y-n;if(v>=s){const b=Math.round(r*1e3/v);t(b),r=0,n=y}i=requestAnimationFrame(c)},d=()=>{a&&(document.hidden||u||(u=!0,n=performance.now(),r=0,i=requestAnimationFrame(c)))},f=()=>{u=!1,cancelAnimationFrame(i)},g=()=>{document.hidden?f():d()};return d(),document.addEventListener("visibilitychange",g),()=>{a=!1,document.removeEventListener("visibilitychange",g),f()}},[s]),e}function pA({mode:s="inline",className:e,pollMs:t=3e3}){const i=TH(1e3),[n,r]=ci.useState(null),[a,u]=ci.useState(null),[c,d]=ci.useState(null),[f,g]=ci.useState(null),[y,v]=ci.useState(null),b=5*1024*1024*1024,T=8*1024*1024*1024,E=ci.useRef(!1);ci.useEffect(()=>{const Y=`/api/perf/stream?ms=${encodeURIComponent(String(t))}`,ne=up(Y,"perf",ie=>{const K=typeof ie?.cpuPercent=="number"?ie.cpuPercent:null,q=typeof ie?.diskFreeBytes=="number"?ie.diskFreeBytes:null,Z=typeof ie?.diskTotalBytes=="number"?ie.diskTotalBytes:null,te=typeof ie?.diskUsedPercent=="number"?ie.diskUsedPercent:null;u(K),d(q),g(Z),v(te);const le=typeof ie?.serverMs=="number"?ie.serverMs:null;r(le!=null?Math.max(0,Date.now()-le):null)});return()=>ne()},[t]);const D=n==null?"bad":n<=120?"good":n<=300?"warn":"bad",O=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",R=a==null?"bad":a<=60?"good":a<=85?"warn":"bad",j=Xm((n??999)/500),F=Xm((i??0)/60),G=Xm((a??0)/100),L=c!=null&&f!=null&&f>0?c/f:null,W=y??(L!=null?(1-L)*100:null),I=Xm((W??0)/100);c==null?E.current=!1:E.current?c>=T&&(E.current=!1):c<=b&&(E.current=!0);const N=c==null||E.current||L==null?"bad":L>=.15?"good":L>=.07?"warn":"bad",X=c==null?"Disk: –":`Free: ${Qv(c)} / Total: ${Qv(f)} · Used: ${mA(W)}`,V=s==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return p.jsx("div",{className:`${V} ${e??""}`,children:p.jsxs("div",{className:`\r rounded-lg border border-gray-200/70 bg-white/70 px-2.5 py-1.5 shadow-sm backdrop-blur\r dark:border-white/10 dark:bg-white/5\r grid grid-cols-2 gap-x-3 gap-y-2\r sm:flex sm:items-center sm:gap-3\r - `,children:[g.jsxs("div",{className:"flex items-center gap-2",title:X,children:[g.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Disk"}),g.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:g.jsx("div",{className:`h-full ${qm(I)}`,style:{width:`${Math.round(L*100)}%`}})}),g.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:Yv(c)})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Ping"}),g.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:g.jsx("div",{className:`h-full ${qm(D)}`,style:{width:`${Math.round(j*100)}%`}})}),g.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:sH(n)})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"FPS"}),g.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:g.jsx("div",{className:`h-full ${qm(O)}`,style:{width:`${Math.round(F*100)}%`}})}),g.jsx("span",{className:"text-[11px] w-8 tabular-nums text-gray-900 dark:text-gray-100",children:i??"–"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"CPU"}),g.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:g.jsx("div",{className:`h-full ${qm(R)}`,style:{width:`${Math.round(z*100)}%`}})}),g.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:aA(a)})]})]})})}function rH(s,e){const t=[];for(let i=0;i{t!=null&&(window.clearTimeout(t),t=null)},c=()=>{if(i){try{i.abort()}catch{}i=null}},d=p=>{a||(u(),t=window.setTimeout(()=>{f()},p))},f=async()=>{if(!a)try{const p=(s.getModels?.()??[]).map(X=>String(X||"").trim()).filter(Boolean),v=(s.getShow?.()??[]).map(X=>String(X||"").trim()).filter(Boolean).slice().sort(),b=p.slice().sort(),T=b.length===0&&!!s.fetchAllWhenNoModels;if(b.length===0&&!T){c();const X={enabled:r?.enabled??!1,rooms:[]};r=X,s.onData(X);const G=document.hidden?Math.max(15e3,e):e;d(G);return}const E=T?[]:b,D=`${v.join(",")}|${T?"__ALL__":E.join(",")}`,O=D;n=D,c();const R=new AbortController;i=R;const F=T?[[]]:rH(E,350);let z=[],N=!1,Y=0,L=!1;for(const X of F){if(R.signal.aborted||O!==n||a)return;const G=await fetch("/api/chaturbate/online",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:X,show:v,refresh:!1}),signal:R.signal,cache:"no-store"});if(!G.ok)continue;L=!0;const q=await G.json();N=N||!!q?.enabled,z.push(...Array.isArray(q?.rooms)?q.rooms:[]);const ae=Number(q?.total??0);Number.isFinite(ae)&&ae>Y&&(Y=ae)}if(!L){const X=document.hidden?Math.max(15e3,e):e;d(X);return}const I={enabled:N,rooms:aH(z),total:Y};if(R.signal.aborted||O!==n||a)return;r=I,s.onData(I)}catch(p){if(p?.name==="AbortError")return;s.onError?.(p)}finally{const p=document.hidden?Math.max(15e3,e):e;d(p)}};return f(),()=>{a=!0,u(),c()}}async function Xv(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function oH(s,e,t,i){const n=`/api/generated/cover?category=${encodeURIComponent(s)}`,r=e?`&v=${e}`:"",a="",u=i&&i.trim()?`&model=${encodeURIComponent(i.trim())}`:"";return`${n}${r}${a}${u}`}function uA(s){if(!s)return[];const e=s.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function ER(s){return String(s||"").replaceAll("\\","/").split("/").pop()||""}function wR(s){return s.toUpperCase().startsWith("HOT ")?s.slice(4).trim():s}function lH(s){const e=wR(ER(s||""));return e?e.replace(/\.[^.]+$/,""):""}const uH=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Qv(s){const t=wR(ER(s)).replace(/\.[^.]+$/,""),i=t.match(uH);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n).trim():t?t.trim():null}function cH(s){const e=lH(s);return e?`/generated/meta/${encodeURIComponent(e)}/thumbs.webp`:null}async function dH(s,e,t,i){const n=(t||"").trim(),r=`/api/generated/cover?category=${encodeURIComponent(s)}&src=${encodeURIComponent(e)}`+(n?`&model=${encodeURIComponent(n)}`:"")+"&refresh=1",a=await fetch(r,{method:"GET",cache:"no-store"});if(!a.ok){const u=await a.text().catch(()=>"");throw new Error(u||`ensureCover failed: HTTP ${a.status}`)}}function hH(){const[s,e]=_.useState([]),[t,i]=_.useState(!1),[n,r]=_.useState(null),[a,u]=_.useState(()=>Date.now()),[c,d]=_.useState({}),[f,p]=_.useState({}),[y,v]=_.useState(!1),[b,T]=_.useState(null),[E,D]=_.useState({}),O=_.useRef(null),R=_.useRef({}),j=_.useCallback((L,I)=>{const X={};for(const q of Array.isArray(L)?L:[]){const ae=String(q?.modelKey??"").trim().toLowerCase();if(!ae)continue;const ie=uA(q?.tags).map(W=>W.toLowerCase());ie.length&&(X[ae]=ie)}const G={};for(const q of Array.isArray(I)?I:[]){const ae=String(q?.output??"");if(!ae)continue;const ie=(Qv(ae)||"").trim().toLowerCase();if(!ie)continue;const W=X[ie];if(!(!W||W.length===0))for(const K of W)K&&(G[K]||(G[K]=[]),G[K].push(ae))}for(const[q,ae]of Object.entries(G))G[q]=Array.from(new Set(ae));R.current=G},[]),F=_.useCallback(L=>{const I=String(L||"").trim();if(I){try{localStorage.setItem("finishedDownloads_pendingTags",JSON.stringify([I]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"finished"}})),window.dispatchEvent(new CustomEvent("finished-downloads:tag-filter",{detail:{tags:[I],mode:"replace"}}))}},[]),z=_.useCallback(L=>{const I=String(L||"").trim();if(I){try{localStorage.setItem("models_pendingTags",JSON.stringify([I]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"models"}})),window.dispatchEvent(new CustomEvent("models:set-tag-filter",{detail:{tags:[I]}}))}},[]),N=_.useCallback(async()=>{O.current?.abort();const L=new AbortController;O.current=L,i(!0),r(null);try{const[I,X]=await Promise.all([Xv("/api/models/list",{cache:"no-store",signal:L.signal}),Xv("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:L.signal})]),G=Array.isArray(X?.items)?X.items:Array.isArray(X)?X:[];j(Array.isArray(I)?I:[],G);const q=new Map;for(const te of Array.isArray(I)?I:[])for(const re of uA(te?.tags)){const U=re.toLowerCase();q.set(U,(q.get(U)??0)+1)}const ae=R.current||{},ie=Array.from(q.entries()).map(([te,re])=>({tag:te,modelsCount:re,downloadsCount:(ae[te]||[]).length})).sort((te,re)=>te.tag.localeCompare(re.tag,void 0,{sensitivity:"base"})),W=new Map;try{const te=await Xv("/api/generated/coverinfo/list",{cache:"no-store",signal:L.signal});for(const re of Array.isArray(te)?te:[]){const U=String(re?.category??"").trim().toLowerCase();U&&W.set(U,re)}}catch{}const K={};for(const te of ie){const re=W.get(te.tag);K[te.tag]=!!re?.hasCover}p(K);const Q={};for(const te of ie){const U=(ae[te.tag]||[])[0]||"";let ne=U?Qv(U):null;if(!ne){const Z=W.get(te.tag);Z?.hasCover&&Z.model?.trim()&&(ne=Z.model.trim())}ne&&(Q[te.tag]=ne)}D(Q),d(te=>{const re={};for(const U of ie){const ne=te[U.tag];ne&&K[U.tag]===!0&&(re[U.tag]=ne)}return re}),e(ie)}catch(I){if(I?.name==="AbortError")return;r(I?.message??String(I)),e([]),R.current={},D({}),p({}),d({})}finally{O.current===L&&(O.current=null,i(!1))}},[j]);_.useEffect(()=>(N(),()=>{O.current?.abort()}),[N]);const Y=_.useCallback(async()=>{if(!y){v(!0),r(null),T({done:0,total:s.length});try{const L=R.current||{},I=await Promise.all(s.map(async G=>{try{const q=L[G.tag]||[];if(q.length===0)return{tag:G.tag,ok:!0,status:0,text:"skipped (no candidates)"};const ae=q[Math.floor(Math.random()*q.length)],ie=cH(ae);if(!ie)return{tag:G.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const W=Qv(ae);return await dH(G.tag,ie,W,!0),p(K=>({...K,[G.tag]:!0})),D(K=>{const Q={...K};return W?.trim()?Q[G.tag]=W.trim():delete Q[G.tag],Q}),d(K=>{const Q={...K};return delete Q[G.tag],Q}),{tag:G.tag,ok:!0,status:200,text:""}}catch(q){return{tag:G.tag,ok:!1,status:0,text:q?.message??String(q)}}finally{T(q=>q&&{...q,done:Math.min(q.total,q.done+1)})}})),X=I.filter(G=>!G.ok);if(X.length){console.warn("Cover renew failed:",X.slice(0,20));const G=X.slice(0,8).map(q=>`${q.tag} (ERR)`).join(", ");r(`Covers fehlgeschlagen: ${X.length}/${I.length} — z.B.: ${G}`)}else r(null)}finally{u(Date.now()),v(!1),setTimeout(()=>T(null),400)}}},[s,y]);return g.jsxs(ca,{header:g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Kategorien ",g.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",s.length,")"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[b?g.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2",children:[g.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 tabular-nums",children:["Covers: ",b.done,"/",b.total]}),g.jsx("div",{className:"h-2 w-28 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden",children:g.jsx("div",{className:"h-full bg-indigo-500",style:{width:b.total>0?`${Math.round(b.done/b.total*100)}%`:"0%"}})})]}):null,g.jsx(di,{variant:"secondary",size:"md",onClick:Y,disabled:t||y,children:"Cover erneuern"}),g.jsx(di,{variant:"secondary",size:"md",onClick:N,disabled:t||y,children:"Aktualisieren"})]})]}),grayBody:!0,children:[n?g.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:n}):null,s.length===0&&!t?g.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Kategorien/Tags gefunden."}):null,g.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(L=>{const I=E[L.tag]??null,X=f[L.tag]===!0,G=Object.prototype.hasOwnProperty.call(f,L.tag),q=X?oH(L.tag,a,!1,I):"",ae=c[L.tag]==="ok",ie=c[L.tag]==="error";return g.jsxs("button",{type:"button",onClick:()=>F(L.tag),className:Mi("group text-left rounded-2xl overflow-hidden transition","bg-white/70 dark:bg-white/[0.06]","border border-gray-200/70 dark:border-white/10","shadow-sm hover:shadow-md","hover:-translate-y-[1px]","hover:bg-white dark:hover:bg-white/[0.09]","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-950"),title:"In FinishedDownloads öffnen (Tag-Filter setzen)",children:[g.jsx("div",{className:"relative w-full overflow-hidden aspect-[16/9] bg-gray-100/70 dark:bg-white/5",children:G?X?ie?g.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[g.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),g.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[g.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Cover konnte nicht geladen werden"}),g.jsx("div",{className:"mt-1 flex justify-center",children:g.jsx("span",{className:`text-[11px] inline-flex items-center rounded-full bg-indigo-50 px-2 py-1 font-semibold text-indigo-700 ring-1 ring-indigo-100 hover:bg-indigo-100\r - dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20 dark:hover:bg-indigo-500/20`,onClick:W=>{W.preventDefault(),W.stopPropagation(),d(K=>{const Q={...K};return delete Q[L.tag],Q}),u(Date.now())},children:"Retry"})})]})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 z-[1] pointer-events-none",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0) 35%),linear-gradient(to top, rgba(0,0,0,0.35), rgba(0,0,0,0) 45%)"}}),g.jsx("img",{src:q,alt:"","aria-hidden":"true",className:"absolute inset-0 z-0 h-full w-full object-cover blur-xl scale-110 opacity-60",loading:"lazy"}),g.jsx("img",{src:q,alt:L.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>d(W=>({...W,[L.tag]:"ok"})),onError:()=>{d(W=>({...W,[L.tag]:"error"})),p(W=>({...W,[L.tag]:!1}))}}),ae&&I?g.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:g.jsx("div",{className:Mi("truncate rounded-full px-2.5 py-1 text-[11px] font-semibold","bg-black/40 text-white backdrop-blur-md","ring-1 ring-white/15"),children:I})}):null]}):g.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[g.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),g.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[g.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Kein Cover vorhanden"}),I?g.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-700 dark:text-gray-300",children:["Model: ",g.jsx("span",{className:"font-semibold",children:I})]}):null,g.jsx("div",{className:"mt-1 text-[11px] text-gray-600 dark:text-gray-400 text-center",children:"(Kein Request / keine 404)"})]})]}):g.jsxs("div",{className:"absolute inset-0",children:[g.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.20), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.14), transparent 55%)"}}),g.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"}),g.jsx("div",{className:"absolute left-3 bottom-3 text-[11px] font-semibold text-white/80 bg-black/30 px-2.5 py-1 rounded-full ring-1 ring-white/10",children:"Cover wird geprüft…"})]})}),g.jsx("div",{className:"px-4 py-3.5",children:g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"font-semibold text-gray-900 dark:text-white truncate tracking-tight",children:L.tag}),g.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[g.jsxs("span",{role:"button",tabIndex:0,className:Mi("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap","overflow-hidden","bg-indigo-50 text-indigo-700 ring-1 ring-indigo-100","dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20","cursor-pointer"),title:"FinishedDownloads nach diesem Tag filtern",onClick:W=>{W.preventDefault(),W.stopPropagation(),F(L.tag)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),F(L.tag))},children:[g.jsx("span",{className:"shrink-0",children:L.downloadsCount}),g.jsx("span",{className:"min-w-0 truncate font-medium",children:"Downloads"})]}),g.jsxs("span",{role:"button",tabIndex:0,className:Mi("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap overflow-hidden","bg-gray-50 text-gray-700 ring-1 ring-gray-200","dark:bg-white/5 dark:text-gray-200 dark:ring-white/10","cursor-pointer"),title:"Models nach diesem Tag filtern",onClick:W=>{W.preventDefault(),W.stopPropagation(),z(L.tag)},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),z(L.tag))},children:[g.jsx("span",{className:"shrink-0",children:L.modelsCount}),g.jsx("span",{className:"min-w-0 truncate font-medium",children:"Models"})]})]})]}),g.jsx("span",{"aria-hidden":"true",className:Mi("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},L.tag)})})]})}async function ah(s,e){const t=await fetch(s,{credentials:"include",...e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function fH(){try{const e=new URL(window.location.href).searchParams.get("next")||"/";return!e.startsWith("/")||e.startsWith("/login")?"/":e}catch{return"/"}}const _1="recorder_login_state_v1";function mH(){try{const s=sessionStorage.getItem(_1);if(!s)return null;const e=JSON.parse(s);return!e?.ts||Date.now()-e.ts>900*1e3?null:e}catch{return null}}function pH(s){try{sessionStorage.setItem(_1,JSON.stringify(s))}catch{}}function Km(){try{sessionStorage.removeItem(_1)}catch{}}function gH(s){const t=(s??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function yH(s){return(s??[]).join("")}function vH({onLoggedIn:s}){const e=_.useMemo(()=>fH(),[]),[t,i]=_.useState(""),[n,r]=_.useState(""),[a,u]=_.useState(["","","","","",""]),c=_.useRef([]),[d,f]=_.useState(!1),[p,y]=_.useState(null),[v,b]=_.useState("login"),[T,E]=_.useState(null),[D,O]=_.useState(null),[R,j]=_.useState(null),F=_.useRef(!1),z=_.useMemo(()=>yH(a),[a]);function N(K){const Q=c.current[K];Q&&Q.focus()}function Y(){u(["","","","","",""]),F.current=!1,window.setTimeout(()=>N(0),0)}function L(K,Q){const te=(Q??"").replace(/\D/g,"").slice(-1);u(re=>{const U=[...re];return U[K]=te,U})}function I(K,Q){const te=(Q??"").replace(/\D/g,"");if(!te){L(K,""),F.current=!1;return}if(te.length>1){u(re=>{const U=[...re];let ne=K;for(const Z of te){if(ne>5)break;U[ne]=Z,ne++}return U}),F.current=!1,window.setTimeout(()=>N(Math.min(5,K+te.length)),0);return}L(K,te),F.current=!1,K<5&&window.setTimeout(()=>N(K+1),0)}function X(K,Q){if(Q.key==="Backspace"){if(a[K]){Q.preventDefault(),L(K,""),F.current=!1;return}K>0&&(Q.preventDefault(),N(K-1),L(K-1,""),F.current=!1);return}if(Q.key==="ArrowLeft"){Q.preventDefault(),K>0&&N(K-1);return}if(Q.key==="ArrowRight"){Q.preventDefault(),K<5&&N(K+1);return}}function G(K,Q){const re=(Q.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);re&&(Q.preventDefault(),u(U=>{const ne=[...U];let Z=K;for(const fe of re){if(Z>5)break;ne[Z]=fe,Z++}return ne}),F.current=!1,window.setTimeout(()=>N(Math.min(5,K+re.length)),0))}_.useEffect(()=>{const K=mH();K&&(b(K.stage??"login"),i(K.username??""),u(gH(K.code??"")),E(K.setupAuthUrl??null),O(K.setupSecret??null),j(K.setupInfo??null))},[]),_.useEffect(()=>{pH({stage:v,username:t,code:z,setupAuthUrl:T,setupSecret:D,setupInfo:R,ts:Date.now()})},[v,t,z,T,D,R]),_.useEffect(()=>{F.current=!1,(v==="verify"||v==="setup")&&window.setTimeout(()=>N(0),0)},[v]),_.useEffect(()=>{let K=!1;return(async()=>{try{const te=await ah("/api/auth/me",{cache:"no-store"});if(K)return;if(te?.authenticated){te?.totpConfigured?(Km(),window.location.assign(e||"/")):(b("setup"),ie());return}if(te?.pending2fa){b("verify");return}b("login")}catch{}})(),()=>{K=!0}},[e]);const q=async()=>{f(!0),y(null);try{if((await ah("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:n})}))?.totpRequired){b("verify"),Y();return}const Q=await ah("/api/auth/me",{cache:"no-store"});if(Q?.authenticated&&!Q?.totpConfigured){b("setup"),Y(),await ie();return}s&&await s(),Km(),window.location.assign(e||"/")}catch(K){y(K?.message??String(K))}finally{f(!1)}},ae=async()=>{const K=z.trim();if(/^\d{6}$/.test(K)){f(!0),y(null);try{await ah("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:K})}),s&&await s(),Km(),window.location.assign(e||"/")}catch(Q){F.current=!1,y(Q?.message??String(Q))}finally{f(!1)}}},ie=async()=>{y(null),j(null);try{const K=await ah("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Q=(K?.otpauth??"").trim();if(!Q)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");E(Q),O((K?.secret??"").trim()||null),j("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(K){y(K?.message??String(K))}};_.useEffect(()=>{d||v!=="verify"&&v!=="setup"||/^\d{6}$/.test(z)&&(F.current||(F.current=!0,ae()))},[z,v,d]);const W=g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"2FA Code"}),g.jsx("div",{className:"flex items-center justify-between gap-2",children:a.map((K,Q)=>g.jsx("input",{ref:te=>{c.current[Q]=te},value:K,onChange:te=>I(Q,te.target.value),onKeyDown:te=>X(Q,te),onPaste:te=>G(Q,te),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:Q===0?"one-time-code":"off",enterKeyHint:Q===5?"done":"next",autoCapitalize:"none",autoCorrect:"off",disabled:d,className:`h-12 w-12 rounded-lg text-center text-lg tabular-nums bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r + `,children:[p.jsxs("div",{className:"flex items-center gap-2",title:X,children:[p.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Disk"}),p.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:p.jsx("div",{className:`h-full ${Qm(N)}`,style:{width:`${Math.round(I*100)}%`}})}),p.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:Qv(c)})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Ping"}),p.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:p.jsx("div",{className:`h-full ${Qm(D)}`,style:{width:`${Math.round(j*100)}%`}})}),p.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:bH(n)})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"FPS"}),p.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:p.jsx("div",{className:`h-full ${Qm(O)}`,style:{width:`${Math.round(F*100)}%`}})}),p.jsx("span",{className:"text-[11px] w-8 tabular-nums text-gray-900 dark:text-gray-100",children:i??"–"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"CPU"}),p.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:p.jsx("div",{className:`h-full ${Qm(R)}`,style:{width:`${Math.round(G*100)}%`}})}),p.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:mA(a)})]})]})})}function SH(s,e){const t=[];for(let i=0;i{t!=null&&(window.clearTimeout(t),t=null)},c=()=>{if(i){try{i.abort()}catch{}i=null}},d=g=>{a||(u(),t=window.setTimeout(()=>{f()},g))},f=async()=>{if(!a)try{const g=(s.getModels?.()??[]).map(X=>String(X||"").trim()).filter(Boolean),v=(s.getShow?.()??[]).map(X=>String(X||"").trim()).filter(Boolean).slice().sort(),b=g.slice().sort(),T=b.length===0&&!!s.fetchAllWhenNoModels;if(b.length===0&&!T){c();const X={enabled:r?.enabled??!1,rooms:[]};r=X,s.onData(X);const V=document.hidden?Math.max(15e3,e):e;d(V);return}const E=T?[]:b,D=`${v.join(",")}|${T?"__ALL__":E.join(",")}`,O=D;n=D,c();const R=new AbortController;i=R;const F=T?[[]]:SH(E,350);let G=[],L=!1,W=0,I=!1;for(const X of F){if(R.signal.aborted||O!==n||a)return;const V=await fetch("/api/chaturbate/online",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:X,show:v,refresh:!1}),signal:R.signal,cache:"no-store"});if(!V.ok)continue;I=!0;const Y=await V.json();L=L||!!Y?.enabled,G.push(...Array.isArray(Y?.rooms)?Y.rooms:[]);const ne=Number(Y?.total??0);Number.isFinite(ne)&&ne>W&&(W=ne)}if(!I){const X=document.hidden?Math.max(15e3,e):e;d(X);return}const N={enabled:L,rooms:_H(G),total:W};if(R.signal.aborted||O!==n||a)return;r=N,s.onData(N)}catch(g){if(g?.name==="AbortError")return;s.onError?.(g)}finally{const g=document.hidden?Math.max(15e3,e):e;d(g)}};return f(),()=>{a=!0,u(),c()}}async function Zv(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function EH(s,e,t,i){const n=`/api/generated/cover?category=${encodeURIComponent(s)}`,r=e?`&v=${e}`:"",a="",u=i&&i.trim()?`&model=${encodeURIComponent(i.trim())}`:"";return`${n}${r}${a}${u}`}function yA(s){if(!s)return[];const e=s.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function NR(s){return String(s||"").replaceAll("\\","/").split("/").pop()||""}function OR(s){return s.toUpperCase().startsWith("HOT ")?s.slice(4).trim():s}function wH(s){const e=OR(NR(s||""));return e?e.replace(/\.[^.]+$/,""):""}const AH=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Jv(s){const t=OR(NR(s)).replace(/\.[^.]+$/,""),i=t.match(AH);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n).trim():t?t.trim():null}function kH(s){const e=wH(s);return e?`/generated/meta/${encodeURIComponent(e)}/thumbs.webp`:null}async function CH(s,e,t,i){const n=(t||"").trim(),r=`/api/generated/cover?category=${encodeURIComponent(s)}&src=${encodeURIComponent(e)}`+(n?`&model=${encodeURIComponent(n)}`:"")+"&refresh=1",a=await fetch(r,{method:"GET",cache:"no-store"});if(!a.ok){const u=await a.text().catch(()=>"");throw new Error(u||`ensureCover failed: HTTP ${a.status}`)}}function DH(){const[s,e]=_.useState([]),[t,i]=_.useState(!1),[n,r]=_.useState(null),[a,u]=_.useState(()=>Date.now()),[c,d]=_.useState({}),[f,g]=_.useState({}),[y,v]=_.useState(!1),[b,T]=_.useState(null),[E,D]=_.useState({}),O=_.useRef(null),R=_.useRef({}),j=_.useCallback((I,N)=>{const X={};for(const Y of Array.isArray(I)?I:[]){const ne=String(Y?.modelKey??"").trim().toLowerCase();if(!ne)continue;const ie=yA(Y?.tags).map(K=>K.toLowerCase());ie.length&&(X[ne]=ie)}const V={};for(const Y of Array.isArray(N)?N:[]){const ne=String(Y?.output??"");if(!ne)continue;const ie=(Jv(ne)||"").trim().toLowerCase();if(!ie)continue;const K=X[ie];if(!(!K||K.length===0))for(const q of K)q&&(V[q]||(V[q]=[]),V[q].push(ne))}for(const[Y,ne]of Object.entries(V))V[Y]=Array.from(new Set(ne));R.current=V},[]),F=_.useCallback(I=>{const N=String(I||"").trim();if(N){try{localStorage.setItem("finishedDownloads_pendingTags",JSON.stringify([N]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"finished"}})),window.dispatchEvent(new CustomEvent("finished-downloads:tag-filter",{detail:{tags:[N],mode:"replace"}}))}},[]),G=_.useCallback(I=>{const N=String(I||"").trim();if(N){try{localStorage.setItem("models_pendingTags",JSON.stringify([N]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"models"}})),window.dispatchEvent(new CustomEvent("models:set-tag-filter",{detail:{tags:[N]}}))}},[]),L=_.useCallback(async()=>{O.current?.abort();const I=new AbortController;O.current=I,i(!0),r(null);try{const[N,X]=await Promise.all([Zv("/api/models",{cache:"no-store",signal:I.signal}),Zv("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:I.signal})]),V=Array.isArray(X?.items)?X.items:Array.isArray(X)?X:[];j(Array.isArray(N)?N:[],V);const Y=new Map;for(const te of Array.isArray(N)?N:[])for(const le of yA(te?.tags)){const z=le.toLowerCase();Y.set(z,(Y.get(z)??0)+1)}const ne=R.current||{},ie=Array.from(Y.entries()).map(([te,le])=>({tag:te,modelsCount:le,downloadsCount:(ne[te]||[]).length})).sort((te,le)=>te.tag.localeCompare(le.tag,void 0,{sensitivity:"base"})),K=new Map;try{const te=await Zv("/api/generated/coverinfo/list",{cache:"no-store",signal:I.signal});for(const le of Array.isArray(te)?te:[]){const z=String(le?.category??"").trim().toLowerCase();z&&K.set(z,le)}}catch{}const q={};for(const te of ie){const le=K.get(te.tag);q[te.tag]=!!le?.hasCover}g(q);const Z={};for(const te of ie){const z=(ne[te.tag]||[])[0]||"";let re=z?Jv(z):null;if(!re){const Q=K.get(te.tag);Q?.hasCover&&Q.model?.trim()&&(re=Q.model.trim())}re&&(Z[te.tag]=re)}D(Z),d(te=>{const le={};for(const z of ie){const re=te[z.tag];re&&q[z.tag]===!0&&(le[z.tag]=re)}return le}),e(ie)}catch(N){if(N?.name==="AbortError")return;r(N?.message??String(N)),e([]),R.current={},D({}),g({}),d({})}finally{O.current===I&&(O.current=null,i(!1))}},[j]);_.useEffect(()=>(L(),()=>{O.current?.abort()}),[L]);const W=_.useCallback(async()=>{if(!y){v(!0),r(null),T({done:0,total:s.length});try{const I=R.current||{},N=await Promise.all(s.map(async V=>{try{const Y=I[V.tag]||[];if(Y.length===0)return{tag:V.tag,ok:!0,status:0,text:"skipped (no candidates)"};const ne=Y[Math.floor(Math.random()*Y.length)],ie=kH(ne);if(!ie)return{tag:V.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const K=Jv(ne);return await CH(V.tag,ie,K,!0),g(q=>({...q,[V.tag]:!0})),D(q=>{const Z={...q};return K?.trim()?Z[V.tag]=K.trim():delete Z[V.tag],Z}),d(q=>{const Z={...q};return delete Z[V.tag],Z}),{tag:V.tag,ok:!0,status:200,text:""}}catch(Y){return{tag:V.tag,ok:!1,status:0,text:Y?.message??String(Y)}}finally{T(Y=>Y&&{...Y,done:Math.min(Y.total,Y.done+1)})}})),X=N.filter(V=>!V.ok);if(X.length){console.warn("Cover renew failed:",X.slice(0,20));const V=X.slice(0,8).map(Y=>`${Y.tag} (ERR)`).join(", ");r(`Covers fehlgeschlagen: ${X.length}/${N.length} — z.B.: ${V}`)}else r(null)}finally{u(Date.now()),v(!1),setTimeout(()=>T(null),400)}}},[s,y]);return p.jsxs(ma,{header:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Kategorien ",p.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",s.length,")"]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[b?p.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2",children:[p.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 tabular-nums",children:["Covers: ",b.done,"/",b.total]}),p.jsx("div",{className:"h-2 w-28 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden",children:p.jsx("div",{className:"h-full bg-indigo-500",style:{width:b.total>0?`${Math.round(b.done/b.total*100)}%`:"0%"}})})]}):null,p.jsx(mi,{variant:"secondary",size:"md",onClick:W,disabled:t||y,children:"Cover erneuern"}),p.jsx(mi,{variant:"secondary",size:"md",onClick:L,disabled:t||y,children:"Aktualisieren"})]})]}),grayBody:!0,children:[n?p.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:n}):null,s.length===0&&!t?p.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Kategorien/Tags gefunden."}):null,p.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(I=>{const N=E[I.tag]??null,X=f[I.tag]===!0,V=Object.prototype.hasOwnProperty.call(f,I.tag),Y=X?EH(I.tag,a,!1,N):"",ne=c[I.tag]==="ok",ie=c[I.tag]==="error";return p.jsxs("button",{type:"button",onClick:()=>F(I.tag),className:vi("group text-left rounded-2xl overflow-hidden transition","bg-white/70 dark:bg-white/[0.06]","border border-gray-200/70 dark:border-white/10","shadow-sm hover:shadow-md","hover:-translate-y-[1px]","hover:bg-white dark:hover:bg-white/[0.09]","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-950"),title:"In FinishedDownloads öffnen (Tag-Filter setzen)",children:[p.jsx("div",{className:"relative w-full overflow-hidden aspect-[16/9] bg-gray-100/70 dark:bg-white/5",children:V?X?ie?p.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[p.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),p.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[p.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Cover konnte nicht geladen werden"}),p.jsx("div",{className:"mt-1 flex justify-center",children:p.jsx("span",{className:`text-[11px] inline-flex items-center rounded-full bg-indigo-50 px-2 py-1 font-semibold text-indigo-700 ring-1 ring-indigo-100 hover:bg-indigo-100\r + dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20 dark:hover:bg-indigo-500/20`,onClick:K=>{K.preventDefault(),K.stopPropagation(),d(q=>{const Z={...q};return delete Z[I.tag],Z}),u(Date.now())},children:"Retry"})})]})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 z-[1] pointer-events-none",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0) 35%),linear-gradient(to top, rgba(0,0,0,0.35), rgba(0,0,0,0) 45%)"}}),p.jsx("img",{src:Y,alt:"","aria-hidden":"true",className:"absolute inset-0 z-0 h-full w-full object-cover blur-xl scale-110 opacity-60",loading:"lazy"}),p.jsx("img",{src:Y,alt:I.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>d(K=>({...K,[I.tag]:"ok"})),onError:()=>{d(K=>({...K,[I.tag]:"error"})),g(K=>({...K,[I.tag]:!1}))}}),ne&&N?p.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:p.jsx("div",{className:vi("truncate rounded-full px-2.5 py-1 text-[11px] font-semibold","bg-black/40 text-white backdrop-blur-md","ring-1 ring-white/15"),children:N})}):null]}):p.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[p.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),p.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[p.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Kein Cover vorhanden"}),N?p.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-700 dark:text-gray-300",children:["Model: ",p.jsx("span",{className:"font-semibold",children:N})]}):null,p.jsx("div",{className:"mt-1 text-[11px] text-gray-600 dark:text-gray-400 text-center",children:"(Kein Request / keine 404)"})]})]}):p.jsxs("div",{className:"absolute inset-0",children:[p.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.20), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.14), transparent 55%)"}}),p.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"}),p.jsx("div",{className:"absolute left-3 bottom-3 text-[11px] font-semibold text-white/80 bg-black/30 px-2.5 py-1 rounded-full ring-1 ring-white/10",children:"Cover wird geprüft…"})]})}),p.jsx("div",{className:"px-4 py-3.5",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"font-semibold text-gray-900 dark:text-white truncate tracking-tight",children:I.tag}),p.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[p.jsxs("span",{role:"button",tabIndex:0,className:vi("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap","overflow-hidden","bg-indigo-50 text-indigo-700 ring-1 ring-indigo-100","dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20","cursor-pointer"),title:"FinishedDownloads nach diesem Tag filtern",onClick:K=>{K.preventDefault(),K.stopPropagation(),F(I.tag)},onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),K.stopPropagation(),F(I.tag))},children:[p.jsx("span",{className:"shrink-0",children:I.downloadsCount}),p.jsx("span",{className:"min-w-0 truncate font-medium",children:"Downloads"})]}),p.jsxs("span",{role:"button",tabIndex:0,className:vi("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap overflow-hidden","bg-gray-50 text-gray-700 ring-1 ring-gray-200","dark:bg-white/5 dark:text-gray-200 dark:ring-white/10","cursor-pointer"),title:"Models nach diesem Tag filtern",onClick:K=>{K.preventDefault(),K.stopPropagation(),G(I.tag)},onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),K.stopPropagation(),G(I.tag))},children:[p.jsx("span",{className:"shrink-0",children:I.modelsCount}),p.jsx("span",{className:"min-w-0 truncate font-medium",children:"Models"})]})]})]}),p.jsx("span",{"aria-hidden":"true",className:vi("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},I.tag)})})]})}async function oh(s,e){const t=await fetch(s,{credentials:"include",...e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function LH(){try{const e=new URL(window.location.href).searchParams.get("next")||"/";return!e.startsWith("/")||e.startsWith("/login")?"/":e}catch{return"/"}}const A1="recorder_login_state_v1";function RH(){try{const s=sessionStorage.getItem(A1);if(!s)return null;const e=JSON.parse(s);return!e?.ts||Date.now()-e.ts>900*1e3?null:e}catch{return null}}function IH(s){try{sessionStorage.setItem(A1,JSON.stringify(s))}catch{}}function Zm(){try{sessionStorage.removeItem(A1)}catch{}}function NH(s){const t=(s??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function OH(s){return(s??[]).join("")}function MH({onLoggedIn:s}){const e=_.useMemo(()=>LH(),[]),[t,i]=_.useState(""),[n,r]=_.useState(""),[a,u]=_.useState(["","","","","",""]),c=_.useRef([]),[d,f]=_.useState(!1),[g,y]=_.useState(null),[v,b]=_.useState("login"),[T,E]=_.useState(null),[D,O]=_.useState(null),[R,j]=_.useState(null),F=_.useRef(!1),G=_.useMemo(()=>OH(a),[a]);function L(q){const Z=c.current[q];Z&&Z.focus()}function W(){u(["","","","","",""]),F.current=!1,window.setTimeout(()=>L(0),0)}function I(q,Z){const te=(Z??"").replace(/\D/g,"").slice(-1);u(le=>{const z=[...le];return z[q]=te,z})}function N(q,Z){const te=(Z??"").replace(/\D/g,"");if(!te){I(q,""),F.current=!1;return}if(te.length>1){u(le=>{const z=[...le];let re=q;for(const Q of te){if(re>5)break;z[re]=Q,re++}return z}),F.current=!1,window.setTimeout(()=>L(Math.min(5,q+te.length)),0);return}I(q,te),F.current=!1,q<5&&window.setTimeout(()=>L(q+1),0)}function X(q,Z){if(Z.key==="Backspace"){if(a[q]){Z.preventDefault(),I(q,""),F.current=!1;return}q>0&&(Z.preventDefault(),L(q-1),I(q-1,""),F.current=!1);return}if(Z.key==="ArrowLeft"){Z.preventDefault(),q>0&&L(q-1);return}if(Z.key==="ArrowRight"){Z.preventDefault(),q<5&&L(q+1);return}}function V(q,Z){const le=(Z.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);le&&(Z.preventDefault(),u(z=>{const re=[...z];let Q=q;for(const pe of le){if(Q>5)break;re[Q]=pe,Q++}return re}),F.current=!1,window.setTimeout(()=>L(Math.min(5,q+le.length)),0))}_.useEffect(()=>{const q=RH();q&&(b(q.stage??"login"),i(q.username??""),u(NH(q.code??"")),E(q.setupAuthUrl??null),O(q.setupSecret??null),j(q.setupInfo??null))},[]),_.useEffect(()=>{IH({stage:v,username:t,code:G,setupAuthUrl:T,setupSecret:D,setupInfo:R,ts:Date.now()})},[v,t,G,T,D,R]),_.useEffect(()=>{F.current=!1,(v==="verify"||v==="setup")&&window.setTimeout(()=>L(0),0)},[v]),_.useEffect(()=>{let q=!1;return(async()=>{try{const te=await oh("/api/auth/me",{cache:"no-store"});if(q)return;if(te?.authenticated){te?.totpConfigured?(Zm(),window.location.assign(e||"/")):(b("setup"),ie());return}if(te?.pending2fa){b("verify");return}b("login")}catch{}})(),()=>{q=!0}},[e]);const Y=async()=>{f(!0),y(null);try{if((await oh("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:n})}))?.totpRequired){b("verify"),W();return}const Z=await oh("/api/auth/me",{cache:"no-store"});if(Z?.authenticated&&!Z?.totpConfigured){b("setup"),W(),await ie();return}s&&await s(),Zm(),window.location.assign(e||"/")}catch(q){y(q?.message??String(q))}finally{f(!1)}},ne=async()=>{const q=G.trim();if(/^\d{6}$/.test(q)){f(!0),y(null);try{await oh("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:q})}),s&&await s(),Zm(),window.location.assign(e||"/")}catch(Z){F.current=!1,y(Z?.message??String(Z))}finally{f(!1)}}},ie=async()=>{y(null),j(null);try{const q=await oh("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Z=(q?.otpauth??"").trim();if(!Z)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");E(Z),O((q?.secret??"").trim()||null),j("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(q){y(q?.message??String(q))}};_.useEffect(()=>{d||v!=="verify"&&v!=="setup"||/^\d{6}$/.test(G)&&(F.current||(F.current=!0,ne()))},[G,v,d]);const K=p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"2FA Code"}),p.jsx("div",{className:"flex items-center justify-between gap-2",children:a.map((q,Z)=>p.jsx("input",{ref:te=>{c.current[Z]=te},value:q,onChange:te=>N(Z,te.target.value),onKeyDown:te=>X(Z,te),onPaste:te=>V(Z,te),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:Z===0?"one-time-code":"off",enterKeyHint:Z===5?"done":"next",autoCapitalize:"none",autoCorrect:"off",disabled:d,className:`h-12 w-12 rounded-lg text-center text-lg tabular-nums bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r - dark:bg-white/10 dark:text-white dark:ring-white/10`,"aria-label":`2FA Ziffer ${Q+1}`},Q))})]});return g.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[g.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[g.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),g.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),g.jsx("div",{className:"relative grid min-h-[100dvh] place-items-center px-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-gray-200/70 bg-white/80 p-6 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Recorder Login"}),g.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Bitte melde dich an, um fortzufahren."})]}),g.jsxs("div",{className:"mt-5 space-y-3",children:[v==="login"?g.jsxs("form",{onSubmit:K=>{K.preventDefault(),!d&&q()},className:"space-y-3",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Username"}),g.jsx("input",{value:t,onChange:K=>i(K.target.value),autoComplete:"username",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"admin",disabled:d})]}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Passwort"}),g.jsx("input",{type:"password",value:n,onChange:K=>r(K.target.value),autoComplete:"current-password",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"••••••••••",disabled:d})]}),g.jsx(di,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:d||!t.trim()||!n,children:d?"Login…":"Login"})]}):v==="verify"?g.jsxs("form",{onSubmit:K=>{K.preventDefault(),!d&&ae()},className:"space-y-3",children:[g.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:"2FA ist aktiv – bitte gib den Code aus deiner Authenticator-App ein."}),W,g.jsxs("div",{className:"flex gap-2",children:[g.jsx(di,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:d,onClick:()=>{b("login"),Y()},children:"Zurück"}),g.jsx(di,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:d||!/^\d{6}$/.test(z),children:d?"Prüfe…":"Bestätigen"})]})]}):g.jsxs("form",{onSubmit:K=>{K.preventDefault(),!d&&ae()},className:"space-y-3",children:[g.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-2 text-sm text-indigo-900 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-200",children:"2FA ist noch nicht eingerichtet – bitte richte es jetzt ein (empfohlen)."}),g.jsxs("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[g.jsx("div",{children:"1) Öffne deine Authenticator-App und füge einen neuen Account hinzu."}),g.jsx("div",{children:"2) Scanne den QR-Code oder verwende den Secret-Key."})]}),g.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white/70 p-3 dark:border-white/10 dark:bg-white/5",children:[g.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"QR / Setup"}),T?g.jsx("div",{className:"mt-2 flex items-center justify-center",children:g.jsx("img",{alt:"2FA QR Code",className:"h-44 w-44 rounded bg-white p-2",src:`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(T)}`})}):g.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-300",children:"QR wird geladen…"}),D?g.jsxs("div",{className:"mt-3",children:[g.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Secret (manuell):"}),g.jsx("div",{className:"mt-1 select-all break-all rounded bg-gray-100 px-2 py-1 text-xs font-mono text-gray-900 dark:bg-white/10 dark:text-gray-100",children:D})]}):null,R?g.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:R}):null,g.jsx("div",{className:"mt-3",children:g.jsx(di,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:d,onClick:()=>{ie()},title:"Setup-Infos neu laden",children:T?"QR/Setup erneut laden":"QR/Setup laden"})})]}),W,g.jsxs("div",{className:"flex gap-2",children:[g.jsx(di,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:d,onClick:()=>{s&&s(),Km(),window.location.assign(e||"/")},title:"Ohne 2FA fortfahren (nicht empfohlen)",children:"Später"}),g.jsx(di,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:d||!/^\d{6}$/.test(z),children:d?"Aktiviere…":"2FA aktivieren"})]})]}),p?g.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsx("div",{className:"min-w-0 break-words",children:p}),g.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>y(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null]})]})})]})}const Zv="record_cookies";function Wm(s){return Object.fromEntries(Object.entries(s??{}).map(([t,i])=>[t.trim().toLowerCase(),String(i??"").trim()]).filter(([t,i])=>t.length>0&&i.length>0))}async function En(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const cA={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!1,autoStartAddedDownloads:!1,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!1,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:3e3};function yo(s){let e=(s??"").trim();if(!e)return null;e=e.replace(/^[("'[{<]+/,"").replace(/[)"'\]}>.,;:]+$/,""),/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function iu(s){const e=(s??"").trim();if(!e)return null;for(const t of e.split(/\s+/g)){const i=yo(t);if(i)return i}return null}function Rh(s){try{const e=new URL(s).hostname.replace(/^www\./i,"").toLowerCase();return e==="chaturbate.com"||e.endsWith(".chaturbate.com")?"chaturbate":e==="myfreecams.com"||e.endsWith(".myfreecams.com")?"mfc":null}catch{return null}}function AR(s){try{const e=new URL(s),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="chaturbate.com"&&!t.endsWith(".chaturbate.com"))return"";const i=e.pathname.split("/").filter(Boolean);return i[0]?decodeURIComponent(i[0]).trim():""}catch{return""}}function pl(s){const e=Rh(s);if(!e)return s;if(e==="chaturbate"){const i=AR(s);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:s}const t=kR(s);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:s}function xH(s){const e=Rh(s);return e?((e==="chaturbate"?AR(s):kR(s))||"").trim().toLowerCase():""}function kR(s){try{const e=new URL(s),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="myfreecams.com"&&!t.endsWith(".myfreecams.com"))return"";const i=(e.hash||"").replace(/^#\/?/,"");if(i){const a=i.split("/").filter(Boolean),u=a[a.length-1]||"";if(u)return decodeURIComponent(u).trim()}const n=e.pathname.split("/").filter(Boolean),r=n[n.length-1]||"";return r?decodeURIComponent(r).trim():""}catch{return""}}const Ws=s=>(s||"").replaceAll("\\","/").split("/").pop()||"";function bH(s,e){const i=(s||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function TH(s){return s.startsWith("HOT ")?s.slice(4):s}const SH=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function oh(s){const t=TH(Ws(s)).replace(/\.[^.]+$/,""),i=t.match(SH);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t||null}function _H(){const[s,e]=_.useState(!1),[t,i]=_.useState(!1),n=_.useCallback(async()=>{try{const ce=await En("/api/auth/me",{cache:"no-store"});i(!!ce?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),r=_.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),ot(null),vt(!1),ni("running"),Zi(null),Yi(!1),pe(null),W([]),Q([]),ne(0),re(1),lt({}),fe(0),$i({}),Rs.current={},yi.current={},$s.current=!1,Et([]),gi({}),ge(0),ae("")}},[]);_.useEffect(()=>{n()},[n]);const a=YA(),u=_.useRef(a),c=_.useRef(0),d=ce=>{const ye=(ce||"").toLowerCase();return ye.includes("altersverifikationsseite erhalten")||ye.includes("verify your age")||ye.includes("schutzseite von cloudflare erhalten")||ye.includes("just a moment")||ye.includes("kein room-html")},f=ce=>{const ye=!!ce?.silent,ve="Cookies fehlen oder sind abgelaufen",Ge="Der Recorder hat statt des Room-HTML eine Schutz-/Altersverifikationsseite erhalten. Bitte Cookies aktualisieren (bei Chaturbate z.B. cf_clearance + sessionId) und erneut starten.";if(!ye){ot(`⚠️ ${ve}. ${Ge}`),si(!0);return}const De=Date.now();De-c.current>15e3&&(c.current=De,u.current?.error(ve,Ge))};_.useEffect(()=>{u.current=a},[a]);const[p,y]=_.useState(!1);_.useEffect(()=>{const ce=window,ye=typeof ce.requestIdleCallback=="function"?ce.requestIdleCallback(()=>y(!0),{timeout:1500}):window.setTimeout(()=>y(!0),800);return()=>{typeof ce.cancelIdleCallback=="function"?ce.cancelIdleCallback(ye):window.clearTimeout(ye)}},[]);const v=8,b="finishedDownloads_sort",[T,E]=_.useState(()=>{try{return window.localStorage.getItem(b)||"completed_desc"}catch{return"completed_desc"}}),D=_.useRef(null),O=_.useRef(!1),R=_.useRef(null),j=_.useRef(!1),F=(ce,ye)=>`${ye}::${ce}`,z=_.useCallback(async ce=>{if(ce<1||O.current)return;const ye=F(ce,T),ve=D.current;if(!(ve?.key===ye&&Date.now()-ve.ts<15e3)){O.current=!0;try{const Ge=await fetch(`/api/record/done?page=${ce}&pageSize=${v}&sort=${encodeURIComponent(T)}`,{cache:"no-store"});if(!Ge.ok)return;const De=await Ge.json().catch(()=>null),rt=Array.isArray(De?.items)?De.items:Array.isArray(De)?De:[];D.current={key:ye,items:rt,ts:Date.now()}}finally{O.current=!1}}},[T]),N=_.useCallback(async()=>{try{const ce=await fetch("/api/record/done/meta",{cache:"no-store"});if(!ce.ok)return;const ye=await ce.json().catch(()=>null),ve=Number(ye?.count??0),Ge=Number.isFinite(ve)&&ve>=0?ve:0;ne(Ge),Me(Date.now())}catch{}},[]),Y=_.useRef(null),L=_.useCallback(()=>{Y.current!=null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,window.dispatchEvent(new CustomEvent("finished-downloads:reload"))},150)},[]);_.useEffect(()=>()=>{Y.current!=null&&(window.clearTimeout(Y.current),Y.current=null)},[]);const I=_.useCallback(async()=>{try{const ce=await fetch("/api/record/list",{cache:"no-store"});if(!ce.ok)return;const ye=await ce.json().catch(()=>null),ve=Array.isArray(ye)?ye:Array.isArray(ye?.items)?ye.items:[];W(ve),fi.current=ve,Me(Date.now())}catch{}},[]);_.useEffect(()=>{try{window.localStorage.setItem(b,T)}catch{}},[T]),_.useEffect(()=>{t&&N()},[t,N]);const[X,G]=_.useState(null),[q,ae]=_.useState(""),[ie,W]=_.useState([]),[K,Q]=_.useState([]),[te,re]=_.useState(1),[U,ne]=_.useState(0),[Z,fe]=_.useState(0),[xe,ge]=_.useState(0),[Ce,Me]=_.useState(()=>Date.now()),[Re,Ae]=_.useState(()=>Date.now());_.useEffect(()=>{const ce=window.setInterval(()=>Ae(Date.now()),1e3);return()=>window.clearInterval(ce)},[]);const be=ce=>(ce||"").toLowerCase().trim(),Pe=ce=>{const ye=Math.max(0,Math.floor(ce/1e3));if(ye<2)return"gerade eben";if(ye<60)return`vor ${ye} Sekunden`;const ve=Math.floor(ye/60);if(ve===1)return"vor 1 Minute";if(ve<60)return`vor ${ve} Minuten`;const Ge=Math.floor(ve/60);return Ge===1?"vor 1 Stunde":`vor ${Ge} Stunden`},gt=_.useMemo(()=>{const ce=Re-Ce;return`(zuletzt aktualisiert: ${Pe(ce)})`},[Re,Ce]),[Ye,lt]=_.useState({}),Ve=_.useCallback(ce=>{const ye={};for(const ve of Array.isArray(ce)?ce:[]){const Ge=(ve?.modelKey||"").trim().toLowerCase();if(!Ge)continue;const De=dt=>(dt.favorite?4:0)+(dt.liked===!0?2:0)+(dt.watching?1:0),rt=ye[Ge];(!rt||De(ve)>=De(rt))&&(ye[Ge]=ve)}return ye},[]),ht=_.useCallback(async()=>{try{const ce=await En("/api/models/list",{cache:"no-store"});lt(Ve(Array.isArray(ce)?ce:[])),Me(Date.now())}catch{}},[Ve]),[st,ct]=_.useState(null),Ke=_.useRef(null),[_t,pe]=_.useState(null);_.useEffect(()=>{const ce=ye=>{const Ge=(ye.detail?.modelKey??"").trim();if(!Ge)return;if(!Ge.includes(" ")&&!Ge.includes("/")&&!Ge.includes("\\")){const wt=Ge.replace(/^@/,"").trim().toLowerCase();wt&&pe(wt);return}const rt=yo(Ge);if(!rt){let wt=Ge.replace(/^https?:\/\//i,"");wt.includes("/")&&(wt=wt.split("/").filter(Boolean).pop()||wt),wt.includes(":")&&(wt=wt.split(":").pop()||wt),wt=wt.trim().toLowerCase(),wt&&pe(wt);return}const dt=pl(rt),at=xH(dt);at&&pe(at)};return window.addEventListener("open-model-details",ce),()=>window.removeEventListener("open-model-details",ce)},[]);const We=_.useCallback(ce=>{const ye=Date.now(),ve=Ke.current;if(!ve){Ke.current={ts:ye,list:[ce]};return}ve.ts=ye;const Ge=ve.list.findIndex(De=>De.id===ce.id);Ge>=0?ve.list[Ge]=ce:ve.list.unshift(ce)},[]);_.useEffect(()=>{ht();const ce=ye=>{const Ge=ye?.detail??{},De=Ge?.model;if(De&&typeof De=="object"){const rt=String(De.modelKey??"").toLowerCase().trim();rt&<(dt=>({...dt,[rt]:De}));try{We(De)}catch{}ct(dt=>dt?.id===De.id?De:dt),Me(Date.now());return}if(Ge?.removed){const rt=String(Ge?.id??"").trim(),dt=String(Ge?.modelKey??"").toLowerCase().trim();dt&<(at=>{const{[dt]:wt,...It}=at;return It}),rt&&ct(at=>at?.id===rt?null:at),Me(Date.now());return}ht()};return window.addEventListener("models-changed",ce),()=>window.removeEventListener("models-changed",ce)},[ht,We]);const[Je,ot]=_.useState(null),[St,vt]=_.useState(!1),[Vt,si]=_.useState(!1),[$t,Pt]=_.useState({}),[Ht,ui]=_.useState(!1),[xt,ni]=_.useState("running"),[Xt,Zi]=_.useState(null),[Gt,Yi]=_.useState(!1),[Ri,Si]=_.useState(0),kt=_.useCallback(()=>Si(ce=>ce+1),[]),[V,H]=_.useState(cA),ee=_.useRef(V);_.useEffect(()=>{ee.current=V},[V]);const Te=!!V.autoAddToDownloadList,Ue=!!V.autoStartAddedDownloads,[ft,Et]=_.useState([]),[pi,gi]=_.useState({}),_i=_.useRef(!1),Ei=_.useRef({}),fi=_.useRef([]),yi=_.useRef({}),$s=_.useRef(!1);_.useEffect(()=>{_i.current=St},[St]),_.useEffect(()=>{Ei.current=$t},[$t]),_.useEffect(()=>{fi.current=ie},[ie]);const ns=_.useRef(null),Xi=_.useRef(""),wi=4,Jt=_.useRef([]),ei=_.useRef(0),Qi=_.useRef(new Set),Ls=_.useRef(!1),Hs=_.useCallback(()=>{const ce=ei.current>0;vt(ce),_i.current=ce},[]),rn=_.useCallback(ce=>{const ye=yo(ce.url);if(!ye)return!1;const ve=pl(ye);return Qi.current.has(ve)||(Qi.current.add(ve),Jt.current.push({...ce,url:ve}),Ls.current||(Ls.current=!0,queueMicrotask(()=>{Ls.current=!1,xi()}))),!0},[]);async function ys(ce,ye){if(ce=pl(ce),fi.current.some(Ge=>{if(String(Ge.status||"").toLowerCase()!=="running"||Ge.endedAt)return!1;const De=yo(String(Ge.sourceUrl||""));return(De?pl(De):"")===ce}))return!0;try{const Ge=Ei.current,De=Rh(ce);if(!De)return ye||ot("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(De==="chaturbate"&&!an(Ge))return ye||ot('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const rt=Object.entries(Ge).map(([at,wt])=>`${at}=${wt}`).join("; "),dt=await En("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:ce,cookie:rt})});return dt?.id&&(yi.current[String(dt.id)]=!0),W(at=>[dt,...at]),fi.current=[dt,...fi.current],!0}catch(Ge){const De=Ge?.message??String(Ge);return d(De)?(f({silent:ye}),!1):(ye||ot(De),!1)}}async function xi(){for(;ei.current0;){const ce=Jt.current.shift();ei.current++,Hs(),(async()=>{try{if(await ys(ce.url,ce.silent)&&ce.pendingKeyLower){const ve=ce.pendingKeyLower;gi(Ge=>{const De={...Ge||{}};return delete De[ve],ri.current=De,De})}}finally{Qi.current.delete(ce.url),ei.current=Math.max(0,ei.current-1),Hs(),Jt.current.length>0&&xi()}})()}}const[Cs,$i]=_.useState({}),Rs=_.useRef({}),Ji=_.useRef({}),Ai=_.useRef({}),hn=_.useRef(!1),_s=_.useRef({});_.useEffect(()=>{Rs.current=Cs},[Cs]);const $e=_.useCallback(ce=>{const ye=String(ce?.host??"").toLowerCase(),ve=String(ce?.input??"").toLowerCase();return ye.includes("chaturbate")||ve.includes("chaturbate.com")},[]),Mt=_.useMemo(()=>{const ce=new Set;for(const ye of Object.values(Ye)){if(!$e(ye))continue;const ve=be(String(ye?.modelKey??""));ve&&ce.add(ve)}return Array.from(ce)},[Ye,$e]),Nt=_.useRef(Ye);_.useEffect(()=>{Nt.current=Ye},[Ye]);const ri=_.useRef(pi);_.useEffect(()=>{ri.current=pi},[pi]);const Wt=_.useRef(Mt);_.useEffect(()=>{Wt.current=Mt},[Mt]);const bi=_.useRef(xt);_.useEffect(()=>{bi.current=xt},[xt]);const ci=_.useCallback(async(ce,ye)=>{const ve=yo(ce);if(!ve)return!1;const Ge=pl(ve),De=!!ye?.silent;De||ot(null);const rt=Rh(Ge);if(!rt)return De||ot("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const dt=Ei.current;if(rt==="chaturbate"&&!an(dt))return De||ot('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if(fi.current.some(wt=>{if(String(wt.status||"").toLowerCase()!=="running"||wt.endedAt)return!1;const It=yo(String(wt.sourceUrl||""));return(It?pl(It):"")===Ge}))return!0;if(rt==="chaturbate"&&ee.current.useChaturbateApi)try{const wt=await En("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Ge})}),It=String(wt?.modelKey??"").trim().toLowerCase();if(It){if(_i.current)return gi(pt=>({...pt||{},[It]:Ge})),!0;const zt=Rs.current[It],mt=String(zt?.current_show??"");if(zt&&mt&&mt!=="public")return gi(pt=>({...pt||{},[It]:Ge})),!0}}catch{}else if(_i.current)return ns.current=Ge,!0;if(_i.current)return!1;vt(!0),_i.current=!0;try{const wt=Object.entries(dt).map(([zt,mt])=>`${zt}=${mt}`).join("; "),It=await En("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Ge,cookie:wt})});return It?.id&&(yi.current[String(It.id)]=!0),W(zt=>[It,...zt]),fi.current=[It,...fi.current],!0}catch(wt){const It=wt?.message??String(wt);return d(It)?(f({silent:De}),!1):(De||ot(It),!1)}finally{vt(!1),_i.current=!1}},[]);_.useEffect(()=>{let ce=!1;const ye=async()=>{try{const De=await En("/api/settings",{cache:"no-store"});!ce&&De&&H({...cA,...De})}catch{}},ve=()=>{ye()},Ge=()=>{ye()};return window.addEventListener("recorder-settings-updated",ve),window.addEventListener("focus",Ge),document.addEventListener("visibilitychange",Ge),ye(),()=>{ce=!0,window.removeEventListener("recorder-settings-updated",ve),window.removeEventListener("focus",Ge),document.removeEventListener("visibilitychange",Ge)}},[]),_.useEffect(()=>{let ce=!1;const ye=async()=>{try{const Ge=await En("/api/models/meta",{cache:"no-store"}),De=Number(Ge?.count??0);!ce&&Number.isFinite(De)&&(fe(De),Me(Date.now()))}catch{}};ye();const ve=window.setInterval(ye,document.hidden?6e4:3e4);return()=>{ce=!0,window.clearInterval(ve)}},[]);const Bi=_.useMemo(()=>Object.entries($t).map(([ce,ye])=>({name:ce,value:ye})),[$t]),qi=_.useCallback(ce=>{Ke.current=null,ct(null),Zi(ce),Yi(!1)},[]),Fi=ie.filter(ce=>{const ye=String(ce?.status??"").toLowerCase();return ye==="running"||ye==="postwork"}),Es=_.useMemo(()=>{let ce=0;for(const ye of Object.values(Ye)){if(!ye?.watching||!$e(ye))continue;const ve=be(String(ye?.modelKey??""));ve&&Cs[ve]&&ce++}return ce},[Ye,Cs,$e]),{onlineFavCount:Qs,onlineLikedCount:fn}=_.useMemo(()=>{let ce=0,ye=0;for(const ve of Object.values(Ye)){const Ge=be(String(ve?.modelKey??""));Ge&&Cs[Ge]&&(ve?.favorite&&ce++,ve?.liked===!0&&ye++)}return{onlineFavCount:ce,onlineLikedCount:ye}},[Ye,Cs]),Pn=[{id:"running",label:"Laufende Downloads",count:Fi.length},{id:"finished",label:"Abgeschlossene Downloads",count:U},{id:"models",label:"Models",count:Z},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],xn=_.useMemo(()=>q.trim().length>0&&!St,[q,St]);_.useEffect(()=>{let ce=!1;return(async()=>{try{const ve=await En("/api/cookies",{cache:"no-store"}),Ge=Wm(ve?.cookies);if(ce||Pt(Ge),Object.keys(Ge).length===0){const De=localStorage.getItem(Zv);if(De)try{const rt=JSON.parse(De),dt=Wm(rt);Object.keys(dt).length>0&&(ce||Pt(dt),await En("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:dt})}))}catch{}}}catch{const ve=localStorage.getItem(Zv);if(ve)try{const Ge=JSON.parse(ve);ce||Pt(Wm(Ge))}catch{}}finally{ce||ui(!0)}})(),()=>{ce=!0}},[]),_.useEffect(()=>{Ht&&localStorage.setItem(Zv,JSON.stringify($t))},[$t,Ht]),_.useEffect(()=>{N();const ce=()=>{document.hidden||N()};return document.addEventListener("visibilitychange",ce),()=>{document.removeEventListener("visibilitychange",ce)}},[N]);const mn=_.useCallback(async ce=>{j.current&&R.current?.abort();const ye=new AbortController;R.current=ye,j.current=!0;try{const ve=typeof ce=="number"?ce:te,Ge=await fetch(`/api/record/done?page=${ve}&pageSize=${v}&sort=${encodeURIComponent(T)}&withCount=1`,{cache:"no-store",signal:ye.signal});if(!Ge.ok)throw new Error(`HTTP ${Ge.status}`);const De=await Ge.json().catch(()=>null),rt=Array.isArray(De?.items)?De.items:Array.isArray(De)?De:[],dt=Number(De?.count??De?.totalCount??rt.length),at=Number.isFinite(dt)&&dt>=0?dt:rt.length;ne(at);const wt=Math.max(1,Math.ceil(at/v)),It=Math.min(Math.max(1,ve),wt);if(It!==te&&re(It),It!==ve){const zt=await fetch(`/api/record/done?page=${It}&pageSize=${v}&sort=${encodeURIComponent(T)}&withCount=1`,{cache:"no-store",signal:ye.signal});if(!zt.ok)throw new Error(`HTTP ${zt.status}`);const mt=await zt.json().catch(()=>null),pt=Array.isArray(mt?.items)?mt.items:[];Q(pt)}else Q(rt);Me(Date.now())}catch(ve){String(ve?.name)}finally{R.current===ye&&(R.current=null,j.current=!1)}},[te,T]);_.useEffect(()=>{if(xt!=="finished")return;N(),L();const ce=()=>{document.hidden||(N(),L())};return document.addEventListener("visibilitychange",ce),()=>{document.removeEventListener("visibilitychange",ce)}},[xt,N,L]),_.useEffect(()=>{const ce=Math.max(1,Math.ceil(U/v));te>ce&&re(ce)},[U,te]),_.useEffect(()=>{if(!t)return;let ce=null,ye=null;const ve=()=>{ye!=null&&(window.clearInterval(ye),ye=null)},Ge=()=>{ye==null&&(ye=window.setInterval(()=>{document.hidden||(bi.current==="finished"?(N(),L()):N())},document.hidden?6e4:15e3))},De={t:0};let rt=null;const dt=()=>{const It=Date.now();if(It-De.t<800){if(rt!=null)return;rt=window.setTimeout(()=>{rt=null,De.t=Date.now(),bi.current==="finished"?(N(),L()):N()},900);return}De.t=It,bi.current==="finished"?(N(),L()):N()};N(),ce=new EventSource("/api/record/done/stream"),ce.onopen=()=>{ve()},ce.onerror=()=>{Ge()};const at=()=>dt();ce.addEventListener("doneChanged",at);const wt=()=>{document.hidden||dt()};return document.addEventListener("visibilitychange",wt),()=>{document.removeEventListener("visibilitychange",wt),rt!=null&&window.clearTimeout(rt),ve(),ce?.removeEventListener("doneChanged",at),ce?.close(),ce=null}},[t,N,L]),_.useEffect(()=>{if(!t)return;I();const ce=window.setInterval(()=>{if(document.hidden)return;const ve=fi.current.some(Ge=>{const De=String(Ge?.status??"").toLowerCase();return De==="running"||De==="postwork"});(bi.current==="running"||ve)&&I()},document.hidden?6e4:3e3),ye=()=>{document.hidden||I()};return document.addEventListener("visibilitychange",ye),()=>{window.clearInterval(ce),document.removeEventListener("visibilitychange",ye)}},[t,I]);function ds(ce){const ye=yo(ce);if(!ye)return!1;try{return new URL(ye).hostname.includes("chaturbate.com")}catch{return!1}}function bn(ce,ye){const ve=Object.fromEntries(Object.entries(ce).map(([Ge,De])=>[Ge.trim().toLowerCase(),De]));for(const Ge of ye){const De=ve[Ge.toLowerCase()];if(De)return De}}function an(ce){const ye=bn(ce,["cf_clearance"]),ve=bn(ce,["sessionid","session_id","sessionId"]);return!!(ye&&ve)}async function Zn(ce){try{await En(`/api/record/stop?id=${encodeURIComponent(ce)}`,{method:"POST"})}catch(ye){a.error("Stop fehlgeschlagen",ye?.message??String(ye))}}_.useEffect(()=>{const ce=ye=>{const Ge=Number(ye.detail?.delta??0);if(!Number.isFinite(Ge)||Ge===0){N(),L();return}ne(De=>Math.max(0,De+Ge)),N(),L()};return window.addEventListener("finished-downloads:count-hint",ce),()=>window.removeEventListener("finished-downloads:count-hint",ce)},[N,L]),_.useEffect(()=>{const ce=ye=>{const ve=ye.detail||{};ve.tab==="finished"&&ni("finished"),ve.tab==="categories"&&ni("categories"),ve.tab==="models"&&ni("models"),ve.tab==="running"&&ni("running"),ve.tab==="settings"&&ni("settings")};return window.addEventListener("app:navigate-tab",ce),()=>window.removeEventListener("app:navigate-tab",ce)},[]),_.useEffect(()=>{if(!Xt){ct(null),G(null);return}const ce=(oh(Xt.output||"")||"").trim().toLowerCase();G(ce||null);const ye=ce?Ye[ce]:void 0;ct(ye??null)},[Xt,Ye]);async function Ii(){return ci(q)}const _e=_.useCallback(async ce=>{const ye=String(ce?.sourceUrl??""),ve=iu(ye);if(!ve)return!1;const Ge=yo(ve);if(!Ge)return!1;const De=pl(Ge),rt=await ci(De,{silent:!0});return rt||a.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),rt},[ci,a]),Le=_.useCallback(async ce=>{const ye=Ws(ce.output||"");if(ye){window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"start"}}));try{const ve=await En(`/api/record/delete?file=${encodeURIComponent(ye)}`,{method:"POST"});window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"success"}})),window.setTimeout(()=>{Q(De=>{const rt=De.filter(mt=>Ws(mt.output||"")!==ye);if(v-rt.length<=0)return rt;const at=F(te+1,T),wt=D.current;if(!wt||wt.key!==at||!Array.isArray(wt.items)||wt.items.length===0)return rt;const It=[...rt],zt=new Set(It.map(mt=>String(mt.id||Ws(mt.output||"")).trim()));for(;It.length0;){const mt=wt.items.shift(),pt=String(mt.id||Ws(mt.output||"")).trim();!pt||zt.has(pt)||(zt.add(pt),It.push(mt))}return D.current={...wt,items:wt.items,ts:wt.ts},It}),ne(De=>Math.max(0,De-1)),W(De=>De.filter(rt=>Ws(rt.output||"")!==ye)),Zi(De=>De&&Ws(De.output||"")===ye?null:De),z(te+1)},320);const Ge=typeof ve?.undoToken=="string"?ve.undoToken:"";return Ge?{undoToken:Ge}:{}}catch{window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"error"}})),a.error("Löschen fehlgeschlagen: ",ye);return}}},[a,mn]),Ne=_.useCallback(async ce=>{await Le(ce)},[Le]),et=_.useCallback(async ce=>{const ye=Ws(ce.output||"");if(ye){window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"start"}}));try{await En(`/api/record/keep?file=${encodeURIComponent(ye)}`,{method:"POST"}),window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"success"}})),window.setTimeout(()=>{Q(ve=>ve.filter(Ge=>Ws(Ge.output||"")!==ye)),W(ve=>ve.filter(Ge=>Ws(Ge.output||"")!==ye)),Zi(ve=>ve&&Ws(ve.output||"")===ye?null:ve)},320)}catch{window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ye,phase:"error"}})),a.error("Keep fehlgeschlagen",ye);return}}},[xt,mn,a]),bt=_.useCallback(async ce=>{const ye=Ws(ce.output||"");if(ye)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:ye}})),await new Promise(De=>window.setTimeout(De,60));const ve=await En(`/api/record/toggle-hot?file=${encodeURIComponent(ye)}`,{method:"POST"});window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:ve.oldFile,newFile:ve.newFile}}));const Ge=De=>bH(De||"",ve.newFile);return Zi(De=>De&&{...De,output:Ge(De.output||"")}),Q(De=>De.map(rt=>rt.id===ce.id||Ws(rt.output||"")===ye?{...rt,output:Ge(rt.output||"")}:rt)),W(De=>De.map(rt=>rt.id===ce.id||Ws(rt.output||"")===ye?{...rt,output:Ge(rt.output||"")}:rt)),ve}catch(ve){a.error("Umbenennen fehlgeschlagen",ve?.message??String(ve));return}},[a]);async function Qt(ce){const ye=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)});if(ye.status===204)return null;if(!ye.ok){const ve=await ye.text().catch(()=>"");throw new Error(ve||`HTTP ${ye.status}`)}return ye.json()}const ti=_.useCallback(ce=>{const ye=Ke.current;!ye||!ce||(ye.ts=Date.now(),ye.list=ye.list.filter(ve=>ve.id!==ce))},[]),le=_.useRef({}),we=_.useCallback(async ce=>{const ye=Ws(ce.output||""),ve=!!(Xt&&Ws(Xt.output||"")===ye),Ge=mt=>{try{const pt=String(mt.sourceUrl??mt.SourceURL??""),Bt=iu(pt);return Bt?new URL(Bt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},De=(oh(ce.output||"")||"").trim().toLowerCase();if(De){const mt=De;if(le.current[mt])return;le.current[mt]=!0;const pt=Ye[De]??{id:"",input:"",host:Ge(ce)||void 0,modelKey:De,watching:!1,favorite:!1,liked:null,isUrl:!1},Bt=!pt.favorite,oi={...pt,modelKey:pt.modelKey||De,favorite:Bt,liked:Bt?!1:pt.liked};lt(qt=>({...qt,[De]:oi})),We(oi),ve&&ct(oi);try{const qt=await Qt({...oi.id?{id:oi.id}:{},host:oi.host||Ge(ce)||"",modelKey:De,favorite:Bt,...Bt?{liked:!1}:{}});if(!qt){lt(Di=>{const{[De]:zs,...Hi}=Di;return Hi}),pt.id&&ti(pt.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:pt.id,modelKey:De}}));return}const Kt=be(qt.modelKey||De);Kt&<(Di=>({...Di,[Kt]:qt})),We(qt),ve&&ct(qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:qt}}))}catch(qt){lt(Kt=>({...Kt,[De]:pt})),We(pt),ve&&ct(pt),a.error("Favorit umschalten fehlgeschlagen",qt?.message??String(qt))}finally{delete le.current[mt]}return}let rt=ve?st:null;if(rt||(rt=await Ct(ce,{ensure:!0})),!rt)return;const dt=be(rt.modelKey||rt.id||"");if(!dt||le.current[dt])return;le.current[dt]=!0;const at=rt,wt=!at.favorite,It={...at,favorite:wt,liked:wt?!1:at.liked},zt=be(at.modelKey||"");zt&<(mt=>({...mt,[zt]:It})),We(It),ve&&ct(It);try{const mt=await Qt({id:at.id,favorite:wt,...wt?{liked:!1}:{}});if(!mt){lt(Bt=>{const oi=be(at.modelKey||"");if(!oi)return Bt;const{[oi]:qt,...Kt}=Bt;return Kt}),ti(at.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:at.id,modelKey:at.modelKey}}));return}const pt=be(mt.modelKey||"");pt&<(Bt=>({...Bt,[pt]:mt})),We(mt),ve&&ct(mt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:mt}}))}catch(mt){const pt=be(at.modelKey||"");pt&<(Bt=>({...Bt,[pt]:at})),We(at),ve&&ct(at),a.error("Favorit umschalten fehlgeschlagen",mt?.message??String(mt))}finally{delete le.current[dt]}},[a,Xt,st,Ct,Qt,We,ti,Ye]),ut=_.useCallback(async ce=>{const ye=Ws(ce.output||""),ve=!!(Xt&&Ws(Xt.output||"")===ye),Ge=mt=>{try{const pt=String(mt.sourceUrl??mt.SourceURL??""),Bt=iu(pt);return Bt?new URL(Bt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},De=(oh(ce.output||"")||"").trim().toLowerCase();if(De){const mt=De;if(le.current[mt])return;le.current[mt]=!0;const pt=Ye[De]??{id:"",input:"",host:Ge(ce)||void 0,modelKey:De,watching:!1,favorite:!1,liked:null,isUrl:!1},Bt=pt.liked!==!0,oi={...pt,modelKey:pt.modelKey||De,liked:Bt,favorite:Bt?!1:pt.favorite};lt(qt=>({...qt,[De]:oi})),We(oi),ve&&ct(oi);try{const qt=await Qt({...oi.id?{id:oi.id}:{},host:oi.host||Ge(ce)||"",modelKey:De,liked:Bt,...Bt?{favorite:!1}:{}});if(!qt){lt(Di=>{const{[De]:zs,...Hi}=Di;return Hi}),pt.id&&ti(pt.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:pt.id,modelKey:De}}));return}const Kt=be(qt.modelKey||De);Kt&<(Di=>({...Di,[Kt]:qt})),We(qt),ve&&ct(qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:qt}}))}catch(qt){lt(Kt=>({...Kt,[De]:pt})),We(pt),ve&&ct(pt),a.error("Like umschalten fehlgeschlagen",qt?.message??String(qt))}finally{delete le.current[mt]}return}let rt=ve?st:null;if(rt||(rt=await Ct(ce,{ensure:!0})),!rt)return;const dt=be(rt.modelKey||rt.id||"");if(!dt||le.current[dt])return;le.current[dt]=!0;const at=rt,wt=at.liked!==!0,It={...at,liked:wt,favorite:wt?!1:at.favorite},zt=be(at.modelKey||"");zt&<(mt=>({...mt,[zt]:It})),We(It),ve&&ct(It);try{const mt=wt?await Qt({id:at.id,liked:!0,favorite:!1}):await Qt({id:at.id,liked:!1});if(!mt){lt(Bt=>{const oi=be(at.modelKey||"");if(!oi)return Bt;const{[oi]:qt,...Kt}=Bt;return Kt}),ti(at.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:at.id,modelKey:at.modelKey}}));return}const pt=be(mt.modelKey||"");pt&<(Bt=>({...Bt,[pt]:mt})),We(mt),ve&&ct(mt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:mt}}))}catch(mt){const pt=be(at.modelKey||"");pt&<(Bt=>({...Bt,[pt]:at})),We(at),ve&&ct(at),a.error("Like umschalten fehlgeschlagen",mt?.message??String(mt))}finally{delete le.current[dt]}},[a,Xt,st,Ct,Qt,We,ti,Ye]),At=_.useCallback(async ce=>{const ye=Ws(ce.output||""),ve=!!(Xt&&Ws(Xt.output||"")===ye),Ge=mt=>{try{const pt=String(mt.sourceUrl??mt.SourceURL??""),Bt=iu(pt);return Bt?new URL(Bt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},De=(oh(ce.output||"")||"").trim().toLowerCase();if(De){const mt=De;if(le.current[mt])return;le.current[mt]=!0;const pt=Ye[De]??{id:"",input:"",host:Ge(ce)||void 0,modelKey:De,watching:!1,favorite:!1,liked:null,isUrl:!1},Bt=!pt.watching,oi={...pt,modelKey:pt.modelKey||De,watching:Bt};lt(qt=>({...qt,[De]:oi})),We(oi),ve&&ct(oi);try{const qt=await Qt({...oi.id?{id:oi.id}:{},host:oi.host||Ge(ce)||"",modelKey:De,watched:Bt});if(!qt){lt(Di=>{const{[De]:zs,...Hi}=Di;return Hi}),pt.id&&ti(pt.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:pt.id,modelKey:De}}));return}const Kt=be(qt.modelKey||De);Kt&<(Di=>({...Di,[Kt]:qt})),We(qt),ve&&ct(qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:qt}}))}catch(qt){lt(Kt=>({...Kt,[De]:pt})),We(pt),ve&&ct(pt),a.error("Watched umschalten fehlgeschlagen",qt?.message??String(qt))}finally{delete le.current[mt]}return}let rt=ve?st:null;if(rt||(rt=await Ct(ce,{ensure:!0})),!rt)return;const dt=be(rt.modelKey||rt.id||"");if(!dt||le.current[dt])return;le.current[dt]=!0;const at=rt,wt=!at.watching,It={...at,watching:wt},zt=be(at.modelKey||"");zt&<(mt=>({...mt,[zt]:It})),We(It),ve&&ct(It);try{const mt=await Qt({id:at.id,watched:wt});if(!mt){lt(Bt=>{const oi=be(at.modelKey||"");if(!oi)return Bt;const{[oi]:qt,...Kt}=Bt;return Kt}),ti(at.id),ve&&ct(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:at.id,modelKey:at.modelKey}}));return}const pt=be(mt.modelKey||"");pt&<(Bt=>({...Bt,[pt]:mt})),We(mt),ve&&ct(mt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:mt}}))}catch(mt){const pt=be(at.modelKey||"");pt&<(Bt=>({...Bt,[pt]:at})),We(at),ve&&ct(at),a.error("Watched umschalten fehlgeschlagen",mt?.message??String(mt))}finally{delete le.current[dt]}},[a,Xt,st,Ct,Qt,We,ti,Ye]);async function Ct(ce,ye){const ve=!!ye?.ensure,Ge=It=>{const zt=Date.now(),mt=Ke.current;if(!mt){Ke.current={ts:zt,list:[It]};return}mt.ts=zt;const pt=mt.list.findIndex(Bt=>Bt.id===It.id);pt>=0?mt.list[pt]=It:mt.list.unshift(It)},De=async It=>{if(!It)return null;const zt=It.trim().toLowerCase();if(!zt)return null;const mt=Ye[zt];if(mt)return Ge(mt),mt;if(ve){let Kt;try{const zs=ce.sourceUrl??ce.SourceURL??"",Hi=iu(zs);Hi&&(Kt=new URL(Hi).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const Di=await En("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:It,...Kt?{host:Kt}:{}})});return We(Di),Di}const pt=Date.now(),Bt=Ke.current;if(!Bt||pt-Bt.ts>3e4){const Kt=Object.values(Ye);if(Kt.length)Ke.current={ts:pt,list:Kt};else{const Di=await En("/api/models/list",{cache:"no-store"});Ke.current={ts:pt,list:Array.isArray(Di)?Di:[]}}}const qt=(Ke.current?.list??[]).find(Kt=>(Kt.modelKey||"").trim().toLowerCase()===zt);return qt||null},rt=oh(ce.output||"");if(rt)return De(rt);const dt=ce.status==="running",at=ce.sourceUrl??ce.SourceURL??"",wt=iu(at);if(dt&&wt){const It=await En("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:wt})}),zt=await En("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(It)});return We(zt),zt}return null}return _.useEffect(()=>{if(!Te&&!Ue||!navigator.clipboard?.readText)return;let ce=!1,ye=!1,ve=null;const Ge=async()=>{if(!(ce||ye)){ye=!0;try{const dt=await navigator.clipboard.readText(),at=iu(dt);if(!at)return;const wt=yo(at);if(!wt||!Rh(wt))return;const zt=pl(wt);if(zt===Xi.current)return;Xi.current=zt,Te&&ae(zt),Ue&&rn({url:zt,silent:!1})}catch{}finally{ye=!1}}},De=dt=>{ce||(ve=window.setTimeout(async()=>{await Ge(),De(document.hidden?5e3:1500)},dt))},rt=()=>{Ge()};return window.addEventListener("hover",rt),document.addEventListener("visibilitychange",rt),De(0),()=>{ce=!0,ve&&window.clearTimeout(ve),window.removeEventListener("hover",rt),document.removeEventListener("visibilitychange",rt)}},[Te,Ue,ci]),_.useEffect(()=>{const ce=lA({getModels:()=>{if(!ee.current.useChaturbateApi)return[];const ye=Nt.current,ve=ri.current,Ge=Object.values(ye).filter(rt=>!!rt?.watching&&String(rt?.host??"").toLowerCase().includes("chaturbate")).map(rt=>String(rt?.modelKey??"").trim().toLowerCase()).filter(Boolean),De=Object.keys(ve||{}).map(rt=>String(rt||"").trim().toLowerCase()).filter(Boolean);return Array.from(new Set([...Ge,...De]))},getShow:()=>["public","private","hidden","away"],intervalMs:8e3,onData:ye=>{(async()=>{if(!ye?.enabled){$i({}),Rs.current={},Ji.current={},Et([]),_s.current={},hn.current=!1,Ai.current={},Me(Date.now());return}const ve={};for(const dt of Array.isArray(ye.rooms)?ye.rooms:[]){const at=String(dt?.username??"").trim().toLowerCase();at&&(ve[at]=dt)}$i(ve),Rs.current=ve;try{const dt=!!(ee.current.enableNotifications??!0),at=new Set(["private","away","hidden"]),wt=new Set(Object.values(Nt.current||{}).filter(Kt=>!!Kt?.watching&&String(Kt?.host??"").toLowerCase().includes("chaturbate")).map(Kt=>String(Kt?.modelKey??"").trim().toLowerCase()).filter(Boolean)),It=Ji.current||{},zt={...It},mt=Ai.current||{},pt=!hn.current,Bt=_s.current||{},oi={...Bt};for(const[Kt,Di]of Object.entries(ve)){const zs=String(Di?.current_show??"").toLowerCase().trim(),Hi=String(It[Kt]??"").toLowerCase().trim(),ea=!0&&!!!mt[Kt],Do=!!Bt[Kt],zn=String(Di?.username??Kt).trim()||Kt,Wa=String(Di?.image_url??"").trim();if(oi[Kt]=!0,zs==="public"&&at.has(Hi)){dt&&a.info(zn,"ist wieder online.",{imageUrl:Wa,imageAlt:`${zn} Vorschau`,durationMs:5500}),zs&&(zt[Kt]=zs);continue}if(wt.has(Kt)&&ea){const Jc=Do;dt&&!pt&&a.info(zn,Jc?"ist wieder online.":"ist online.",{imageUrl:Wa,imageAlt:`${zn} Vorschau`,durationMs:5500})}zs&&(zt[Kt]=zs)}const qt={};for(const Kt of Object.keys(ve))qt[Kt]=!0;Ai.current=qt,_s.current=oi,hn.current=!0,Ji.current=zt}catch{}const Ge=Wt.current;for(const dt of Ge||[]){const at=String(dt||"").trim().toLowerCase();at&&ve[at]}if(!ee.current.useChaturbateApi)Et([]);else if(bi.current==="running"){const dt=Nt.current,at=ri.current,wt=Array.from(new Set(Object.values(dt).filter(pt=>!!pt?.watching&&String(pt?.host??"").toLowerCase().includes("chaturbate")).map(pt=>String(pt?.modelKey??"").trim().toLowerCase()).filter(Boolean))),It=Object.keys(at||{}).map(pt=>String(pt||"").trim().toLowerCase()).filter(Boolean),zt=new Set(It),mt=Array.from(new Set([...wt,...It]));if(mt.length===0)Et([]);else{const pt=[];for(const Bt of mt){const oi=ve[Bt];if(!oi)continue;const qt=String(oi?.username??"").trim(),Kt=String(oi?.current_show??"unknown");if(Kt==="public"&&!zt.has(Bt))continue;const Di=`https://chaturbate.com/${(qt||Bt).trim()}/`;pt.push({id:Bt,modelKey:qt||Bt,url:Di,currentShow:Kt,imageUrl:String(oi?.image_url??"")})}pt.sort((Bt,oi)=>Bt.modelKey.localeCompare(oi.modelKey,void 0,{sensitivity:"base"})),Et(pt)}}if(!ee.current.useChaturbateApi||_i.current)return;const De=ri.current,rt=Object.keys(De||{}).map(dt=>String(dt||"").toLowerCase()).filter(Boolean);for(const dt of rt){const at=ve[dt];if(!at||String(at.current_show??"")!=="public")continue;const wt=De[dt];wt&&rn({url:wt,silent:!0,pendingKeyLower:dt})}Me(Date.now())})()}});return()=>ce()},[]),_.useEffect(()=>{if(!V.useChaturbateApi){ge(0);return}const ce=lA({getModels:()=>[],getShow:()=>["public","private","hidden","away"],intervalMs:3e4,fetchAllWhenNoModels:!0,onData:ye=>{if(!ye?.enabled){ge(0);return}const ve=Number(ye?.total??0);ge(Number.isFinite(ve)?ve:0),Me(Date.now())},onError:ye=>{console.error("[ALL-online poller] error",ye)}});return()=>ce()},[V.useChaturbateApi]),s?t?g.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[g.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[g.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),g.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),g.jsxs("div",{className:"relative",children:[g.jsx("header",{className:"z-30 bg-white/70 backdrop-blur dark:bg-gray-950/60 sm:sticky sm:top-0 sm:border-b sm:border-gray-200/70 sm:dark:border-white/10",children:g.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-3 sm:py-4 space-y-2 sm:space-y-3",children:[g.jsxs("div",{className:"flex items-center sm:items-start justify-between gap-3 sm:gap-4",children:[g.jsx("div",{className:"min-w-0",children:g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("h1",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:"Recorder"}),g.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"online",children:[g.jsx(LM,{className:"size-4 opacity-80"}),g.jsx("span",{className:"tabular-nums",children:xe})]}),g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Watched online",children:[g.jsx(xu,{className:"size-4 opacity-80"}),g.jsx("span",{className:"tabular-nums",children:Es})]}),g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Fav online",children:[g.jsx(bu,{className:"size-4 opacity-80"}),g.jsx("span",{className:"tabular-nums",children:Qs})]}),g.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Like online",children:[g.jsx(_M,{className:"size-4 opacity-80"}),g.jsx("span",{className:"tabular-nums",children:fn})]})]}),g.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:gt})]}),g.jsxs("div",{className:"sm:hidden mt-1 w-full",children:[g.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:gt}),g.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[p?g.jsx(oA,{mode:"inline",className:"flex-1"}):g.jsx("div",{className:"flex-1"}),g.jsx(di,{variant:"secondary",onClick:()=>si(!0),className:"px-3 shrink-0",children:"Cookies"}),g.jsx(di,{variant:"secondary",onClick:r,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),g.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[p?g.jsx(oA,{mode:"inline"}):null,g.jsx(di,{variant:"secondary",onClick:()=>si(!0),className:"h-9 px-3",children:"Cookies"}),g.jsx(di,{variant:"secondary",onClick:r,className:"h-9 px-3",children:"Abmelden"})]})]}),g.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto] sm:items-stretch",children:[g.jsxs("div",{className:"relative",children:[g.jsx("label",{className:"sr-only",children:"Source URL"}),g.jsx("input",{value:q,onChange:ce=>ae(ce.target.value),placeholder:"https://…",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10"})]}),g.jsx(di,{variant:"primary",onClick:Ii,disabled:!xn,className:"w-full sm:w-auto rounded-lg",children:"Start"})]}),Je?g.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsx("div",{className:"min-w-0 break-words",children:Je}),g.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>ot(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,ds(q)&&!an($t)?g.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["⚠️ Für Chaturbate werden die Cookies ",g.jsx("code",{children:"cf_clearance"})," und ",g.jsx("code",{children:"sessionId"})," benötigt."]}):null,St?g.jsx("div",{className:"pt-1",children:g.jsx(Vh,{label:"Starte Download…",indeterminate:!0})}):null,g.jsx("div",{className:"hidden sm:block pt-2",children:g.jsx(ax,{tabs:Pn,value:xt,onChange:ni,ariaLabel:"Tabs",variant:"barUnderline"})})]})}),g.jsx("div",{className:"sm:hidden sticky top-0 z-20 border-b border-gray-200/70 bg-white/70 backdrop-blur dark:border-white/10 dark:bg-gray-950/60",children:g.jsx("div",{className:"mx-auto max-w-7xl px-4 py-2",children:g.jsx(ax,{tabs:Pn,value:xt,onChange:ni,ariaLabel:"Tabs",variant:"barUnderline"})})}),g.jsxs("main",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-2 space-y-2",children:[xt==="running"?g.jsx(F$,{jobs:Fi,modelsByKey:Ye,pending:ft,onOpenPlayer:qi,onStopJob:Zn,onToggleFavorite:we,onToggleLike:ut,onToggleWatch:At,onAddToDownloads:_e,blurPreviews:!!V.blurPreviews}):null,xt==="finished"?g.jsx(c3,{jobs:ie,modelsByKey:Ye,doneJobs:K,doneTotal:U,page:te,pageSize:v,onPageChange:re,onOpenPlayer:qi,onDeleteJob:Le,onToggleHot:bt,onToggleFavorite:we,onToggleLike:ut,onToggleWatch:At,blurPreviews:!!V.blurPreviews,teaserPlayback:V.teaserPlayback??"hover",teaserAudio:!!V.teaserAudio,assetNonce:Ri,sortMode:T,onSortModeChange:ce=>{E(ce),re(1)},loadMode:"paged"}):null,xt==="models"?g.jsx(V$,{}):null,xt==="categories"?g.jsx(hH,{}):null,xt==="settings"?g.jsx(bO,{onAssetsGenerated:kt}):null]}),g.jsx(uO,{open:Vt,onClose:()=>si(!1),initialCookies:Bi,onApply:ce=>{const ye=Wm(Object.fromEntries(ce.map(ve=>[ve.name,ve.value])));Pt(ye),En("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:ye})}).catch(()=>{})}}),g.jsx(iH,{open:!!_t,modelKey:_t,onClose:()=>pe(null),onOpenPlayer:qi,runningJobs:Fi,cookies:$t,blurPreviews:V.blurPreviews,onToggleHot:bt,onDelete:Ne,onToggleFavorite:we,onToggleLike:ut,onToggleWatch:At}),Xt?g.jsx(R$,{job:Xt,modelKey:X??void 0,modelsByKey:Ye,expanded:Gt,onToggleExpand:()=>Yi(ce=>!ce),onClose:()=>Zi(null),isHot:Ws(Xt.output||"").startsWith("HOT "),isFavorite:!!st?.favorite,isLiked:st?.liked===!0,isWatching:!!st?.watching,onKeep:et,onDelete:Ne,onToggleHot:bt,onToggleFavorite:we,onToggleLike:ut,onStopJob:Zn,onToggleWatch:At},[String(Xt?.id??""),Ws(Xt.output||""),String(Ri)].join("::")):null]})]}):g.jsx(vH,{onLoggedIn:n}):g.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}hA.createRoot(document.getElementById("root")).render(g.jsx(_.StrictMode,{children:g.jsx(r3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:g.jsx(_H,{})})})); + dark:bg-white/10 dark:text-white dark:ring-white/10`,"aria-label":`2FA Ziffer ${Z+1}`},Z))})]});return p.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[p.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[p.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),p.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),p.jsx("div",{className:"relative grid min-h-[100dvh] place-items-center px-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-gray-200/70 bg-white/80 p-6 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Recorder Login"}),p.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Bitte melde dich an, um fortzufahren."})]}),p.jsxs("div",{className:"mt-5 space-y-3",children:[v==="login"?p.jsxs("form",{onSubmit:q=>{q.preventDefault(),!d&&Y()},className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Username"}),p.jsx("input",{value:t,onChange:q=>i(q.target.value),autoComplete:"username",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"admin",disabled:d})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Passwort"}),p.jsx("input",{type:"password",value:n,onChange:q=>r(q.target.value),autoComplete:"current-password",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"••••••••••",disabled:d})]}),p.jsx(mi,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:d||!t.trim()||!n,children:d?"Login…":"Login"})]}):v==="verify"?p.jsxs("form",{onSubmit:q=>{q.preventDefault(),!d&&ne()},className:"space-y-3",children:[p.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:"2FA ist aktiv – bitte gib den Code aus deiner Authenticator-App ein."}),K,p.jsxs("div",{className:"flex gap-2",children:[p.jsx(mi,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:d,onClick:()=>{b("login"),W()},children:"Zurück"}),p.jsx(mi,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:d||!/^\d{6}$/.test(G),children:d?"Prüfe…":"Bestätigen"})]})]}):p.jsxs("form",{onSubmit:q=>{q.preventDefault(),!d&&ne()},className:"space-y-3",children:[p.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-2 text-sm text-indigo-900 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-200",children:"2FA ist noch nicht eingerichtet – bitte richte es jetzt ein (empfohlen)."}),p.jsxs("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[p.jsx("div",{children:"1) Öffne deine Authenticator-App und füge einen neuen Account hinzu."}),p.jsx("div",{children:"2) Scanne den QR-Code oder verwende den Secret-Key."})]}),p.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white/70 p-3 dark:border-white/10 dark:bg-white/5",children:[p.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"QR / Setup"}),T?p.jsx("div",{className:"mt-2 flex items-center justify-center",children:p.jsx("img",{alt:"2FA QR Code",className:"h-44 w-44 rounded bg-white p-2",src:`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(T)}`})}):p.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-300",children:"QR wird geladen…"}),D?p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Secret (manuell):"}),p.jsx("div",{className:"mt-1 select-all break-all rounded bg-gray-100 px-2 py-1 text-xs font-mono text-gray-900 dark:bg-white/10 dark:text-gray-100",children:D})]}):null,R?p.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:R}):null,p.jsx("div",{className:"mt-3",children:p.jsx(mi,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:d,onClick:()=>{ie()},title:"Setup-Infos neu laden",children:T?"QR/Setup erneut laden":"QR/Setup laden"})})]}),K,p.jsxs("div",{className:"flex gap-2",children:[p.jsx(mi,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:d,onClick:()=>{s&&s(),Zm(),window.location.assign(e||"/")},title:"Ohne 2FA fortfahren (nicht empfohlen)",children:"Später"}),p.jsx(mi,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:d||!/^\d{6}$/.test(G),children:d?"Aktiviere…":"2FA aktivieren"})]})]}),g?p.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0 break-words",children:g}),p.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>y(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null]})]})})]})}const ex="record_cookies";function Jm(s){return Object.fromEntries(Object.entries(s??{}).map(([t,i])=>[t.trim().toLowerCase(),String(i??"").trim()]).filter(([t,i])=>t.length>0&&i.length>0))}async function wn(s,e){const t=await fetch(s,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const vA={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!1,autoStartAddedDownloads:!1,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!1,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:3e3};function xo(s){let e=(s??"").trim();if(!e)return null;e=e.replace(/^[("'[{<]+/,"").replace(/[)"'\]}>.,;:]+$/,""),/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function su(s){const e=(s??"").trim();if(!e)return null;for(const t of e.split(/\s+/g)){const i=xo(t);if(i)return i}return null}function Ih(s){try{const e=new URL(s).hostname.replace(/^www\./i,"").toLowerCase();return e==="chaturbate.com"||e.endsWith(".chaturbate.com")?"chaturbate":e==="myfreecams.com"||e.endsWith(".myfreecams.com")?"mfc":null}catch{return null}}function MR(s){try{const e=new URL(s),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="chaturbate.com"&&!t.endsWith(".chaturbate.com"))return"";const i=e.pathname.split("/").filter(Boolean);return i[0]?decodeURIComponent(i[0]).trim():""}catch{return""}}function gl(s){const e=Ih(s);if(!e)return s;if(e==="chaturbate"){const i=MR(s);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:s}const t=PR(s);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:s}function PH(s){const e=Ih(s);return e?((e==="chaturbate"?MR(s):PR(s))||"").trim().toLowerCase():""}function PR(s){try{const e=new URL(s),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="myfreecams.com"&&!t.endsWith(".myfreecams.com"))return"";const i=(e.hash||"").replace(/^#\/?/,"");if(i){const a=i.split("/").filter(Boolean),u=a[a.length-1]||"";if(u)return decodeURIComponent(u).trim()}const n=e.pathname.split("/").filter(Boolean),r=n[n.length-1]||"";return r?decodeURIComponent(r).trim():""}catch{return""}}const Zs=s=>(s||"").replaceAll("\\","/").split("/").pop()||"";function FH(s,e){const i=(s||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function BH(s){return s.startsWith("HOT ")?s.slice(4):s}const UH=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function lh(s){const t=BH(Zs(s)).replace(/\.[^.]+$/,""),i=t.match(UH);if(i?.[1]?.trim())return i[1].trim();const n=t.lastIndexOf("_");return n>0?t.slice(0,n):t||null}function jH(){const[s,e]=_.useState(!1),[t,i]=_.useState(!1),n=_.useCallback(async()=>{try{const ue=await wn("/api/auth/me",{cache:"no-store"});i(!!ue?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),r=_.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),qe(null),tt(!1),yi("running"),It(null),wi(!1),ze(null),K([]),Z([]),re(0),le(1),Ge({}),pe(0),Ms({}),ji.current={},Si.current={},jt.current=!1,si([]),Ri({}),ve(0),ne("")}},[]);_.useEffect(()=>{n()},[n]);const a=nk(),u=_.useRef(a),c=_.useRef(0),d=ue=>{const fe=(ue||"").toLowerCase();return fe.includes("altersverifikationsseite erhalten")||fe.includes("verify your age")||fe.includes("schutzseite von cloudflare erhalten")||fe.includes("just a moment")||fe.includes("kein room-html")},f=ue=>{const fe=!!ue?.silent,ge="Cookies fehlen oder sind abgelaufen",Be="Der Recorder hat statt des Room-HTML eine Schutz-/Altersverifikationsseite erhalten. Bitte Cookies aktualisieren (bei Chaturbate z.B. cf_clearance + sessionId) und erneut starten.";if(!fe){qe(`⚠️ ${ge}. ${Be}`),ft(!0);return}const Ee=Date.now();Ee-c.current>15e3&&(c.current=Ee,u.current?.error(ge,Be))};_.useEffect(()=>{u.current=a},[a]);const[g,y]=_.useState(!1);_.useEffect(()=>{const ue=window,fe=typeof ue.requestIdleCallback=="function"?ue.requestIdleCallback(()=>y(!0),{timeout:1500}):window.setTimeout(()=>y(!0),800);return()=>{typeof ue.cancelIdleCallback=="function"?ue.cancelIdleCallback(fe):window.clearTimeout(fe)}},[]);const v=8,b="finishedDownloads_sort",[T,E]=_.useState(()=>{try{return window.localStorage.getItem(b)||"completed_desc"}catch{return"completed_desc"}}),D=_.useRef(null),O=_.useRef(!1),R=_.useRef(null),j=_.useRef(!1),F=(ue,fe)=>`${fe}::${ue}`,G=_.useCallback(async ue=>{if(ue<1||O.current)return;const fe=F(ue,T),ge=D.current;if(!(ge?.key===fe&&Date.now()-ge.ts<15e3)){O.current=!0;try{const Be=await fetch(`/api/record/done?page=${ue}&pageSize=${v}&sort=${encodeURIComponent(T)}`,{cache:"no-store"});if(!Be.ok)return;const Ee=await Be.json().catch(()=>null),et=Array.isArray(Ee?.items)?Ee.items:Array.isArray(Ee)?Ee:[];D.current={key:fe,items:et,ts:Date.now()}}finally{O.current=!1}}},[T]),L=_.useCallback(async()=>{try{const ue=await fetch("/api/record/done/meta",{cache:"no-store"});if(!ue.ok)return;const fe=await ue.json().catch(()=>null),ge=Number(fe?.count??0),Be=Number.isFinite(ge)&&ge>=0?ge:0;re(Be),He(Date.now())}catch{}},[]),W=_.useRef(null),I=_.useCallback(()=>{W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{W.current=null,window.dispatchEvent(new CustomEvent("finished-downloads:reload"))},150)},[]);_.useEffect(()=>()=>{W.current!=null&&(window.clearTimeout(W.current),W.current=null)},[]);const N=_.useCallback(async()=>{try{const ue=await fetch("/api/record/list",{cache:"no-store"});if(!ue.ok)return;const fe=await ue.json().catch(()=>null),ge=Array.isArray(fe)?fe:Array.isArray(fe?.items)?fe.items:[];K(ge),Kt.current=ge,He(Date.now())}catch{}},[]);_.useEffect(()=>{try{window.localStorage.setItem(b,T)}catch{}},[T]),_.useEffect(()=>{t&&L()},[t,L]);const[X,V]=_.useState(null),[Y,ne]=_.useState(""),[ie,K]=_.useState([]),[q,Z]=_.useState([]),[te,le]=_.useState(1),[z,re]=_.useState(0),[Q,pe]=_.useState(0),[be,ve]=_.useState(0),[we,He]=_.useState(()=>Date.now()),[Fe,Ze]=_.useState(()=>Date.now());_.useEffect(()=>{const ue=window.setInterval(()=>Ze(Date.now()),1e3);return()=>window.clearInterval(ue)},[]);const De=ue=>(ue||"").toLowerCase().trim(),Ye=ue=>{const fe=Math.max(0,Math.floor(ue/1e3));if(fe<2)return"gerade eben";if(fe<60)return`vor ${fe} Sekunden`;const ge=Math.floor(fe/60);if(ge===1)return"vor 1 Minute";if(ge<60)return`vor ${ge} Minuten`;const Be=Math.floor(ge/60);return Be===1?"vor 1 Stunde":`vor ${Be} Stunden`},wt=_.useMemo(()=>{const ue=Fe-we;return`(zuletzt aktualisiert: ${Ye(ue)})`},[Fe,we]),[vt,Ge]=_.useState({}),ke=_.useCallback(ue=>{const fe={};for(const ge of Array.isArray(ue)?ue:[]){const Be=(ge?.modelKey||"").trim().toLowerCase();if(!Be)continue;const Ee=pt=>(pt.favorite?4:0)+(pt.liked===!0?2:0)+(pt.watching?1:0),et=fe[Be];(!et||Ee(ge)>=Ee(et))&&(fe[Be]=ge)}return fe},[]),ut=_.useCallback(async()=>{try{const ue=await wn("/api/models",{cache:"no-store"});Ge(ke(Array.isArray(ue)?ue:[])),He(Date.now())}catch{}},[ke]),[rt,Je]=_.useState(null),at=_.useRef(null),[Re,ze]=_.useState(null);_.useEffect(()=>{const ue=fe=>{const Be=(fe.detail?.modelKey??"").trim();if(!Be)return;if(!Be.includes(" ")&&!Be.includes("/")&&!Be.includes("\\")){const yt=Be.replace(/^@/,"").trim().toLowerCase();yt&&ze(yt);return}const et=xo(Be);if(!et){let yt=Be.replace(/^https?:\/\//i,"");yt.includes("/")&&(yt=yt.split("/").filter(Boolean).pop()||yt),yt.includes(":")&&(yt=yt.split(":").pop()||yt),yt=yt.trim().toLowerCase(),yt&&ze(yt);return}const pt=gl(et),mt=PH(pt);mt&&ze(mt)};return window.addEventListener("open-model-details",ue),()=>window.removeEventListener("open-model-details",ue)},[]);const Ue=_.useCallback(ue=>{const fe=Date.now(),ge=at.current;if(!ge){at.current={ts:fe,list:[ue]};return}ge.ts=fe;const Be=ge.list.findIndex(Ee=>Ee.id===ue.id);Be>=0?ge.list[Be]=ue:ge.list.unshift(ue)},[]);_.useEffect(()=>{ut();const ue=fe=>{const Be=fe?.detail??{},Ee=Be?.model;if(Ee&&typeof Ee=="object"){const et=String(Ee.modelKey??"").toLowerCase().trim();et&&Ge(pt=>({...pt,[et]:Ee}));try{Ue(Ee)}catch{}Je(pt=>pt?.id===Ee.id?Ee:pt),He(Date.now());return}if(Be?.removed){const et=String(Be?.id??"").trim(),pt=String(Be?.modelKey??"").toLowerCase().trim();pt&&Ge(mt=>{const{[pt]:yt,...Dt}=mt;return Dt}),et&&Je(mt=>mt?.id===et?null:mt),He(Date.now());return}ut()};return window.addEventListener("models-changed",ue),()=>window.removeEventListener("models-changed",ue)},[ut,Ue]);const[de,qe]=_.useState(null),[ht,tt]=_.useState(!1),[At,ft]=_.useState(!1),[Et,Lt]=_.useState({}),[Rt,qt]=_.useState(!1),[Wt,yi]=_.useState("running"),[Ct,It]=_.useState(null),[oi,wi]=_.useState(!1),[Di,Yt]=_.useState(null),[Nt,H]=_.useState(0),U=_.useCallback(()=>H(ue=>ue+1),[]),[ee,Te]=_.useState(vA),Me=_.useRef(ee);_.useEffect(()=>{Me.current=ee},[ee]);const gt=!!ee.autoAddToDownloadList,Tt=!!ee.autoStartAddedDownloads,[gi,si]=_.useState([]),[xi,Ri]=_.useState({}),hi=_.useRef(!1),li=_.useRef({}),Kt=_.useRef([]),Si=_.useRef({}),jt=_.useRef(!1);_.useEffect(()=>{hi.current=ht},[ht]),_.useEffect(()=>{li.current=Et},[Et]),_.useEffect(()=>{Kt.current=ie},[ie]);const ui=_.useRef(null),ei=_.useRef(""),ti=4,Ui=_.useRef([]),rs=_.useRef(0),Ks=_.useRef(new Set),Is=_.useRef(!1),qi=_.useCallback(()=>{const ue=rs.current>0;tt(ue),hi.current=ue},[]),_i=_.useCallback(ue=>{const fe=xo(ue.url);if(!fe)return!1;const ge=gl(fe);return Ks.current.has(ge)||(Ks.current.add(ge),Ui.current.push({...ue,url:ge}),Is.current||(Is.current=!0,queueMicrotask(()=>{Is.current=!1,Ji()}))),!0},[]);async function Ns(ue,fe){if(ue=gl(ue),Kt.current.some(Be=>{if(String(Be.status||"").toLowerCase()!=="running"||Be.endedAt)return!1;const Ee=xo(String(Be.sourceUrl||""));return(Ee?gl(Ee):"")===ue}))return!0;try{const Be=li.current,Ee=Ih(ue);if(!Ee)return fe||qe("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(Ee==="chaturbate"&&!ls(Be))return fe||qe('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const et=Object.entries(Be).map(([mt,yt])=>`${mt}=${yt}`).join("; "),pt=await wn("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:ue,cookie:et})});return pt?.id&&(Si.current[String(pt.id)]=!0),K(mt=>[pt,...mt]),Kt.current=[pt,...Kt.current],!0}catch(Be){const Ee=Be?.message??String(Be);return d(Ee)?(f({silent:fe}),!1):(fe||qe(Ee),!1)}}async function Ji(){for(;rs.current0;){const ue=Ui.current.shift();rs.current++,qi(),(async()=>{try{if(await Ns(ue.url,ue.silent)&&ue.pendingKeyLower){const ge=ue.pendingKeyLower;Ri(Be=>{const Ee={...Be||{}};return delete Ee[ge],tn.current=Ee,Ee})}}finally{Ks.current.delete(ue.url),rs.current=Math.max(0,rs.current-1),qi(),Ui.current.length>0&&Ji()}})()}}const[as,Ms]=_.useState({}),ji=_.useRef({}),ds=_.useRef({}),Ki=_.useRef({}),Mi=_.useRef(!1),ss=_.useRef({});_.useEffect(()=>{ji.current=as},[as]);const Ps=_.useCallback(ue=>{const fe=String(ue?.host??"").toLowerCase(),ge=String(ue?.input??"").toLowerCase();return fe.includes("chaturbate")||ge.includes("chaturbate.com")},[]),ni=_.useMemo(()=>{const ue=new Set;for(const fe of Object.values(vt)){if(!Ps(fe))continue;const ge=De(String(fe?.modelKey??""));ge&&ue.add(ge)}return Array.from(ue)},[vt,Ps]),Fs=_.useRef(vt);_.useEffect(()=>{Fs.current=vt},[vt]);const tn=_.useRef(xi);_.useEffect(()=>{tn.current=xi},[xi]);const We=_.useRef(ni);_.useEffect(()=>{We.current=ni},[ni]);const Mt=_.useRef(Wt);_.useEffect(()=>{Mt.current=Wt},[Wt]);const Ot=_.useCallback(async(ue,fe)=>{const ge=xo(ue);if(!ge)return!1;const Be=gl(ge),Ee=!!fe?.silent;Ee||qe(null);const et=Ih(Be);if(!et)return Ee||qe("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const pt=li.current;if(et==="chaturbate"&&!ls(pt))return Ee||qe('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if(Kt.current.some(yt=>{if(String(yt.status||"").toLowerCase()!=="running"||yt.endedAt)return!1;const Dt=xo(String(yt.sourceUrl||""));return(Dt?gl(Dt):"")===Be}))return!0;if(et==="chaturbate"&&Me.current.useChaturbateApi)try{const yt=await wn("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Be})}),Dt=String(yt?.modelKey??"").trim().toLowerCase();if(Dt){if(hi.current)return Ri(bt=>({...bt||{},[Dt]:Be})),!0;const ri=ji.current[Dt],St=String(ri?.current_show??"");if(ri&&St&&St!=="public")return Ri(bt=>({...bt||{},[Dt]:Be})),!0}}catch{}else if(hi.current)return ui.current=Be,!0;if(hi.current)return!1;tt(!0),hi.current=!0;try{const yt=Object.entries(pt).map(([ri,St])=>`${ri}=${St}`).join("; "),Dt=await wn("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Be,cookie:yt})});return Dt?.id&&(Si.current[String(Dt.id)]=!0),K(ri=>[Dt,...ri]),Kt.current=[Dt,...Kt.current],!0}catch(yt){const Dt=yt?.message??String(yt);return d(Dt)?(f({silent:Ee}),!1):(Ee||qe(Dt),!1)}finally{tt(!1),hi.current=!1}},[]);_.useEffect(()=>{let ue=!1;const fe=async()=>{try{const Ee=await wn("/api/settings",{cache:"no-store"});!ue&&Ee&&Te({...vA,...Ee})}catch{}},ge=()=>{fe()},Be=()=>{fe()};return window.addEventListener("recorder-settings-updated",ge),window.addEventListener("focus",Be),document.addEventListener("visibilitychange",Be),fe(),()=>{ue=!0,window.removeEventListener("recorder-settings-updated",ge),window.removeEventListener("focus",Be),document.removeEventListener("visibilitychange",Be)}},[]),_.useEffect(()=>{let ue=!1;const fe=async()=>{try{const Be=await wn("/api/models/meta",{cache:"no-store"}),Ee=Number(Be?.count??0);!ue&&Number.isFinite(Ee)&&(pe(Ee),He(Date.now()))}catch{}};fe();const ge=window.setInterval(fe,document.hidden?6e4:3e4);return()=>{ue=!0,window.clearInterval(ge)}},[]);const zt=_.useMemo(()=>Object.entries(Et).map(([ue,fe])=>({name:ue,value:fe})),[Et]),Xt=_.useCallback((ue,fe)=>{at.current=null,Je(null),It(ue),wi(!1),Yt(typeof fe=="number"&&Number.isFinite(fe)&&fe>=0?fe:null)},[]),Qi=ie.filter(ue=>{const fe=String(ue?.status??"").toLowerCase();return fe==="running"||fe==="postwork"}),Ii=_.useMemo(()=>{let ue=0;for(const fe of Object.values(vt)){if(!fe?.watching||!Ps(fe))continue;const ge=De(String(fe?.modelKey??""));ge&&as[ge]&&ue++}return ue},[vt,as,Ps]),{onlineFavCount:Ni,onlineLikedCount:Wi}=_.useMemo(()=>{let ue=0,fe=0;for(const ge of Object.values(vt)){const Be=De(String(ge?.modelKey??""));Be&&as[Be]&&(ge?.favorite&&ue++,ge?.liked===!0&&fe++)}return{onlineFavCount:ue,onlineLikedCount:fe}},[vt,as]),Ds=[{id:"running",label:"Laufende Downloads",count:Qi.length},{id:"finished",label:"Abgeschlossene Downloads",count:z},{id:"models",label:"Models",count:Q},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],os=_.useMemo(()=>Y.trim().length>0&&!ht,[Y,ht]);_.useEffect(()=>{let ue=!1;return(async()=>{try{const ge=await wn("/api/cookies",{cache:"no-store"}),Be=Jm(ge?.cookies);if(ue||Lt(Be),Object.keys(Be).length===0){const Ee=localStorage.getItem(ex);if(Ee)try{const et=JSON.parse(Ee),pt=Jm(et);Object.keys(pt).length>0&&(ue||Lt(pt),await wn("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:pt})}))}catch{}}}catch{const ge=localStorage.getItem(ex);if(ge)try{const Be=JSON.parse(ge);ue||Lt(Jm(Be))}catch{}}finally{ue||qt(!0)}})(),()=>{ue=!0}},[]),_.useEffect(()=>{Rt&&localStorage.setItem(ex,JSON.stringify(Et))},[Et,Rt]),_.useEffect(()=>{L();const ue=()=>{document.hidden||L()};return document.addEventListener("visibilitychange",ue),()=>{document.removeEventListener("visibilitychange",ue)}},[L]);const jn=_.useCallback(async ue=>{j.current&&R.current?.abort();const fe=new AbortController;R.current=fe,j.current=!0;try{const ge=typeof ue=="number"?ue:te,Be=await fetch(`/api/record/done?page=${ge}&pageSize=${v}&sort=${encodeURIComponent(T)}&withCount=1`,{cache:"no-store",signal:fe.signal});if(!Be.ok)throw new Error(`HTTP ${Be.status}`);const Ee=await Be.json().catch(()=>null),et=Array.isArray(Ee?.items)?Ee.items:Array.isArray(Ee)?Ee:[],pt=Number(Ee?.count??Ee?.totalCount??et.length),mt=Number.isFinite(pt)&&pt>=0?pt:et.length;re(mt);const yt=Math.max(1,Math.ceil(mt/v)),Dt=Math.min(Math.max(1,ge),yt);if(Dt!==te&&le(Dt),Dt!==ge){const ri=await fetch(`/api/record/done?page=${Dt}&pageSize=${v}&sort=${encodeURIComponent(T)}&withCount=1`,{cache:"no-store",signal:fe.signal});if(!ri.ok)throw new Error(`HTTP ${ri.status}`);const St=await ri.json().catch(()=>null),bt=Array.isArray(St?.items)?St.items:[];Z(bt)}else Z(et);He(Date.now())}catch(ge){String(ge?.name)}finally{R.current===fe&&(R.current=null,j.current=!1)}},[te,T]);_.useEffect(()=>{if(Wt!=="finished")return;L(),I();const ue=()=>{document.hidden||(L(),I())};return document.addEventListener("visibilitychange",ue),()=>{document.removeEventListener("visibilitychange",ue)}},[Wt,L,I]),_.useEffect(()=>{const ue=Math.max(1,Math.ceil(z/v));te>ue&&le(ue)},[z,te]),_.useEffect(()=>{if(!t)return;let ue=null,fe=null;const ge=()=>{fe!=null&&(window.clearInterval(fe),fe=null)},Be=()=>{fe==null&&(fe=window.setInterval(()=>{document.hidden||(Mt.current==="finished"?(L(),I()):L())},document.hidden?6e4:15e3))},Ee={t:0};let et=null;const pt=()=>{const Dt=Date.now();if(Dt-Ee.t<800){if(et!=null)return;et=window.setTimeout(()=>{et=null,Ee.t=Date.now(),Mt.current==="finished"?(L(),I()):L()},900);return}Ee.t=Dt,Mt.current==="finished"?(L(),I()):L()};L(),ue=new EventSource("/api/record/done/stream"),ue.onopen=()=>{ge()},ue.onerror=()=>{Be()};const mt=()=>pt();ue.addEventListener("doneChanged",mt);const yt=()=>{document.hidden||pt()};return document.addEventListener("visibilitychange",yt),()=>{document.removeEventListener("visibilitychange",yt),et!=null&&window.clearTimeout(et),ge(),ue?.removeEventListener("doneChanged",mt),ue?.close(),ue=null}},[t,L,I]),_.useEffect(()=>{if(!t)return;N();const ue=window.setInterval(()=>{if(document.hidden)return;const ge=Kt.current.some(Be=>{const Ee=String(Be?.status??"").toLowerCase();return Ee==="running"||Ee==="postwork"});(Mt.current==="running"||ge)&&N()},document.hidden?6e4:3e3),fe=()=>{document.hidden||N()};return document.addEventListener("visibilitychange",fe),()=>{window.clearInterval(ue),document.removeEventListener("visibilitychange",fe)}},[t,N]);function Dn(ue){const fe=xo(ue);if(!fe)return!1;try{return new URL(fe).hostname.includes("chaturbate.com")}catch{return!1}}function Tn(ue,fe){const ge=Object.fromEntries(Object.entries(ue).map(([Be,Ee])=>[Be.trim().toLowerCase(),Ee]));for(const Be of fe){const Ee=ge[Be.toLowerCase()];if(Ee)return Ee}}function ls(ue){const fe=Tn(ue,["cf_clearance"]),ge=Tn(ue,["sessionid","session_id","sessionId"]);return!!(fe&&ge)}async function tr(ue){try{await wn(`/api/record/stop?id=${encodeURIComponent(ue)}`,{method:"POST"})}catch(fe){a.error("Stop fehlgeschlagen",fe?.message??String(fe))}}_.useEffect(()=>{const ue=fe=>{const Be=Number(fe.detail?.delta??0);if(!Number.isFinite(Be)||Be===0){L(),I();return}re(Ee=>Math.max(0,Ee+Be)),L(),I()};return window.addEventListener("finished-downloads:count-hint",ue),()=>window.removeEventListener("finished-downloads:count-hint",ue)},[L,I]),_.useEffect(()=>{const ue=fe=>{const ge=fe.detail||{};ge.tab==="finished"&&yi("finished"),ge.tab==="categories"&&yi("categories"),ge.tab==="models"&&yi("models"),ge.tab==="running"&&yi("running"),ge.tab==="settings"&&yi("settings")};return window.addEventListener("app:navigate-tab",ue),()=>window.removeEventListener("app:navigate-tab",ue)},[]),_.useEffect(()=>{if(!Ct){Je(null),V(null);return}const ue=(lh(Ct.output||"")||"").trim().toLowerCase();V(ue||null);const fe=ue?vt[ue]:void 0;Je(fe??null)},[Ct,vt]);async function dn(){return Ot(Y)}const sn=_.useCallback(async ue=>{const fe=String(ue?.sourceUrl??""),ge=su(fe);if(!ge)return!1;const Be=xo(ge);if(!Be)return!1;const Ee=gl(Be),et=await Ot(Ee,{silent:!0});return et||a.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),et},[Ot,a]),hs=_.useCallback(async ue=>{const fe=Zs(ue.output||"");if(fe){window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"start"}}));try{const ge=await wn(`/api/record/delete?file=${encodeURIComponent(fe)}`,{method:"POST"});window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"success"}})),window.setTimeout(()=>{Z(Ee=>{const et=Ee.filter(St=>Zs(St.output||"")!==fe);if(v-et.length<=0)return et;const mt=F(te+1,T),yt=D.current;if(!yt||yt.key!==mt||!Array.isArray(yt.items)||yt.items.length===0)return et;const Dt=[...et],ri=new Set(Dt.map(St=>String(St.id||Zs(St.output||"")).trim()));for(;Dt.length0;){const St=yt.items.shift(),bt=String(St.id||Zs(St.output||"")).trim();!bt||ri.has(bt)||(ri.add(bt),Dt.push(St))}return D.current={...yt,items:yt.items,ts:yt.ts},Dt}),re(Ee=>Math.max(0,Ee-1)),K(Ee=>Ee.filter(et=>Zs(et.output||"")!==fe)),It(Ee=>Ee&&Zs(Ee.output||"")===fe?null:Ee),G(te+1)},320);const Be=typeof ge?.undoToken=="string"?ge.undoToken:"";return Be?{undoToken:Be}:{}}catch{window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"error"}})),a.error("Löschen fehlgeschlagen: ",fe);return}}},[a,jn]),xe=_.useCallback(async ue=>{await hs(ue)},[hs]),Ce=_.useCallback(async ue=>{const fe=Zs(ue.output||"");if(fe){window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"start"}}));try{await wn(`/api/record/keep?file=${encodeURIComponent(fe)}`,{method:"POST"}),window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"success"}})),window.setTimeout(()=>{Z(ge=>ge.filter(Be=>Zs(Be.output||"")!==fe)),K(ge=>ge.filter(Be=>Zs(Be.output||"")!==fe)),It(ge=>ge&&Zs(ge.output||"")===fe?null:ge)},320)}catch{window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:fe,phase:"error"}})),a.error("Keep fehlgeschlagen",fe);return}}},[a]),Ie=_.useCallback(async ue=>{const fe=Zs(ue.output||"");if(fe)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:fe}})),await new Promise(Ee=>window.setTimeout(Ee,60));const ge=await wn(`/api/record/toggle-hot?file=${encodeURIComponent(fe)}`,{method:"POST"});window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:ge.oldFile,newFile:ge.newFile}}));const Be=Ee=>FH(Ee||"",ge.newFile);return It(Ee=>Ee&&{...Ee,output:Be(Ee.output||"")}),Z(Ee=>Ee.map(et=>et.id===ue.id||Zs(et.output||"")===fe?{...et,output:Be(et.output||"")}:et)),K(Ee=>Ee.map(et=>et.id===ue.id||Zs(et.output||"")===fe?{...et,output:Be(et.output||"")}:et)),ge}catch(ge){a.error("Umbenennen fehlgeschlagen",ge?.message??String(ge));return}},[a]);async function Xe(ue){const fe=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(fe.status===204)return null;if(!fe.ok){const ge=await fe.text().catch(()=>"");throw new Error(ge||`HTTP ${fe.status}`)}return fe.json()}const xt=_.useCallback(ue=>{const fe=at.current;!fe||!ue||(fe.ts=Date.now(),fe.list=fe.list.filter(ge=>ge.id!==ue))},[]),Ft=_.useRef({}),ii=_.useCallback(async ue=>{const fe=Zs(ue.output||""),ge=!!(Ct&&Zs(Ct.output||"")===fe),Be=St=>{try{const bt=String(St.sourceUrl??St.SourceURL??""),Ht=su(bt);return Ht?new URL(Ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(lh(ue.output||"")||"").trim().toLowerCase();if(Ee){const St=Ee;if(Ft.current[St])return;Ft.current[St]=!0;const bt=vt[Ee]??{id:"",input:"",host:Be(ue)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},Ht=!bt.favorite,bi={...bt,modelKey:bt.modelKey||Ee,favorite:Ht,liked:Ht?!1:bt.liked};Ge(Vt=>({...Vt,[Ee]:bi})),Ue(bi),ge&&Je(bi);try{const Vt=await Xe({...bi.id?{id:bi.id}:{},host:bi.host||Be(ue)||"",modelKey:Ee,favorite:Ht,...Ht?{liked:!1}:{}});if(!Vt){Ge(Zi=>{const{[Ee]:nn,...Ln}=Zi;return Ln}),bt.id&&xt(bt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:Ee}}));return}const Qt=De(Vt.modelKey||Ee);Qt&&Ge(Zi=>({...Zi,[Qt]:Vt})),Ue(Vt),ge&&Je(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Ge(Qt=>({...Qt,[Ee]:bt})),Ue(bt),ge&&Je(bt),a.error("Favorit umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete Ft.current[St]}return}let et=ge?rt:null;if(et||(et=await ct(ue,{ensure:!0})),!et)return;const pt=De(et.modelKey||et.id||"");if(!pt||Ft.current[pt])return;Ft.current[pt]=!0;const mt=et,yt=!mt.favorite,Dt={...mt,favorite:yt,liked:yt?!1:mt.liked},ri=De(mt.modelKey||"");ri&&Ge(St=>({...St,[ri]:Dt})),Ue(Dt),ge&&Je(Dt);try{const St=await Xe({id:mt.id,favorite:yt,...yt?{liked:!1}:{}});if(!St){Ge(Ht=>{const bi=De(mt.modelKey||"");if(!bi)return Ht;const{[bi]:Vt,...Qt}=Ht;return Qt}),xt(mt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:mt.id,modelKey:mt.modelKey}}));return}const bt=De(St.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:St})),Ue(St),ge&&Je(St),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:St}}))}catch(St){const bt=De(mt.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:mt})),Ue(mt),ge&&Je(mt),a.error("Favorit umschalten fehlgeschlagen",St?.message??String(St))}finally{delete Ft.current[pt]}},[a,Ct,rt,ct,Xe,Ue,xt,vt]),oe=_.useCallback(async ue=>{const fe=Zs(ue.output||""),ge=!!(Ct&&Zs(Ct.output||"")===fe),Be=St=>{try{const bt=String(St.sourceUrl??St.SourceURL??""),Ht=su(bt);return Ht?new URL(Ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(lh(ue.output||"")||"").trim().toLowerCase();if(Ee){const St=Ee;if(Ft.current[St])return;Ft.current[St]=!0;const bt=vt[Ee]??{id:"",input:"",host:Be(ue)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},Ht=bt.liked!==!0,bi={...bt,modelKey:bt.modelKey||Ee,liked:Ht,favorite:Ht?!1:bt.favorite};Ge(Vt=>({...Vt,[Ee]:bi})),Ue(bi),ge&&Je(bi);try{const Vt=await Xe({...bi.id?{id:bi.id}:{},host:bi.host||Be(ue)||"",modelKey:Ee,liked:Ht,...Ht?{favorite:!1}:{}});if(!Vt){Ge(Zi=>{const{[Ee]:nn,...Ln}=Zi;return Ln}),bt.id&&xt(bt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:Ee}}));return}const Qt=De(Vt.modelKey||Ee);Qt&&Ge(Zi=>({...Zi,[Qt]:Vt})),Ue(Vt),ge&&Je(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Ge(Qt=>({...Qt,[Ee]:bt})),Ue(bt),ge&&Je(bt),a.error("Like umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete Ft.current[St]}return}let et=ge?rt:null;if(et||(et=await ct(ue,{ensure:!0})),!et)return;const pt=De(et.modelKey||et.id||"");if(!pt||Ft.current[pt])return;Ft.current[pt]=!0;const mt=et,yt=mt.liked!==!0,Dt={...mt,liked:yt,favorite:yt?!1:mt.favorite},ri=De(mt.modelKey||"");ri&&Ge(St=>({...St,[ri]:Dt})),Ue(Dt),ge&&Je(Dt);try{const St=yt?await Xe({id:mt.id,liked:!0,favorite:!1}):await Xe({id:mt.id,liked:!1});if(!St){Ge(Ht=>{const bi=De(mt.modelKey||"");if(!bi)return Ht;const{[bi]:Vt,...Qt}=Ht;return Qt}),xt(mt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:mt.id,modelKey:mt.modelKey}}));return}const bt=De(St.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:St})),Ue(St),ge&&Je(St),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:St}}))}catch(St){const bt=De(mt.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:mt})),Ue(mt),ge&&Je(mt),a.error("Like umschalten fehlgeschlagen",St?.message??String(St))}finally{delete Ft.current[pt]}},[a,Ct,rt,ct,Xe,Ue,xt,vt]),Se=_.useCallback(async ue=>{const fe=Zs(ue.output||""),ge=!!(Ct&&Zs(Ct.output||"")===fe),Be=St=>{try{const bt=String(St.sourceUrl??St.SourceURL??""),Ht=su(bt);return Ht?new URL(Ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(lh(ue.output||"")||"").trim().toLowerCase();if(Ee){const St=Ee;if(Ft.current[St])return;Ft.current[St]=!0;const bt=vt[Ee]??{id:"",input:"",host:Be(ue)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},Ht=!bt.watching,bi={...bt,modelKey:bt.modelKey||Ee,watching:Ht};Ge(Vt=>({...Vt,[Ee]:bi})),Ue(bi),ge&&Je(bi);try{const Vt=await Xe({...bi.id?{id:bi.id}:{},host:bi.host||Be(ue)||"",modelKey:Ee,watched:Ht});if(!Vt){Ge(Zi=>{const{[Ee]:nn,...Ln}=Zi;return Ln}),bt.id&&xt(bt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:Ee}}));return}const Qt=De(Vt.modelKey||Ee);Qt&&Ge(Zi=>({...Zi,[Qt]:Vt})),Ue(Vt),ge&&Je(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Ge(Qt=>({...Qt,[Ee]:bt})),Ue(bt),ge&&Je(bt),a.error("Watched umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete Ft.current[St]}return}let et=ge?rt:null;if(et||(et=await ct(ue,{ensure:!0})),!et)return;const pt=De(et.modelKey||et.id||"");if(!pt||Ft.current[pt])return;Ft.current[pt]=!0;const mt=et,yt=!mt.watching,Dt={...mt,watching:yt},ri=De(mt.modelKey||"");ri&&Ge(St=>({...St,[ri]:Dt})),Ue(Dt),ge&&Je(Dt);try{const St=await Xe({id:mt.id,watched:yt});if(!St){Ge(Ht=>{const bi=De(mt.modelKey||"");if(!bi)return Ht;const{[bi]:Vt,...Qt}=Ht;return Qt}),xt(mt.id),ge&&Je(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:mt.id,modelKey:mt.modelKey}}));return}const bt=De(St.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:St})),Ue(St),ge&&Je(St),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:St}}))}catch(St){const bt=De(mt.modelKey||"");bt&&Ge(Ht=>({...Ht,[bt]:mt})),Ue(mt),ge&&Je(mt),a.error("Watched umschalten fehlgeschlagen",St?.message??String(St))}finally{delete Ft.current[pt]}},[a,Ct,rt,ct,Xe,Ue,xt,vt]);async function ct(ue,fe){const ge=!!fe?.ensure,Be=Dt=>{const ri=Date.now(),St=at.current;if(!St){at.current={ts:ri,list:[Dt]};return}St.ts=ri;const bt=St.list.findIndex(Ht=>Ht.id===Dt.id);bt>=0?St.list[bt]=Dt:St.list.unshift(Dt)},Ee=async Dt=>{if(!Dt)return null;const ri=Dt.trim().toLowerCase();if(!ri)return null;const St=vt[ri];if(St)return Be(St),St;if(ge){let Qt;try{const nn=ue.sourceUrl??ue.SourceURL??"",Ln=su(nn);Ln&&(Qt=new URL(Ln).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const Zi=await wn("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:Dt,...Qt?{host:Qt}:{}})});return Ue(Zi),Zi}const bt=Date.now(),Ht=at.current;if(!Ht||bt-Ht.ts>3e4){const Qt=Object.values(vt);if(Qt.length)at.current={ts:bt,list:Qt};else{const Zi=await wn("/api/models",{cache:"no-store"});at.current={ts:bt,list:Array.isArray(Zi)?Zi:[]}}}const Vt=(at.current?.list??[]).find(Qt=>(Qt.modelKey||"").trim().toLowerCase()===ri);return Vt||null},et=lh(ue.output||"");if(et)return Ee(et);const pt=ue.status==="running",mt=ue.sourceUrl??ue.SourceURL??"",yt=su(mt);if(pt&&yt){const Dt=await wn("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:yt})}),ri=await wn("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Dt)});return Ue(ri),ri}return null}return _.useEffect(()=>{if(!gt&&!Tt||!navigator.clipboard?.readText)return;let ue=!1,fe=!1,ge=null;const Be=async()=>{if(!(ue||fe)){fe=!0;try{const pt=await navigator.clipboard.readText(),mt=su(pt);if(!mt)return;const yt=xo(mt);if(!yt||!Ih(yt))return;const ri=gl(yt);if(ri===ei.current)return;ei.current=ri,gt&&ne(ri),Tt&&_i({url:ri,silent:!1})}catch{}finally{fe=!1}}},Ee=pt=>{ue||(ge=window.setTimeout(async()=>{await Be(),Ee(document.hidden?5e3:1500)},pt))},et=()=>{Be()};return window.addEventListener("hover",et),document.addEventListener("visibilitychange",et),Ee(0),()=>{ue=!0,ge&&window.clearTimeout(ge),window.removeEventListener("hover",et),document.removeEventListener("visibilitychange",et)}},[gt,Tt,_i]),_.useEffect(()=>{const ue=gA({getModels:()=>{if(!Me.current.useChaturbateApi)return[];const fe=Fs.current,ge=tn.current,Be=Object.values(fe).filter(et=>!!et?.watching&&String(et?.host??"").toLowerCase().includes("chaturbate")).map(et=>String(et?.modelKey??"").trim().toLowerCase()).filter(Boolean),Ee=Object.keys(ge||{}).map(et=>String(et||"").trim().toLowerCase()).filter(Boolean);return Array.from(new Set([...Be,...Ee]))},getShow:()=>["public","private","hidden","away"],intervalMs:8e3,onData:fe=>{(async()=>{if(!fe?.enabled){Ms({}),ji.current={},ds.current={},si([]),ss.current={},Mi.current=!1,Ki.current={},He(Date.now());return}const ge={};for(const pt of Array.isArray(fe.rooms)?fe.rooms:[]){const mt=String(pt?.username??"").trim().toLowerCase();mt&&(ge[mt]=pt)}Ms(ge),ji.current=ge;try{const pt=!!(Me.current.enableNotifications??!0),mt=new Set(["private","away","hidden"]),yt=new Set(Object.values(Fs.current||{}).filter(Qt=>!!Qt?.watching&&String(Qt?.host??"").toLowerCase().includes("chaturbate")).map(Qt=>String(Qt?.modelKey??"").trim().toLowerCase()).filter(Boolean)),Dt=ds.current||{},ri={...Dt},St=Ki.current||{},bt=!Mi.current,Ht=ss.current||{},bi={...Ht};for(const[Qt,Zi]of Object.entries(ge)){const nn=String(Zi?.current_show??"").toLowerCase().trim(),Ln=String(Dt[Qt]??"").toLowerCase().trim(),us=!0&&!!!St[Qt],$n=!!Ht[Qt],Sr=String(Zi?.username??Qt).trim()||Qt,Au=String(Zi?.image_url??"").trim();if(bi[Qt]=!0,nn==="public"&&mt.has(Ln)){pt&&a.info(Sr,"ist wieder online.",{imageUrl:Au,imageAlt:`${Sr} Vorschau`,durationMs:5500}),nn&&(ri[Qt]=nn);continue}if(yt.has(Qt)&&us){const ed=$n;pt&&!bt&&a.info(Sr,ed?"ist wieder online.":"ist online.",{imageUrl:Au,imageAlt:`${Sr} Vorschau`,durationMs:5500})}nn&&(ri[Qt]=nn)}const Vt={};for(const Qt of Object.keys(ge))Vt[Qt]=!0;Ki.current=Vt,ss.current=bi,Mi.current=!0,ds.current=ri}catch{}const Be=We.current;for(const pt of Be||[]){const mt=String(pt||"").trim().toLowerCase();mt&&ge[mt]}if(!Me.current.useChaturbateApi)si([]);else if(Mt.current==="running"){const pt=Fs.current,mt=tn.current,yt=Array.from(new Set(Object.values(pt).filter(bt=>!!bt?.watching&&String(bt?.host??"").toLowerCase().includes("chaturbate")).map(bt=>String(bt?.modelKey??"").trim().toLowerCase()).filter(Boolean))),Dt=Object.keys(mt||{}).map(bt=>String(bt||"").trim().toLowerCase()).filter(Boolean),ri=new Set(Dt),St=Array.from(new Set([...yt,...Dt]));if(St.length===0)si([]);else{const bt=[];for(const Ht of St){const bi=ge[Ht];if(!bi)continue;const Vt=String(bi?.username??"").trim(),Qt=String(bi?.current_show??"unknown");if(Qt==="public"&&!ri.has(Ht))continue;const Zi=`https://chaturbate.com/${(Vt||Ht).trim()}/`;bt.push({id:Ht,modelKey:Vt||Ht,url:Zi,currentShow:Qt,imageUrl:String(bi?.image_url??"")})}bt.sort((Ht,bi)=>Ht.modelKey.localeCompare(bi.modelKey,void 0,{sensitivity:"base"})),si(bt)}}if(!Me.current.useChaturbateApi||hi.current)return;const Ee=tn.current,et=Object.keys(Ee||{}).map(pt=>String(pt||"").toLowerCase()).filter(Boolean);for(const pt of et){const mt=ge[pt];if(!mt||String(mt.current_show??"")!=="public")continue;const yt=Ee[pt];yt&&_i({url:yt,silent:!0,pendingKeyLower:pt})}He(Date.now())})()}});return()=>ue()},[]),_.useEffect(()=>{if(!ee.useChaturbateApi){ve(0);return}const ue=gA({getModels:()=>[],getShow:()=>["public","private","hidden","away"],intervalMs:3e4,fetchAllWhenNoModels:!0,onData:fe=>{if(!fe?.enabled){ve(0);return}const ge=Number(fe?.total??0);ve(Number.isFinite(ge)?ge:0),He(Date.now())},onError:fe=>{console.error("[ALL-online poller] error",fe)}});return()=>ue()},[ee.useChaturbateApi]),s?t?p.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[p.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[p.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),p.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),p.jsxs("div",{className:"relative",children:[p.jsx("header",{className:"z-30 bg-white/70 backdrop-blur dark:bg-gray-950/60 sm:sticky sm:top-0 sm:border-b sm:border-gray-200/70 sm:dark:border-white/10",children:p.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-3 sm:py-4 space-y-2 sm:space-y-3",children:[p.jsxs("div",{className:"flex items-center sm:items-start justify-between gap-3 sm:gap-4",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p.jsx("h1",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:"Recorder"}),p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"online",children:[p.jsx(BM,{className:"size-4 opacity-80"}),p.jsx("span",{className:"tabular-nums",children:be})]}),p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Watched online",children:[p.jsx(bu,{className:"size-4 opacity-80"}),p.jsx("span",{className:"tabular-nums",children:Ii})]}),p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Fav online",children:[p.jsx(Tu,{className:"size-4 opacity-80"}),p.jsx("span",{className:"tabular-nums",children:Ni})]}),p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Like online",children:[p.jsx(RM,{className:"size-4 opacity-80"}),p.jsx("span",{className:"tabular-nums",children:Wi})]})]}),p.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:wt})]}),p.jsxs("div",{className:"sm:hidden mt-1 w-full",children:[p.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:wt}),p.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[g?p.jsx(pA,{mode:"inline",className:"flex-1"}):p.jsx("div",{className:"flex-1"}),p.jsx(mi,{variant:"secondary",onClick:()=>ft(!0),className:"px-3 shrink-0",children:"Cookies"}),p.jsx(mi,{variant:"secondary",onClick:r,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),p.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[g?p.jsx(pA,{mode:"inline"}):null,p.jsx(mi,{variant:"secondary",onClick:()=>ft(!0),className:"h-9 px-3",children:"Cookies"}),p.jsx(mi,{variant:"secondary",onClick:r,className:"h-9 px-3",children:"Abmelden"})]})]}),p.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto] sm:items-stretch",children:[p.jsxs("div",{className:"relative",children:[p.jsx("label",{className:"sr-only",children:"Source URL"}),p.jsx("input",{value:Y,onChange:ue=>ne(ue.target.value),placeholder:"https://…",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10"})]}),p.jsx(mi,{variant:"primary",onClick:dn,disabled:!os,className:"w-full sm:w-auto rounded-lg",children:"Start"})]}),de?p.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0 break-words",children:de}),p.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>qe(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,Dn(Y)&&!ls(Et)?p.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["⚠️ Für Chaturbate werden die Cookies ",p.jsx("code",{children:"cf_clearance"})," und ",p.jsx("code",{children:"sessionId"})," benötigt."]}):null,ht?p.jsx("div",{className:"pt-1",children:p.jsx(qh,{label:"Starte Download…",indeterminate:!0})}):null,p.jsx("div",{className:"hidden sm:block pt-2",children:p.jsx(lx,{tabs:Ds,value:Wt,onChange:yi,ariaLabel:"Tabs",variant:"barUnderline"})})]})}),p.jsx("div",{className:"sm:hidden sticky top-0 z-20 border-b border-gray-200/70 bg-white/70 backdrop-blur dark:border-white/10 dark:bg-gray-950/60",children:p.jsx("div",{className:"mx-auto max-w-7xl px-4 py-2",children:p.jsx(lx,{tabs:Ds,value:Wt,onChange:yi,ariaLabel:"Tabs",variant:"barUnderline"})})}),p.jsxs("main",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-2 space-y-2",children:[Wt==="running"?p.jsx(J$,{jobs:Qi,modelsByKey:vt,pending:gi,onOpenPlayer:Xt,onStopJob:tr,onToggleFavorite:ii,onToggleLike:oe,onToggleWatch:Se,onAddToDownloads:sn,blurPreviews:!!ee.blurPreviews}):null,Wt==="finished"?p.jsx(w3,{jobs:ie,modelsByKey:vt,doneJobs:q,doneTotal:z,page:te,pageSize:v,onPageChange:le,onOpenPlayer:Xt,onDeleteJob:hs,onToggleHot:Ie,onToggleFavorite:ii,onToggleLike:oe,onToggleWatch:Se,blurPreviews:!!ee.blurPreviews,teaserPlayback:ee.teaserPlayback??"hover",teaserAudio:!!ee.teaserAudio,assetNonce:Nt,sortMode:T,onSortModeChange:ue=>{E(ue),le(1)},loadMode:"paged"}):null,Wt==="models"?p.jsx(oH,{}):null,Wt==="categories"?p.jsx(DH,{}):null,Wt==="settings"?p.jsx(DO,{onAssetsGenerated:U}):null]}),p.jsx(vO,{open:At,onClose:()=>ft(!1),initialCookies:zt,onApply:ue=>{const fe=Jm(Object.fromEntries(ue.map(ge=>[ge.name,ge.value])));Lt(fe),wn("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:fe})}).catch(()=>{})}}),p.jsx(xH,{open:!!Re,modelKey:Re,onClose:()=>ze(null),onOpenPlayer:Xt,runningJobs:Qi,cookies:Et,blurPreviews:ee.blurPreviews,onToggleHot:Ie,onDelete:xe,onToggleFavorite:ii,onToggleLike:oe,onToggleWatch:Se}),Ct?p.jsx(q$,{job:Ct,modelKey:X??void 0,modelsByKey:vt,expanded:oi,onToggleExpand:()=>wi(ue=>!ue),onClose:()=>{It(null),Yt(null)},startAtSec:Di??void 0,isHot:Zs(Ct.output||"").startsWith("HOT "),isFavorite:!!rt?.favorite,isLiked:rt?.liked===!0,isWatching:!!rt?.watching,onKeep:Ce,onDelete:xe,onToggleHot:Ie,onToggleFavorite:ii,onToggleLike:oe,onStopJob:tr,onToggleWatch:Se},[String(Ct?.id??""),Zs(Ct.output||""),String(Nt)].join("::")):null]})]}):p.jsx(MH,{onLoggedIn:n}):p.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}bA.createRoot(document.getElementById("root")).render(p.jsx(_.StrictMode,{children:p.jsx(b3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:p.jsx(jH,{})})})); diff --git a/backend/web/dist/index.html b/backend/web/dist/index.html index 1c815d6..1a24576 100644 --- a/backend/web/dist/index.html +++ b/backend/web/dist/index.html @@ -5,8 +5,8 @@ App - - + +
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 8472e9a..a8cf128 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -40,7 +40,7 @@ async function apiJSON(url: string, init?: RequestInit): Promise { return res.json() as Promise } -type RecorderSettings = { +type RecorderSettingsState = { recordDir: string doneDir: string ffmpegPath?: string @@ -56,7 +56,7 @@ type RecorderSettings = { lowDiskPauseBelowGB?: number } -const DEFAULT_RECORDER_SETTINGS: RecorderSettings = { +const DEFAULT_RECORDER_SETTINGS: RecorderSettingsState = { recordDir: 'records', doneDir: 'records/done', ffmpegPath: '', @@ -580,7 +580,7 @@ export default function App() { const refreshModelsByKey = useCallback(async () => { try { - const list = await apiJSON('/api/models/list', { cache: 'no-store' as any }) + const list = await apiJSON('/api/models', { cache: 'no-store' as any }) setModelsByKey(buildModelsByKey(Array.isArray(list) ? list : [])) setLastHeaderUpdateAtMs(Date.now()) } catch { @@ -656,7 +656,7 @@ export default function App() { const detail = e?.detail ?? {} const updated = detail?.model - // ✅ 1) Update-Event mit Model: direkt in State übernehmen (KEIN /api/models/list) + // ✅ 1) Update-Event mit Model: direkt in State übernehmen (KEIN /api/models) if (updated && typeof updated === 'object') { const k = String(updated.modelKey ?? '').toLowerCase().trim() if (k) setModelsByKey((prev) => ({ ...prev, [k]: updated })) @@ -706,11 +706,12 @@ export default function App() { const [selectedTab, setSelectedTab] = useState('running') const [playerJob, setPlayerJob] = useState(null) const [playerExpanded, setPlayerExpanded] = useState(false) + const [playerStartAtSec, setPlayerStartAtSec] = useState(null) const [assetNonce, setAssetNonce] = useState(0) const bumpAssets = useCallback(() => setAssetNonce((n) => n + 1), []) - const [recSettings, setRecSettings] = useState(DEFAULT_RECORDER_SETTINGS) + const [recSettings, setRecSettings] = useState(DEFAULT_RECORDER_SETTINGS) const recSettingsRef = useRef(recSettings) useEffect(() => { recSettingsRef.current = recSettings @@ -1059,7 +1060,7 @@ export default function App() { const load = async () => { try { - const s = await apiJSON('/api/settings', { cache: 'no-store' }) + const s = await apiJSON('/api/settings', { cache: 'no-store' }) if (!cancelled && s) setRecSettings({ ...DEFAULT_RECORDER_SETTINGS, ...s }) } catch { // ignore @@ -1110,11 +1111,16 @@ export default function App() { const initialCookies = useMemo(() => Object.entries(cookies).map(([name, value]) => ({ name, value })), [cookies]) - const openPlayer = useCallback((job: RecordJob) => { + const openPlayer = useCallback((job: RecordJob, startAtSec?: number) => { modelsCacheRef.current = null setPlayerModel(null) setPlayerJob(job) setPlayerExpanded(false) + setPlayerStartAtSec( + typeof startAtSec === 'number' && Number.isFinite(startAtSec) && startAtSec >= 0 + ? startAtSec + : null + ) }, []) const runningJobs = jobs.filter((j) => { @@ -1670,7 +1676,7 @@ export default function App() { return } }, - [selectedTab, refreshDoneNow, notify] + [notify] ) const handleToggleHot = useCallback( @@ -2240,7 +2246,7 @@ export default function App() { return stateHit } - // ✅ 1) Wenn ensure gewünscht: DIREKT ensure (kein /api/models/list) + // ✅ 1) Wenn ensure gewünscht: DIREKT ensure (kein /api/models) if (wantEnsure) { let host: string | undefined @@ -2270,7 +2276,7 @@ export default function App() { if (seeded.length) { modelsCacheRef.current = { ts: now, list: seeded } } else { - const list = await apiJSON('/api/models/list', { cache: 'no-store' as any }) + const list = await apiJSON('/api/models', { cache: 'no-store' as any }) modelsCacheRef.current = { ts: now, list: Array.isArray(list) ? list : [] } } } @@ -2380,7 +2386,7 @@ export default function App() { window.removeEventListener('hover', kick) document.removeEventListener('visibilitychange', kick) } - }, [autoAddEnabled, autoStartEnabled, startUrl]) + }, [autoAddEnabled, autoStartEnabled, enqueueStart]) useEffect(() => { const stop = startChaturbateOnlinePolling({ @@ -2905,7 +2911,11 @@ export default function App() { modelsByKey={modelsByKey} expanded={playerExpanded} onToggleExpand={() => setPlayerExpanded((s) => !s)} - onClose={() => setPlayerJob(null)} + onClose={() => { + setPlayerJob(null) + setPlayerStartAtSec(null) + }} + startAtSec={playerStartAtSec ?? undefined} isHot={baseName(playerJob.output || '').startsWith('HOT ')} isFavorite={Boolean(playerModel?.favorite)} isLiked={playerModel?.liked === true} diff --git a/frontend/src/components/ui/ButtonGroup.tsx b/frontend/src/components/ui/ButtonGroup.tsx index 77ec877..846a899 100644 --- a/frontend/src/components/ui/ButtonGroup.tsx +++ b/frontend/src/components/ui/ButtonGroup.tsx @@ -3,7 +3,7 @@ import * as React from 'react' -type Size = 'sm' | 'md' +type Size = 'sm' | 'md' | 'lg' export type ButtonGroupItem = { id: string @@ -29,6 +29,7 @@ function cn(...parts: Array) { const sizeMap: Record = { sm: { btn: 'px-2.5 py-1.5 text-sm', icon: 'size-5', iconOnly: 'h-9 w-9' }, md: { btn: 'px-3 py-2 text-sm', icon: 'size-5', iconOnly: 'h-10 w-10' }, + lg: { btn: 'px-3.5 py-2.5 text-sm', icon: 'size-5', iconOnly: 'h-11 w-11' }, } export default function ButtonGroup({ diff --git a/frontend/src/components/ui/CategoriesTab.tsx b/frontend/src/components/ui/CategoriesTab.tsx index e309c31..03c9f88 100644 --- a/frontend/src/components/ui/CategoriesTab.tsx +++ b/frontend/src/components/ui/CategoriesTab.tsx @@ -216,7 +216,7 @@ export default function CategoriesTab() { try { // parallel laden const [models, doneResp] = await Promise.all([ - apiJSON('/api/models/list', { + apiJSON('/api/models', { cache: 'no-store' as any, signal: ac.signal as any, }), diff --git a/frontend/src/components/ui/FinishedDownloads.tsx b/frontend/src/components/ui/FinishedDownloads.tsx index c5439db..7b6880d 100644 --- a/frontend/src/components/ui/FinishedDownloads.tsx +++ b/frontend/src/components/ui/FinishedDownloads.tsx @@ -47,7 +47,7 @@ type Props = { blurPreviews?: boolean teaserPlayback?: TeaserPlaybackMode teaserAudio?: boolean - onOpenPlayer: (job: RecordJob) => void + onOpenPlayer: (job: RecordJob, startAtSec?: number) => void onDeleteJob?: ( job: RecordJob ) => void | { undoToken?: string } | Promise @@ -748,11 +748,115 @@ export default function FinishedDownloads({ setInlinePlay((prev) => (prev?.key === key ? { key, nonce: prev.nonce + 1 } : { key, nonce: 1 })) }, []) + const startInlineAt = useCallback((key: string, seconds: number, domId: string) => { + const safeSeconds = Number.isFinite(seconds) && seconds > 0 ? seconds : 0 + + // Inline-Preview aktivieren / remount erzwingen + setInlinePlay((prev) => (prev?.key === key ? { key, nonce: prev.nonce + 1 } : { key, nonce: 1 })) + + // Nach dem Rendern das Video suchen, seeken und autoplay versuchen + const trySeekAndPlay = (retriesLeft: number) => { + const host = document.getElementById(domId) + const v = host?.querySelector('video') as HTMLVideoElement | null + + if (!v) { + if (retriesLeft > 0) { + requestAnimationFrame(() => trySeekAndPlay(retriesLeft - 1)) + } + return + } + + applyInlineVideoPolicy(v, { muted: previewMuted }) + + const applySeek = () => { + try { + const dur = Number(v.duration) + const maxSeek = + Number.isFinite(dur) && dur > 0 + ? Math.max(0, dur - 0.05) + : safeSeconds + + v.currentTime = Math.max(0, Math.min(safeSeconds, maxSeek)) + } catch { + // ignore + } + + const p = v.play?.() + if (p && typeof (p as any).catch === 'function') { + ;(p as Promise).catch(() => {}) + } + } + + // Wenn Metadaten schon da sind -> direkt seeken + if (v.readyState >= 1) { + applySeek() + return + } + + // Sonst warten bis metadata da sind + const onLoadedMetadata = () => { + v.removeEventListener('loadedmetadata', onLoadedMetadata) + applySeek() + } + + v.addEventListener('loadedmetadata', onLoadedMetadata, { once: true }) + + // zusätzlich sofort play versuchen (hilft manchmal) + const p = v.play?.() + if (p && typeof (p as any).catch === 'function') { + ;(p as Promise).catch(() => {}) + } + } + + requestAnimationFrame(() => trySeekAndPlay(8)) + }, [previewMuted]) + const openPlayer = useCallback((job: RecordJob) => { setInlinePlay(null) onOpenPlayer(job) }, [onOpenPlayer]) + const openPlayerAt = useCallback((job: RecordJob, seconds: number) => { + const s = Number.isFinite(seconds) && seconds >= 0 ? seconds : 0 + setInlinePlay(null) + onOpenPlayer(job, s) + }, [onOpenPlayer]) + + const handleScrubberClickIndex = useCallback( + (job: RecordJob, segmentIndex: number, segmentCount: number) => { + const idx = Number.isFinite(segmentIndex) ? Math.floor(segmentIndex) : 0 + const count = Number.isFinite(segmentCount) ? Math.floor(segmentCount) : 0 + + if (count <= 0) { + // Fallback: Player normal öffnen + openPlayer(job) + return + } + + // Dauer bevorzugt aus Preview-Metadaten, sonst aus Job + const k = keyFor(job) + const durationSec = + durations[k] ?? + ((job as any)?.durationSeconds as number | undefined) ?? + 0 + + if (!Number.isFinite(durationSec) || durationSec <= 0) { + // Wenn keine Dauer bekannt ist: trotzdem öffnen (ohne Timestamp) + openPlayer(job) + return + } + + // Segment-Index -> Startsekunde + // Beispiel: 10 Segmente, Klick auf Index 0..9 + const clampedIdx = Math.max(0, Math.min(idx, count - 1)) + const secPerSegment = durationSec / count + const startAtSec = clampedIdx * secPerSegment + + openPlayerAt(job, startAtSec) + }, + [durations, keyFor, openPlayer, openPlayerAt] + ) + const markDeleting = useCallback((key: string, value: boolean) => { setDeletingKeys((prev) => { const next = new Set(prev) @@ -1944,6 +2048,9 @@ export default function FinishedDownloads({ lower={lower} onOpenPlayer={onOpenPlayer} openPlayer={openPlayer} + onOpenPlayerAt={openPlayerAt} + handleScrubberClickIndex={handleScrubberClickIndex} + startInlineAt={startInlineAt} startInline={startInline} tryAutoplayInline={tryAutoplayInline} registerTeaserHost={registerTeaserHost} @@ -1995,6 +2102,7 @@ export default function FinishedDownloads({ activeTagSet={activeTagSet} onToggleTagFilter={toggleTagFilter} onOpenPlayer={onOpenPlayer} + handleScrubberClickIndex={handleScrubberClickIndex} onSortModeChange={onSortModeChange} page={page} onPageChange={onPageChange} @@ -2030,6 +2138,7 @@ export default function FinishedDownloads({ deletedKeys={deletedKeys} registerTeaserHost={registerTeaserHost} onOpenPlayer={onOpenPlayer} + handleScrubberClickIndex={handleScrubberClickIndex} deleteVideo={deleteVideo} keepVideo={keepVideo} onToggleHot={toggleHotVideo} diff --git a/frontend/src/components/ui/FinishedDownloadsCardsView.tsx b/frontend/src/components/ui/FinishedDownloadsCardsView.tsx index d6f774e..2fdf485 100644 --- a/frontend/src/components/ui/FinishedDownloadsCardsView.tsx +++ b/frontend/src/components/ui/FinishedDownloadsCardsView.tsx @@ -40,6 +40,8 @@ type Props = { assetNonce?: number + handleScrubberClickIndex: (job: RecordJob, segmentIndex: number, segmentCount: number) => void + // helpers keyFor: (j: RecordJob) => string baseName: (p: string) => string @@ -53,6 +55,8 @@ type Props = { onHoverPreviewKeyChange?: (key: string | null) => void onOpenPlayer: (job: RecordJob) => void openPlayer: (job: RecordJob) => void + onOpenPlayerAt?: (job: RecordJob, seconds: number) => void + startInlineAt?: (key: string, seconds: number, domId: string) => void startInline: (key: string) => void tryAutoplayInline: (domId: string) => boolean registerTeaserHost: (key: string) => (el: HTMLDivElement | null) => void @@ -161,7 +165,7 @@ export default function FinishedDownloadsCardsView({ teaserAudio, hoverTeaserKey, blurPreviews, - durations, // ✅ fehlte + durations, teaserKey, inlinePlay, deletingKeys, @@ -170,6 +174,7 @@ export default function FinishedDownloadsCardsView({ swipeRefs, assetNonce, + handleScrubberClickIndex, keyFor, baseName, @@ -182,6 +187,7 @@ export default function FinishedDownloadsCardsView({ onHoverPreviewKeyChange, onOpenPlayer, openPlayer, + startInlineAt, startInline, tryAutoplayInline, registerTeaserHost, @@ -276,6 +282,7 @@ export default function FinishedDownloadsCardsView({ ) const [scrubActiveByKey, setScrubActiveByKey] = React.useState>({}) + const [scrubHoveringByKey, setScrubHoveringByKey] = React.useState>({}) const setScrubActiveIndex = React.useCallback((key: string, index: number | undefined) => { setScrubActiveByKey((prev) => { @@ -295,6 +302,19 @@ export default function FinishedDownloadsCardsView({ setScrubActiveIndex(key, undefined) }, [setScrubActiveIndex]) + const setScrubHovering = React.useCallback((key: string, hovering: boolean | undefined) => { + setScrubHoveringByKey((prev) => { + if (hovering === undefined) { + if (!(key in prev)) return prev + const next = { ...prev } + delete next[key] + return next + } + if (prev[key] === hovering) return prev + return { ...prev, [key]: hovering } + }) + }, []) + const renderCardItem = ( j: RecordJob, opts?: { @@ -344,6 +364,7 @@ export default function FinishedDownloadsCardsView({ const meta = parseMeta(j) const spriteInfo = previewScrubberInfoOf(j) const scrubActiveIndex = scrubActiveByKey[k] + const scrubHovering = scrubHoveringByKey[k] === true // ✅ Sprite-Quelle wie in GalleryView (1 Request, danach nur CSS background-position) const spritePathRaw = firstNonEmptyString( @@ -437,6 +458,11 @@ export default function FinishedDownloadsCardsView({ const scrubberCount = hasScrubberUi ? spriteCount : 0 const scrubberStepSeconds = hasScrubberUi ? spriteStepSeconds : 0 + const scrubProgressRatio = + typeof scrubActiveIndex === 'number' && scrubberCount > 1 + ? clamp(scrubActiveIndex / (scrubberCount - 1), 0, 1) + : undefined + const spriteFrameStyle: React.CSSProperties | undefined = hasSpriteScrubber && typeof scrubActiveIndex === 'number' ? (() => { @@ -456,9 +482,6 @@ export default function FinishedDownloadsCardsView({ })() : undefined - const showScrubberSpriteInThumb = Boolean(spriteFrameStyle) - const hideTeaserUnderOverlay = showScrubberSpriteInThumb - const isHot = isHotName(fileRaw) const isFav = Boolean(flags?.favorite) const isLiked = flags?.liked === true @@ -566,7 +589,7 @@ export default function FinishedDownloadsCardsView({ onDuration={handleDuration} showPopover={false} blur={inlineActive ? false : Boolean(blurPreviews)} - animated={hideTeaserUnderOverlay ? false : allowTeaserAnimation} + animated={allowTeaserAnimation} animatedMode="teaser" animatedTrigger="always" clipSeconds={1} @@ -581,6 +604,8 @@ export default function FinishedDownloadsCardsView({ alwaysLoadStill={forceLoadStill} teaserPreloadEnabled={opts?.mobileStackTopOnlyVideo ? true : !isSmall} teaserPreloadRootMargin={isSmall ? '900px 0px' : '700px 0px'} + scrubProgressRatio={scrubProgressRatio} + preferScrubProgress={scrubHovering && typeof scrubActiveIndex === 'number'} /> {/* ✅ Sprite einmal vorladen, damit der erste Scrub-Move sofort sichtbar ist */} @@ -596,24 +621,72 @@ export default function FinishedDownloadsCardsView({ ) : null} {/* ✅ Scrub-Frame Overlay via Sprite (kein Request pro Move) */} - {hasSpriteScrubber && spriteFrameStyle ? ( -