UNPKG

spectatr-player-sdk

Version:

A custom video player built with Stencil with Shaka Player integration

539 lines (528 loc) 886 kB
import { r as registerInstance, g as getElement, h, c as createEvent, H as Host } from './index-BvFqIDu0.js'; import { b as addReaction, a as analyticsService, c as fetchVideoSrc, d as fetchSuggestions } from './analyticsService-D2vrsufF.js'; function setupTracks(component) { const { player } = component; if (!player) return; const audioTracks = player.getAudioTracks(); // Use a Map to store the first occurrence of each language const uniqueLanguageTracks = new Map(); audioTracks.forEach(track => { const language = track.language; if (!uniqueLanguageTracks.has(language)) { uniqueLanguageTracks.set(language, { index: track.id, language: language, label: track.label || `Audio ${language}`, enabled: track.active, }); } }); // Convert Map values back to an array component.audioTracks = Array.from(uniqueLanguageTracks.values()); // Set the first track as active (or keep existing logic) component.currentAudioTrack = 0; setupQualityTrack(component); } function setupQualityTrack(component) { const { player } = component; if (!player) return; const tracks = player.getVariantTracks(); component.qualities = tracks .filter(track => !track.label || track.label === component.audioTracks[component.currentAudioTrack]?.label) .reduce((unique, track) => { const qualityLabel = track.height ? `${track.height}p` : `${Math.floor(track.bandwidth / 1000)}kbps`; unique.push({ index: track.id, height: track.height, bitrate: track.bandwidth, name: qualityLabel, }); return unique; }, []); component.currentQuality = -1; } function togglePlay(component) { const video = component.videoElement; if (video.paused) { video.play(); component.playVideo.emit(); window.parent.postMessage({ type: 'ON_VIDEO_PLAY', }, '*'); } else { video.pause(); component.pauseVideo.emit(); window.parent.postMessage({ type: 'ON_VIDEO_PAUSE', }, '*'); } } function toggleMute(component) { component.videoElement.muted = !component.videoElement.muted; } function setVolume(component, volume) { if (volume !== 0 && component.videoElement.muted) { component.videoElement.muted = false; } component.videoElement.volume = volume; } function seek(component, time) { if (component.isLive) { const dvrStartTime = component.player.seekRange().start; component.videoElement.currentTime = Math.max(time, dvrStartTime); component.currentTime = component.videoElement.currentTime; } else { component.videoElement.currentTime = time; component.currentTime = time; } } function skipForward(component) { component.videoElement.currentTime = Math.min(component.duration, component.videoElement.currentTime + 10); } function skipBackward(component) { let seekToTime = component.videoElement.currentTime - 10; if (component.isLive) { const dvrStartTime = component.player.seekRange().start; if (seekToTime < dvrStartTime) { seekToTime = dvrStartTime; } } component.videoElement.currentTime = seekToTime; } const toggleFullscreen = (component) => { // Get the video container directly from the component reference const videoContainer = component.videoContainer; if (!videoContainer) { console.error('Video container element not found'); component.videoError.emit('Video container element not found'); return; } if (!document.fullscreenElement) { // Enter fullscreen if (videoContainer.requestFullscreen) { videoContainer .requestFullscreen() .then(() => { component.isFullscreen = true; }) .catch(err => { console.error('Error attempting to enable fullscreen:', err); component.videoError.emit('Error attempting to enable fullscreen'); }); } } else { // Exit fullscreen if (document.exitFullscreen) { document .exitFullscreen() .then(() => { component.isFullscreen = false; }) .catch(err => { console.error('Error attempting to exit fullscreen:', err); component.videoError.emit('Error attempting to exit fullscreen'); }); } } }; function startProgressUpdate(component) { component.progressUpdateInterval = setInterval(() => { component.currentTime = component.videoElement.currentTime; }, 100); } function stopProgressUpdate(component) { if (component.progressUpdateInterval) { clearInterval(component.progressUpdateInterval); } } async function setQuality(component, qualityIndex) { if (!component.player) return; if (qualityIndex === -1) { // Auto quality component.player.configure({ abr: { enabled: true } }); } else { // Specific quality component.player.configure({ abr: { enabled: false } }); const tracks = component.player.getVariantTracks().filter(track => !track.label || track.label === component.audioTracks[component.currentAudioTrack]?.label); component.player.selectVariantTrack(tracks[qualityIndex], true); } component.currentQuality = qualityIndex; } function setAudioTrack(component, trackIndex) { if (!component.player) return; const audioTracks = component.player.getAudioTracks(); if (audioTracks[trackIndex]) { component.player.selectAudioTrack(audioTracks[trackIndex]); component.currentAudioTrack = trackIndex; setupQualityTrack(component); } } function toggleSettings(component, e) { e.stopPropagation(); // Prevent component click from triggering the outside click handler component.showSettings = !component.showSettings; if (component.showSettings) { component.showMainSettings = true; component.showQualityOptions = false; component.showAudioOptions = false; } } function handleGoLive(component) { component.duration = component.player.seekRange().end; component.videoElement.currentTime = component.duration; } function handleClickOutsideSetting(component, event) { if (!component.showSettings) return; const settingsMenu = component.hostElement.shadowRoot?.querySelector('.settings-menu'); const settingsButton = component.hostElement.shadowRoot?.querySelector('.control-btn'); // Check if click was outside both the menu and the settings button const clickedInsideMenu = settingsMenu?.contains(event.target); const clickedSettingsButton = settingsButton?.contains(event.target); if (!clickedInsideMenu && !clickedSettingsButton) { component.showSettings = false; component.showQualityOptions = false; component.showAudioOptions = false; } } function shouldShowToggle(component) { // Only show toggle if description is longer than 2 lines return component.videoDescription.length > 200; // Adjust this threshold as needed } function toggleDescription(component) { component.showFullDescription = !component.showFullDescription; } async function toggleLike(component) { try { component.isLiked = !component.isLiked; component.isDisliked = false; component.totalLikes = component.isLiked ? component.totalLikes + 1 : component.totalLikes - 1; // Track like click component.analyticsTracker.trackReactionClick('like', component.isLiked); await addReaction(component, 'like'); } catch (error) { component.isLiked = !component.isLiked; component.isDisliked = false; component.totalLikes = component.isLiked ? component.totalLikes + 1 : component.totalLikes - 1; console.error('like toggle failed:', error); component.videoError.emit('React to video failed'); } } async function toggleDislike(component) { const wasLiked = component.isLiked; const wasDisliked = component.isDisliked; const originalLikes = component.totalLikes; try { if (component.isLiked) { component.isLiked = false; component.totalLikes--; } component.isDisliked = !component.isDisliked; // Track dislike click component.analyticsTracker.trackReactionClick('dislike', component.isDisliked); await addReaction(component, 'dislike'); } catch (error) { component.isLiked = wasLiked; component.isDisliked = wasDisliked; component.totalLikes = originalLikes; console.error('Dislike toggle failed:', error); component.videoError.emit('React to video failed'); } } function formatTimeAgo(createdAt) { const date = new Date(createdAt); const now = new Date(); const seconds = Math.floor((now.getTime() - date.getTime()) / 1000); const intervals = { year: 31536000, month: 2592000, week: 604800, day: 86400, hour: 3600, minute: 60, second: 1, }; for (const [unit, secondsInUnit] of Object.entries(intervals)) { const interval = Math.floor(seconds / secondsInUnit); if (interval >= 1) { return new Intl.RelativeTimeFormat('en', { numeric: 'auto' }).format(-interval, unit); } } return 'just now'; } function formatLikeCount(count) { return Math.abs(count) >= 1e9 ? (count / 1e9).toFixed(1).replace(/\.0$/, '') + 'B' : Math.abs(count) >= 1e6 ? (count / 1e6).toFixed(1).replace(/\.0$/, '') + 'M' : Math.abs(count) >= 1e3 ? (count / 1e3).toFixed(1).replace(/\.0$/, '') + 'K' : count.toString(); } function getUserUUID(userId) { if (userId) return userId; if (localStorage.getItem('spactatr_user_id')) { return localStorage.getItem('spactatr_user_id'); } else { const id = crypto.randomUUID(); localStorage.setItem('spactatr_user_id', id); return id; } } function cleanupData(component) { component.src = null; component.token = null; component.videoDescription = ''; component.videoTitle = ''; component.isLoading = true; component.showPoll = false; component.showQuiz = false; component.pollAnswered = []; component.quizAnswered = []; component.quizzes = null; component.timelineEvents = []; component.isLive = false; component.currentTime = 0; component.duration = 0; clearTimeout(component.controlsTimeout); clearInterval(component.progressUpdateInterval); clearInterval(component.livePollingInterval); clearInterval(component.reactionPollingInterval); } function applyTheme(themeId, root) { switch (themeId) { case 'minimal-dark': //pass root.style.setProperty('--vp-primary-bg', '#121212'); root.style.setProperty('--vp-controls-bg', 'rgba(0, 0, 0, 0.7)'); root.style.setProperty('--vp-accent', '#ff5555'); root.style.setProperty('--vp-video-text', '#ffffff'); root.style.setProperty('--vp-text', '#ffffff'); break; case 'minimal-light': //pass root.style.setProperty('--vp-primary-bg', '#f8f8f8'); root.style.setProperty('--vp-controls-bg', 'rgba(48, 48, 48, 0.7)'); root.style.setProperty('--vp-accent', '#e53e3e'); // Deep red for contrast root.style.setProperty('--vp-video-text', '#ffffff'); root.style.setProperty('--vp-text', '#1a202c'); break; case 'classic-youtube': //pass root.style.setProperty('--vp-primary-bg', '#f9f9f9'); root.style.setProperty('--vp-controls-bg', 'rgba(0, 0, 0, 0.7)'); root.style.setProperty('--vp-accent', '#065fd4'); root.style.setProperty('--vp-video-text', '#ffffff'); root.style.setProperty('--vp-text', '#000'); break; case 'cinema-mode': //pass root.style.setProperty('--vp-primary-bg', '#f9f9f9'); root.style.setProperty('--vp-controls-bg', 'rgba(156, 3, 29, 0.45)'); root.style.setProperty('--vp-accent', '#cd2843ff'); root.style.setProperty('--vp-video-text', '#ffffff'); root.style.setProperty('--vp-text', '#000'); break; case 'true-back': //pass root.style.setProperty('--vp-primary-bg', '#000000'); root.style.setProperty('--vp-controls-bg', 'rgba(255, 255, 255, 0.3)'); root.style.setProperty('--vp-accent', '#000000'); root.style.setProperty('--vp-video-text', '#ffffff'); root.style.setProperty('--vp-text', '#aaaaaa'); break; } } const spectatrPlayerSdkCss = ":host{display:block;position:relative;float:calc(50%);width:100%;height:100%;background:var(--vp-primary-bg);--title-font:'Inter', -apple-system, sans-serif;--description-font:'SF Pro Text', system-ui, sans-serif;padding:2px;border-radius:4px}.video-wrapper-container{display:flex;justify-content:space-between;height:100%;gap:1.5rem}@media (max-width: 768px){.video-wrapper-container{flex-direction:column;gap:2rem}}"; const VideoWrapper = class { constructor(hostRef) { registerInstance(this, hostRef); } clientId; baseUrl = 'https://api.staging.spectatr.ai/player-sdk'; videoId = ''; userId = ''; autoPlay = false; showSuggestions = true; captureReaction = true; theme = 'classic-youtube'; get host() { return getElement(this); } _videoId; _nextVideoId; _clientId; _userId; _baseUrl; _autoPlay; _showSuggestions; _captureReaction; _theme; isIframe = false; suggestions = []; suggestionsHeight = 0; componentWillLoad() { this.isIframe = window.self !== window.top; // Extract query parameters from the URL const queryParams = new URLSearchParams(window.location.search); // Override props with query params if they exist this._videoId = queryParams.get('videoId') || this.videoId; this._clientId = queryParams.get('clientId') || this.clientId; this._userId = getUserUUID(queryParams.get('userId') || this.userId); this._baseUrl = queryParams.get('baseUrl') || this.baseUrl; this._autoPlay = queryParams.get('autoPlay') ? queryParams.get('autoPlay') === 'true' : this.autoPlay; this._showSuggestions = queryParams.get('showSuggestions') ? queryParams.get('showSuggestions') === 'true' : this.showSuggestions; this._captureReaction = queryParams.get('captureReaction') ? queryParams.get('captureReaction') === 'true' : this.captureReaction; this._theme = queryParams.get('theme') ?? this.theme; const root = document.documentElement; applyTheme(this._theme, root); } setPlayerHeight() { const videoContainer = this.host.shadowRoot.querySelector('video-player'); if (!videoContainer) { return; } const videoPlayerShadowRoot = videoContainer.shadowRoot; if (!videoContainer) return; const videoElement = videoPlayerShadowRoot.querySelector('#spectart-video-player')?.clientHeight; const videoMetaElement = videoPlayerShadowRoot.querySelector('.video-info')?.clientHeight; this.suggestionsHeight = videoElement + (videoMetaElement ?? 10); } setNextVideoId() { if (!this.suggestions.length) return; let idx = -1; idx = this.suggestions.findIndex(suggestion => suggestion.id === this._videoId); if (idx >= 0 && idx < this.suggestions.length - 1) { this._nextVideoId = this.suggestions[idx + 1].id; } else if (idx < 0) { this._nextVideoId = this.suggestions[0].id; } } setVideoId = (videoId) => { if (!videoId) return; this._videoId = videoId; this.setNextVideoId(); this.setPlayerHeight(); }; setSuggestions = (suggestions) => { this.suggestions = suggestions; this.setPlayerHeight(); this.setNextVideoId(); }; render() { if (!this._clientId) { console.error('Please provide client id to the player to proceed.'); return; } return (h("div", { class: "video-wrapper-container" }, h("video-player", { autoPlay: this._autoPlay, captureReaction: this._captureReaction, videoId: this._videoId, userId: this._userId, clientId: this._clientId, baseUrl: this._baseUrl, setVideoId: this.setVideoId, nextVideoId: this._nextVideoId }), this._showSuggestions && (h("video-suggestions", { baseUrl: this._baseUrl, height: this.suggestionsHeight, clientId: this._clientId, setSuggestions: this.setSuggestions, videoId: this._videoId, handlePlaySuggestion: this.setVideoId })))); } }; VideoWrapper.style = spectatrPlayerSdkCss; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var shakaPlayer_compiled = {}; /* @license Shaka Player Copyright 2016 Google LLC SPDX-License-Identifier: Apache-2.0 */ var hasRequiredShakaPlayer_compiled; function requireShakaPlayer_compiled () { if (hasRequiredShakaPlayer_compiled) return shakaPlayer_compiled; hasRequiredShakaPlayer_compiled = 1; (function (exports) { (function(){var innerGlobal=typeof window!="undefined"?window:commonjsGlobal;var exportTo={};(function(window,global,module){/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ var p,aa=typeof Object.create=="function"?Object.create:function(a){function b(){}b.prototype=a;return new b},ba=typeof Object.defineProperties=="function"?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a}; function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var da=ca(this);function ea(a,b){if(b)a:{var c=da;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e];}a=a[a.length-1];d=c[a];b=b(d);b!=d&&b!=null&&ba(c,a,{configurable:true,writable:true,value:b});}}var fa; if(typeof Object.setPrototypeOf=="function")fa=Object.setPrototypeOf;else {var ha;a:{var ia={a:true},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=false;}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;}var ka=fa; function la(a,b){a.prototype=aa(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if(c!="prototype")if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d);}else a[c]=b[c];a.Gm=b.prototype;}function ma(a){var b=0;return function(){return b<a.length?{done:false,value:a[b++]}:{done:true}}} function t(a){var b=typeof Symbol!="undefined"&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if(typeof a.length=="number")return {next:ma(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}function x(a){if(!(a instanceof Array)){a=t(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c;}return a} ea("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.g=f;ba(this,"description",{configurable:true,writable:true,value:g});}if(a)return a;c.prototype.toString=function(){return this.g};var d="jscomp_symbol_"+(Math.random()*1E9>>>0)+"_",e=0;return b}); ea("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=da[b[c]];typeof d==="function"&&typeof d.prototype[a]!="function"&&ba(d.prototype,a,{configurable:true,writable:true,value:function(){return na(ma(this))}});}return a});function na(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} function qa(){this.o=false;this.l=null;this.h=void 0;this.g=1;this.j=this.m=0;this.B=this.i=null;}function ra(a){if(a.o)throw new TypeError("Generator is already running");a.o=true;}qa.prototype.u=function(a){this.h=a;};function sa(a,b){a.i={Wh:b,li:true};a.g=a.m||a.j;}qa.prototype.return=function(a){this.i={return:a};this.g=this.j;};function F(a,b,c){a.g=c;return {value:b}}qa.prototype.A=function(a){this.g=a;};function G(a){a.g=0;}function ua(a,b,c){a.m=b;c!=void 0&&(a.j=c);}function va(a,b){a.m=0;a.j=b||0;} function xa(a,b,c){a.g=b;a.m=c||0;}function ya(a,b){a.m=b||0;b=a.i.Wh;a.i=null;return b}function Aa(a){a.B=[a.i];a.m=0;a.j=0;}function Da(a,b){var c=a.B.splice(0)[0];(c=a.i=a.i||c)?c.li?a.g=a.m||a.j:c.A!=void 0&&a.j<c.A?(a.g=c.A,a.i=null):a.g=a.j:a.g=b;}function Ga(a){this.g=new qa;this.h=a;}function Ia(a,b){ra(a.g);var c=a.g.l;if(c)return Ja(a,"return"in c?c["return"]:function(d){return {value:d,done:true}},b,a.g.return);a.g.return(b);return Ka(a)} function Ja(a,b,c,d){try{var e=b.call(a.g.l,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.g.o=false,e;var f=e.value;}catch(g){return a.g.l=null,sa(a.g,g),Ka(a)}a.g.l=null;d.call(a.g,f);return Ka(a)}function Ka(a){for(;a.g.g;)try{var b=a.h(a.g);if(b)return a.g.o=false,{value:b.value,done:false}}catch(c){a.g.h=void 0,sa(a.g,c);}a.g.o=false;if(a.g.i){b=a.g.i;a.g.i=null;if(b.li)throw b.Wh;return {value:b.return,done:true}}return {value:void 0,done:true}} function La(a){this.next=function(b){ra(a.g);a.g.l?b=Ja(a,a.g.l.next,b,a.g.u):(a.g.u(b),b=Ka(a));return b};this.throw=function(b){ra(a.g);a.g.l?b=Ja(a,a.g.l["throw"],b,a.g.u):(sa(a.g,b),b=Ka(a));return b};this.return=function(b){return Ia(a,b)};this[Symbol.iterator]=function(){return this};}function Ma(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function f(g){g.done?d(g.value):Promise.resolve(g.value).then(b,c).then(f,e);}f(a.next());})} function P(a){return Ma(new La(new Ga(a)))}function Oa(){for(var a=Number(this),b=[],c=a;c<arguments.length;c++)b[c-a]=arguments[c];return b} ea("Promise",function(a){function b(g){this.h=0;this.i=void 0;this.g=[];this.o=false;var h=this.j();try{g(h.resolve,h.reject);}catch(k){h.reject(k);}}function c(){this.g=null;}function d(g){return g instanceof b?g:new b(function(h){h(g);})}if(a)return a;c.prototype.h=function(g){if(this.g==null){this.g=[];var h=this;this.i(function(){h.l();});}this.g.push(g);};var e=da.setTimeout;c.prototype.i=function(g){e(g,0);};c.prototype.l=function(){for(;this.g&&this.g.length;){var g=this.g;this.g=[];for(var h=0;h<g.length;++h){var k= g[h];g[h]=null;try{k();}catch(l){this.j(l);}}}this.g=null;};c.prototype.j=function(g){this.i(function(){throw g;});};b.prototype.j=function(){function g(l){return function(m){k||(k=true,l.call(h,m));}}var h=this,k=false;return {resolve:g(this.G),reject:g(this.l)}};b.prototype.G=function(g){if(g===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(g instanceof b)this.I(g);else {a:switch(typeof g){case "object":var h=g!=null;break a;case "function":h=true;break a;default:h=false;}h?this.F(g):this.m(g);}}; b.prototype.F=function(g){var h=void 0;try{h=g.then;}catch(k){this.l(k);return}typeof h=="function"?this.J(h,g):this.m(g);};b.prototype.l=function(g){this.u(2,g);};b.prototype.m=function(g){this.u(1,g);};b.prototype.u=function(g,h){if(this.h!=0)throw Error("Cannot settle("+g+", "+h+"): Promise already settled in state"+this.h);this.h=g;this.i=h;this.h===2&&this.H();this.B();};b.prototype.H=function(){var g=this;e(function(){if(g.C()){var h=da.console;typeof h!=="undefined"&&h.error(g.i);}},1);};b.prototype.C= function(){if(this.o)return false;var g=da.CustomEvent,h=da.Event,k=da.dispatchEvent;if(typeof k==="undefined")return true;typeof g==="function"?g=new g("unhandledrejection",{cancelable:true}):typeof h==="function"?g=new h("unhandledrejection",{cancelable:true}):(g=da.document.createEvent("CustomEvent"),g.initCustomEvent("unhandledrejection",false,true,g));g.promise=this;g.reason=this.i;return k(g)};b.prototype.B=function(){if(this.g!=null){for(var g=0;g<this.g.length;++g)f.h(this.g[g]);this.g=null;}};var f=new c; b.prototype.I=function(g){var h=this.j();g.Qe(h.resolve,h.reject);};b.prototype.J=function(g,h){var k=this.j();try{g.call(h,k.resolve,k.reject);}catch(l){k.reject(l);}};b.prototype.then=function(g,h){function k(q,r){return typeof q=="function"?function(u){try{l(q(u));}catch(v){m(v);}}:r}var l,m,n=new b(function(q,r){l=q;m=r;});this.Qe(k(g,l),k(h,m));return n};b.prototype.catch=function(g){return this.then(void 0,g)};b.prototype.Qe=function(g,h){function k(){switch(l.h){case 1:g(l.i);break;case 2:h(l.i); break;default:throw Error("Unexpected state: "+l.h);}}var l=this;this.g==null?f.h(k):this.g.push(k);this.o=true;};b.resolve=d;b.reject=function(g){return new b(function(h,k){k(g);})};b.race=function(g){return new b(function(h,k){for(var l=t(g),m=l.next();!m.done;m=l.next())d(m.value).Qe(h,k);})};b.all=function(g){var h=t(g),k=h.next();return k.done?d([]):new b(function(l,m){function n(u){return function(v){q[u]=v;r--;r==0&&l(q);}}var q=[],r=0;do q.push(void 0),r++,d(k.value).Qe(n(q.length-1),m),k=h.next(); while(!k.done)})};return b});function Pa(a,b){return Object.prototype.hasOwnProperty.call(a,b)} ea("WeakMap",function(a){function b(k){this.g=(h+=Math.random()+1).toString();if(k){k=t(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1]);}}function c(){}function d(k){var l=typeof k;return l==="object"&&k!==null||l==="function"}function e(k){if(!Pa(k,g)){var l=new c;ba(k,g,{value:l});}}function f(k){var l=Object[k];l&&(Object[k]=function(m){if(m instanceof c)return m;Object.isExtensible(m)&&e(m);return l(m)});}if(function(){if(!a||!Object.seal)return false;try{var k=Object.seal({}),l=Object.seal({}), m=new a([[k,2],[l,3]]);if(m.get(k)!=2||m.get(l)!=3)return false;m.delete(k);m.set(l,4);return !m.has(k)&&m.get(l)==4}catch(n){return false}}())return a;var g="$jscomp_hidden_"+Math.random();f("freeze");f("preventExtensions");f("seal");var h=0;b.prototype.set=function(k,l){if(!d(k))throw Error("Invalid WeakMap key");e(k);if(!Pa(k,g))throw Error("WeakMap key fail: "+k);k[g][this.g]=l;return this};b.prototype.get=function(k){return d(k)&&Pa(k,g)?k[g][this.g]:void 0};b.prototype.has=function(k){return d(k)&&Pa(k, g)&&Pa(k[g],this.g)};b.prototype.delete=function(k){return d(k)&&Pa(k,g)&&Pa(k[g],this.g)?delete k[g][this.g]:false};return b}); ea("Map",function(a){function b(){var h={};return h.wc=h.next=h.head=h}function c(h,k){var l=h[1];return na(function(){if(l){for(;l.head!=h[1];)l=l.wc;for(;l.next!=l.head;)return l=l.next,{done:false,value:k(l)};l=null;}return {done:true,value:void 0}})}function d(h,k){var l=k&&typeof k;l=="object"||l=="function"?f.has(k)?l=f.get(k):(l=""+ ++g,f.set(k,l)):l="p_"+k;var m=h[0][l];if(m&&Pa(h[0],l))for(h=0;h<m.length;h++){var n=m[h];if(k!==k&&n.key!==n.key||k===n.key)return {id:l,list:m,index:h,entry:n}}return {id:l, list:m,index:-1,entry:void 0}}function e(h){this[0]={};this[1]=b();this.size=0;if(h){h=t(h);for(var k;!(k=h.next()).done;)k=k.value,this.set(k[0],k[1]);}}if(function(){if(!a||typeof a!="function"||!a.prototype.entries||typeof Object.seal!="function")return false;try{var h=Object.seal({x:4}),k=new a(t([[h,"s"]]));if(k.get(h)!="s"||k.size!=1||k.get({x:4})||k.set({x:4},"t")!=k||k.size!=2)return false;var l=k.entries(),m=l.next();if(m.done||m.value[0]!=h||m.value[1]!="s")return false;m=l.next();return m.done||m.value[0].x!= 4||m.value[1]!="t"||!l.next().done?false:true}catch(n){return false}}())return a;var f=new WeakMap;e.prototype.set=function(h,k){h=h===0?0:h;var l=d(this,h);l.list||(l.list=this[0][l.id]=[]);l.entry?l.entry.value=k:(l.entry={next:this[1],wc:this[1].wc,head:this[1],key:h,value:k},l.list.push(l.entry),this[1].wc.next=l.entry,this[1].wc=l.entry,this.size++);return this};e.prototype.delete=function(h){h=d(this,h);return h.entry&&h.list?(h.list.splice(h.index,1),h.list.length||delete this[0][h.id],h.entry.wc.next= h.entry.next,h.entry.next.wc=h.entry.wc,h.entry.head=null,this.size--,true):false};e.prototype.clear=function(){this[0]={};this[1]=this[1].wc=b();this.size=0;};e.prototype.has=function(h){return !!d(this,h).entry};e.prototype.get=function(h){return (h=d(this,h).entry)&&h.value};e.prototype.entries=function(){return c(this,function(h){return [h.key,h.value]})};e.prototype.keys=function(){return c(this,function(h){return h.key})};e.prototype.values=function(){return c(this,function(h){return h.value})};e.prototype.forEach= function(h,k){for(var l=this.entries(),m;!(m=l.next()).done;)m=m.value,h.call(k,m[1],m[0],this);};e.prototype[Symbol.iterator]=e.prototype.entries;var g=0;return e}); ea("Set",function(a){function b(c){this.g=new Map;if(c){c=t(c);for(var d;!(d=c.next()).done;)this.add(d.value);}this.size=this.g.size;}if(function(){if(!a||typeof a!="function"||!a.prototype.entries||typeof Object.seal!="function")return false;try{var c=Object.seal({x:4}),d=new a(t([c]));if(!d.has(c)||d.size!=1||d.add(c)!=d||d.size!=1||d.add({x:4})!=d||d.size!=2)return false;var e=d.entries(),f=e.next();if(f.done||f.value[0]!=c||f.value[1]!=c)return false;f=e.next();return f.done||f.value[0]==c||f.value[0].x!= 4||f.value[1]!=f.value[0]?false:e.next().done}catch(g){return false}}())return a;b.prototype.add=function(c){c=c===0?0:c;this.g.set(c,c);this.size=this.g.size;return this};b.prototype.delete=function(c){c=this.g.delete(c);this.size=this.g.size;return c};b.prototype.clear=function(){this.g.clear();this.size=0;};b.prototype.has=function(c){return this.g.has(c)};b.prototype.entries=function(){return this.g.entries()};b.prototype.values=function(){return this.g.values()};b.prototype.keys=b.prototype.values;b.prototype[Symbol.iterator]= b.prototype.values;b.prototype.forEach=function(c,d){var e=this;this.g.forEach(function(f){return c.call(d,f,f,e)});};return b});function Qa(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return {gi:e,v:f}}return {gi:-1,v:void 0}}ea("Array.prototype.findIndex",function(a){return a?a:function(b,c){return Qa(this,b,c).gi}}); function Ra(a,b){a instanceof String&&(a+="");var c=0,d=false,e={next:function(){if(!d&&c<a.length){var f=c++;return {value:b(f,a[f]),done:false}}d=true;return {done:true,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}ea("Array.prototype.values",function(a){return a?a:function(){return Ra(this,function(b,c){return c})}}); ea("Array.from",function(a){return a?a:function(b,c,d){c=c!=null?c:function(h){return h};var e=[],f=typeof Symbol!="undefined"&&Symbol.iterator&&b[Symbol.iterator];if(typeof f=="function"){b=f.call(b);for(var g=0;!(f=b.next()).done;)e.push(c.call(d,f.value,g++));}else for(f=b.length,g=0;g<f;g++)e.push(c.call(d,b[g],g));return e}});ea("Array.prototype.keys",function(a){return a?a:function(){return Ra(this,function(b){return b})}}); ea("Object.is",function(a){return a?a:function(b,c){return b===c?b!==0||1/b===1/c:b!==b&&c!==c}});ea("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(c<0&&(c=Math.max(c+e,0));c<e;c++){var f=d[c];if(f===b||Object.is(f,b))return true}return false}}); function Sa(a,b,c){if(a==null)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""}ea("String.prototype.includes",function(a){return a?a:function(b,c){return Sa(this,b,"includes").indexOf(b,c||0)!==-1}}); ea("String.fromCodePoint",function(a){return a?a:function(b){for(var c="",d=0;d<arguments.length;d++){var e=Number(arguments[d]);if(e<0||e>1114111||e!==Math.floor(e))throw new RangeError("invalid_code_point "+e);e<=65535?c+=String.fromCharCode(e):(e-=65536,c+=String.fromCharCode(e>>>10&1023|55296),c+=String.fromCharCode(e&1023|56320));}return c}}); ea("WeakSet",function(a){function b(c){this.g=new WeakMap;if(c){c=t(c);for(var d;!(d=c.next()).done;)this.add(d.value);}}if(function(){if(!a||!Object.seal)return false;try{var c=Object.seal({}),d=Object.seal({}),e=new a([c]);if(!e.has(c)||e.has(d))return false;e.delete(c);e.add(d);return !e.has(c)&&e.has(d)}catch(f){return false}}())return a;b.prototype.add=function(c){this.g.set(c,true);return this};b.prototype.has=function(c){return this.g.has(c)};b.prototype.delete=function(c){return this.g.delete(c)};return b}); ea("Array.prototype.find",function(a){return a?a:function(b,c){return Qa(this,b,c).v}});ea("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=Sa(this,b,"startsWith"),e=d.length,f=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var g=0;g<f&&c<e;)if(d[c++]!=b[g++])return false;return g>=f}});ea("Object.entries",function(a){return a?a:function(b){var c=[],d;for(d in b)Pa(b,d)&&c.push([d,b[d]]);return c}}); var Ta=typeof Object.assign=="function"?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Pa(d,e)&&(a[e]=d[e]);}return a};ea("Object.assign",function(a){return a||Ta});ea("Promise.prototype.finally",function(a){return a?a:function(b){return this.then(function(c){return Promise.resolve(b()).then(function(){return c})},function(c){return Promise.resolve(b()).then(function(){throw c;})})}}); ea("Array.prototype.entries",function(a){return a?a:function(){return Ra(this,function(b,c){return [b,c]})}});ea("Number.isNaN",function(a){return a?a:function(b){return typeof b==="number"&&isNaN(b)}});ea("String.prototype.repeat",function(a){return a?a:function(b){var c=Sa(this,null,"repeat");if(b<0||b>1342177279)throw new RangeError("Invalid count value");b|=0;for(var d="";b;)if(b&1&&(d+=c),b>>>=1)c+=c;return d}});ea("Number.EPSILON",function(){return 2.220446049250313E-16}); ea("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991});ea("Number.isFinite",function(a){return a?a:function(b){return typeof b!=="number"?false:!isNaN(b)&&b!==Infinity&&b!==-Infinity}});ea("Object.values",function(a){return a?a:function(b){var c=[],d;for(d in b)Pa(b,d)&&c.push(b[d]);return c}});ea("Math.log2",function(a){return a?a:function(b){return Math.log(b)/Math.LN2}}); ea("String.prototype.endsWith",function(a){return a?a:function(b,c){var d=Sa(this,b,"endsWith");c===void 0&&(c=d.length);c=Math.max(0,Math.min(c|0,d.length));for(var e=b.length;e>0&&c>0;)if(d[--c]!=b[--e])return false;return e<=0}});ea("Math.trunc",function(a){return a?a:function(b){b=Number(b);if(isNaN(b)||b===Infinity||b===-Infinity||b===0)return b;var c=Math.floor(Math.abs(b));return b<0?-c:c}});var Ua=this||self; function S(a,b){a=a.split(".");var c=Ua;a[0]in c||typeof c.execScript=="undefined"||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||b===void 0?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b;} function Va(a){this.g=Math.exp(Math.log(.5)/a);this.i=this.h=0;}Va.prototype.sample=function(a,b){var c=Math.pow(this.g,a);b=b*(1-c)+c*this.h;isNaN(b)||(this.h=b,this.i+=a);};function Wa(a){return a.h/(1-Math.pow(a.g,a.i))}function Xa(){this.h=new Va(2);this.j=new Va(5);this.g=0;this.i=128E3;this.l=16E3;}Xa.prototype.configure=function(a){this.i=a.minTotalBytes;this.l=a.minBytes;this.h.g=Math.exp(Math.log(.5)/a.fastHalfLife);this.j.g=Math.exp(Math.log(.5)/a.slowHalfLife);};Xa.prototype.sample=function(a,b){if(!(b<this.l)){var c=8E3*b/a;a/=1E3;this.g+=b;this.h.sample(a,c);this.j.sample(a,c);}};Xa.prototype.getBandwidthEstimate=function(a){return this.g<this.i?a:Math.min(Wa(this.h),Wa(this.j))};function Ya(){}function $a(){}function ab(){}function cb(a){var b=Oa.apply(1,arguments);db.has(a)||(db.add(a),ab.apply(Ya,x(b)));}function eb(){}function fb(){}function gb(){}var db=new Set; window.console&&((new Map).set(1,function(){return console.error.apply(console,x(Oa.apply(0,arguments)))}).set(2,function(){return console.warn.apply(console,x(Oa.apply(0,arguments)))}).set(3,function(){return console.info.apply(console,x(Oa.apply(0,arguments)))}).set(4,function(){return console.log.apply(console,x(Oa.apply(0,arguments)))}).set(5,function(){return console.debug.apply(console,x(Oa.apply(0,arguments)))}).set(6,function(){return console.debug.apply(console,x(Oa.apply(0,arguments)))}), ab=function(){return console.warn.apply(console,x(Oa.apply(0,arguments)))},$a=function(){console.error.apply(console,x(Oa.apply(0,arguments)));});function hb(a,b){return typeof a==="number"&&typeof b==="number"&&isNaN(a)&&isNaN(b)?true:a===b}function jb(a,b){b=a.indexOf(b);b>-1&&a.splice(b,1);}function kb(a,b,c){c||(c=hb);if(a.length!=b.length)return false;b=b.slice();a=t(a);for(var d=a.next(),e={};!d.done;e={mi:void 0},d=a.next()){e.mi=d.value;d=b.findIndex(function(f){return function(g){return c(f.mi,g)}}(e));if(d==-1)return false;b[d]=b[b.length-1];b.pop();}return b.length==0} function lb(a,b,c){if(a===b)return true;if(!a||!b)return a==b;c||(c=hb);if(a.length!=b.length)return false;for(var d=0;d<a.length;d++)if(!c(a[d],b[d]))return false;return true}function mb(){this.g=new Map;}p=mb.prototype;p.push=function(a,b){this.g.has(a)?this.g.get(a).push(b):this.g.set(a,[b]);};p.get=function(a){return this.g.has(a)?this.g.get(a).slice():null};p.remove=function(a,b){if(this.g.has(a)){var c=this.g.get(a).filter(function(d){return d!=b});this.g.set(a,c);c.length||this.g.delete(a);}};p.forEach=function(a){this.g.forEach(function(b,c){a(c,b);});};p.size=function(){return this.g.size};p.keys=function(){return Array.from(this.g.keys())};function nb(){this.g=new mb;}p=nb.prototype;p.release=function(){this.Pa();this.g=null;};p.D=function(a,b,c,d){this.g&&(a=new ob(a,b,c,d),this.g.push(b,a));};p.Ba=function(a,b,c,d){function e(g){f.Ma(a,b,e);c(g);}var f=this;this.D(a,b,e,d);};p.Ma=function(a,b,c){if(this.g){var d=this.g.get(b)||[];d=t(d);for(var e=d.next();!e.done;e=d.next())e=e.value,e.target!=a||c!=e.listener&&c||(e.Ma(),this.g.remove(b,e));}}; p.Pa=function(){if(this.g){for(var a=[],b=t(this.g.g.values()),c=b.next();!c.done;c=b.next())a.push.apply(a,x(c.value));a=t(a);for(b=a.next();!b.done;b=a.next())b.value.Ma();this.g.g.clear();}};S("shaka.util.EventManager",nb);nb.prototype.removeAll=nb.prototype.Pa;nb.prototype.unlisten=nb.prototype.Ma;nb.prototype.listenOnce=nb.prototype.Ba;nb.prototype.listen=nb.prototype.D;nb.prototype.release=nb.prototype.release; function ob(a,b,c,d){this.target=a;this.type=b;this.listener=c;this.g=pb(a,d);this.target.addEventListener(b,c,this.g);}ob.prototype.Ma=function(){this.target.removeEventListener(this.type,this.listener,this.g);this.listener=this.target=null;this.g=false;};function pb(a,b){if(b==void 0)return false;if(typeof b=="boolean")return b;var c=new Set(["passive","capture"]);Object.keys(b).filter(function(d){return !c.has(d)});return qb(a)?b:b.capture||false} function qb(a){var b=rb;if(b==void 0){b=false;try{var c={},d={get:function(){b=true;return false}};Object.defineProperty(c,"passive",d);Object.defineProperty(c,"capture",d);d=function(){};a.addEventListener("test",d,c);a.removeEventListener("test",d,c);}catch(e){b=false;}rb=b;}return b||false}var rb=void 0;S("shaka.config.AutoShowText",{NEVER:0,ALWAYS:1,IF_PREFERRED_TEXT_LANGUAGE:2,IF_SUBTITLES_MAY_BE_NEEDED:3});function sb(a){this.h=a;this.g=void 0;}sb.prototype.value=function(){this.g===void 0&&(this.g=this.h());return this.g};/* @license Shaka Player Copyright 2025 Google LLC SPDX-License-Identifier: Apache-2.0 */ function tb(){return ub.value()}var vb=null,wb=null,ub=new sb(function(){var a=void 0;vb&&(a=vb());!a&&wb&&(a=wb());return a});function xb(a,b){this.g=a;this.h=b;}xb.prototype.toString=function(){return "v"+this.g+"."+this.h};function yb(a,b){var c=new xb(5,0),d=zb,e=d.g,f=c.h-e.h;((c.g-e.g||f)>0?d.i:d.h)(d.g,c,a,b);}function Ab(a,b,c,d){ab([c,"has been deprecated and will be removed in",b,". We are currently at version",a,". Additional information:",d].join(" "));}function Bb(a,b,c,d){$a([c,"has been deprecated and has been removed in",b,". We are now at version",a,". Additional information:",d].join(" "));}var zb=null;/* @license Copyright 2008 The Closure Library Authors SPDX-License-Identifier: Apache-2.0 */ var Cb=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");/* @license Copyright 2006 The Closure Library Authors SPDX-License-Identifier: Apache-2.0 */ function Db(a){var b;a instanceof Db?(Eb(this,a.bc),this.hd=a.hd,Fb(this,a.Db),Gb(this,a.Cd),this.Sb=a.Sb,Hb(this,a.g.clone()),this.Rc=a.Rc):a&&(b=String(a).match(Cb))?(Eb(this,b[1]||"",true),this.hd=Ib(b[2]||""),Fb(this,b[3]||"",true),Gb(this,b[4]),this.Sb=Ib(b[5]||"",true),Hb(this,b[6]||"",true),this.Rc=Ib(b[7]||"")):this.g=new Jb(null);}p=Db.prototype;p.bc="";p.hd="";p.Db="";p.Cd=null;p.Sb="";p.Rc=""; p.toString=function(){var a=[],b=this.bc;b&&a.push(Kb(b,Lb,true),":");if(b=this.Db){a.push("//");var c=this.hd;c&&a.push(Kb(c,Lb,true),"@");a.push(encodeURIComponent(b).replace(/%25([0-9a-fA-F]{2})/g,"%$1"));b=this.Cd;b!=null&&a.push(":",String(b));}if(b=this.Sb)this.Db&&b.charAt(0)!="/"&&a.push("/"),a.push(Kb(b,b.charAt(0)=="/"?Mb:Nb,true));(b=this.g.toString())&&a.push("?",b);(b=this.Rc)&&a.push("#",Kb(b,Ob));return a.join("")}; p.resolve=function(a){var b=this.clone();b.bc==="data"&&(b=new Db);var c=!!a.bc;c?Eb(b,a.bc):c=!!a.hd;c?b.hd=a.hd:c=!!a.Db;c?Fb(b,a.Db):c=a.Cd!=null;var d=a.Sb;if(c)Gb(b,a.Cd);else if(c=!!a.Sb){if(d.charAt(0)!="/")if(this.Db&&!this.Sb)d="/"+d;else {var e=b.Sb.lastIndexOf("/");e!=-1&&(d=b.Sb.substr(0,e+1)+d);}if(d==".."||d==".")d="";else if(d.indexOf("./")!=-1||d.indexOf("/.")!=-1){e=d.lastIndexOf("/",0)==0;d=d.split("/");for(var f=[],g=0;g<d.length;){var h=d[g++];h=="."?e&&g==d.length&&f.push(""):h== ".."?((f.length>1||f.length==1&&f[0]!="")&&f.pop(),e&&g==d.length&&f.push("")):(f.push(h),e=true);}d=f.join("/");}}c?b.Sb=d:c=a.g.toString()!=="";c?Hb(b,a.g.clone()):c=!!a.Rc;c&&(b.Rc=a.Rc);return b};p.clone=function(){return new Db(this)};function Eb(a,b,c){a.bc=c?Ib(b,true):b;a.bc&&(a.bc=a.bc.replace(/:$/,""));}function Fb(a,b,c){a.Db=c?Ib(b,true):b;}function Gb(a,b){if(b){b=Number(b);if(isNaN(b)||b<0)throw Error("Bad port number "+b);a.Cd=b;}else a.Cd=null;} function Hb(a,b,c){b instanceof Jb?a.g=b:(c||(b=Kb(b,Pb)),a.g=new Jb(b));}function Ib(a,b){return a?b?decodeURI(a):decodeURIComponent(a):""}function Kb(a,b,c){return a!=null?(a=encodeURI(a).replace(b,Qb),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function Qb(a){a=a.charCodeAt(0);return "%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Lb=/[#\/\?@]/g,Nb=/[#\?:]/g,Mb=/[#\?]/g,Pb=/[#\?@]/g,Ob=/#/g;function Jb(a){this.g=a||null;} function Rb(a){if(!a.eb&&(a.eb=new Map,a.Sd=0,a.g))for(var b=a.g.split("&"),c=0;c<b.length;c++){var d=b[c].indexOf("="),e=null;if(d>=0){var f=b[c].substring(0,d);e=b[c].substring(d+1);}else f=b[c];f=decodeURIComponent(f);e=e||"";a.add(f,decodeURIComponent(e));}}p=Jb.prototype;p.eb=null;p.Sd=null;function Sb(a){Rb(a);return a.Sd}p.add=function(a,b){Rb(this);this.g=null;var c=this.eb.has(a)?this.eb.get(a):null;c||this.eb.set(a,c=[]);c.push(b);this.Sd++;return this}; p.set=function(a,b){Rb(this);this.g=null;this.eb.has(a)?this.eb.set(a,[b]):this.add(a,b);return this};p.get=function(a){Rb(this);return this.eb.get(a)||[]};p.toString=function(){if(this.g)return this.g;if(!this.eb||!this.eb.size)return "";for(var a=[],b=t(this.eb.keys()),c=b.next();!c.done;c=b.next()){var d=c.value;c=encodeURIComponent(d);d=this.eb.get(d);for(var e=0;e<d.length;e++){var f=c;d[e]!==""&&(f+="="+encodeURIComponent(d[e]));a.push(f);}}return this.g=a.join("&")}; p.clone=function(){var a=new Jb;a.g=this.g;if(this.eb){for(var b=new Map,c=t(this.eb),d=c.next();!d.done;d=c.next()){var e=t(d.value);d=e.next().value;e=e.next().value;b.set(d,e.concat());}a.eb=b;a.Sd=this.Sd;}return a};function Tb(){}function Ub(a,b){if(!a&&!b)return true;if(!a||!b||a.byteLength!=b.byteLength)return false;if((ArrayBuffer.isView(a)?a.buffer:a)==(ArrayBuffer.isView(b)?b.buffer:b)&&(a.byteOffset||0)==(b.byteOffset||0))return true;var c=Vb(a);b=Vb(b);for(var d=0;d<a.byteLength;d++)if(c[d]!=b[d])return false;return true}function Wb(a){return ArrayBuffer.isView(a)?a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:(new Uint8Array(a)).buffer:a} function Vb(a,b,c){c=c===void 0?Infinity:c;return Yb(a,b===void 0?0:b,c,Uint8Array)}function $b(a,b,c){c=c===void 0?Infinity:c;return Yb(a,b===void 0?0:b,c,Uint16Array)}function ac(a,b,c){c=c===void 0?Infinity:c;return Yb(a,b===void 0?0:b,c,DataView)} function Yb(a,b,c,d){var e=ArrayBuffer.isView(a)?a.buffer:a,f=1;"BYTES_PER_ELEMENT"in d&&(f=d.BYTES_PER_ELEMENT);var g=((a.byteOffset||0)+a.byteLength)/f;a=Math.floor(Math.max(0,Math.min(((a.byteOffset||0)+b)/f,g)));return new d(e,a,Math.floor(Math.min(a+Math.max(c,0),g))-a)}S("shaka.util.BufferUtils",Tb);Tb.toDataView=ac;Tb.toUint16=$b;Tb.toUint8=Vb;Tb.toArrayBuffer=Wb;Tb.equal=Ub;function U(a,b,c){var d=Oa.apply(3,arguments);this.severity=a;this.category=b;this.code=c;this.data=d;this.handled=false;this.message="Shaka Error "+this.code;try{throw Error(this.message||"Shaka Error");}catch(e){this.stack=e.stack;}}U.prototype.toString=function(){return "shaka.util.Error "+JSON.stringify(this,null," ")};S("shaka.util.Error",U);U.Severity={RECOVERABLE:1,CRITICAL:2};U.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9,ADS:10}; U.Code={UNSUPPORTED_SCHEME:1E3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,MALFORMED_TEST_URI:1008,UNEXPECTED_TEST_REQUEST:1009,ATTEMPTS_EXHAUSTED:1010,SEGMENT_MISSING:1011,INVALID_TEXT_HEADER:2E3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,INVALID_MP4_CEA:2010,TEXT_COULD_NOT_GUESS_MIME_TYPE:2011, CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS:2012,TEXT_ONLY_WEBVTT_SRC_EQUALS:2013,MISSING_TEXT_PLUGIN:2014,UNSUPPORTED_EXTERNAL_THUMBNAILS_URI:2017,BUFFER_READ_OUT_OF_BOUNDS:3E3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011, WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,TRANSMUXING_FAILED:3018,CONTENT_TRANSFORMATION_FAILED:3019,MSS_MISSING_DATA_FOR_TRANSMUXING:3020,MSS_TRANSMUXING_FAILED:3022,TRANSMUXING_NO_VIDEO_DATA:3023,STREAMING_NOT_ALLOWED:3024,UNABLE_TO_GUESS_MANIFEST_TYPE:4E3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004, DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,RESTRICTIONS_CANNOT_BE_MET:4012,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026, DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,CONTENT_UNSUPPORTED_BY_BROWSER:4032,CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM:4033,NO_VARIANTS:4036,PERIOD_FLATTENING_FAILED:4037,INCONSISTENT_DRM_ACROSS_PERIODS:4038,HLS_VARIABLE_NOT_FOUND:4039,HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED:4040,HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED:4041,NO_WEB_CRYPTO_API:4042,CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM:4045,MSS_INVALID_XML:4046,MSS_LIVE_CONTENT_NOT_SUPPORTED:4047,AES_128_INVALID_IV_LENGTH:4048, AES_128_INVALID_KEY_LENGTH:4049,DASH_CONFLICTING_AES_128:4050,DASH_UNSUPPORTED_AES_128:4051,DASH_INVALID_PATCH:4052,HLS_EMPTY_MEDIA_PLAYLIST:4053,DASH_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED:4054,CANNOT_ADD_EXTERNAL_CHAPTERS_TO_LIVE_STREAM:4055,STREAMING_ENGINE_STARTUP_INVALID_STATE:5006,NO_RECOGNIZED_KEY_SYSTEMS:6E3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006, LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,SERVER_CERTIFICATE_REQUIRED:6015,INIT_DATA_TRANSFORM_ERROR:6016,SERVER_CERTIFICATE_REQUEST_FAILED:6017,MIN_HDCP_VERSION_NOT_MATCH:6018,ERROR_CHECKING_HDCP_VERSION:6019,MISSING_EME_SUPPORT:6020,LOAD_INTERRUPTED:7E3,OPERATION_ABORTED:7001,NO_VIDEO_ELEMENT:7