From 966eafc44b08617d42aa4216f3f10be3b665840e Mon Sep 17 00:00:00 2001 From: PierreMesure Date: Fri, 8 Nov 2024 06:49:19 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20PierreMe?= =?UTF-8?q?sure/hejulf.se@05f5f8fd340842892dd2ebc1877f809f162fd555=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 13 +------ .../8WDTZZl1B6BZSKyoGS9WV/_buildManifest.js | 1 - _next/static/chunks/240-099a450812900649.js | 1 + _next/static/chunks/439-4f5dc6f54fc3c57e.js | 1 - .../chunks/d6e1aeb5-82b384d9c81e9ae5.js | 34 +++++++++++++++++++ .../chunks/d6e1aeb5-b67145be142cd9e2.js | 1 - .../chunks/framework-a6b3d2fb26bce5d1.js | 1 + .../chunks/framework-e70c6273bfe3f237.js | 1 - _next/static/chunks/main-1c0dbd07ea791e85.js | 1 + _next/static/chunks/main-da3fd3fb2b129097.js | 1 - .../chunks/pages/_app-4159d3b1486e8564.js | 1 - .../chunks/pages/_app-bc94df786567e722.js | 1 + .../chunks/pages/_error-a4ba2246ff8fb532.js | 1 - .../chunks/pages/_error-fde50cb7f1ab27e0.js | 1 + .../chunks/pages/index-23cbf76784208cbf.js | 1 + .../chunks/pages/index-464e3211c4d816ce.js | 1 - .../chunks/polyfills-42372ed130431b0a.js | 1 + .../chunks/polyfills-c67a75d1b6f99dc8.js | 1 - .../static/chunks/webpack-5752944655d749a0.js | 1 - .../static/chunks/webpack-8cac0b4b405cede1.js | 1 + _next/static/css/04d7f1e9fff99a9c.css | 1 - _next/static/css/0a431a927ecc6b6d.css | 1 + _next/static/css/1f5fd3205098cc2c.css | 1 + _next/static/css/63c51a095b60281c.css | 1 - _next/static/css/f28589ae613b5426.css | 1 + .../jv4aHV-OkGNJzFo5_CSFo/_buildManifest.js | 1 + .../_ssgManifest.js | 0 index.html | 2 +- 28 files changed, 48 insertions(+), 25 deletions(-) delete mode 100644 _next/static/8WDTZZl1B6BZSKyoGS9WV/_buildManifest.js create mode 100644 _next/static/chunks/240-099a450812900649.js delete mode 100644 _next/static/chunks/439-4f5dc6f54fc3c57e.js create mode 100644 _next/static/chunks/d6e1aeb5-82b384d9c81e9ae5.js delete mode 100644 _next/static/chunks/d6e1aeb5-b67145be142cd9e2.js create mode 100644 _next/static/chunks/framework-a6b3d2fb26bce5d1.js delete mode 100644 _next/static/chunks/framework-e70c6273bfe3f237.js create mode 100644 _next/static/chunks/main-1c0dbd07ea791e85.js delete mode 100644 _next/static/chunks/main-da3fd3fb2b129097.js delete mode 100644 _next/static/chunks/pages/_app-4159d3b1486e8564.js create mode 100644 _next/static/chunks/pages/_app-bc94df786567e722.js delete mode 100644 _next/static/chunks/pages/_error-a4ba2246ff8fb532.js create mode 100644 _next/static/chunks/pages/_error-fde50cb7f1ab27e0.js create mode 100644 _next/static/chunks/pages/index-23cbf76784208cbf.js delete mode 100644 _next/static/chunks/pages/index-464e3211c4d816ce.js create mode 100644 _next/static/chunks/polyfills-42372ed130431b0a.js delete mode 100644 _next/static/chunks/polyfills-c67a75d1b6f99dc8.js delete mode 100644 _next/static/chunks/webpack-5752944655d749a0.js create mode 100644 _next/static/chunks/webpack-8cac0b4b405cede1.js delete mode 100644 _next/static/css/04d7f1e9fff99a9c.css create mode 100644 _next/static/css/0a431a927ecc6b6d.css create mode 100644 _next/static/css/1f5fd3205098cc2c.css delete mode 100644 _next/static/css/63c51a095b60281c.css create mode 100644 _next/static/css/f28589ae613b5426.css create mode 100644 _next/static/jv4aHV-OkGNJzFo5_CSFo/_buildManifest.js rename _next/static/{8WDTZZl1B6BZSKyoGS9WV => jv4aHV-OkGNJzFo5_CSFo}/_ssgManifest.js (100%) diff --git a/404.html b/404.html index abef9360..2bd344d5 100644 --- a/404.html +++ b/404.html @@ -1,12 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/_next/static/8WDTZZl1B6BZSKyoGS9WV/_buildManifest.js b/_next/static/8WDTZZl1B6BZSKyoGS9WV/_buildManifest.js deleted file mode 100644 index feeaf3b9..00000000 --- a/_next/static/8WDTZZl1B6BZSKyoGS9WV/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/d6e1aeb5-b67145be142cd9e2.js","static/css/04d7f1e9fff99a9c.css","static/chunks/439-4f5dc6f54fc3c57e.js","static/chunks/pages/index-464e3211c4d816ce.js"],"/_error":["static/chunks/pages/_error-a4ba2246ff8fb532.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/chunks/240-099a450812900649.js b/_next/static/chunks/240-099a450812900649.js new file mode 100644 index 00000000..0637c097 --- /dev/null +++ b/_next/static/chunks/240-099a450812900649.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[240],{7222:(t,e,r)=>{"use strict";r.d(e,{Af:()=>p,Ar:()=>f,Bu:()=>h,L7:()=>d,Sk:()=>l,WG:()=>c,W_:()=>o,hc:()=>a});var n=r(9840),i=r.n(n),a=function(t){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer},o=function(t){return t instanceof Uint8Array?t:(Array.isArray(t)||a(t)||t instanceof ArrayBuffer||(t="number"!=typeof t||"number"==typeof t&&t!=t?0:[t]),new Uint8Array(t&&t.buffer||t,t&&t.byteOffset||0,t&&t.byteLength||0))},s=i().BigInt||Number,u=[s("0x1"),s("0x100"),s("0x10000"),s("0x1000000"),s("0x100000000"),s("0x10000000000"),s("0x1000000000000"),s("0x100000000000000"),s("0x10000000000000000")],l=(function(){var t=new Uint16Array([65484]),e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);255===e[0]||e[0]}(),function(t,e){var r=void 0===e?{}:e,n=r.signed,i=r.le,a=void 0!==i&&i;t=o(t);var l=a?"reduce":"reduceRight",c=(t[l]?t[l]:Array.prototype[l]).call(t,function(e,r,n){var i=a?n:Math.abs(n+1-t.length);return e+s(r)*u[i]},s(0));if(void 0!==n&&n){var f=u[t.length]/s(2)-s(1);(c=s(c))>f&&(c-=f,c-=f,c-=s(2))}return Number(c)}),c=function(t,e){var r=(void 0===e?{}:e).le,n=void 0!==r&&r;("bigint"!=typeof t&&"number"!=typeof t||"number"==typeof t&&t!=t)&&(t=0);for(var i=Math.ceil((t=s(t)).toString(2).length/8),a=new Uint8Array(new ArrayBuffer(i)),o=0;o=e.length&&l.call(e,function(e,r){return e===(u[r]?u[r]&t[a+r]:t[a+r])})}},279:(t,e,r)=>{"use strict";r.d(e,{BX:()=>c,Et:()=>u,TY:()=>h,UD:()=>p,YZ:()=>d,Yg:()=>g,dv:()=>m,fz:()=>f,tB:()=>l});var n=r(9840),i=r.n(n),a={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},o=["video","audio","text"],s=["Video","Audio","Text"],u=function(t){return t?t.replace(/avc1\.(\d+)\.(\d+)/i,function(t,e,r){return"avc1."+("00"+Number(e).toString(16)).slice(-2)+"00"+("00"+Number(r).toString(16)).slice(-2)}):t},l=function(t){void 0===t&&(t="");var e=t.split(","),r=[];return e.forEach(function(t){var e;t=t.trim(),o.forEach(function(n){var i=a[n].exec(t.toLowerCase());if(i&&!(i.length<=1)){e=n;var o=t.substring(0,i[1].length),s=t.replace(o,"");r.push({type:o,details:s,mediaType:n})}}),e||r.push({type:t,details:"",mediaType:"unknown"})}),r},c=function(t,e){if(!t.mediaGroups.AUDIO||!e)return null;var r=t.mediaGroups.AUDIO[e];if(!r)return null;for(var n in r){var i=r[n];if(i.default&&i.playlists)return l(i.playlists[0].attributes.CODECS)}return null},f=function(t){return void 0===t&&(t=""),a.audio.test(t.trim().toLowerCase())},p=function(t){if(t&&"string"==typeof t){var e,r=t.toLowerCase().split(",").map(function(t){return u(t.trim())}),n="video";1===r.length&&f(r[0])?n="audio":1===r.length&&(void 0===(e=r[0])&&(e=""),a.text.test(e.trim().toLowerCase()))&&(n="application");var i="mp4";return r.every(function(t){return a.mp4.test(t)})?i="mp4":r.every(function(t){return a.webm.test(t)})?i="webm":r.every(function(t){return a.ogg.test(t)})&&(i="ogg"),n+"/"+i+';codecs="'+t+'"'}},h=function(t,e){return void 0===t&&(t=""),void 0===e&&(e=!1),i().MediaSource&&i().MediaSource.isTypeSupported&&i().MediaSource.isTypeSupported(p(t))||e&&i().ManagedMediaSource&&i().ManagedMediaSource.isTypeSupported&&i().ManagedMediaSource.isTypeSupported(p(t))||!1},d=function(t){return void 0===t&&(t=""),t.toLowerCase().split(",").every(function(t){t=t.trim();for(var e=0;e{"use strict";r.d(e,{ne:()=>A,J2:()=>N});var n,i=r(7222);new Uint8Array([79,112,117,115,72,101,97,100]);var a=function(t){return"string"==typeof t?(0,i.Af)(t):t},o=function(t){t=(0,i.W_)(t);for(var e=[],r=0;t.length>r;){var a=t[r],o=0,s=0,u=t[++s];for(s++;128&u;)o=(127&u)<<7,u=t[s],s++;o+=127&u;for(var l=0;l>>0,c=e.subarray(u+4,u+8);if(0===l)break;var f=u+l;if(f>e.length){if(n)break;f=e.length}var p=e.subarray(u+8,f);(0,i.L7)(c,r[0])&&(1===r.length?s.push(p):s.push.apply(s,t(p,r.slice(1),n))),u=f}return s},u={EBML:(0,i.W_)([26,69,223,163]),DocType:(0,i.W_)([66,130]),Segment:(0,i.W_)([24,83,128,103]),SegmentInfo:(0,i.W_)([21,73,169,102]),Tracks:(0,i.W_)([22,84,174,107]),Track:(0,i.W_)([174]),TrackNumber:(0,i.W_)([215]),DefaultDuration:(0,i.W_)([35,227,131]),TrackEntry:(0,i.W_)([174]),TrackType:(0,i.W_)([131]),FlagDefault:(0,i.W_)([136]),CodecID:(0,i.W_)([134]),CodecPrivate:(0,i.W_)([99,162]),VideoTrack:(0,i.W_)([224]),AudioTrack:(0,i.W_)([225]),Cluster:(0,i.W_)([31,67,182,117]),Timestamp:(0,i.W_)([231]),TimestampScale:(0,i.W_)([42,215,177]),BlockGroup:(0,i.W_)([160]),BlockDuration:(0,i.W_)([155]),Block:(0,i.W_)([161]),SimpleBlock:(0,i.W_)([163])},l=[128,64,32,16,8,4,2,1],c=function(t){for(var e=1,r=0;r=r.length)return r.length;var a=f(r,n,!1);if((0,i.L7)(e.bytes,a.bytes))return n;var o=f(r,n+a.length);return t(e,r,n+o.length+o.value+a.length)},d=function t(e,r){r=Array.isArray(n=r)?n.map(function(t){return p(t)}):[p(n)],e=(0,i.W_)(e);var n,a=[];if(!r.length)return a;for(var o=0;oe.length?e.length:l+u.value,d=e.subarray(l,c);(0,i.L7)(r[0],s.bytes)&&(1===r.length?a.push(d):a=a.concat(t(d,r.slice(1)))),o+=s.length+u.length+d.length}return a},g=r(1320),m=(0,i.W_)([0,0,0,1]),b=(0,i.W_)([0,0,1]),y=(0,i.W_)([0,0,3]),v=function(t){for(var e=[],r=1;r>1&63),-1!==r.indexOf(l)&&(a=o+u),o+=u+("h264"===e?1:2)}return t.subarray(0,0)},D={webm:(0,i.W_)([119,101,98,109]),matroska:(0,i.W_)([109,97,116,114,111,115,107,97]),flac:(0,i.W_)([102,76,97,67]),ogg:(0,i.W_)([79,103,103,83]),ac3:(0,i.W_)([11,119]),riff:(0,i.W_)([82,73,70,70]),avi:(0,i.W_)([65,86,73]),wav:(0,i.W_)([87,65,86,69]),"3gp":(0,i.W_)([102,116,121,112,51,103]),mp4:(0,i.W_)([102,116,121,112]),fmp4:(0,i.W_)([115,116,121,112]),mov:(0,i.W_)([102,116,121,112,113,116]),moov:(0,i.W_)([109,111,111,118]),moof:(0,i.W_)([109,111,111,102])},T={aac:function(t){var e=(0,g.A)(t);return(0,i.L7)(t,[255,16],{offset:e,mask:[255,22]})},mp3:function(t){var e=(0,g.A)(t);return(0,i.L7)(t,[255,2],{offset:e,mask:[255,6]})},webm:function(t){var e=d(t,[u.EBML,u.DocType])[0];return(0,i.L7)(e,D.webm)},mkv:function(t){var e=d(t,[u.EBML,u.DocType])[0];return(0,i.L7)(e,D.matroska)},mp4:function(t){return!(T["3gp"](t)||T.mov(t))&&(!!((0,i.L7)(t,D.mp4,{offset:4})||(0,i.L7)(t,D.fmp4,{offset:4})||(0,i.L7)(t,D.moof,{offset:4})||(0,i.L7)(t,D.moov,{offset:4}))||void 0)},mov:function(t){return(0,i.L7)(t,D.mov,{offset:4})},"3gp":function(t){return(0,i.L7)(t,D["3gp"],{offset:4})},ac3:function(t){var e=(0,g.A)(t);return(0,i.L7)(t,D.ac3,{offset:e})},ts:function(t){if(t.length<189&&t.length>=1)return 71===t[0];for(var e=0;e+1880}},7860:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(9840),i=r.n(n),a=r(2928).Buffer;function o(t){for(var e=i().atob?i().atob(t):a.from(t,"base64").toString("binary"),r=new Uint8Array(e.length),n=0;n{"use strict";r.d(e,{A:()=>o});var n=r(7222),i=(0,n.W_)([73,68,51]),a=function(t,e){void 0===e&&(e=0);var r=(t=(0,n.W_)(t))[e+5],i=t[e+6]<<21|t[e+7]<<14|t[e+8]<<7|t[e+9];return(16&r)>>4?i+20:i+10},o=function t(e,r){return(void 0===r&&(r=0),(e=(0,n.W_)(e)).length-r<10||!(0,n.L7)(e,i,{offset:r}))?r:(r+=a(e,r),t(e,r))}},4866:(t,e,r)=>{"use strict";r.d(e,{I:()=>a});var n=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,i=/^application\/dash\+xml/i,a=function(t){return n.test(t)?"hls":i.test(t)?"dash":"application/vnd.videojs.vhs+json"===t?"vhs-json":null}},7098:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(9840),i=r.n(n),a="https://example.com";let o=function(t,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(t)&&(t=i().location&&i().location.href||"");var r=/^\/\//.test(t),n=!i().location&&!/\/\//i.test(t),o=new URL(e,t=new(i()).URL(t,i().location||a));return n?o.href.slice(a.length):r?o.href.slice(o.protocol.length):o.href}},7495:(t,e,r)=>{"use strict";var n=r(9840);t.exports=function(t,e){return void 0===e&&(e=!1),function(r,i,a){if(r){t(r);return}if(i.statusCode>=400&&i.statusCode<=599){var o=a;if(e){if(n.TextDecoder){var s,u=(void 0===(s=i.headers&&i.headers["content-type"])&&(s=""),s.toLowerCase().split(";").reduce(function(t,e){var r=e.split("="),n=r[0],i=r[1];return"charset"===n.trim()?i.trim():t},"utf-8"));try{o=new TextDecoder(u).decode(a)}catch(t){}}else o=String.fromCharCode.apply(null,new Uint8Array(a))}t({cause:o});return}t(null,a)}}},1036:(t,e,r)=>{"use strict";var n=r(9840),i=r(4634),a=r(7056),o=r(6162),s=r(8670);c.httpHandler=r(7495),c.requestInterceptorsStorage=new o,c.responseInterceptorsStorage=new o,c.retryManager=new s;var u=function(t){var e={};return t&&t.trim().split("\n").forEach(function(t){var r=t.indexOf(":"),n=t.slice(0,r).trim().toLowerCase(),i=t.slice(r+1).trim();void 0===e[n]?e[n]=i:Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]}),e};function l(t,e,r){var n=t;return a(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=i({},e,{uri:t}),n.callback=r,n}function c(t,e,r){return f(e=l(t,e,r))}function f(t){if(void 0===t.callback)throw Error("callback argument missing");if(t.requestType&&c.requestInterceptorsStorage.getIsEnabled()){var e,r,n,i={uri:t.uri||t.url,headers:t.headers||{},body:t.body,metadata:t.metadata||{},retry:t.retry,timeout:t.timeout},a=c.requestInterceptorsStorage.execute(t.requestType,i);t.uri=a.uri,t.headers=a.headers,t.body=a.body,t.metadata=a.metadata,t.retry=a.retry,t.timeout=a.timeout}var o=!1,s=function(e,r,n){o||(o=!0,t.callback(e,r,n))};function l(e){if(clearTimeout(n),clearTimeout(t.retryTimeout),e instanceof Error||(e=Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,!r&&c.retryManager.getIsEnabled()&&t.retry&&t.retry.shouldRetry()){t.retryTimeout=setTimeout(function(){t.retry.moveToNextAttempt(),t.xhr=h,f(t)},t.retry.getCurrentFuzzedDelay());return}if(t.requestType&&c.responseInterceptorsStorage.getIsEnabled()){var i={headers:E.headers||{},body:E.body,responseUrl:h.responseURL,responseType:h.responseType},a=c.responseInterceptorsStorage.execute(t.requestType,i);E.body=a.body,E.headers=a.headers}return s(e,E)}function p(){if(!r){clearTimeout(n),clearTimeout(t.retryTimeout);var e,i=E,a=null;if(0!==(e=t.useXDR&&void 0===h.status?200:1223===h.status?204:h.status)?(i={body:function(){var t=void 0;if(t=h.response?h.response:h.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(h),v)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:g,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(i.headers=u(h.getAllResponseHeaders()))):a=Error("Internal XMLHttpRequest Error"),t.requestType&&c.responseInterceptorsStorage.getIsEnabled()){var o={headers:i.headers||{},body:i.body,responseUrl:h.responseURL,responseType:h.responseType},l=c.responseInterceptorsStorage.execute(t.requestType,o);i.body=l.body,i.headers=l.headers}return s(a,i,i.body)}}var h=t.xhr||null;h||(h=t.cors||t.useXDR?new c.XDomainRequest:new c.XMLHttpRequest);var d=h.url=t.uri||t.url,g=h.method=t.method||"GET",m=t.body||t.data,b=h.headers=t.headers||{},y=!!t.sync,v=!1,E={body:void 0,headers:{},statusCode:0,method:g,url:d,rawRequest:h};if("json"in t&&!1!==t.json&&(v=!0,b.accept||b.Accept||(b.Accept="application/json"),"GET"!==g&&"HEAD"!==g&&(b["content-type"]||b["Content-Type"]||(b["Content-Type"]="application/json"),m=JSON.stringify(!0===t.json?m:t.json))),h.onreadystatechange=function(){4!==h.readyState||c.responseInterceptorsStorage.getIsEnabled()||setTimeout(p,0)},h.onload=p,h.onerror=l,h.onprogress=function(){},h.onabort=function(){r=!0,clearTimeout(t.retryTimeout)},h.ontimeout=l,h.open(g,d,!y,t.username,t.password),y||(h.withCredentials=!!t.withCredentials),!y&&t.timeout>0&&(n=setTimeout(function(){if(!r){r=!0,h.abort("timeout");var t=Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",l(t)}},t.timeout)),h.setRequestHeader)for(e in b)b.hasOwnProperty(e)&&h.setRequestHeader(e,b[e]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(h.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(h),h.send(m||null),h}t.exports=c,t.exports.default=c,c.XMLHttpRequest=n.XMLHttpRequest||function(){},c.XDomainRequest="withCredentials"in new c.XMLHttpRequest?c.XMLHttpRequest:n.XDomainRequest,function(t,e){for(var r=0;r{"use strict";function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(i);!(n=a()).done;){var o=n.value;try{r=o(r)}catch(t){}}return r},t}();t.exports=r},8670:t=>{"use strict";var e=function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=t.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(t){this.maxAttempts_=t},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(t){this.delayFactor_=t},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(t){this.fuzzFactor_=t},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(t){this.initialDelay_=t},e.createRetry=function(t){var e=void 0===t?{}:t,n=e.maxAttempts,i=e.delayFactor,a=e.fuzzFactor,o=e.initialDelay;return new r({maxAttempts:n||this.maxAttempts_,delayFactor:i||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:o||this.initialDelay_})},t}(),r=function(){function t(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=t.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var t=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+t},e.shouldRetry=function(){return this.currentAttempt_{"use strict";function r(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var n=r({HTML:"text/html",isHTML:function(t){return t===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),i=r({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===i.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});e.assign=function(t,e){if(null===t||"object"!=typeof t)throw TypeError("target is not an object");for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},e.find=function(t,e,r){if(void 0===r&&(r=Array.prototype),t&&"function"==typeof r.find)return r.find.call(t,e);for(var n=0;n{var n=r(4582),i=r(4722),a=r(6559),o=r(4466),s=i.DOMImplementation,u=n.NAMESPACE,l=o.ParseError,c=o.XMLReader;function f(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function p(t){this.options=t||{locator:{}}}function h(){this.cdata=!1}function d(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function g(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function m(t,e,r){return"string"==typeof t?t.substr(e,r):t.length>=e+r||e?new java.lang.String(t,e,r)+"":t}function b(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}p.prototype.parseFromString=function(t,e){var r=this.options,n=new c,i=r.domBuilder||new h,o=r.errorHandler,s=r.locator,l=r.xmlns||{},p=/\/x?html?$/.test(e),d=p?a.HTML_ENTITIES:a.XML_ENTITIES;s&&i.setDocumentLocator(s),n.errorHandler=function(t,e,r){if(!t){if(e instanceof h)return e;t=e}var n={},i=t instanceof Function;function a(e){var a=t[e];!a&&i&&(a=2==t.length?function(r){t(e,r)}:t),n[e]=a&&function(t){a("[xmldom "+e+"] "+t+g(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),n}(o,i,s),n.domBuilder=r.domBuilder||i,p&&(l[""]=u.HTML),l.xml=l.xml||u.XML;var m=r.normalizeLineEndings||f;return t&&"string"==typeof t?n.parse(m(t),l,d):n.errorHandler.error("invalid doc source"),i.doc},h.prototype={startDocument:function(){this.doc=new s().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,r,n){var i=this.doc,a=i.createElementNS(t,r||e),o=n.length;b(this,a),this.currentElement=a,this.locator&&d(this.locator,a);for(var s=0;s{var n=r(4582),i=n.find,a=n.NAMESPACE;function o(t){return""!==t}function s(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function u(t){return t?Object.keys((t?t.split(/[\t\n\f\r ]+/).filter(o):[]).reduce(s,{})):[]}function l(t,e){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}function c(t,e){var r=t.prototype;if(!(r instanceof e)){function n(){}n.prototype=e.prototype,l(r,n=new n),t.prototype=r=n}r.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),r.constructor=t)}var f={},p=f.ELEMENT_NODE=1,h=f.ATTRIBUTE_NODE=2,d=f.TEXT_NODE=3,g=f.CDATA_SECTION_NODE=4,m=f.ENTITY_REFERENCE_NODE=5,b=f.ENTITY_NODE=6,y=f.PROCESSING_INSTRUCTION_NODE=7,v=f.COMMENT_NODE=8,E=f.DOCUMENT_NODE=9,D=f.DOCUMENT_TYPE_NODE=10,T=f.DOCUMENT_FRAGMENT_NODE=11,w=f.NOTATION_NODE=12,A={},N={};A.INDEX_SIZE_ERR=(N[1]="Index size error",1),A.DOMSTRING_SIZE_ERR=(N[2]="DOMString size error",2);var S=A.HIERARCHY_REQUEST_ERR=(N[3]="Hierarchy request error",3);A.WRONG_DOCUMENT_ERR=(N[4]="Wrong document",4),A.INVALID_CHARACTER_ERR=(N[5]="Invalid character",5),A.NO_DATA_ALLOWED_ERR=(N[6]="No data allowed",6),A.NO_MODIFICATION_ALLOWED_ERR=(N[7]="No modification allowed",7);var I=A.NOT_FOUND_ERR=(N[8]="Not found",8);A.NOT_SUPPORTED_ERR=(N[9]="Not supported",9);var R=A.INUSE_ATTRIBUTE_ERR=(N[10]="Attribute in use",10);function x(t,e){if(e instanceof Error)var r=e;else r=this,Error.call(this,N[t]),this.message=N[t],Error.captureStackTrace&&Error.captureStackTrace(this,x);return r.code=t,e&&(this.message=this.message+": "+e),r}function C(){}function O(t,e){this._node=t,this._refresh=e,L(this)}function L(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var r=t._refresh(t._node);if(tg(t,"length",r.length),!t.$$length||r.length=0){for(var i=e.length-1;n"==t&&">"||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function X(t,e){if(e(t))return!0;if(t=t.firstChild)do if(X(t,e))return!0;while(t=t.nextSibling)}function F(){this.ownerDocument=this}function V(t,e,r,n){t&&t._inc++,r.namespaceURI===a.XMLNS&&delete e._nsMap[r.prefix?r.localName:""]}function G(t,e,r){if(t&&t._inc){t._inc++;var n=e.childNodes;if(r)n[n.length++]=r;else{for(var i=e.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a,delete n[n.length]}}}function H(t,e){var r=e.previousSibling,n=e.nextSibling;return r?r.nextSibling=n:t.firstChild=n,n?n.previousSibling=r:t.lastChild=r,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,G(t.ownerDocument,t),e}function z(t){return t&&t.nodeType===B.DOCUMENT_TYPE_NODE}function $(t){return t&&t.nodeType===B.ELEMENT_NODE}function j(t){return t&&t.nodeType===B.TEXT_NODE}function W(t,e){var r=t.childNodes||[];if(i(r,$)||z(e))return!1;var n=i(r,z);return!(e&&n&&r.indexOf(n)>r.indexOf(e))}function Y(t,e){var r=t.childNodes||[];if(i(r,function(t){return $(t)&&t!==e}))return!1;var n=i(r,z);return!(e&&n&&r.indexOf(n)>r.indexOf(e))}function K(t,e,r){var n=t.childNodes||[],a=e.childNodes||[];if(e.nodeType===B.DOCUMENT_FRAGMENT_NODE){var o=a.filter($);if(o.length>1||i(a,j))throw new x(S,"More than one element or text in fragment");if(1===o.length&&!Y(t,r))throw new x(S,"Element in fragment can not be inserted before doctype")}if($(e)&&!Y(t,r))throw new x(S,"Only one element can be added and only after doctype");if(z(e)){if(i(n,function(t){return z(t)&&t!==r}))throw new x(S,"Only one doctype is allowed");var s=i(n,$);if(r&&n.indexOf(s)1||i(a,j))throw new x(S,"More than one element or text in fragment");if(1===o.length&&!W(t,r))throw new x(S,"Element in fragment can not be inserted before doctype")}if($(e)&&!W(t,r))throw new x(S,"Only one element can be added and only after doctype");if(z(e)){if(i(n,z))throw new x(S,"Only one doctype is allowed");var s=i(n,$);if(r&&n.indexOf(s)=0;w--){var A=i[w];if(""===A.prefix&&A.namespace===t.namespaceURI){o=A.namespace;break}}if(o!==t.namespaceURI)for(var w=i.length-1;w>=0;w--){var A=i[w];if(A.namespace===t.namespaceURI){A.prefix&&(f=A.prefix+":"+c);break}}}e.push("<",f);for(var N=0;N"),r&&/^script$/i.test(c))for(;l;)l.data?e.push(l.data):td(l,e,r,n,i.slice()),l=l.nextSibling;else for(;l;)td(l,e,r,n,i.slice()),l=l.nextSibling;e.push("")}else e.push("/>");return;case E:case T:for(var l=t.firstChild;l;)td(l,e,r,n,i.slice()),l=l.nextSibling;return;case h:return th(e,t.name,t.value);case d:return e.push(t.data.replace(/[<&>]/g,k));case g:return e.push("");case v:return e.push("");case D:var x=t.publicId,C=t.systemId;if(e.push("");else if(C&&"."!=C)e.push(" SYSTEM ",C,">");else{var O=t.internalSubset;O&&e.push(" [",O,"]"),e.push(">")}return;case y:return e.push("");case m:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function tg(t,e,r){t[e]=r}A.INVALID_STATE_ERR=(N[11]="Invalid state",11),A.SYNTAX_ERR=(N[12]="Syntax error",12),A.INVALID_MODIFICATION_ERR=(N[13]="Invalid modification",13),A.NAMESPACE_ERR=(N[14]="Invalid namespace",14),A.INVALID_ACCESS_ERR=(N[15]="Invalid access",15),x.prototype=Error.prototype,l(A,x),C.prototype={length:0,item:function(t){return t>=0&&t0},lookupPrefix:function(t){for(var e=this;e;){var r=e._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===t)return n}e=e.nodeType==h?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var r=e._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,t))return r[t];e=e.nodeType==h?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},l(f,B),l(f,B.prototype),F.prototype={nodeName:"#document",nodeType:E,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==T){for(var r=t.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,e),r=n}return t}return Z(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===p&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),H(this,t)},replaceChild:function(t,e){Z(this,t,e,K),t.ownerDocument=this,e&&this.removeChild(e),$(t)&&(this.documentElement=t)},importNode:function(t,e){return function t(e,r,n){var i;switch(r.nodeType){case p:(i=r.cloneNode(!1)).ownerDocument=e;case T:break;case h:n=!0}if(i||(i=r.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,n)for(var a=r.firstChild;a;)i.appendChild(t(e,a,n)),a=a.nextSibling;return i}(this,t,e)},getElementById:function(t){var e=null;return X(this.documentElement,function(r){if(r.nodeType==p&&r.getAttribute("id")==t)return e=r,!0}),e},getElementsByClassName:function(t){var e=u(t);return new O(this,function(r){var n=[];return e.length>0&&X(r.documentElement,function(i){if(i!==r&&i.nodeType===p){var a=i.getAttribute("class");if(a){var o=t===a;if(!o){var s=u(a);o=e.every(function(t){return s&&-1!==s.indexOf(t)})}o&&n.push(i)}}}),n})},createElement:function(t){var e=new J;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new C,(e.attributes=new M)._ownerElement=e,e},createDocumentFragment:function(){var t=new tu;return t.ownerDocument=this,t.childNodes=new C,t},createTextNode:function(t){var e=new te;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new tr;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new tn;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var r=new tl;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=t,r.nodeValue=r.data=e,r},createAttribute:function(t){var e=new Q;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new ts;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var r=new J,n=e.split(":"),i=r.attributes=new M;return r.childNodes=new C,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=e,i._ownerElement=r,r},createAttributeNS:function(t,e){var r=new Q,n=e.split(":");return r.ownerDocument=this,r.nodeName=e,r.name=e,r.namespaceURI=t,r.specified=!0,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=e,r}},c(F,B),J.prototype={nodeType:p,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var r=this.ownerDocument.createAttribute(t);r.value=r.nodeValue=""+e,this.setAttributeNode(r)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===T?this.insertBefore(t,null):(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,t.previousSibling=this.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:this.firstChild=t,this.lastChild=t,G(this.ownerDocument,this,t),t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);r&&this.removeAttributeNode(r)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);return r&&r.value||""},setAttributeNS:function(t,e,r){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new O(this,function(e){var r=[];return X(e,function(n){n!==e&&n.nodeType==p&&("*"===t||n.tagName==t)&&r.push(n)}),r})},getElementsByTagNameNS:function(t,e){return new O(this,function(r){var n=[];return X(r,function(i){i!==r&&i.nodeType===p&&("*"===t||i.namespaceURI===t)&&("*"===e||i.localName==e)&&n.push(i)}),n})}},F.prototype.getElementsByTagName=J.prototype.getElementsByTagName,F.prototype.getElementsByTagNameNS=J.prototype.getElementsByTagNameNS,c(J,B),Q.prototype.nodeType=h,c(Q,B),tt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw Error(N[S])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,r){r=this.data.substring(0,t)+r+this.data.substring(t+e),this.nodeValue=this.data=r,this.length=r.length}},c(tt,B),te.prototype={nodeName:"#text",nodeType:d,splitText:function(t){var e=this.data,r=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},c(te,tt),tr.prototype={nodeName:"#comment",nodeType:v},c(tr,tt),tn.prototype={nodeName:"#cdata-section",nodeType:g},c(tn,tt),ti.prototype.nodeType=D,c(ti,B),ta.prototype.nodeType=w,c(ta,B),to.prototype.nodeType=b,c(to,B),ts.prototype.nodeType=m,c(ts,B),tu.prototype.nodeName="#document-fragment",tu.prototype.nodeType=T,c(tu,B),tl.prototype.nodeType=y,c(tl,B),tc.prototype.serializeToString=function(t,e,r){return tf.call(t,e,r)},B.prototype.toString=tf;try{Object.defineProperty&&(Object.defineProperty(O.prototype,"length",{get:function(){return L(this),this.$$length}}),Object.defineProperty(B.prototype,"textContent",{get:function(){return function t(e){switch(e.nodeType){case p:case T:var r=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&r.push(t(e)),e=e.nextSibling;return r.join("");default:return e.nodeValue}}(this)},set:function(t){switch(this.nodeType){case p:case T:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),tg=function(t,e,r){t["$$"+e]=r})}catch(t){}e.DocumentType=ti,e.DOMException=x,e.DOMImplementation=q,e.Element=J,e.Node=B,e.NodeList=C,e.XMLSerializer=tc},6559:(t,e,r)=>{"use strict";var n=r(4582).freeze;e.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=n({Aacute:"\xc1",aacute:"\xe1",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"А",acy:"а",AElig:"\xc6",aelig:"\xe6",af:"⁡",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"\xc0",agrave:"\xe0",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:"\xc5",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"\xc5",aring:"\xe5",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",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:"\uD835\uDD05",bfr:"\uD835\uDD1F",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:"\uD835\uDD39",bopf:"\uD835\uDD53",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:"\xa6",Bscr:"ℬ",bscr:"\uD835\uDCB7",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:"\xc7",ccedil:"\xe7",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"⦲",cent:"\xa2",CenterDot:"\xb7",centerdot:"\xb7",Cfr:"ℭ",cfr:"\uD835\uDD20",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"\xae",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:"\uD835\uDD54",coprod:"∐",Coproduct:"∐",COPY:"\xa9",copy:"\xa9",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",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:"\xa4",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:"\xb0",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"\xb4",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"\xa8",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"\xf7",divide:"\xf7",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"\xa8",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"\xa8",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:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"\xc9",eacute:"\xe9",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"\xca",ecirc:"\xea",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"⪚",Egrave:"\xc8",egrave:"\xe8",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",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:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"\xbd",frac13:"⅓",frac14:"\xbc",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"\xbe",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"\uD835\uDCBB",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:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"\xbd",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"\uD835\uDD25",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"\uD835\uDD59",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"\uD835\uDCBD",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"\xcd",iacute:"\xed",ic:"⁣",Icirc:"\xce",icirc:"\xee",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"\xa1",iff:"⇔",Ifr:"ℑ",ifr:"\uD835\uDD26",Igrave:"\xcc",igrave:"\xec",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:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"\xbf",Iscr:"ℐ",iscr:"\uD835\uDCBE",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"\xcf",iuml:"\xef",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"ȷ",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"\xab",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:"\uD835\uDD0F",lfr:"\uD835\uDD29",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:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"\uD835\uDCC1",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:"\xaf",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"℧",micro:"\xb5",mid:"∣",midast:"*",midcir:"⫰",middot:"\xb7",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"∓",Mscr:"ℳ",mscr:"\uD835\uDCC2",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:"\xa0",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:"\n",nexist:"∄",nexists:"∄",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",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:"\xa0",Nopf:"ℕ",nopf:"\uD835\uDD5F",Not:"⫬",not:"\xac",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:"\uD835\uDCA9",nscr:"\uD835\uDCC3",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:"\xd1",ntilde:"\xf1",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:"\xd3",oacute:"\xf3",oast:"⊛",ocir:"⊚",Ocirc:"\xd4",ocirc:"\xf4",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"˛",Ograve:"\xd2",ograve:"\xf2",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"\xaa",ordm:"\xba",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"\uD835\uDCAA",oscr:"ℴ",Oslash:"\xd8",oslash:"\xf8",osol:"⊘",Otilde:"\xd5",otilde:"\xf5",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"\xd6",ouml:"\xf6",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"\xb6",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"⨦",plustwo:"⨧",pm:"\xb1",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"\uD835\uDD61",pound:"\xa3",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:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"⨌",Qopf:"ℚ",qopf:"\uD835\uDD62",qprime:"⁗",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"\xbb",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:"\xae",reg:"\xae",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"\uD835\uDD2F",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:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"\uD835\uDCC7",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:"\xa7",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"\xad",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:"\uD835\uDD4A",sopf:"\uD835\uDD64",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:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"\xaf",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:"\xb9",sup2:"\xb2",sup3:"\xb3",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:"\xdf",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"\xde",thorn:"\xfe",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"\xd7",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"\xda",uacute:"\xfa",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"\xd9",ugrave:"\xf9",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"\xa8",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",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:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"\xdc",uuml:"\xfc",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:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"\xdd",yacute:"\xfd",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"\xa5",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"Ї",yicy:"ї",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"\xff",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"\uD835\uDD37",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"‍",zwnj:"‌"}),e.entityMap=e.HTML_ENTITIES},8978:(t,e,r)=>{var n=r(4722);n.DOMImplementation,n.XMLSerializer,e.DOMParser=r(5752).DOMParser},4466:(t,e,r)=>{var n=r(4582).NAMESPACE,i=/[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]/,a=RegExp("[\\-\\.0-9"+i.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=RegExp("^"+i.source+a.source+"*(?::"+i.source+a.source+"*)?$");function s(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,s)}function u(){}function l(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function c(t,e,r){for(var i=t.tagName,a=null,o=t.length;o--;){var s=t[o],u=s.qName,l=s.value,c=u.indexOf(":");if(c>0)var p=s.prefix=u.slice(0,c),h=u.slice(c+1),d="xmlns"===p&&h;else h=u,p=null,d="xmlns"===u&&"";s.localName=h,!1!==d&&(null==a&&(a={},f(r,r={})),r[d]=a[d]=l,s.uri=n.XMLNS,e.startPrefixMapping(d,l))}for(var o=t.length;o--;){var p=(s=t[o]).prefix;p&&("xml"===p&&(s.uri=n.XML),"xmlns"!==p&&(s.uri=r[p||""]))}var c=i.indexOf(":");c>0?(p=t.prefix=i.slice(0,c),h=t.localName=i.slice(c+1)):(p=null,h=t.localName=i);var g=t.uri=r[p||""];if(e.startElement(g,h,i,t),!t.closed)return t.currentNSMap=r,t.localNSMap=a,!0;if(e.endElement(g,h,i),a)for(p in a)Object.prototype.hasOwnProperty.call(a,p)&&e.endPrefixMapping(p)}function f(t,e){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}function p(){this.attributeNames={}}s.prototype=Error(),s.prototype.name=s.name,u.prototype={parse:function(t,e,r){var i=this.domBuilder;i.startDocument(),f(e,e={}),function(t,e,r,i,a){function o(t){var e,n=t.slice(1,-1);return Object.hasOwnProperty.call(r,n)?r[n]:"#"!==n.charAt(0)?(a.error("entity not found:"+t),t):(e=parseInt(n.substr(1).replace("x","0x")))>65535?String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e)):String.fromCharCode(e)}function u(e){if(e>v){var r=t.substring(v,e).replace(/&#?\w+;/g,o);m&&f(v),i.characters(r,0,e-v),v=e}}function f(e,r){for(;e>=d&&(r=g.exec(t));)d=(h=r.index)+r[0].length,m.lineNumber++;m.columnNumber=e-h+1}for(var h=0,d=0,g=/.*(?:\r\n?|\n)|.*$/g,m=i.locator,b=[{currentNSMap:e}],y={},v=0;;){try{var E=t.indexOf("<",v);if(E<0){if(!t.substr(v).match(/^\s*$/)){var D=i.doc,T=D.createTextNode(t.substr(v));D.appendChild(T),i.currentElement=T}return}switch(E>v&&u(E),t.charAt(E+1)){case"/":var w=t.indexOf(">",E+3),A=t.substring(E+2,w).replace(/[ \t\n\r]+$/g,""),N=b.pop();w<0?(A=t.substring(E+2).replace(/[\s<].*/,""),a.error("end tag name: "+A+" is not complete:"+N.tagName),w=E+1+A.length):A.match(/\s",e);if(n){var i=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i)return i[0].length,r.processingInstruction(i[1],i[2]),n+2}return -1}(t,E,i);break;case"!":m&&f(E),w=function(t,e,r,n){if("-"===t.charAt(e+2)){if("-"===t.charAt(e+3)){var i=t.indexOf("-->",e+4);if(i>e)return r.comment(t,e+4,i-e-4),i+3;n.error("Unclosed comment")}}else{if("CDATA["==t.substr(e+3,6)){var i=t.indexOf("]]>",e+9);return r.startCDATA(),r.characters(t,e+9,i-e-9),r.endCDATA(),i+3}var a=function(t,e){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);r=i.exec(t);)if(n.push(r),r[1])return n}(t,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var s=a[1][0],u=!1,l=!1;o>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[o-1];return r.startDTD(s,u,l),r.endDTD(),c.index+c[0].length}}return -1}(t,E,i,a);break;default:m&&f(E);var x=new p,C=b[b.length-1].currentNSMap,w=function(t,e,r,i,a,o){function s(t,e,n){r.attributeNames.hasOwnProperty(t)&&o.fatalError("Attribute "+t+" redefined"),r.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),n)}for(var u,l,c=++e,f=0;;){var p=t.charAt(c);switch(p){case"=":if(1===f)u=t.slice(e,c),f=3;else if(2===f)f=3;else throw Error("attribute equal must after attrName");break;case"'":case'"':if(3===f||1===f){if(1===f&&(o.warning('attribute value must after "="'),u=t.slice(e,c)),e=c+1,(c=t.indexOf(p,e))>0)s(u,l=t.slice(e,c),e-1),f=5;else throw Error("attribute value no end '"+p+"' match")}else if(4==f)s(u,l=t.slice(e,c),e),o.warning('attribute "'+u+'" missed start quot('+p+")!!"),e=c+1,f=5;else throw Error('attribute value must after "="');break;case"/":switch(f){case 0:r.setTagName(t.slice(e,c));case 5:case 6:case 7:f=7,r.closed=!0;case 4:case 1:break;case 2:r.closed=!0;break;default:throw Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==f&&r.setTagName(t.slice(e,c)),c;case">":switch(f){case 0:r.setTagName(t.slice(e,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(l=t.slice(e,c)).slice(-1)&&(r.closed=!0,l=l.slice(0,-1));case 2:2===f&&(l=u),4==f?(o.warning('attribute "'+l+'" missed quot(")!'),s(u,l,e)):(n.isHTML(i[""])&&l.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),s(l,l,e));break;case 3:throw Error("attribute value missed!!")}return c;case"\x80":p=" ";default:if(p<=" ")switch(f){case 0:r.setTagName(t.slice(e,c)),f=6;break;case 1:u=t.slice(e,c),f=2;break;case 4:var l=t.slice(e,c);o.warning('attribute "'+l+'" missed quot(")!!'),s(u,l,e);case 5:f=6}else switch(f){case 2:r.tagName,n.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),s(u,u,e),e=c,f=1;break;case 5:o.warning('attribute space is required"'+u+'"!!');case 6:f=1,e=c;break;case 3:f=4,e=c;break;case 7:throw Error("elements closed character '/' and '>' must be connected to")}}c++}}(t,E,x,C,o,a),O=x.length;if(!x.closed&&function(t,e,r,n){var i=n[r];return null==i&&((i=t.lastIndexOf(""))",e),o=t.substring(e+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)||(o=o.replace(/&#?\w+;/g,n)),i.characters(o,0,o.length),a}return e+1}(t,w,x.tagName,o,i):w++}}catch(t){if(t instanceof s)throw t;a.error("element parse error: "+t),w=-1}w>v?v=w:u(Math.max(E,v)+1)}}(t,e,r,i,this.errorHandler),i.endDocument()}},p.prototype={setTagName:function(t){if(!o.test(t))throw Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!o.test(t))throw Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=u,e.ParseError=s},9697:(t,e,r)=>{var n,i=void 0!==r.g?r.g:"undefined"!=typeof window?window:{},a=r(542);"undefined"!=typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=a),t.exports=n},9840:(t,e,r)=>{var n;"undefined"!=typeof window?n=window:void 0!==r.g?n=r.g:"undefined"!=typeof self?n=self:n={},t.exports=n},7056:t=>{t.exports=function(t){if(!t)return!1;var r=e.call(t);return"[object Function]"===r||"function"==typeof t&&"[object RegExp]"!==r||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},642:(t,e,r)=>{"use strict";r.d(e,{iX:()=>d});var n=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var r=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(r,1),r>-1},e.trigger=function(t){var e=this.listeners[t];if(e){if(2==arguments.length)for(var r=e.length,n=0;n-1;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)}}let s=function(t){let e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),r={};return e[1]&&(r.length=parseInt(e[1],10)),e[2]&&(r.offset=parseInt(e[2],10)),r},u=function(t){let e;let r={};if(!t)return r;let n=t.split(RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),i=n.length;for(;i--;)""!==n[i]&&((e=/([^=]*)=(.*)/.exec(n[i]).slice(1))[0]=e[0].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^['"](.*)['"]$/g,"$1"),r[e[0]]=e[1]);return r},l=t=>{let e=t.split("x"),r={};return e[0]&&(r.width=parseInt(e[0],10)),e[1]&&(r.height=parseInt(e[1],10)),r};class c extends n{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(t){let e,r;if(0!==(t=t.trim()).length){if("#"!==t[0]){this.trigger("data",{type:"uri",uri:t});return}this.tagMappers.reduce((e,r)=>{let n=r(t);return n===t?e:e.concat([n])},[t]).forEach(t=>{for(let e=0;et),this.customParsers.push(i=>{if(t.exec(i))return this.trigger("data",{type:"custom",data:r(i),customType:e,segment:n}),!0})}addTagMapper({expression:t,map:e}){this.tagMappers.push(r=>t.test(r)?e(r):r)}}let f=t=>t.toLowerCase().replace(/-(\w)/g,t=>t[1].toUpperCase()),p=function(t){let e={};return Object.keys(t).forEach(function(r){e[f(r)]=t[r]}),e},h=function(t){let{serverControl:e,targetDuration:r,partTargetDuration:n}=t;if(!e)return;let i="#EXT-X-SERVER-CONTROL",a="holdBack",o="partHoldBack",s=r&&3*r,u=n&&2*n;r&&!e.hasOwnProperty(a)&&(e[a]=s,this.trigger("info",{message:`${i} defaulting HOLD-BACK to targetDuration * 3 (${s}).`})),s&&e[a]{!u.uri&&(u.parts||u.preloadHints)&&(!u.map&&e&&(u.map=e),!u.key&&r&&(u.key=r),u.timeline||"number"!=typeof g||(u.timeline=g),this.manifest.preloadSegment=u)}),this.parseStream.on("data",function(t){let o,c;if(n.manifest.definitions){for(let e in n.manifest.definitions)if(t.uri&&(t.uri=t.uri.replace(`{$${e}}`,n.manifest.definitions[e])),t.attributes)for(let r in t.attributes)"string"==typeof t.attributes[r]&&(t.attributes[r]=t.attributes[r].replace(`{$${e}}`,n.manifest.definitions[e]))}({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(){let e={};"length"in t&&(u.byterange=e,e.length=t.length,"offset"in t||(t.offset=m)),"offset"in t&&(u.byterange=e,e.offset=t.offset),m=e.offset+e.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&&(u.title=t.title),t.duration>0&&(u.duration=t.duration),0===t.duration&&(u.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key(){if(!t.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if("NONE"===t.attributes.METHOD){r=null;return}if(!t.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if("com.apple.streamingkeydelivery"===t.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:t.attributes};return}if("com.microsoft.playready"===t.attributes.KEYFORMAT){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:t.attributes.URI};return}if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===t.attributes.KEYFORMAT){if(-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(t.attributes.METHOD)){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if("SAMPLE-AES-CENC"===t.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==t.attributes.URI.substring(0,23)){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(t.attributes.KEYID&&"0x"===t.attributes.KEYID.substring(0,2))){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:(0,a.A)(t.attributes.URI.split(",")[1])};return}t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void 0!==t.attributes.IV&&(r.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(){e={},t.uri&&(e.uri=t.uri),t.byterange&&(e.byterange=t.byterange),r&&(e.key=r)},"stream-inf"(){if(this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!t.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}u.attributes||(u.attributes={}),(0,i.A)(u.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}let e=this.manifest.mediaGroups[t.attributes.TYPE];e[t.attributes["GROUP-ID"]]=e[t.attributes["GROUP-ID"]]||{},o=e[t.attributes["GROUP-ID"]],(c={default:/yes/i.test(t.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(c.language=t.attributes.LANGUAGE),t.attributes.URI&&(c.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(c.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(c.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(c.forced=/yes/i.test(t.attributes.FORCED)),o[t.attributes.NAME]=c},discontinuity(){g+=1,u.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),u.dateTimeString=t.dateTimeString,u.dateTimeObject=t.dateTimeObject;let{lastProgramDateTime:e}=this;this.lastProgramDateTime=new Date(t.dateTimeString).getTime(),null===e&&this.manifest.segments.reduceRight((t,e)=>(e.programDateTime=t-1e3*e.duration,e.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,h.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"(){u.cueOut=t.data},"cue-out-cont"(){u.cueOutCont=t.data},"cue-in"(){u.cueIn=t.data},skip(){this.manifest.skip=p(t.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",t.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;let e=this.manifest.segments.length,r=p(t.attributes);u.parts=u.parts||[],u.parts.push(r),r.byterange&&(r.byterange.hasOwnProperty("offset")||(r.byterange.offset=b),b=r.byterange.offset+r.byterange.length);let n=u.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${n} for segment #${e}`,t.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((t,e)=>{t.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${e} lacks required attribute(s): LAST-PART`})})},"server-control"(){let e=this.manifest.serverControl=p(t.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),h.call(this,this.manifest),e.canSkipDateranges&&!e.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"(){let e=this.manifest.segments.length,r=p(t.attributes),n=r.type&&"PART"===r.type;u.preloadHints=u.preloadHints||[],u.preloadHints.push(r),r.byterange&&!r.byterange.hasOwnProperty("offset")&&(r.byterange.offset=n?b:0,n&&(b=r.byterange.offset+r.byterange.length));let i=u.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${i} for segment #${e}`,t.attributes,["TYPE","URI"]),r.type)for(let t=0;tt.id===r.id);this.manifest.dateRanges[t]=(0,i.A)(this.manifest.dateRanges[t],r),y[r.id]=(0,i.A)(y[r.id],r),this.manifest.dateRanges.pop()}else y[r.id]=r},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=p(t.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",t.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};let e=(t,e)=>{if(t in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${t}`});return}this.manifest.definitions[t]=e};if("QUERYPARAM"in t.attributes){if("NAME"in t.attributes||"IMPORT"in t.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}let r=this.params.get(t.attributes.QUERYPARAM);if(!r){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${t.attributes.QUERYPARAM}`});return}e(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)||"string"!=typeof t.attributes.VALUE){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${t.attributes.NAME}`});return}e(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}e(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]||f).call(n)},uri(){u.uri=t.uri,s.push(u),!this.manifest.targetDuration||"duration"in u||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),u.duration=this.manifest.targetDuration),r&&(u.key=r),u.timeline=g,e&&(u.map=e),b=0,null!==this.lastProgramDateTime&&(u.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*u.duration),u={}},comment(){},custom(){t.segment?(u.custom=u.custom||{},u.custom[t.customType]=t.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[t.customType]=t.data)}})[t.type].call(n)})}requiredCompatibilityversion(t,e){(t{"use strict";r.d(e,{Tt:()=>N,Ze:()=>U,qg:()=>tR,i6:()=>tx});var n=r(7098),i=r(9840),a=r.n(i),o=function(t,e,r){e.forEach(function(e){for(var n in t.mediaGroups[e])for(var i in t.mediaGroups[e][n])r(t.mediaGroups[e][n][i],e,n,i)})},s=r(7860),u=r(8978);let l=t=>!!t&&"object"==typeof t,c=(...t)=>t.reduce((t,e)=>("object"!=typeof e||Object.keys(e).forEach(r=>{Array.isArray(t[r])&&Array.isArray(e[r])?t[r]=t[r].concat(e[r]):l(t[r])&&l(e[r])?t[r]=c(t[r],e[r]):t[r]=e[r]}),t),{}),f=t=>Object.keys(t).map(e=>t[e]),p=(t,e)=>{let r=[];for(let n=t;nt.reduce((t,e)=>t.concat(e),[]),d=t=>{if(!t.length)return[];let e=[];for(let r=0;rt.reduce((t,r,n)=>(r[e]&&t.push(n),t),[]),m=(t,e)=>f(t.reduce((t,r)=>(r.forEach(r=>{t[e(r)]=r}),t),{}));var b={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"};let y=({baseUrl:t="",source:e="",range:r="",indexRange:i=""})=>{let o={uri:e,resolvedUri:(0,n.A)(t||"",e)};if(r||i){let t;let e=(r||i).split("-"),n=a().BigInt?a().BigInt(e[0]):parseInt(e[0],10),s=a().BigInt?a().BigInt(e[1]):parseInt(e[1],10);n{let e;return e="bigint"==typeof t.offset||"bigint"==typeof t.length?a().BigInt(t.offset)+a().BigInt(t.length)-a().BigInt(1):t.offset+t.length-1,`${t.offset}-${e}`},E=t=>(t&&"number"!=typeof t&&(t=parseInt(t,10)),isNaN(t))?null:t,D={static(t){let{duration:e,timescale:r=1,sourceDuration:n,periodDuration:i}=t,a=E(t.endNumber),o=e/r;return"number"==typeof a?{start:0,end:a}:"number"==typeof i?{start:0,end:i/o}:{start:0,end:n/o}},dynamic(t){let{NOW:e,clientOffset:r,availabilityStartTime:n,timescale:i=1,duration:a,periodStart:o=0,minimumUpdatePeriod:s=0,timeShiftBufferDepth:u=1/0}=t,l=E(t.endNumber),c=(e+r)/1e3,f=n+o,p=Math.ceil((c+s-f)*i/a),h=Math.floor((c-f-u)*i/a),d=Math.floor((c-f)*i/a);return{start:Math.max(0,h),end:"number"==typeof l?l:Math.min(p,d)}}},T=t=>e=>{let{duration:r,timescale:n=1,periodStart:i,startNumber:a=1}=t;return{number:a+e,duration:r/n,timeline:i,time:e*r}},w=t=>{let{type:e,duration:r,timescale:n=1,periodDuration:i,sourceDuration:a}=t,{start:o,end:s}=D[e](t),u=p(o,s).map(T(t));if("static"===e){let t=u.length-1;u[t].duration=("number"==typeof i?i:a)-r/n*t}return u},A=t=>{let{baseUrl:e,initialization:r={},sourceDuration:n,indexRange:i="",periodStart:a,presentationTime:o,number:s=0,duration:u}=t;if(!e)throw Error(b.NO_BASE_URL);let l=y({baseUrl:e,source:r.sourceURL,range:r.range}),c=y({baseUrl:e,source:e,indexRange:i});if(c.map=l,u){let e=w(t);e.length&&(c.duration=e[0].duration,c.timeline=e[0].timeline)}else n&&(c.duration=n,c.timeline=a);return c.presentationTime=o||a,c.number=s,[c]},N=(t,e,r)=>{let n;let i=t.sidx.map?t.sidx.map:null,o=t.sidx.duration,s=t.timeline||0,u=t.sidx.byterange,l=u.offset+u.length,c=e.timescale,f=e.references.filter(t=>1!==t.referenceType),p=[],h=t.endList?"static":"dynamic",d=t.sidx.timeline,g=d,m=t.mediaSequence||0;n="bigint"==typeof e.firstOffset?a().BigInt(l)+e.firstOffset:l+e.firstOffset;for(let t=0;tm(t,({timeline:t})=>t).sort((t,e)=>t.timeline>e.timeline?1:-1),x=(t,e)=>{for(let r=0;r{let e=[];return o(t,S,(t,r,n,i)=>{e=e.concat(t.playlists||[])}),e},O=({playlist:t,mediaSequence:e})=>{t.mediaSequence=e,t.segments.forEach((e,r)=>{e.number=t.mediaSequence+r})},L=({oldPlaylists:t,newPlaylists:e,timelineStarts:r})=>{e.forEach(e=>{e.discontinuitySequence=r.findIndex(function({timeline:t}){return t===e.timeline});let n=x(t,e.attributes.NAME);if(!n||e.sidx)return;let i=e.segments[0],a=n.segments.findIndex(function(t){return Math.abs(t.presentationTime-i.presentationTime)n.timeline||n.segments.length&&e.timeline>n.segments[n.segments.length-1].timeline)&&e.discontinuitySequence--;return}n.segments[a].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),O({playlist:e,mediaSequence:n.segments[a].number})})},M=({oldManifest:t,newManifest:e})=>{let r=t.playlists.concat(C(t)),n=e.playlists.concat(C(e));return e.timelineStarts=R([t.timelineStarts,e.timelineStarts]),L({oldPlaylists:r,newPlaylists:n,timelineStarts:e.timelineStarts}),e},U=t=>t&&t.uri+"-"+v(t.byterange),_=t=>{let e=t.reduce(function(t,e){return t[e.attributes.baseUrl]||(t[e.attributes.baseUrl]=[]),t[e.attributes.baseUrl].push(e),t},{}),r=[];return Object.values(e).forEach(t=>{let e=f(t.reduce((t,e)=>{let r=e.attributes.id+(e.attributes.lang||"");return t[r]?(e.segments&&(e.segments[0]&&(e.segments[0].discontinuity=!0),t[r].segments.push(...e.segments)),e.attributes.contentProtection&&(t[r].attributes.contentProtection=e.attributes.contentProtection)):(t[r]=e,t[r].attributes.timelineStarts=[]),t[r].attributes.timelineStarts.push({start:e.attributes.periodStart,timeline:e.attributes.periodStart}),t},{}));r=r.concat(e)}),r.map(t=>(t.discontinuityStarts=g(t.segments||[],"discontinuity"),t))},P=(t,e)=>{let r=U(t.sidx),n=r&&e[r]&&e[r].sidx;return n&&N(t,n,t.sidx.resolvedUri),t},q=(t,e={})=>{if(!Object.keys(e).length)return t;for(let r in t)t[r]=P(t[r],e);return t},B=({attributes:t,segments:e,sidx:r,mediaSequence:n,discontinuitySequence:i,discontinuityStarts:a},o)=>{let s={attributes:{NAME:t.id,BANDWIDTH:t.bandwidth,CODECS:t.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuitySequence:i,discontinuityStarts:a,timelineStarts:t.timelineStarts,mediaSequence:n,segments:e};return t.contentProtection&&(s.contentProtection=t.contentProtection),t.serviceLocation&&(s.attributes.serviceLocation=t.serviceLocation),r&&(s.sidx=r),o&&(s.attributes.AUDIO="audio",s.attributes.SUBTITLES="subs"),s},k=({attributes:t,segments:e,mediaSequence:r,discontinuityStarts:n,discontinuitySequence:i})=>{void 0===e&&(e=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);let a={NAME:t.id,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1};t.codecs&&(a.CODECS=t.codecs);let o={attributes:a,uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:n,discontinuitySequence:i,mediaSequence:r,segments:e};return t.serviceLocation&&(o.attributes.serviceLocation=t.serviceLocation),o},X=(t,e={},r=!1)=>{let n;let i=t.reduce((t,i)=>{let a=i.attributes.role&&i.attributes.role.value||"",o=i.attributes.lang||"",s=i.attributes.label||"main";if(o&&!i.attributes.label){let t=a?` (${a})`:"";s=`${i.attributes.lang}${t}`}t[s]||(t[s]={language:o,autoselect:!0,default:"main"===a,playlists:[],uri:""});let u=P(B(i,r),e);return t[s].playlists.push(u),void 0===n&&"main"===a&&((n=i).default=!0),t},{});if(!n){let t=Object.keys(i)[0];i[t].default=!0}return i},F=(t,e={})=>t.reduce((t,r)=>{let n=r.attributes.label||r.attributes.lang||"text",i=r.attributes.lang||"und";return t[n]||(t[n]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(P(k(r),e)),t},{}),V=t=>t.reduce((t,e)=>(e&&e.forEach(e=>{let{channel:r,language:n}=e;t[n]={autoselect:!1,default:!1,instreamId:r,language:n},e.hasOwnProperty("aspectRatio")&&(t[n].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(t[n].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(t[n]["3D"]=e["3D"])}),t),{}),G=({attributes:t,segments:e,sidx:r,discontinuityStarts:n})=>{let i={attributes:{NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:n,timelineStarts:t.timelineStarts,segments:e};return t.frameRate&&(i.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(i.contentProtection=t.contentProtection),t.serviceLocation&&(i.attributes.serviceLocation=t.serviceLocation),r&&(i.sidx=r),i},H=({attributes:t})=>"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType,z=({attributes:t})=>"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType,$=({attributes:t})=>"text/vtt"===t.mimeType||"text"===t.contentType,j=(t,e)=>{t.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((t,e)=>{t.number=e})})},W=t=>t?Object.keys(t).reduce((e,r)=>{let n=t[r];return e.concat(n.playlists)},[]):[],Y=({dashPlaylists:t,locations:e,contentSteering:r,sidxMapping:n={},previousManifest:i,eventStream:a})=>{if(!t.length)return{};let{sourceDuration:o,type:s,suggestedPresentationDelay:u,minimumUpdatePeriod:l}=t[0].attributes,c=_(t.filter(H)).map(G),f=_(t.filter(z)),p=_(t.filter($)),h=t.map(t=>t.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:o,playlists:q(c,n)};l>=0&&(d.minimumUpdatePeriod=1e3*l),e&&(d.locations=e),r&&(d.contentSteering=r),"dynamic"===s&&(d.suggestedPresentationDelay=u),a&&a.length>0&&(d.eventStream=a);let g=0===d.playlists.length,m=f.length?X(f,n,g):null,b=p.length?F(p,n):null,y=c.concat(W(m),W(b)),v=y.map(({timelineStarts:t})=>t);return(d.timelineStarts=R(v),j(y,d.timelineStarts),m&&(d.mediaGroups.AUDIO.audio=m),b&&(d.mediaGroups.SUBTITLES.subs=b),h.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=V(h)),i)?M({oldManifest:i,newManifest:d}):d},K=(t,e,r)=>{let{NOW:n,clientOffset:i,availabilityStartTime:a,timescale:o=1,periodStart:s=0,minimumUpdatePeriod:u=0}=t;return Math.ceil((((n+i)/1e3+u-(a+s))*o-e)/r)},Z=(t,e)=>{let{type:r,minimumUpdatePeriod:n=0,media:i="",sourceDuration:a,timescale:o=1,startNumber:s=1,periodStart:u}=t,l=[],c=-1;for(let f=0;fc&&(c=m),g<0){let s=f+1;p=s===e.length?"dynamic"===r&&n>0&&i.indexOf("$Number$")>0?K(t,c,d):(a*o-c)/d:(e[s].t-c)/d}else p=g+1;let b=s+l.length+p,y=s+l.length;for(;y(e,r,n,i)=>{if("$$"===e)return"$";if(void 0===t[r])return e;let a=""+t[r];return"RepresentationID"===r?a:(i=n?parseInt(i,10):1,a.length>=i)?a:`${Array(i-a.length+1).join("0")}${a}`},tt=(t,e)=>t.replace(J,Q(e)),te=(t,e)=>t.duration||e?t.duration?w(t):Z(t,e):[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}],tr=(t,e)=>{let r={RepresentationID:t.id,Bandwidth:t.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=t,a=y({baseUrl:t.baseUrl,source:tt(i.sourceURL,r),range:i.range});return te(t,e).map(e=>{r.Number=e.number,r.Time=e.time;let i=tt(t.media||"",r),o=t.timescale||1,s=t.presentationTimeOffset||0,u=t.periodStart+(e.time-s)/o;return{uri:i,timeline:e.timeline,duration:e.duration,resolvedUri:(0,n.A)(t.baseUrl||"",i),map:a,number:e.number,presentationTime:u}})},tn=(t,e)=>{let{baseUrl:r,initialization:n={}}=t,i=y({baseUrl:r,source:n.sourceURL,range:n.range}),a=y({baseUrl:r,source:e.media,range:e.mediaRange});return a.map=i,a},ti=(t,e)=>{let r;let{duration:n,segmentUrls:i=[],periodStart:a}=t;if(!n&&!e||n&&e)throw Error(b.SEGMENT_TIME_UNSPECIFIED);let o=i.map(e=>tn(t,e));return n&&(r=w(t)),e&&(r=Z(t,e)),r.map((e,r)=>{if(o[r]){let n=o[r],i=t.timescale||1,s=t.presentationTimeOffset||0;return n.timeline=e.timeline,n.duration=e.duration,n.number=e.number,n.presentationTime=a+(e.time-s)/i,n}}).filter(t=>t)},ta=({attributes:t,segmentInfo:e})=>{let r,n;e.template?(n=tr,r=c(t,e.template)):e.base?(n=A,r=c(t,e.base)):e.list&&(n=ti,r=c(t,e.list));let i={attributes:t};if(!n)return i;let a=n(r,e.segmentTimeline);if(r.duration){let{duration:t,timescale:e=1}=r;r.duration=t/e}else a.length?r.duration=a.reduce((t,e)=>Math.max(t,Math.ceil(e.duration)),0):r.duration=0;return i.attributes=r,i.segments=a,e.base&&r.indexRange&&(i.sidx=a[0],i.segments=[]),i},to=t=>t.map(ta),ts=(t,e)=>d(t.childNodes).filter(({tagName:t})=>t===e),tu=t=>t.textContent.trim(),tl=t=>parseFloat(t.split("/").reduce((t,e)=>t/e)),tc=t=>{let e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!e)return 0;let[r,n,i,a,o,s]=e.slice(1);return 31536e3*parseFloat(r||0)+2592e3*parseFloat(n||0)+86400*parseFloat(i||0)+3600*parseFloat(a||0)+60*parseFloat(o||0)+parseFloat(s||0)},tf=t=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),Date.parse(t)),tp={mediaPresentationDuration:t=>tc(t),availabilityStartTime:t=>tf(t)/1e3,minimumUpdatePeriod:t=>tc(t),suggestedPresentationDelay:t=>tc(t),type:t=>t,timeShiftBufferDepth:t=>tc(t),start:t=>tc(t),width:t=>parseInt(t,10),height:t=>parseInt(t,10),bandwidth:t=>parseInt(t,10),frameRate:t=>tl(t),startNumber:t=>parseInt(t,10),timescale:t=>parseInt(t,10),presentationTimeOffset:t=>parseInt(t,10),duration(t){let e=parseInt(t,10);return isNaN(e)?tc(t):e},d:t=>parseInt(t,10),t:t=>parseInt(t,10),r:t=>parseInt(t,10),presentationTime:t=>parseInt(t,10),DEFAULT:t=>t},th=t=>t&&t.attributes?d(t.attributes).reduce((t,e)=>{let r=tp[e.name]||tp.DEFAULT;return t[e.name]=r(e.value),t},{}):{},td={"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"},tg=(t,e)=>e.length?h(t.map(function(t){return e.map(function(e){let r=tu(e),i=(0,n.A)(t.baseUrl,r),a=c(th(e),{baseUrl:i});return i!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):t,tm=t=>{let e=ts(t,"SegmentTemplate")[0],r=ts(t,"SegmentList")[0],n=r&&ts(r,"SegmentURL").map(t=>c({tag:"SegmentURL"},th(t))),i=ts(t,"SegmentBase")[0],a=r||e,o=a&&ts(a,"SegmentTimeline")[0],s=r||i||e,u=s&&ts(s,"Initialization")[0],l=e&&th(e);l&&u?l.initialization=u&&th(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});let f={template:l,segmentTimeline:o&&ts(o,"S").map(t=>th(t)),list:r&&c(th(r),{segmentUrls:n,initialization:th(u)}),base:i&&c(th(i),{initialization:th(u)})};return Object.keys(f).forEach(t=>{f[t]||delete f[t]}),f},tb=(t,e,r)=>n=>{let i=tg(e,ts(n,"BaseURL")),a=c(t,th(n)),o=tm(n);return i.map(t=>({segmentInfo:c(r,o),attributes:c(a,t)}))},ty=t=>t.reduce((t,e)=>{let r=th(e);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());let n=td[r.schemeIdUri];if(n){t[n]={attributes:r};let i=ts(e,"cenc:pssh")[0];if(i){let e=tu(i);t[n].pssh=e&&(0,s.A)(e)}}return t},{}),tv=t=>"urn:scte:dash:cc:cea-608:2015"===t.schemeIdUri?("string"!=typeof t.value?[]:t.value.split(";")).map(t=>{let e,r;return r=t,/^CC\d=/.test(t)?[e,r]=t.split("="):/^CC\d$/.test(t)&&(e=t),{channel:e,language:r}}):"urn:scte:dash:cc:cea-708:2015"===t.schemeIdUri?("string"!=typeof t.value?[]:t.value.split(";")).map(t=>{let e={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){let[r,n=""]=t.split("=");e.channel=r,e.language=t,n.split(",").forEach(t=>{let[r,n]=t.split(":");"lang"===r?e.language=n:"er"===r?e.easyReader=Number(n):"war"===r?e.aspectRatio=Number(n):"3D"===r&&(e["3D"]=Number(n))})}else e.language=t;return e.channel&&(e.channel="SERVICE"+e.channel),e}):void 0,tE=t=>h(ts(t.node,"EventStream").map(e=>{let r=th(e),n=r.schemeIdUri;return ts(e,"Event").map(e=>{let i=th(e),a=i.presentationTime||0,o=r.timescale||1,s=i.duration||0,u=a/o+t.attributes.start;return{schemeIdUri:n,value:r.value,id:i.id,start:u,end:u+s/o,messageData:tu(e)||i.messageData,contentEncoding:r.contentEncoding,presentationTimeOffset:r.presentationTimeOffset||0}})})),tD=(t,e,r)=>n=>{let i=th(n),a=tg(e,ts(n,"BaseURL")),o=c(t,i,{role:th(ts(n,"Role")[0])}),s=tv(th(ts(n,"Accessibility")[0]));s&&(o=c(o,{captionServices:s}));let u=ts(n,"Label")[0];u&&u.childNodes.length&&(o=c(o,{label:u.childNodes[0].nodeValue.trim()}));let l=ty(ts(n,"ContentProtection"));Object.keys(l).length&&(o=c(o,{contentProtection:l}));let f=tm(n),p=ts(n,"Representation"),d=c(r,f);return h(p.map(tb(o,a,d)))},tT=(t,e)=>(r,n)=>{let i=tg(e,ts(r.node,"BaseURL")),a=c(t,{periodStart:r.attributes.start});"number"==typeof r.attributes.duration&&(a.periodDuration=r.attributes.duration);let o=ts(r.node,"AdaptationSet"),s=tm(r.node);return h(o.map(tD(a,i,s)))},tw=(t,e)=>{if(t.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!t.length)return null;let r=c({serverURL:tu(t[0])},th(t[0]));return r.queryBeforeStart="true"===r.queryBeforeStart,r},tA=({attributes:t,priorPeriodAttributes:e,mpdType:r})=>"number"==typeof t.start?t.start:e&&"number"==typeof e.start&&"number"==typeof e.duration?e.start+e.duration:e||"static"!==r?null:0,tN=(t,e={})=>{let{manifestUri:r="",NOW:n=Date.now(),clientOffset:i=0,eventHandler:a=function(){}}=e,o=ts(t,"Period");if(!o.length)throw Error(b.INVALID_NUMBER_OF_PERIOD);let s=ts(t,"Location"),u=th(t),l=tg([{baseUrl:r}],ts(t,"BaseURL")),c=ts(t,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=n,u.clientOffset=i,s.length&&(u.locations=s.map(tu));let f=[];return o.forEach((t,e)=>{let r=th(t),n=f[e-1];r.start=tA({attributes:r,priorPeriodAttributes:n?n.attributes:null,mpdType:u.type}),f.push({node:t,attributes:r})}),{locations:u.locations,contentSteeringInfo:tw(c,a),representationInfo:h(f.map(tT(u,l))),eventStream:h(f.map(tE))}},tS=t=>{let e,r;if(""===t)throw Error(b.DASH_EMPTY_MANIFEST);let n=new u.DOMParser;try{r=(e=n.parseFromString(t,"application/xml"))&&"MPD"===e.documentElement.tagName?e.documentElement:null}catch(t){}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw Error(b.DASH_INVALID_XML);return r},tI=t=>{let e=ts(t,"UTCTiming")[0];if(!e)return null;let r=th(e);switch(r.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":r.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":r.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":r.method="DIRECT",r.value=Date.parse(r.value);break;default:throw Error(b.UNSUPPORTED_UTC_TIMING_SCHEME)}return r},tR=(t,e={})=>{let r=tN(tS(t),e);return Y({dashPlaylists:to(r.representationInfo),locations:r.locations,contentSteering:r.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:r.eventStream})},tx=t=>tI(tS(t))},8962:(t,e,r)=>{var n=r(3626).getUint64;t.exports=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},i=12;0===r.version?(r.earliestPresentationTime=e.getUint32(i),r.firstOffset=e.getUint32(i+4),i+=8):(r.earliestPresentationTime=n(t.subarray(i)),r.firstOffset=n(t.subarray(i+8)),i+=16),i+=2;var a=e.getUint16(i);for(i+=2;a>0;i+=12,a--)r.references.push({referenceType:(128&t[i])>>>7,referencedSize:0x7fffffff&e.getUint32(i),subsegmentDuration:e.getUint32(i+4),startsWithSap:!!(128&t[i+8]),sapType:(112&t[i+8])>>>4,sapDeltaTime:0xfffffff&e.getUint32(i+8)});return r}},9622:t=>{var e,r,n,i,a,o,s;e=function(t){return 9e4*t},r=function(t,e){return t*e},n=function(t){return t/9e4},i=function(t,e){return t/e},a=function(t,r){return e(i(t,r))},o=function(t,e){return r(n(t),e)},s=function(t,e,r){return n(r?t:t-e)},t.exports={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:e,secondsToAudioTs:r,videoTsToSeconds:n,audioTsToSeconds:i,audioTsToVideoTs:a,videoTsToAudioTs:o,metadataTsToSeconds:s}},3626:t=>{t.exports={getUint64:function(t){var e,r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getBigUint64?(e=r.getBigUint64(0)){!function(){var e={675:function(t,e){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return(r+n)*3/4-n},e.toByteArray=function(t){var e,r,a=u(t),o=a[0],s=a[1],l=new i((o+s)*3/4-s),c=0,f=s>0?o-4:o;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,l[c++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e),l},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,a=[],o=0,s=n-i;o>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}(t,o,o+16383>s?s:o+16383));return 1===i?a.push(r[(e=t[n-1])>>2]+r[e<<4&63]+"=="):2===i&&a.push(r[(e=(t[n-2]<<8)+t[n-1])>>10]+r[e>>4&63]+r[e<<2&63]+"="),a.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var n=r===e?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},72:function(t,e,r){"use strict";var n=r(675),i=r(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if(("string"!=typeof e||""===e)&&(e="utf8"),!s.isEncoding(e))throw TypeError("Unknown encoding: "+e);var r=0|h(t,e),n=o(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(x(t,ArrayBuffer)||t&&x(t.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(x(t,SharedArrayBuffer)||t&&x(t.buffer,SharedArrayBuffer)))return function(t,e,r){var n;if(e<0||t.byteLength=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function h(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||x(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return I(t).length;default:if(i)return n?-1:N(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,r){var i,a,o=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(a=r=+r)!=a&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return(e&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var a,o=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;o=2,s/=2,u/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){for(var f=!0,p=0;p239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:(192&(a=t[i+1]))==128&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=t[i+1],o=t[i+2],(192&a)==128&&(192&o)==128&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;nr)throw RangeError("Trying to access beyond buffer length")}function E(t,e,r,n,i,a){if(!s.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw RangeError("Index out of range")}function D(t,e,r,n,i,a){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function T(t,e,r,n,a){return e=+e,r>>>=0,a||D(t,e,r,4,34028234663852886e22,-34028234663852886e22),i.write(t,e,r,n,23,4),r+4}function w(t,e,r,n,a){return e=+e,r>>>=0,a||D(t,e,r,8,17976931348623157e292,-17976931348623157e292),i.write(t,e,r,n,52,8),r+8}e.Buffer=s,e.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return(l(t),t<=0)?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)},s.allocUnsafe=function(t){return c(t)},s.allocUnsafeSlow=function(t){return c(t)},s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(x(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),x(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);ir&&(t+=" ... "),""},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(x(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var a=i-n,o=r-e,u=Math.min(a,o),l=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,u,l,c,f,p,h,d,g,m=this.length-e;if((void 0===r||r>m)&&(r=m),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var b=!1;;)switch(n){case"hex":return function(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i.push(r%256),i.push(n);return i}(t,this.length-d),this,d,g);default:if(b)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),b=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||v(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||v(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return(t>>>=0,e||v(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||v(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||v(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||v(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;E(this,t,e,r,i,0)}var a=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;E(this,t,e,r,i,0)}var a=r-1,o=1;for(this[e+a]=255&t;--a>=0&&(o*=256);)this[e+a]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);E(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);E(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||E(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return T(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return w(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return w(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===t.length){var i,a=t.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(t=a)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!i){if(r>56319||o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return a}function S(t){for(var e=[],r=0;r=e.length)&&!(i>=t.length);++i)e[i+r]=t[i];return i}function x(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}var C=function(){for(var t="0123456789abcdef",e=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},783:function(t,e){e.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,p=r?-1:1,h=t[e+f];for(f+=p,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=256*a+t[e+f],f+=p,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=p,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=l}return(h?-1:1)*o*Math.pow(2,a-n)},e.write=function(t,e,r,n,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,p=23===i?5960464477539062e-23:0,h=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(isNaN(e=Math.abs(e))||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+f>=1?e+=p/u:e+=p*Math.pow(2,1-f),e*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(e*u-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=255&s,h+=d,s/=256,i-=8);for(o=o<0;t[r+h]=255&o,h+=d,o/=256,l-=8);t[r+h-d]|=128*g}}},r={};function n(t){var i=r[t];if(void 0!==i)return i.exports;var a=r[t]={exports:{}},o=!0;try{e[t](a,a.exports,n),o=!1}finally{o&&delete r[t]}return a.exports}n.ab="//";var i=n(72);t.exports=i}()},6036:()=>{},3368:(t,e,r)=>{t.exports=r(6085)},4784:(t,e,r)=>{var n=r(9840),i=t.exports={WebVTT:r(6311),VTTCue:r(184),VTTRegion:r(5891)};n.vttjs=i,n.WebVTT=i.WebVTT;var a=i.VTTCue,o=i.VTTRegion,s=n.VTTCue,u=n.VTTRegion;i.shim=function(){n.VTTCue=a,n.VTTRegion=o},i.restore=function(){n.VTTCue=s,n.VTTRegion=u},n.VTTCue||i.shim()},6311:(t,e,r)=>{var n=r(9697),i=Object.create||function(){function t(){}return function(e){if(1!=arguments.length)throw Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function a(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}function o(t){function e(t,e,r,n){return(0|t)*3600+(0|e)*60+(0|r)+(0|n)/1e3}var r=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return r?r[3]?e(r[1],r[2],r[3].replace(":",""),r[4]):r[1]>59?e(r[1],r[2],0,r[4]):e(0,r[1],r[2],r[4]):null}function s(){this.values=i(null)}function u(t,e,r,n){var i=n?t.split(n):[t];for(var a in i)if("string"==typeof i[a]){var o=i[a].split(r);2===o.length&&e(o[0].trim(),o[1].trim())}}a.prototype=i(Error.prototype),a.prototype.constructor=a,a.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},s.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var n=0;n=0&&e<=100)&&(this.set(t,e),!0)}};var l=n.createElement&&n.createElement("textarea"),c={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},f={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)"},p={v:"title",lang:"lang"},h={rt:"ruby"};function d(t,e){for(var r,n=t.document.createElement("div"),i=n,a=[];null!==(r=function(){if(!e)return null;var t,r=e.match(/^([^<]*)(<[^>]*>?)?/);return t=r[1]?r[1]:r[2],e=e.substr(t.length),t}());){if("<"===r[0]){if("/"===r[1]){a.length&&a[a.length-1]===r.substr(2).replace(">","")&&(a.pop(),i=i.parentNode);continue}var s,u,d,g,m=o(r.substr(1,r.length-2));if(m){g=t.document.createProcessingInstruction("timestamp",m),i.appendChild(g);continue}var b=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!b||!(g=function(e,r){var n=c[e];if(!n)return null;var i=t.document.createElement(n),a=p[e];return a&&r&&(i[a]=r.trim()),i}(b[1],b[3]))||(u=i,h[(d=g).localName]&&h[d.localName]!==u.localName))continue;if(b[2]){var y=b[2].split(".");y.forEach(function(t){var e=/^bg_/.test(t),r=e?t.slice(3):t;if(f.hasOwnProperty(r)){var n=e?"background-color":"color",i=f[r];g.style[n]=i}}),g.className=y.join(" ")}a.push(b[1]),i.appendChild(g),i=g;continue}i.appendChild(t.document.createTextNode((s=r,l.innerHTML=s,s=l.textContent,l.textContent="",s)))}return n}var g=[[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 m(){}function b(t,e,r){m.call(this),this.cue=e,this.cueDiv=d(t,e.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=t.document.createElement("div"),n={direction:function(t){var e=[],r="";if(!t||!t.childNodes)return"ltr";function n(t,e){for(var r=e.childNodes.length-1;r>=0;r--)t.push(e.childNodes[r])}for(n(e,t);r=function t(e){if(!e||!e.length)return null;var r=e.pop(),i=r.textContent||r.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===r.tagName?t(e):r.childNodes?(n(e,r),t(e)):void 0}(e);)for(var i=0;i=r[0]&&t<=r[1])return!0}return!1}(r.charCodeAt(i)))return"rtl";return"ltr"}(this.cueDiv),writingMode:""===e.vertical?"horizontal-tb":"lr"===e.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===e.align?"center":e.align,font:r.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var i=0;switch(e.positionAlign){case"start":case"line-left":i=e.position;break;case"center":i=e.position-e.size/2;break;case"end":case"line-right":i=e.position-e.size}""===e.vertical?this.applyStyles({left:this.formatStyle(i,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(i,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(t){this.applyStyles({top:this.formatStyle(t.top,"px"),bottom:this.formatStyle(t.bottom,"px"),left:this.formatStyle(t.left,"px"),right:this.formatStyle(t.right,"px"),height:this.formatStyle(t.height,"px"),width:this.formatStyle(t.width,"px")})}}function y(t){var e,r,n,i;if(t.div){r=t.div.offsetHeight,n=t.div.offsetWidth,i=t.div.offsetTop;var a=(a=t.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();t=t.div.getBoundingClientRect(),e=a?Math.max(a[0]&&a[0].height||0,t.height/a.length):0}this.left=t.left,this.right=t.right,this.top=t.top||i,this.height=t.height||r,this.bottom=t.bottom||i+(t.height||r),this.width=t.width||n,this.lineHeight=void 0!==e?e:t.lineHeight}function v(){}m.prototype.applyStyles=function(t,e){for(var r in e=e||this.div,t)t.hasOwnProperty(r)&&(e.style[r]=t[r])},m.prototype.formatStyle=function(t,e){return 0===t?0:t+e},b.prototype=i(m.prototype),b.prototype.constructor=b,y.prototype.move=function(t,e){switch(e=void 0!==e?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e}},y.prototype.overlaps=function(t){return this.leftt.left&&this.topt.top},y.prototype.overlapsAny=function(t){for(var e=0;e=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},y.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}},y.prototype.intersectPercentage=function(t){return Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left))*Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top))/(this.height*this.width)},y.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},y.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,r=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,n=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;return{left:(t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t).left,right:t.right,top:t.top||n,height:t.height||e,bottom:t.bottom||n+(t.height||e),width:t.width||r}},v.StringDecoder=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}},v.convertCueToDOMTree=function(t,e){return t&&e?d(t,e):null},v.processCues=function(t,e,r){if(!t||!e||!r)return null;for(;r.firstChild;)r.removeChild(r.firstChild);var n=t.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",r.appendChild(n),!function(t){for(var e=0;e=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return -1;for(var e=t.track,r=e.textTrackList,n=0,i=0;if&&(c=Math.ceil(f/l)*l*(c<0?-1:1)),o<0&&(c+=""===a.vertical?r.height:r.width,s=s.reverse()),i.move(p,c)}else{var h=i.lineHeight/r.height*100;switch(a.lineAlign){case"center":o-=h/2;break;case"end":o-=h}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")})}s=["+y","-x","+x","-y"],i=new y(e)}var d=function(t,e){for(var i,a=new y(t),o=1,s=0;su&&(i=new y(t),o=u),t=new y(a)}return i||a}(i,s);e.move(d.toCSSCompatValues(r))}(0,r,o,a),i.displayState=r.div,a.push(y.getSimpleBoxPosition(r))}()},v.Parser=function(t,e,r){r||(r=e,e={}),e||(e={}),this.window=t,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=r||new TextDecoder("utf8"),this.regionList=[]},v.Parser.prototype={reportOrThrowError:function(t){if(t instanceof a)this.onparsingerror&&this.onparsingerror(t);else throw t},parse:function(t){var e=this;function r(){for(var t=e.buffer,r=0;r")){e.cue.id=i;continue}case"CUE":try{!function(t,e,r){var n=t;function i(){var e=o(t);if(null===e)throw new a(a.Errors.BadTimeStamp,"Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function l(){t=t.replace(/^\s+/,"")}if(l(),e.startTime=i(),l(),"-->"!==t.substr(0,3))throw new a(a.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);t=t.substr(3),l(),e.endTime=i(),l(),function(t,e){var n=new s;u(t,function(t,e){switch(t){case"region":for(var i=r.length-1;i>=0;i--)if(r[i].id===e){n.set(t,r[i].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":var a=e.split(","),o=a[0];n.integer(t,o),n.percent(t,o)&&n.set("snapToLines",!1),n.alt(t,o,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=e.split(","),n.percent(t,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start","center","end","left","right"])}},/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");try{e.line=n.get("line","auto")}catch(t){}e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100);try{e.align=n.get("align","center")}catch(t){e.align=n.get("align","middle")}try{e.position=n.get("position","auto")}catch(t){e.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},e.align)}e.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},e.align)}(t,e)}(i,e.cue,e.regionList)}catch(t){e.reportOrThrowError(t),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var f=-1!==i.indexOf("-->");if(!i||f&&(c=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+="\n"),e.cue.text+=i.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":i||(e.state="ID");continue}}catch(t){e.reportOrThrowError(t),"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new a(a.Errors.BadSignature)}catch(t){this.reportOrThrowError(t)}return this.onflush&&this.onflush(),this}},t.exports=v},184:t=>{var e={"":1,lr:1,rl:1},r={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function n(t){return"string"==typeof t&&!!r[t.toLowerCase()]&&t.toLowerCase()}function i(t,r,i){this.hasBeenReset=!1;var a="",o=!1,s=t,u=r,l=i,c=null,f="",p=!0,h="auto",d="start",g="auto",m="auto",b=100,y="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return a},set:function(t){a=""+t}},pauseOnExit:{enumerable:!0,get:function(){return o},set:function(t){o=!!t}},startTime:{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t)throw TypeError("Start time must be set to a number.");s=t,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t)throw TypeError("End time must be set to a number.");u=t,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(t){l=""+t,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return c},set:function(t){c=t,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return f},set:function(t){var r="string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase();if(!1===r)throw SyntaxError("Vertical: an invalid or illegal direction string was specified.");f=r,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(t){p=!!t,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t&&"auto"!==t)throw SyntaxError("Line: an invalid number or illegal string was specified.");h=t,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return d},set:function(t){var e=n(t);e?(d=e,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return g},set:function(t){if(t<0||t>100)throw Error("Position must be between 0 and 100.");g=t,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(t){var e=n(t);e?(m=e,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return b},set:function(t){if(t<0||t>100)throw Error("Size must be between 0 and 100.");b=t,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return y},set:function(t){var e=n(t);if(!e)throw SyntaxError("align: an invalid or illegal alignment string was specified.");y=e,this.hasBeenReset=!0}}}),this.displayState=void 0}i.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},t.exports=i},5891:t=>{var e={"":!0,up:!0};function r(t){return"number"==typeof t&&t>=0&&t<=100}t.exports=function(){var t=100,n=3,i=0,a=100,o=0,s=100,u="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!r(e))throw Error("Width must be between 0 and 100.");t=e}},lines:{enumerable:!0,get:function(){return n},set:function(t){if("number"!=typeof t)throw TypeError("Lines must be set to a number.");n=t}},regionAnchorY:{enumerable:!0,get:function(){return a},set:function(t){if(!r(t))throw Error("RegionAnchorX must be between 0 and 100.");a=t}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(t){if(!r(t))throw Error("RegionAnchorY must be between 0 and 100.");i=t}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(t){if(!r(t))throw Error("ViewportAnchorY must be between 0 and 100.");s=t}},viewportAnchorX:{enumerable:!0,get:function(){return o},set:function(t){if(!r(t))throw Error("ViewportAnchorX must be between 0 and 100.");o=t}},scroll:{enumerable:!0,get:function(){return u},set:function(t){var r="string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase();!1===r?console.warn("Scroll: an invalid or illegal string was specified."):u=r}}})}},4634:t=>{function e(){return t.exports=e=Object.assign?Object.assign.bind():function(t){for(var e=1;e{"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(t){for(var e=1;en})}}]); \ No newline at end of file diff --git a/_next/static/chunks/439-4f5dc6f54fc3c57e.js b/_next/static/chunks/439-4f5dc6f54fc3c57e.js deleted file mode 100644 index bd7b05d0..00000000 --- a/_next/static/chunks/439-4f5dc6f54fc3c57e.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[439],{7154:function(t){function e(){return t.exports=e=Object.assign||function(t){for(var e=1;ep&&(l-=p,l-=p,l-=o(2))}return Number(l)}),c=function(t,e){var r=(void 0===e?{}:e).le,n=void 0!==r&&r;("bigint"!==typeof t&&"number"!==typeof t||"number"===typeof t&&t!==t)&&(t=0),t=o(t);for(var i,a=(i=t,Math.ceil(function(t){return t.toString(2).length}(i)/8)),u=new Uint8Array(new ArrayBuffer(a)),c=0;c=e.length&&c.call(e,(function(e,r){return e===(u[r]?u[r]&t[o+r]:t[o+r])}))}},2260:function(t,e,r){"use strict";r.d(e,{Hi:function(){return d},Jg:function(){return f},KL:function(){return l},_5:function(){return p},kS:function(){return c},lA:function(){return g},p7:function(){return h},ws:function(){return u},xz:function(){return m}});var n=r(8908),i=r.n(n),a={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},o=["video","audio","text"],s=["Video","Audio","Text"],u=function(t){return t?t.replace(/avc1\.(\d+)\.(\d+)/i,(function(t,e,r){return"avc1."+("00"+Number(e).toString(16)).slice(-2)+"00"+("00"+Number(r).toString(16)).slice(-2)})):t},c=function(t){void 0===t&&(t="");var e=t.split(","),r=[];return e.forEach((function(t){var e;t=t.trim(),o.forEach((function(n){var i=a[n].exec(t.toLowerCase());if(i&&!(i.length<=1)){e=n;var o=t.substring(0,i[1].length),s=t.replace(o,"");r.push({type:o,details:s,mediaType:n})}})),e||r.push({type:t,details:"",mediaType:"unknown"})})),r},f=function(t,e){if(!t.mediaGroups.AUDIO||!e)return null;var r=t.mediaGroups.AUDIO[e];if(!r)return null;for(var n in r){var i=r[n];if(i.default&&i.playlists)return c(i.playlists[0].attributes.CODECS)}return null},l=function(t){return void 0===t&&(t=""),a.audio.test(t.trim().toLowerCase())},p=function(t){if(t&&"string"===typeof t){var e,r=t.toLowerCase().split(",").map((function(t){return u(t.trim())})),n="video";1===r.length&&l(r[0])?n="audio":1===r.length&&(void 0===(e=r[0])&&(e=""),a.text.test(e.trim().toLowerCase()))&&(n="application");var i="mp4";return r.every((function(t){return a.mp4.test(t)}))?i="mp4":r.every((function(t){return a.webm.test(t)}))?i="webm":r.every((function(t){return a.ogg.test(t)}))&&(i="ogg"),n+"/"+i+';codecs="'+t+'"'}},h=function(t){return void 0===t&&(t=""),i().MediaSource&&i().MediaSource.isTypeSupported&&i().MediaSource.isTypeSupported(p(t))||!1},d=function(t){return void 0===t&&(t=""),t.toLowerCase().split(",").every((function(t){t=t.trim();for(var e=0;er;){var a=t[r],o=0,s=0,u=t[++s];for(s++;128&u;)o=(127&u)<<7,u=t[s],s++;o+=127&u;for(var c=0;c>>0,c=e.subarray(s+4,s+8);if(0===u)break;var f=s+u;if(f>e.length){if(n)break;f=e.length}var l=e.subarray(s+8,f);(0,i.G3)(c,r[0])&&(1===r.length?o.push(l):o.push.apply(o,t(l,r.slice(1),n))),s=f}return o},u={EBML:(0,i.Ki)([26,69,223,163]),DocType:(0,i.Ki)([66,130]),Segment:(0,i.Ki)([24,83,128,103]),SegmentInfo:(0,i.Ki)([21,73,169,102]),Tracks:(0,i.Ki)([22,84,174,107]),Track:(0,i.Ki)([174]),TrackNumber:(0,i.Ki)([215]),DefaultDuration:(0,i.Ki)([35,227,131]),TrackEntry:(0,i.Ki)([174]),TrackType:(0,i.Ki)([131]),FlagDefault:(0,i.Ki)([136]),CodecID:(0,i.Ki)([134]),CodecPrivate:(0,i.Ki)([99,162]),VideoTrack:(0,i.Ki)([224]),AudioTrack:(0,i.Ki)([225]),Cluster:(0,i.Ki)([31,67,182,117]),Timestamp:(0,i.Ki)([231]),TimestampScale:(0,i.Ki)([42,215,177]),BlockGroup:(0,i.Ki)([160]),BlockDuration:(0,i.Ki)([155]),Block:(0,i.Ki)([161]),SimpleBlock:(0,i.Ki)([163])},c=[128,64,32,16,8,4,2,1],f=function(t,e,r,n){void 0===r&&(r=!0),void 0===n&&(n=!1);var a=function(t){for(var e=1,r=0;r=r.length)return r.length;var a=f(r,n,!1);if((0,i.G3)(e.bytes,a.bytes))return n;var o=f(r,n+a.length);return t(e,r,n+o.length+o.value+a.length)},h=function t(e,r){r=function(t){return Array.isArray(t)?t.map((function(t){return l(t)})):[l(t)]}(r),e=(0,i.Ki)(e);var n=[];if(!r.length)return n;for(var a=0;ae.length?e.length:u+s.value,h=e.subarray(u,c);(0,i.G3)(r[0],o.bytes)&&(1===r.length?n.push(h):n=n.concat(t(h,r.slice(1)))),a+=o.length+s.length+h.length}return n},d=r(8925),g=(0,i.Ki)([0,0,0,1]),m=(0,i.Ki)([0,0,1]),v=(0,i.Ki)([0,0,3]),y=function(t){for(var e=[],r=1;r>1&63),-1!==r.indexOf(c)&&(a=o+u),o+=u+("h264"===e?1:2)}else o++}return t.subarray(0,0)},w={webm:(0,i.Ki)([119,101,98,109]),matroska:(0,i.Ki)([109,97,116,114,111,115,107,97]),flac:(0,i.Ki)([102,76,97,67]),ogg:(0,i.Ki)([79,103,103,83]),ac3:(0,i.Ki)([11,119]),riff:(0,i.Ki)([82,73,70,70]),avi:(0,i.Ki)([65,86,73]),wav:(0,i.Ki)([87,65,86,69]),"3gp":(0,i.Ki)([102,116,121,112,51,103]),mp4:(0,i.Ki)([102,116,121,112]),fmp4:(0,i.Ki)([115,116,121,112]),mov:(0,i.Ki)([102,116,121,112,113,116]),moov:(0,i.Ki)([109,111,111,118]),moof:(0,i.Ki)([109,111,111,102])},E={aac:function(t){var e=(0,d.c)(t);return(0,i.G3)(t,[255,16],{offset:e,mask:[255,22]})},mp3:function(t){var e=(0,d.c)(t);return(0,i.G3)(t,[255,2],{offset:e,mask:[255,6]})},webm:function(t){var e=h(t,[u.EBML,u.DocType])[0];return(0,i.G3)(e,w.webm)},mkv:function(t){var e=h(t,[u.EBML,u.DocType])[0];return(0,i.G3)(e,w.matroska)},mp4:function(t){return!E["3gp"](t)&&!E.mov(t)&&(!(!(0,i.G3)(t,w.mp4,{offset:4})&&!(0,i.G3)(t,w.fmp4,{offset:4}))||(!(!(0,i.G3)(t,w.moof,{offset:4})&&!(0,i.G3)(t,w.moov,{offset:4}))||void 0))},mov:function(t){return(0,i.G3)(t,w.mov,{offset:4})},"3gp":function(t){return(0,i.G3)(t,w["3gp"],{offset:4})},ac3:function(t){var e=(0,d.c)(t);return(0,i.G3)(t,w.ac3,{offset:e})},ts:function(t){if(t.length<189&&t.length>=1)return 71===t[0];for(var e=0;e+1880}},6722:function(t,e,r){"use strict";r.d(e,{Z:function(){return o}});var n=r(8908),i=r.n(n),a=r(1876).Buffer;function o(t){for(var e,r=(e=t,i().atob?i().atob(e):a.from(e,"base64").toString("binary")),n=new Uint8Array(r.length),o=0;o>4?i+20:i+10}(e,r),t(e,r))}},8485:function(t,e,r){"use strict";r.d(e,{t:function(){return a}});var n=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,i=/^application\/dash\+xml/i,a=function(t){return n.test(t)?"hls":i.test(t)?"dash":"application/vnd.videojs.vhs+json"===t?"vhs-json":null}},779:function(t,e,r){"use strict";var n=r(9945),i=r.n(n),a=r(8908),o=r.n(a),s="http://example.com";e.Z=function(t,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(t)&&(t=o().location&&o().location.href||"");var r="function"===typeof o().URL,n=/^\/\//.test(t),a=!o().location&&!/\/\//i.test(t);if(r?t=new(o().URL)(t,o().location||s):/\/\//i.test(t)||(t=i().buildAbsoluteURL(o().location&&o().location.href||"",t)),r){var u=new URL(e,t);return a?u.href.slice(s.length):n?u.href.slice(u.protocol.length):u.href}return i().buildAbsoluteURL(t,e)}},3490:function(t,e,r){"use strict";var n=r(8908);t.exports=function(t,e){return void 0===e&&(e=!1),function(r,i,a){if(r)t(r);else if(i.statusCode>=400&&i.statusCode<=599){var o=a;if(e)if(n.TextDecoder){var s=function(t){void 0===t&&(t="");return t.toLowerCase().split(";").reduce((function(t,e){var r=e.split("="),n=r[0],i=r[1];return"charset"===n.trim()?i.trim():t}),"utf-8")}(i.headers&&i.headers["content-type"]);try{o=new TextDecoder(s).decode(a)}catch(u){}}else o=String.fromCharCode.apply(null,new Uint8Array(a));t({cause:o})}else t(null,a)}}},9603:function(t,e,r){"use strict";var n=r(8908),i=r(7154),a=r(7376);s.httpHandler=r(3490);function o(t,e,r){var n=t;return a(e)?(r=e,"string"===typeof t&&(n={uri:t})):n=i({},e,{uri:t}),n.callback=r,n}function s(t,e,r){return u(e=o(t,e,r))}function u(t){if("undefined"===typeof t.callback)throw new Error("callback argument missing");var e=!1,r=function(r,n,i){e||(e=!0,t.callback(r,n,i))};function n(){var t=void 0;if(t=c.response?c.response:c.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(r){}return null}(c),m)try{t=JSON.parse(t)}catch(e){}return t}function i(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,r(t,v)}function a(){if(!u){var e;clearTimeout(f),e=t.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var i=v,a=null;return 0!==e?(i={body:n(),statusCode:e,method:p,headers:{},url:l,rawRequest:c},c.getAllResponseHeaders&&(i.headers=function(t){var e={};return t?(t.trim().split("\n").forEach((function(t){var r=t.indexOf(":"),n=t.slice(0,r).trim().toLowerCase(),i=t.slice(r+1).trim();"undefined"===typeof e[n]?e[n]=i:Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]})),e):e}(c.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),r(a,i,i.body)}}var o,u,c=t.xhr||null;c||(c=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=c.url=t.uri||t.url,p=c.method=t.method||"GET",h=t.body||t.data,d=c.headers=t.headers||{},g=!!t.sync,m=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:l,rawRequest:c};if("json"in t&&!1!==t.json&&(m=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===t.json?h:t.json))),c.onreadystatechange=function(){4===c.readyState&&setTimeout(a,0)},c.onload=a,c.onerror=i,c.onprogress=function(){},c.onabort=function(){u=!0},c.ontimeout=i,c.open(p,l,!g,t.username,t.password),g||(c.withCredentials=!!t.withCredentials),!g&&t.timeout>0&&(f=setTimeout((function(){if(!u){u=!0,c.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",i(t)}}),t.timeout)),c.setRequestHeader)for(o in d)d.hasOwnProperty(o)&&c.setRequestHeader(o,d[o]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(c.responseType=t.responseType),"beforeSend"in t&&"function"===typeof t.beforeSend&&t.beforeSend(c),c.send(h||null),c}t.exports=s,t.exports.default=s,s.XMLHttpRequest=n.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:n.XDomainRequest,function(t,e){for(var r=0;r=e+r||e?new java.lang.String(t,e,r)+"":t}function m(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}l.prototype.parseFromString=function(t,e){var r=this.options,n=new f,i=r.domBuilder||new p,o=r.errorHandler,s=r.locator,c=r.xmlns||{},l=/\/x?html?$/.test(e),h=l?a.HTML_ENTITIES:a.XML_ENTITIES;return s&&i.setDocumentLocator(s),n.errorHandler=function(t,e,r){if(!t){if(e instanceof p)return e;t=e}var n={},i=t instanceof Function;function a(e){var a=t[e];!a&&i&&(a=2==t.length?function(r){t(e,r)}:t),n[e]=a&&function(t){a("[xmldom "+e+"]\t"+t+d(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),n}(o,i,s),n.domBuilder=r.domBuilder||i,l&&(c[""]=u.HTML),c.xml=c.xml||u.XML,t&&"string"===typeof t?n.parse(t,c,h):n.errorHandler.error("invalid doc source"),i.doc},p.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,r,n){var i=this.doc,a=i.createElementNS(t,r||e),o=n.length;m(this,a),this.currentElement=a,this.locator&&h(this.locator,a);for(var s=0;s=0))throw R(A,new Error(t.tagName+"@"+r));for(var i=e.length-1;n"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function _(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(_(t,e))return!0}while(t=t.nextSibling)}function X(){}function G(t,e,r,i){t&&t._inc++,r.namespaceURI===n.XMLNS&&delete e._nsMap[r.prefix?r.localName:""]}function H(t,e,r){if(t&&t._inc){t._inc++;var n=e.childNodes;if(r)n[n.length++]=r;else{for(var i=e.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a}}}function V(t,e){var r=e.previousSibling,n=e.nextSibling;return r?r.nextSibling=n:t.firstChild=n,n?n.previousSibling=r:t.lastChild=r,H(t.ownerDocument,t),e}function q(t,e,r){var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===w){var i=e.firstChild;if(null==i)return e;var a=e.lastChild}else i=a=e;var o=r?r.previousSibling:t.lastChild;i.previousSibling=o,a.nextSibling=r,o?o.nextSibling=i:t.firstChild=i,null==r?t.lastChild=a:r.previousSibling=a;do{i.parentNode=t}while(i!==a&&(i=i.nextSibling));return H(t.ownerDocument||t,t),e.nodeType==w&&(e.firstChild=e.lastChild=null),e}function F(){this._nsMap={}}function j(){}function z(){}function K(){}function Y(){}function $(){}function Z(){}function W(){}function Q(){}function J(){}function tt(){}function et(){}function rt(){}function nt(t,e){var r=[],n=9==this.nodeType&&this.documentElement||this,i=n.prefix,a=n.namespaceURI;if(a&&null==i&&null==(i=n.lookupPrefix(a)))var o=[{namespace:a,prefix:null}];return ot(this,r,t,e,o),r.join("")}function it(t,e,r){var i=t.prefix||"",a=t.namespaceURI;if(!a)return!1;if("xml"===i&&a===n.XML||a===n.XMLNS)return!1;for(var o=r.length;o--;){var s=r[o];if(s.prefix===i)return s.namespace!==a}return!0}function at(t,e,r){t.push(" ",e,'="',r.replace(/[<&"]/g,k),'"')}function ot(t,e,r,i,a){if(a||(a=[]),i){if(!(t=i(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case f:var o=t.attributes,s=o.length,u=t.firstChild,c=t.tagName,g=c;if(!(r=n.isHTML(t.namespaceURI)||r)&&!t.prefix&&t.namespaceURI){for(var E,T=0;T=0;S--){if(""===(N=a[S]).prefix&&N.namespace===t.namespaceURI){E=N.namespace;break}}if(E!==t.namespaceURI)for(S=a.length-1;S>=0;S--){var N;if((N=a[S]).namespace===t.namespaceURI){N.prefix&&(g=N.prefix+":"+c);break}}}e.push("<",g);for(var A=0;A"),r&&/^script$/i.test(c))for(;u;)u.data?e.push(u.data):ot(u,e,r,i,a.slice()),u=u.nextSibling;else for(;u;)ot(u,e,r,i,a.slice()),u=u.nextSibling;e.push("")}else e.push("/>");return;case y:case w:for(u=t.firstChild;u;)ot(u,e,r,i,a.slice()),u=u.nextSibling;return;case l:return at(e,t.name,t.value);case p:return e.push(t.data.replace(/[<&]/g,k).replace(/]]>/g,"]]>"));case h:return e.push("");case v:return e.push("\x3c!--",t.data,"--\x3e");case b:var O=t.publicId,C=t.systemId;if(e.push("");else if(C&&"."!=C)e.push(" SYSTEM ",C,">");else{var D=t.internalSubset;D&&e.push(" [",D,"]"),e.push(">")}return;case m:return e.push("");case d:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function st(t,e,r){var n;switch(e.nodeType){case f:(n=e.cloneNode(!1)).ownerDocument=t;case w:break;case l:r=!0}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,r)for(var i=e.firstChild;i;)n.appendChild(st(t,i,r)),i=i.nextSibling;return n}function ut(t,e,r){var n=new e.constructor;for(var i in e){var a=e[i];"object"!=typeof a&&a!=n[i]&&(n[i]=a)}switch(e.childNodes&&(n.childNodes=new x),n.ownerDocument=t,n.nodeType){case f:var o=e.attributes,s=n.attributes=new D,u=o.length;s._ownerElement=n;for(var c=0;c0},lookupPrefix:function(t){for(var e=this;e;){var r=e._nsMap;if(r)for(var n in r)if(r[n]==t)return n;e=e.nodeType==l?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var r=e._nsMap;if(r&&t in r)return r[t];e=e.nodeType==l?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},s(c,B),s(c,B.prototype),X.prototype={nodeName:"#document",nodeType:y,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==w){for(var r=t.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,e),r=n}return t}return null==this.documentElement&&t.nodeType==f&&(this.documentElement=t),q(this,t,e),t.ownerDocument=this,t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),V(this,t)},importNode:function(t,e){return st(this,t,e)},getElementById:function(t){var e=null;return _(this.documentElement,(function(r){if(r.nodeType==f&&r.getAttribute("id")==t)return e=r,!0})),e},getElementsByClassName:function(t){var e=o(t);return new O(this,(function(r){var n=[];return e.length>0&&_(r.documentElement,(function(i){if(i!==r&&i.nodeType===f){var a=i.getAttribute("class");if(a){var s=t===a;if(!s){var u=o(a);s=e.every((c=u,function(t){return c&&-1!==c.indexOf(t)}))}s&&n.push(i)}}var c})),n}))},createElement:function(t){var e=new F;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new x,(e.attributes=new D)._ownerElement=e,e},createDocumentFragment:function(){var t=new tt;return t.ownerDocument=this,t.childNodes=new x,t},createTextNode:function(t){var e=new K;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Y;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new $;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var r=new et;return r.ownerDocument=this,r.tagName=r.target=t,r.nodeValue=r.data=e,r},createAttribute:function(t){var e=new j;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new J;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var r=new F,n=e.split(":"),i=r.attributes=new D;return r.childNodes=new x,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=e,i._ownerElement=r,r},createAttributeNS:function(t,e){var r=new j,n=e.split(":");return r.ownerDocument=this,r.nodeName=e,r.name=e,r.namespaceURI=t,r.specified=!0,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=e,r}},u(X,B),F.prototype={nodeType:f,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var r=this.ownerDocument.createAttribute(t);r.value=r.nodeValue=""+e,this.setAttributeNode(r)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===w?this.insertBefore(t,null):function(t,e){var r=e.parentNode;if(r){var n=t.lastChild;r.removeChild(e),n=t.lastChild}return n=t.lastChild,e.parentNode=t,e.previousSibling=n,e.nextSibling=null,n?n.nextSibling=e:t.firstChild=e,t.lastChild=e,H(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);r&&this.removeAttributeNode(r)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);return r&&r.value||""},setAttributeNS:function(t,e,r){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new O(this,(function(e){var r=[];return _(e,(function(n){n===e||n.nodeType!=f||"*"!==t&&n.tagName!=t||r.push(n)})),r}))},getElementsByTagNameNS:function(t,e){return new O(this,(function(r){var n=[];return _(r,(function(i){i===r||i.nodeType!==f||"*"!==t&&i.namespaceURI!==t||"*"!==e&&i.localName!=e||n.push(i)})),n}))}},X.prototype.getElementsByTagName=F.prototype.getElementsByTagName,X.prototype.getElementsByTagNameNS=F.prototype.getElementsByTagNameNS,u(F,B),j.prototype.nodeType=l,u(j,B),z.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(S[N])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,r){r=this.data.substring(0,t)+r+this.data.substring(t+e),this.nodeValue=this.data=r,this.length=r.length}},u(z,B),K.prototype={nodeName:"#text",nodeType:p,splitText:function(t){var e=this.data,r=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},u(K,z),Y.prototype={nodeName:"#comment",nodeType:v},u(Y,z),$.prototype={nodeName:"#cdata-section",nodeType:h},u($,z),Z.prototype.nodeType=b,u(Z,B),W.prototype.nodeType=E,u(W,B),Q.prototype.nodeType=g,u(Q,B),J.prototype.nodeType=d,u(J,B),tt.prototype.nodeName="#document-fragment",tt.prototype.nodeType=w,u(tt,B),et.prototype.nodeType=m,u(et,B),rt.prototype.serializeToString=function(t,e,r){return nt.call(t,e,r)},B.prototype.toString=nt;try{if(Object.defineProperty){function ft(t){switch(t.nodeType){case f:case w:var e=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&e.push(ft(t)),t=t.nextSibling;return e.join("");default:return t.nodeValue}}Object.defineProperty(O.prototype,"length",{get:function(){return C(this),this.$$length}}),Object.defineProperty(B.prototype,"textContent",{get:function(){return ft(this)},set:function(t){switch(this.nodeType){case f:case w:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),ct=function(t,e,r){t["$$"+e]=r}}}catch(lt){}e.DocumentType=Z,e.DOMException=R,e.DOMImplementation=P,e.Element=F,e.Node=B,e.NodeList=x,e.XMLSerializer=rt},1045:function(t,e,r){var n=r(2167).freeze;e.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"\xc0",Aacute:"\xc1",Acirc:"\xc2",Atilde:"\xc3",Auml:"\xc4",Aring:"\xc5",AElig:"\xc6",Ccedil:"\xc7",Egrave:"\xc8",Eacute:"\xc9",Ecirc:"\xca",Euml:"\xcb",Igrave:"\xcc",Iacute:"\xcd",Icirc:"\xce",Iuml:"\xcf",ETH:"\xd0",Ntilde:"\xd1",Ograve:"\xd2",Oacute:"\xd3",Ocirc:"\xd4",Otilde:"\xd5",Ouml:"\xd6",Oslash:"\xd8",Ugrave:"\xd9",Uacute:"\xda",Ucirc:"\xdb",Uuml:"\xdc",Yacute:"\xdd",THORN:"\xde",szlig:"\xdf",agrave:"\xe0",aacute:"\xe1",acirc:"\xe2",atilde:"\xe3",auml:"\xe4",aring:"\xe5",aelig:"\xe6",ccedil:"\xe7",egrave:"\xe8",eacute:"\xe9",ecirc:"\xea",euml:"\xeb",igrave:"\xec",iacute:"\xed",icirc:"\xee",iuml:"\xef",eth:"\xf0",ntilde:"\xf1",ograve:"\xf2",oacute:"\xf3",ocirc:"\xf4",otilde:"\xf5",ouml:"\xf6",oslash:"\xf8",ugrave:"\xf9",uacute:"\xfa",ucirc:"\xfb",uuml:"\xfc",yacute:"\xfd",thorn:"\xfe",yuml:"\xff",nbsp:"\xa0",iexcl:"\xa1",cent:"\xa2",pound:"\xa3",curren:"\xa4",yen:"\xa5",brvbar:"\xa6",sect:"\xa7",uml:"\xa8",copy:"\xa9",ordf:"\xaa",laquo:"\xab",not:"\xac",shy:"\xad\xad",reg:"\xae",macr:"\xaf",deg:"\xb0",plusmn:"\xb1",sup2:"\xb2",sup3:"\xb3",acute:"\xb4",micro:"\xb5",para:"\xb6",middot:"\xb7",cedil:"\xb8",sup1:"\xb9",ordm:"\xba",raquo:"\xbb",frac14:"\xbc",frac12:"\xbd",frac34:"\xbe",iquest:"\xbf",times:"\xd7",divide:"\xf7",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220b",prod:"\u220f",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221a",prop:"\u221d",infin:"\u221e",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222a",int:"\u222b",there4:"\u2234",sim:"\u223c",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22a5",sdot:"\u22c5",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039a",Lambda:"\u039b",Mu:"\u039c",Nu:"\u039d",Xi:"\u039e",Omicron:"\u039f",Pi:"\u03a0",Rho:"\u03a1",Sigma:"\u03a3",Tau:"\u03a4",Upsilon:"\u03a5",Phi:"\u03a6",Chi:"\u03a7",Psi:"\u03a8",Omega:"\u03a9",alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigmaf:"\u03c2",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",thetasym:"\u03d1",upsih:"\u03d2",piv:"\u03d6",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02c6",tilde:"\u02dc",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200c",zwj:"\u200d",lrm:"\u200e",rlm:"\u200f",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201a",ldquo:"\u201c",rdquo:"\u201d",bdquo:"\u201e",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203a",oline:"\u203e",euro:"\u20ac",trade:"\u2122",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21b5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230a",rfloor:"\u230b",loz:"\u25ca",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"}),e.entityMap=e.HTML_ENTITIES},3969:function(t,e,r){var n=r(1146);n.DOMImplementation,n.XMLSerializer,e.DOMParser=r(6129).DOMParser},6925:function(t,e,r){var n=r(2167).NAMESPACE,i=/[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]/,a=new RegExp("[\\-\\.0-9"+i.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=new RegExp("^"+i.source+a.source+"*(?::"+i.source+a.source+"*)?$");function s(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,s)}function u(){}function c(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function f(t,e,r,i,a,o){function s(t,e,n){r.attributeNames.hasOwnProperty(t)&&o.fatalError("Attribute "+t+" redefined"),r.addValue(t,e,n)}for(var u,c=++e,f=0;;){var l=t.charAt(c);switch(l){case"=":if(1===f)u=t.slice(e,c),f=3;else{if(2!==f)throw new Error("attribute equal must after attrName");f=3}break;case"'":case'"':if(3===f||1===f){if(1===f&&(o.warning('attribute value must after "="'),u=t.slice(e,c)),e=c+1,!((c=t.indexOf(l,e))>0))throw new Error("attribute value no end '"+l+"' match");s(u,p=t.slice(e,c).replace(/&#?\w+;/g,a),e-1),f=5}else{if(4!=f)throw new Error('attribute value must after "="');s(u,p=t.slice(e,c).replace(/&#?\w+;/g,a),e),o.warning('attribute "'+u+'" missed start quot('+l+")!!"),e=c+1,f=5}break;case"/":switch(f){case 0:r.setTagName(t.slice(e,c));case 5:case 6:case 7:f=7,r.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==f&&r.setTagName(t.slice(e,c)),c;case">":switch(f){case 0:r.setTagName(t.slice(e,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(p=t.slice(e,c)).slice(-1)&&(r.closed=!0,p=p.slice(0,-1));case 2:2===f&&(p=u),4==f?(o.warning('attribute "'+p+'" missed quot(")!'),s(u,p.replace(/&#?\w+;/g,a),e)):(n.isHTML(i[""])&&p.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+p+'" missed value!! "'+p+'" instead!!'),s(p,p,e));break;case 3:throw new Error("attribute value missed!!")}return c;case"\x80":l=" ";default:if(l<=" ")switch(f){case 0:r.setTagName(t.slice(e,c)),f=6;break;case 1:u=t.slice(e,c),f=2;break;case 4:var p=t.slice(e,c).replace(/&#?\w+;/g,a);o.warning('attribute "'+p+'" missed quot(")!!'),s(u,p,e);case 5:f=6}else switch(f){case 2:r.tagName;n.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),s(u,u,e),e=c,f=1;break;case 5:o.warning('attribute space is required"'+u+'"!!');case 6:f=1,e=c;break;case 3:f=4,e=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function l(t,e,r){for(var i=t.tagName,a=null,o=t.length;o--;){var s=t[o],u=s.qName,c=s.value;if((h=u.indexOf(":"))>0)var f=s.prefix=u.slice(0,h),l=u.slice(h+1),p="xmlns"===f&&l;else l=u,f=null,p="xmlns"===u&&"";s.localName=l,!1!==p&&(null==a&&(a={},d(r,r={})),r[p]=a[p]=c,s.uri=n.XMLNS,e.startPrefixMapping(p,c))}for(o=t.length;o--;){(f=(s=t[o]).prefix)&&("xml"===f&&(s.uri=n.XML),"xmlns"!==f&&(s.uri=r[f||""]))}var h;(h=i.indexOf(":"))>0?(f=t.prefix=i.slice(0,h),l=t.localName=i.slice(h+1)):(f=null,l=t.localName=i);var g=t.uri=r[f||""];if(e.startElement(g,l,i,t),!t.closed)return t.currentNSMap=r,t.localNSMap=a,!0;if(e.endElement(g,l,i),a)for(f in a)e.endPrefixMapping(f)}function p(t,e,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var a=t.indexOf("",e),o=t.substring(e+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,n),i.characters(o,0,o.length),a)}return e+1}function h(t,e,r,n){var i=n[r];return null==i&&((i=t.lastIndexOf(""))e?(r.comment(t,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var i=t.indexOf("]]>",e+9);return r.startCDATA(),r.characters(t,e+9,i-e-9),r.endCDATA(),i+3}var a=function(t,e){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=e,i.exec(t);for(;r=i.exec(t);)if(n.push(r),r[1])return n}(t,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var s=a[1][0],u=!1,c=!1;o>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],c=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var f=a[o-1];return r.startDTD(s,u,c),r.endDTD(),f.index+f[0].length}return-1}function m(t,e,r){var n=t.indexOf("?>",e);if(n){var i=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){i[0].length;return r.processingInstruction(i[1],i[2]),n+2}return-1}return-1}function v(){this.attributeNames={}}s.prototype=new Error,s.prototype.name=s.name,u.prototype={parse:function(t,e,r){var i=this.domBuilder;i.startDocument(),d(e,e={}),function(t,e,r,i,a){function o(t){if(t>65535){var e=55296+((t-=65536)>>10),r=56320+(1023&t);return String.fromCharCode(e,r)}return String.fromCharCode(t)}function u(t){var e=t.slice(1,-1);return e in r?r[e]:"#"===e.charAt(0)?o(parseInt(e.substr(1).replace("x","0x"))):(a.error("entity not found:"+t),t)}function d(e){if(e>A){var r=t.substring(A,e).replace(/&#?\w+;/g,u);T&&y(A),i.characters(r,0,e-A),A=e}}function y(e,r){for(;e>=w&&(r=E.exec(t));)b=r.index,w=b+r[0].length,T.lineNumber++;T.columnNumber=e-b+1}var b=0,w=0,E=/.*(?:\r\n?|\n)|.*$/g,T=i.locator,S=[{currentNSMap:e}],N={},A=0;for(;;){try{var I=t.indexOf("<",A);if(I<0){if(!t.substr(A).match(/^\s*$/)){var R=i.doc,x=R.createTextNode(t.substr(A));R.appendChild(x),i.currentElement=x}return}switch(I>A&&d(I),t.charAt(I+1)){case"/":var O=t.indexOf(">",I+3),C=t.substring(I+2,O).replace(/[ \t\n\r]+$/g,""),D=S.pop();O<0?(C=t.substring(I+2).replace(/[\s<].*/,""),a.error("end tag name: "+C+" is not complete:"+D.tagName),O=I+1+C.length):C.match(/\sA?A=O:d(Math.max(I,A)+1)}}(t,e,r,i,this.errorHandler),i.endDocument()}},v.prototype={setTagName:function(t){if(!o.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!o.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=u,e.ParseError=s},9144:function(t,e,r){var n,i="undefined"!==typeof r.g?r.g:"undefined"!==typeof window?window:{},a=r(7579);"undefined"!==typeof document?n=document:(n=i["__GLOBAL_DOCUMENT_CACHE@4"])||(n=i["__GLOBAL_DOCUMENT_CACHE@4"]=a),t.exports=n},8908:function(t,e,r){var n;n="undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:{},t.exports=n},7376:function(t){t.exports=function(t){if(!t)return!1;var r=e.call(t);return"[object Function]"===r||"function"===typeof t&&"[object RegExp]"!==r||"undefined"!==typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},7537:function(t,e){function r(t){if(t&&"object"===typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"===typeof t)return o[t];var r,a=String(t);return(r=n[a.toLowerCase()])?r:(r=i[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}r.isEventKey=function(t,e){if(t&&"object"===typeof t){var r=t.which||t.keyCode||t.charCode;if(null===r||void 0===r)return!1;if("string"===typeof e){var a;if(a=n[e.toLowerCase()])return a===r;if(a=i[e.toLowerCase()])return a===r}else if("number"===typeof e)return e===r;return!1}};var n=(e=t.exports=r).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=e.aliases={windows:91,"\u21e7":16,"\u2325":18,"\u2303":17,"\u2318":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var o=e.names=e.title={};for(a in n)o[n[a]]=a;for(var s in i)n[s]=i[s]},9323:function(t,e,r){"use strict";r.d(e,{_b:function(){return g}});var n=r(4578),i=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var r=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(r,1),r>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var r=e.length,n=0;n-1;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)},e}(i),c=String.fromCharCode(9),f=function(t){var e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),r={};return e[1]&&(r.length=parseInt(e[1],10)),e[2]&&(r.offset=parseInt(e[2],10)),r},l=function(t){for(var e,r=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},i=r.length;i--;)""!==r[i]&&((e=/([^=]*)=(.*)/.exec(r[i]).slice(1))[0]=e[0].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^['"](.*)['"]$/g,"$1"),n[e[0]]=e[1]);return n},p=function(t){function e(){var e;return(e=t.call(this)||this).customParsers=[],e.tagMappers=[],e}(0,n.Z)(e,t);var r=e.prototype;return r.push=function(t){var e,r,n=this;0!==(t=t.trim()).length&&("#"===t[0]?this.tagMappers.reduce((function(e,r){var n=r(t);return n===t?e:e.concat([n])}),[t]).forEach((function(t){for(var i=0;i0&&(f.duration=t.duration),0===t.duration&&(f.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=c},key:function(){if(t.attributes)if("NONE"!==t.attributes.METHOD)if(t.attributes.URI){if("com.apple.streamingkeydelivery"===t.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:t.attributes});if("com.microsoft.playready"===t.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:t.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===t.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(t.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===t.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==t.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):t.attributes.KEYID&&"0x"===t.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:t.attributes.KEYFORMAT,keyId:t.attributes.KEYID.substring(2)},pssh:(0,s.Z)(t.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},"undefined"!==typeof t.attributes.IV&&(n.iv=t.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,v=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){r={},t.uri&&(r.uri=t.uri),t.byterange&&(r.byterange=t.byterange),n&&(r.key=n)},"stream-inf":function(){this.manifest.playlists=c,this.manifest.mediaGroups=this.manifest.mediaGroups||m,t.attributes?(f.attributes||(f.attributes={}),(0,a.Z)(f.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||m,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var r=this.manifest.mediaGroups[t.attributes.TYPE];r[t.attributes["GROUP-ID"]]=r[t.attributes["GROUP-ID"]]||{},e=r[t.attributes["GROUP-ID"]],(o={default:/yes/i.test(t.attributes.DEFAULT)}).default?o.autoselect=!0:o.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(o.language=t.attributes.LANGUAGE),t.attributes.URI&&(o.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(o.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(o.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(o.forced=/yes/i.test(t.attributes.FORCED)),e[t.attributes.NAME]=o}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){v+=1,f.discontinuity=!0,this.manifest.discontinuityStarts.push(c.length)},"program-date-time":function(){"undefined"===typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),f.dateTimeString=t.dateTimeString,f.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):(this.manifest.targetDuration=t.duration,d.call(this,this.manifest))},start:function(){t.attributes&&!isNaN(t.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:t.attributes["TIME-OFFSET"],precise:t.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){f.cueOut=t.data},"cue-out-cont":function(){f.cueOutCont=t.data},"cue-in":function(){f.cueIn=t.data},skip:function(){this.manifest.skip=h(t.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",t.attributes,["SKIPPED-SEGMENTS"])},part:function(){var e=this;l=!0;var r=this.manifest.segments.length,n=h(t.attributes);f.parts=f.parts||[],f.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=b),b=n.byterange.offset+n.byterange.length);var i=f.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+i+" for segment #"+r,t.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(t,r){t.hasOwnProperty("lastPart")||e.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+r+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var e=this.manifest.serverControl=h(t.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),d.call(this,this.manifest),e.canSkipDateranges&&!e.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":function(){var e=this.manifest.segments.length,r=h(t.attributes),n=r.type&&"PART"===r.type;f.preloadHints=f.preloadHints||[],f.preloadHints.push(r),r.byterange&&(r.byterange.hasOwnProperty("offset")||(r.byterange.offset=n?b:0,n&&(b=r.byterange.offset+r.byterange.length)));var i=f.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+i+" for segment #"+e,t.attributes,["TYPE","URI"]),r.type)for(var a=0;ae.timeline?1:-1}));var e,r},x=function(t){var e,r,n=[];return e=t,r=function(t,e,r,i){n=n.concat(t.playlists||[])},I.forEach((function(t){for(var n in e.mediaGroups[t])for(var i in e.mediaGroups[t][n]){var a=e.mediaGroups[t][n][i];r(a,t,n,i)}})),n},O=function(t){var e=t.playlist,r=t.mediaSequence;e.mediaSequence=r,e.segments.forEach((function(t,r){t.number=e.mediaSequence+r}))},C=function(t){var e=t.oldManifest,r=t.newManifest,n=e.playlists.concat(x(e)),i=r.playlists.concat(x(r));return r.timelineStarts=R([e.timelineStarts,r.timelineStarts]),function(t){var e=t.oldPlaylists,r=t.newPlaylists,n=t.timelineStarts;r.forEach((function(t){t.discontinuitySequence=h(n,(function(e){return e.timeline===t.timeline}));var r=function(t,e){for(var r=0;rr.timeline||r.segments.length&&t.timeline>r.segments[r.segments.length-1].timeline)&&t.discontinuitySequence--);r.segments[a].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),O({playlist:t,mediaSequence:r.segments[a].number})}}))}({oldPlaylists:n,newPlaylists:i,timelineStarts:r.timelineStarts}),r},D=function(t){return t&&t.uri+"-"+function(t){var e;return e="bigint"===typeof t.offset||"bigint"===typeof t.length?a().BigInt(t.offset)+a().BigInt(t.length)-a().BigInt(1):t.offset+t.length-1,t.offset+"-"+e}(t.byterange)},L=function(t){return f(t.reduce((function(t,e){var r=e.attributes.id+(e.attributes.lang||"");if(t[r]){var n;if(e.segments)e.segments[0]&&(e.segments[0].discontinuity=!0),(n=t[r].segments).push.apply(n,e.segments);e.attributes.contentProtection&&(t[r].attributes.contentProtection=e.attributes.contentProtection)}else t[r]=e,t[r].attributes.timelineStarts=[];return t[r].attributes.timelineStarts.push({start:e.attributes.periodStart,timeline:e.attributes.periodStart}),t}),{})).map((function(t){var e,r;return t.discontinuityStarts=(e=t.segments||[],r="discontinuity",e.reduce((function(t,e,n){return e[r]&&t.push(n),t}),[])),t}))},M=function(t,e){var r=D(t.sidx),n=r&&e[r]&&e[r].sidx;return n&&A(t,n,t.sidx.resolvedUri),t},U=function(t,e){if(void 0===e&&(e={}),!Object.keys(e).length)return t;for(var r in t)t[r]=M(t[r],e);return t},P=function(t){var e,r=t.attributes,n=t.segments,i=t.sidx,a=t.discontinuityStarts,o={attributes:(e={NAME:r.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:r.width,height:r.height},CODECS:r.codecs,BANDWIDTH:r.bandwidth},e["PROGRAM-ID"]=1,e),uri:"",endList:"static"===r.type,timeline:r.periodStart,resolvedUri:"",targetDuration:r.duration,discontinuityStarts:a,timelineStarts:r.timelineStarts,segments:n};return r.contentProtection&&(o.contentProtection=r.contentProtection),i&&(o.sidx=i),o},B=function(t){var e=t.attributes;return"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType},k=function(t){var e=t.attributes;return"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType},_=function(t){var e=t.attributes;return"text/vtt"===e.mimeType||"text"===e.contentType},X=function(t){return t?Object.keys(t).reduce((function(e,r){var n=t[r];return e.concat(n.playlists)}),[]):[]},G=function(t){var e,r=t.dashPlaylists,n=t.locations,i=t.sidxMapping,a=void 0===i?{}:i,o=t.previousManifest;if(!r.length)return{};var s=r[0].attributes,u=s.sourceDuration,c=s.type,f=s.suggestedPresentationDelay,l=s.minimumUpdatePeriod,p=L(r.filter(B)).map(P),d=L(r.filter(k)),g=L(r.filter(_)),m=r.map((function(t){return t.attributes.captionServices})).filter(Boolean),v={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(e={AUDIO:{},VIDEO:{}},e["CLOSED-CAPTIONS"]={},e.SUBTITLES={},e),uri:"",duration:u,playlists:U(p,a)};l>=0&&(v.minimumUpdatePeriod=1e3*l),n&&(v.locations=n),"dynamic"===c&&(v.suggestedPresentationDelay=f);var y,b,w=0===v.playlists.length,E=d.length?function(t,e,r){var n;void 0===e&&(e={}),void 0===r&&(r=!1);var i=t.reduce((function(t,i){var a=i.attributes.role&&i.attributes.role.value||"",o=i.attributes.lang||"",s=i.attributes.label||"main";if(o&&!i.attributes.label){var u=a?" ("+a+")":"";s=""+i.attributes.lang+u}t[s]||(t[s]={language:o,autoselect:!0,default:"main"===a,playlists:[],uri:""});var c=M(function(t,e){var r,n=t.attributes,i=t.segments,a=t.sidx,o=t.mediaSequence,s=t.discontinuitySequence,u=t.discontinuityStarts,c={attributes:(r={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},r["PROGRAM-ID"]=1,r),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:"",targetDuration:n.duration,discontinuitySequence:s,discontinuityStarts:u,timelineStarts:n.timelineStarts,mediaSequence:o,segments:i};return n.contentProtection&&(c.contentProtection=n.contentProtection),a&&(c.sidx=a),e&&(c.attributes.AUDIO="audio",c.attributes.SUBTITLES="subs"),c}(i,r),e);return t[s].playlists.push(c),"undefined"===typeof n&&"main"===a&&((n=i).default=!0),t}),{});return n||(i[Object.keys(i)[0]].default=!0),i}(d,a,w):null,T=g.length?function(t,e){return void 0===e&&(e={}),t.reduce((function(t,r){var n=r.attributes.lang||"text";return t[n]||(t[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(M(function(t){var e,r=t.attributes,n=t.segments,i=t.mediaSequence,a=t.discontinuityStarts,o=t.discontinuitySequence;"undefined"===typeof n&&(n=[{uri:r.baseUrl,timeline:r.periodStart,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration);var s=((e={NAME:r.id,BANDWIDTH:r.bandwidth})["PROGRAM-ID"]=1,e);return r.codecs&&(s.CODECS=r.codecs),{attributes:s,uri:"",endList:"static"===r.type,timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,timelineStarts:r.timelineStarts,discontinuityStarts:a,discontinuitySequence:o,mediaSequence:i,segments:n}}(r),e)),t}),{})}(g,a):null,S=p.concat(X(E),X(T)),N=S.map((function(t){return t.timelineStarts}));return v.timelineStarts=R(N),y=S,b=v.timelineStarts,y.forEach((function(t){t.mediaSequence=0,t.discontinuitySequence=h(b,(function(e){return e.timeline===t.timeline})),t.segments&&t.segments.forEach((function(t,e){t.number=e}))})),E&&(v.mediaGroups.AUDIO.audio=E),T&&(v.mediaGroups.SUBTITLES.subs=T),m.length&&(v.mediaGroups["CLOSED-CAPTIONS"].cc=m.reduce((function(t,e){return e?(e.forEach((function(e){var r=e.channel,n=e.language;t[n]={autoselect:!1,default:!1,instreamId:r,language:n},e.hasOwnProperty("aspectRatio")&&(t[n].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(t[n].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(t[n]["3D"]=e["3D"])})),t):t}),{})),o?C({oldManifest:o,newManifest:v}):v},H=function(t,e,r){var n=t.NOW,i=t.clientOffset,a=t.availabilityStartTime,o=t.timescale,s=void 0===o?1:o,u=t.periodStart,c=void 0===u?0:u,f=t.minimumUpdatePeriod,l=(n+i)/1e3+(void 0===f?0:f)-(a+c);return Math.ceil((l*s-e)/r)},V=function(t,e){for(var r=t.type,n=t.minimumUpdatePeriod,i=void 0===n?0:n,a=t.media,o=void 0===a?"":a,s=t.sourceDuration,u=t.timescale,c=void 0===u?1:u,f=t.startNumber,l=void 0===f?1:f,p=t.periodStart,h=[],d=-1,g=0;gd&&(d=b);var w=void 0;if(y<0){var E=g+1;w=E===e.length?"dynamic"===r&&i>0&&o.indexOf("$Number$")>0?H(t,d,v):(s*c-d)/v:(e[E].t-d)/v}else w=y+1;for(var T=l+h.length+w,S=l+h.length;S=i?a:""+new Array(i-a.length+1).join("0")+a)}}(e))},j=function(t,e){var r={RepresentationID:t.id,Bandwidth:t.bandwidth||0},i=t.initialization,a=void 0===i?{sourceURL:"",range:""}:i,o=w({baseUrl:t.baseUrl,source:F(a.sourceURL,r),range:a.range}),s=function(t,e){return t.duration||e?t.duration?S(t):V(t,e):[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]}(t,e);return s.map((function(e){r.Number=e.number,r.Time=e.time;var i=F(t.media||"",r),a=t.timescale||1,s=t.presentationTimeOffset||0,u=t.periodStart+(e.time-s)/a;return{uri:i,timeline:e.timeline,duration:e.duration,resolvedUri:(0,n.Z)(t.baseUrl||"",i),map:o,number:e.number,presentationTime:u}}))},z=function(t,e){var r=t.duration,n=t.segmentUrls,i=void 0===n?[]:n,a=t.periodStart;if(!r&&!e||r&&e)throw new Error(y);var o,s=i.map((function(e){return function(t,e){var r=t.baseUrl,n=t.initialization,i=void 0===n?{}:n,a=w({baseUrl:r,source:i.sourceURL,range:i.range}),o=w({baseUrl:r,source:e.media,range:e.mediaRange});return o.map=a,o}(t,e)}));return r&&(o=S(t)),e&&(o=V(t,e)),o.map((function(e,r){if(s[r]){var n=s[r],i=t.timescale||1,o=t.presentationTimeOffset||0;return n.timeline=e.timeline,n.duration=e.duration,n.number=e.number,n.presentationTime=a+(e.time-o)/i,n}})).filter((function(t){return t}))},K=function(t){var e,r,n=t.attributes,i=t.segmentInfo;i.template?(r=j,e=c(n,i.template)):i.base?(r=N,e=c(n,i.base)):i.list&&(r=z,e=c(n,i.list));var a={attributes:n};if(!r)return a;var o=r(e,i.segmentTimeline);if(e.duration){var s=e,u=s.duration,f=s.timescale,l=void 0===f?1:f;e.duration=u/l}else o.length?e.duration=o.reduce((function(t,e){return Math.max(t,Math.ceil(e.duration))}),0):e.duration=0;return a.attributes=e,a.segments=o,i.base&&e.indexRange&&(a.sidx=o[0],a.segments=[]),a},Y=function(t,e){return p(t.childNodes).filter((function(t){return t.tagName===e}))},$=function(t){return t.textContent.trim()},Z=function(t){var e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!e)return 0;var r=e.slice(1),n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],u=r[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(i||0)+86400*parseFloat(a||0)+3600*parseFloat(o||0)+60*parseFloat(s||0)+parseFloat(u||0)},W={mediaPresentationDuration:function(t){return Z(t)},availabilityStartTime:function(t){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=t)&&(e+="Z"),Date.parse(e)/1e3;var e},minimumUpdatePeriod:function(t){return Z(t)},suggestedPresentationDelay:function(t){return Z(t)},type:function(t){return t},timeShiftBufferDepth:function(t){return Z(t)},start:function(t){return Z(t)},width:function(t){return parseInt(t,10)},height:function(t){return parseInt(t,10)},bandwidth:function(t){return parseInt(t,10)},startNumber:function(t){return parseInt(t,10)},timescale:function(t){return parseInt(t,10)},presentationTimeOffset:function(t){return parseInt(t,10)},duration:function(t){var e=parseInt(t,10);return isNaN(e)?Z(t):e},d:function(t){return parseInt(t,10)},t:function(t){return parseInt(t,10)},r:function(t){return parseInt(t,10)},DEFAULT:function(t){return t}},Q=function(t){return t&&t.attributes?p(t.attributes).reduce((function(t,e){var r=W[e.name]||W.DEFAULT;return t[e.name]=r(e.value),t}),{}):{}},J={"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"},tt=function(t,e){return e.length?l(t.map((function(t){return e.map((function(e){return(0,n.Z)(t,$(e))}))}))):t},et=function(t){var e=Y(t,"SegmentTemplate")[0],r=Y(t,"SegmentList")[0],n=r&&Y(r,"SegmentURL").map((function(t){return c({tag:"SegmentURL"},Q(t))})),i=Y(t,"SegmentBase")[0],a=r||e,o=a&&Y(a,"SegmentTimeline")[0],s=r||i||e,u=s&&Y(s,"Initialization")[0],f=e&&Q(e);f&&u?f.initialization=u&&Q(u):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});var l={template:f,segmentTimeline:o&&Y(o,"S").map((function(t){return Q(t)})),list:r&&c(Q(r),{segmentUrls:n,initialization:Q(u)}),base:i&&c(Q(i),{initialization:Q(u)})};return Object.keys(l).forEach((function(t){l[t]||delete l[t]})),l},rt=function(t,e,r){return function(n){var i,a=Q(n),s=tt(e,Y(n,"BaseURL")),u=Y(n,"Role")[0],f={role:Q(u)},p=c(t,a,f),h=Y(n,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(i=Q(h)).schemeIdUri?("string"!==typeof i.value?[]:i.value.split(";")).map((function(t){var e,r;if(r=t,/^CC\d=/.test(t)){var n=t.split("=");e=n[0],r=n[1]}else/^CC\d$/.test(t)&&(e=t);return{channel:e,language:r}})):"urn:scte:dash:cc:cea-708:2015"===i.schemeIdUri?("string"!==typeof i.value?[]:i.value.split(";")).map((function(t){var e={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){var r=t.split("="),n=r[0],i=r[1],a=void 0===i?"":i;e.channel=n,e.language=t,a.split(",").forEach((function(t){var r=t.split(":"),n=r[0],i=r[1];"lang"===n?e.language=i:"er"===n?e.easyReader=Number(i):"war"===n?e.aspectRatio=Number(i):"3D"===n&&(e["3D"]=Number(i))}))}else e.language=t;return e.channel&&(e.channel="SERVICE"+e.channel),e})):void 0;d&&(p=c(p,{captionServices:d}));var g=Y(n,"Label")[0];if(g&&g.childNodes.length){var m=g.childNodes[0].nodeValue.trim();p=c(p,{label:m})}var v=Y(n,"ContentProtection").reduce((function(t,e){var r=Q(e);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());var n=J[r.schemeIdUri];if(n){t[n]={attributes:r};var i=Y(e,"cenc:pssh")[0];if(i){var a=$(i);t[n].pssh=a&&(0,o.Z)(a)}}return t}),{});Object.keys(v).length&&(p=c(p,{contentProtection:v}));var y=et(n),b=Y(n,"Representation"),w=c(r,y);return l(b.map(function(t,e,r){return function(n){var i=Y(n,"BaseURL"),a=tt(e,i),o=c(t,Q(n)),s=et(n);return a.map((function(t){return{segmentInfo:c(r,s),attributes:c(o,{baseUrl:t})}}))}}(p,s,w)))}},nt=function(t,e){return function(r,n){var i=tt(e,Y(r.node,"BaseURL")),a=c(t,{periodStart:r.attributes.start});"number"===typeof r.attributes.duration&&(a.periodDuration=r.attributes.duration);var o=Y(r.node,"AdaptationSet"),s=et(r.node);return l(o.map(rt(a,i,s)))}},it=function(t){if(""===t)throw new Error(g);var e,r,n=new s.DOMParser;try{r=(e=n.parseFromString(t,"application/xml"))&&"MPD"===e.documentElement.tagName?e.documentElement:null}catch(i){}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(m);return r},at=function(t,e){void 0===e&&(e={});var r=function(t,e){void 0===e&&(e={});var r=e,n=r.manifestUri,i=void 0===n?"":n,a=r.NOW,o=void 0===a?Date.now():a,s=r.clientOffset,u=void 0===s?0:s,c=Y(t,"Period");if(!c.length)throw new Error(d);var f=Y(t,"Location"),p=Q(t),h=tt([i],Y(t,"BaseURL"));p.type=p.type||"static",p.sourceDuration=p.mediaPresentationDuration||0,p.NOW=o,p.clientOffset=u,f.length&&(p.locations=f.map($));var g=[];return c.forEach((function(t,e){var r=Q(t),n=g[e-1];r.start=function(t){var e=t.attributes,r=t.priorPeriodAttributes,n=t.mpdType;return"number"===typeof e.start?e.start:r&&"number"===typeof r.start&&"number"===typeof r.duration?r.start+r.duration:r||"static"!==n?null:0}({attributes:r,priorPeriodAttributes:n?n.attributes:null,mpdType:p.type}),g.push({node:t,attributes:r})})),{locations:p.locations,representationInfo:l(g.map(nt(p,h)))}}(it(t),e),n=r.representationInfo.map(K);return G({dashPlaylists:n,locations:r.locations,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest})},ot=function(t){return function(t){var e=Y(t,"UTCTiming")[0];if(!e)return null;var r=Q(e);switch(r.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":r.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":r.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":r.method="DIRECT",r.value=Date.parse(r.value);break;default:throw new Error(b)}return r}(it(t))}},4221:function(t,e,r){var n=r(6894).getUint64;t.exports=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},i=12;0===r.version?(r.earliestPresentationTime=e.getUint32(i),r.firstOffset=e.getUint32(i+4),i+=8):(r.earliestPresentationTime=n(t.subarray(i)),r.firstOffset=n(t.subarray(i+8)),i+=16),i+=2;var a=e.getUint16(i);for(i+=2;a>0;i+=12,a--)r.references.push({referenceType:(128&t[i])>>>7,referencedSize:2147483647&e.getUint32(i),subsegmentDuration:e.getUint32(i+4),startsWithSap:!!(128&t[i+8]),sapType:(112&t[i+8])>>>4,sapDeltaTime:268435455&e.getUint32(i+8)});return r}},1489:function(t){var e,r,n,i,a,o,s,u=9e4;e=function(t){return t*u},r=function(t,e){return t*e},n=function(t){return t/u},i=function(t,e){return t/e},a=function(t,r){return e(i(t,r))},o=function(t,e){return r(n(t),e)},s=function(t,e,r){return n(r?t:t-e)},t.exports={ONE_SECOND_IN_TS:u,secondsToVideoTs:e,secondsToAudioTs:r,videoTsToSeconds:n,audioTsToSeconds:i,audioTsToVideoTs:a,videoTsToAudioTs:o,metadataTsToSeconds:s}},6894:function(t){var e=Math.pow(2,32);t.exports={getUint64:function(t){var r,n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.getBigUint64?(r=n.getBigUint64(0))0?o-4:o;for(r=0;r>16&255,c[f++]=e>>8&255,c[f++]=255&e;2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[f++]=255&e);1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,a=[],o=16383,s=0,u=n-i;su?u:s+o));1===i?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return a.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,r){for(var n,i=[],a=e;ao)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"===typeof t){if("string"===typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return c(t,e,r)}function c(t,e,r){if("string"===typeof t)return function(t,e){"string"===typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return p(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return h(t,e,r);if("undefined"!==typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(t.buffer,SharedArrayBuffer)))return h(t,e,r);if("number"===typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);var i=function(t){if(u.isBuffer(t)){var e=0|d(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!==typeof t.length||q(t.length)?s(0):p(t);if("Buffer"===t.type&&Array.isArray(t.data))return p(t.data)}(t);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!==typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return f(t),s(t<0?0:0|d(t))}function p(t){for(var e=t.length<0?0:0|d(t.length),r=s(e),n=0;n=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(t,ArrayBuffer))return t.byteLength;if("string"!==typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(i)return n?-1:X(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"===typeof e)return e&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var a,o=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var f=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){for(var l=!0,p=0;pi&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128===(192&(a=t[i+1]))&&(u=(31&c)<<6|63&a)>127&&(f=u);break;case 3:a=t[i+1],o=t[i+2],128===(192&a)&&128===(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128===(192&a)&&128===(192&o)&&128===(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return x(n)}e.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"===typeof console||"function"!==typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return f(t),t<=0?s(t):void 0!==e?"string"===typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return l(t)},u.allocUnsafeSlow=function(t){return l(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),V(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);ir&&(t+=" ... "),""},a&&(u.prototype[a]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),s=Math.min(a,o),c=this.slice(n,i),f=t.slice(e,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return T(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return N(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function U(t,e,r,n,i,a){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function k(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||M(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||M(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},u.prototype.readInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||M(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||M(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||M(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||M(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||M(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||M(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||U(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,n)||U(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);U(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);U(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||U(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},u.prototype.fill=function(t,e,r,n){if("string"===typeof t){if("string"===typeof e?(n=e,e=0,r=this.length):"string"===typeof r&&(n=r,r=this.length),void 0!==n&&"string"!==typeof n)throw new TypeError("encoding must be a string");if("string"===typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"===typeof t?t&=255:"boolean"===typeof t&&(t=Number(t));if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"===typeof t)for(a=e;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function G(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;t.length%4!==0;)t+="=";return t}(t))}function H(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function V(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!==t}var F=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()},783:function(t,e){e.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,f=-7,l=r?i-1:0,p=r?-1:1,h=t[e+l];for(l+=p,a=h&(1<<-f)-1,h>>=-f,f+=s;f>0;a=256*a+t[e+l],l+=p,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=n;f>0;o=256*o+t[e+l],l+=p,f-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),a-=c}return(h?-1:1)*o*Math.pow(2,a-n)},e.write=function(t,e,r,n,i,a){var o,s,u,c=8*a-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+l>=1?p/u:p*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=f?(s=0,o=f):o+l>=1?(s=(e*u-1)*Math.pow(2,i),o+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=255&s,h+=d,s/=256,i-=8);for(o=o<0;t[r+h]=255&o,h+=d,o/=256,c-=8);t[r+h-d]|=128*g}}},r={};function n(t){var i=r[t];if(void 0!==i)return i.exports;var a=r[t]={exports:{}},o=!0;try{e[t](a,a.exports,n),o=!1}finally{o&&delete r[t]}return a.exports}n.ab="//";var i=n(72);t.exports=i}()},3512:function(){},9008:function(t,e,r){t.exports=r(5443)},5974:function(t){t.exports=function(t,e){var r,n=null;try{r=JSON.parse(t,e)}catch(i){n=i}return[n,r]}},9945:function(t){!function(e){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=o.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):e;var s=o.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var u=n.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var c={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(c.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var f=s.path,l=f.substring(0,f.lastIndexOf("/")+1)+a.path;c.path=o.normalizePath(l)}else c.path=s.path,a.params||(c.params=s.params,a.query||(c.query=s.query));return null===c.path&&(c.path=r.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(c)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(i,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=o}()},3407:function(t,e,r){var n=r(8908),i=t.exports={WebVTT:r(3706),VTTCue:r(2230),VTTRegion:r(3710)};n.vttjs=i,n.WebVTT=i.WebVTT;var a=i.VTTCue,o=i.VTTRegion,s=n.VTTCue,u=n.VTTRegion;i.shim=function(){n.VTTCue=a,n.VTTRegion=o},i.restore=function(){n.VTTCue=s,n.VTTRegion=u},n.VTTCue||i.shim()},3706:function(t,e,r){var n=r(9144),i=Object.create||function(){function t(){}return function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function a(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}function o(t){function e(t,e,r,n){return 3600*(0|t)+60*(0|e)+(0|r)+(0|n)/1e3}var r=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return r?r[3]?e(r[1],r[2],r[3].replace(":",""),r[4]):r[1]>59?e(r[1],r[2],0,r[4]):e(0,r[1],r[2],r[4]):null}function s(){this.values=i(null)}function u(t,e,r,n){var i=n?t.split(n):[t];for(var a in i)if("string"===typeof i[a]){var o=i[a].split(r);if(2===o.length)e(o[0].trim(),o[1].trim())}}function c(t,e,r){var n=t;function i(){var e=o(t);if(null===e)throw new a(a.Errors.BadTimeStamp,"Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function c(){t=t.replace(/^\s+/,"")}if(c(),e.startTime=i(),c(),"--\x3e"!==t.substr(0,3))throw new a(a.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.substr(3),c(),e.endTime=i(),c(),function(t,e){var n=new s;u(t,(function(t,e){switch(t){case"region":for(var i=r.length-1;i>=0;i--)if(r[i].id===e){n.set(t,r[i].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":var a=e.split(","),o=a[0];n.integer(t,o),n.percent(t,o)&&n.set("snapToLines",!1),n.alt(t,o,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=e.split(","),n.percent(t,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start","center","end","left","right"])}}),/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");try{e.line=n.get("line","auto")}catch(i){}e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100);try{e.align=n.get("align","center")}catch(i){e.align=n.get("align","middle")}try{e.position=n.get("position","auto")}catch(i){e.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},e.align)}e.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},e.align)}(t,e)}a.prototype=i(Error.prototype),a.prototype.constructor=a,a.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},s.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var n=0;n=0&&e<=100)&&(this.set(t,e),!0)}};var f=n.createElement&&n.createElement("textarea"),l={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},p={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)"},h={v:"title",lang:"lang"},d={rt:"ruby"};function g(t,e){function r(){if(!e)return null;var t,r=e.match(/^([^<]*)(<[^>]*>?)?/);return t=r[1]?r[1]:r[2],e=e.substr(t.length),t}function n(t,e){return!d[e.localName]||d[e.localName]===t.localName}function i(e,r){var n=l[e];if(!n)return null;var i=t.document.createElement(n),a=h[e];return a&&r&&(i[a]=r.trim()),i}for(var a,s,u=t.document.createElement("div"),c=u,g=[];null!==(a=r());)if("<"!==a[0])c.appendChild(t.document.createTextNode((s=a,f.innerHTML=s,s=f.textContent,f.textContent="",s)));else{if("/"===a[1]){g.length&&g[g.length-1]===a.substr(2).replace(">","")&&(g.pop(),c=c.parentNode);continue}var m,v=o(a.substr(1,a.length-2));if(v){m=t.document.createProcessingInstruction("timestamp",v),c.appendChild(m);continue}var y=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!y)continue;if(!(m=i(y[1],y[3])))continue;if(!n(c,m))continue;if(y[2]){var b=y[2].split(".");b.forEach((function(t){var e=/^bg_/.test(t),r=e?t.slice(3):t;if(p.hasOwnProperty(r)){var n=e?"background-color":"color",i=p[r];m.style[n]=i}})),m.className=b.join(" ")}g.push(y[1]),c.appendChild(m),c=m}return u}var m=[[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 v(t){for(var e=0;e=r[0]&&t<=r[1])return!0}return!1}function y(t){var e=[],r="";if(!t||!t.childNodes)return"ltr";function n(t,e){for(var r=e.childNodes.length-1;r>=0;r--)t.push(e.childNodes[r])}function i(t){if(!t||!t.length)return null;var e=t.pop(),r=e.textContent||e.innerText;if(r){var a=r.match(/^.*(\n|\r)/);return a?(t.length=0,a[0]):r}return"ruby"===e.tagName?i(t):e.childNodes?(n(t,e),i(t)):void 0}for(n(e,t);r=i(e);)for(var a=0;a=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var e=t.track,r=e.textTrackList,n=0,i=0;il&&(f=f<0?-1:1,f*=Math.ceil(l/c)*c),o<0&&(f+=""===a.vertical?r.height:r.width,s=s.reverse()),i.move(p,f)}else{var h=i.lineHeight/r.height*100;switch(a.lineAlign){case"center":o-=h/2;break;case"end":o-=h}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")})}s=["+y","-x","+x","-y"],i=new E(e)}var d=function(t,e){for(var i,a=new E(t),o=1,s=0;su&&(i=new E(t),o=u),t=new E(a)}return i||a}(i,s);e.move(d.toCSSCompatValues(r))}function S(){}b.prototype.applyStyles=function(t,e){for(var r in e=e||this.div,t)t.hasOwnProperty(r)&&(e.style[r]=t[r])},b.prototype.formatStyle=function(t,e){return 0===t?0:t+e},w.prototype=i(b.prototype),w.prototype.constructor=w,E.prototype.move=function(t,e){switch(e=void 0!==e?e:this.lineHeight,t){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e}},E.prototype.overlaps=function(t){return this.leftt.left&&this.topt.top},E.prototype.overlapsAny=function(t){for(var e=0;e=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},E.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}},E.prototype.intersectPercentage=function(t){return Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left))*Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top))/(this.height*this.width)},E.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},E.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,r=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,n=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;return{left:(t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t).left,right:t.right,top:t.top||n,height:t.height||e,bottom:t.bottom||n+(t.height||e),width:t.width||r}},S.StringDecoder=function(){return{decode:function(t){if(!t)return"";if("string"!==typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}},S.convertCueToDOMTree=function(t,e){return t&&e?g(t,e):null};S.processCues=function(t,e,r){if(!t||!e||!r)return null;for(;r.firstChild;)r.removeChild(r.firstChild);var n=t.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",r.appendChild(n),function(t){for(var e=0;e100)throw new Error("Position must be between 0 and 100.");g=t,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(t){var e=n(t);e?(m=e,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return v},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");v=t,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return y},set:function(t){var e=n(t);if(!e)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");y=e,this.hasBeenReset=!0}}}),this.displayState=void 0}i.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},t.exports=i},3710:function(t){var e={"":!0,up:!0};function r(t){return"number"===typeof t&&t>=0&&t<=100}t.exports=function(){var t=100,n=3,i=0,a=100,o=0,s=100,u="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!r(e))throw new Error("Width must be between 0 and 100.");t=e}},lines:{enumerable:!0,get:function(){return n},set:function(t){if("number"!==typeof t)throw new TypeError("Lines must be set to a number.");n=t}},regionAnchorY:{enumerable:!0,get:function(){return a},set:function(t){if(!r(t))throw new Error("RegionAnchorX must be between 0 and 100.");a=t}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(t){if(!r(t))throw new Error("RegionAnchorY must be between 0 and 100.");i=t}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(t){if(!r(t))throw new Error("ViewportAnchorY must be between 0 and 100.");s=t}},viewportAnchorX:{enumerable:!0,get:function(){return o},set:function(t){if(!r(t))throw new Error("ViewportAnchorX must be between 0 and 100.");o=t}},scroll:{enumerable:!0,get:function(){return u},set:function(t){var r=function(t){return"string"===typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}(t);!1===r?console.warn("Scroll: an invalid or illegal string was specified."):u=r}}})}},7326:function(t,e,r){"use strict";function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}r.d(e,{Z:function(){return n}})},8852:function(t,e,r){"use strict";r.d(e,{Z:function(){return a}});var n=r(9611);function i(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function a(t,e,r){return a=i()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var a=new(Function.bind.apply(t,i));return r&&(0,n.Z)(a,r.prototype),a},a.apply(null,arguments)}},7462:function(t,e,r){"use strict";function n(){return n=Object.assign||function(t){for(var e=1;e{let s,r,n,a,o,l;i.d(t,{A:()=>rk});var h=i(9840),d=i.n(h),u=i(9697),c=i.n(u),p=i(1036),m=i.n(p),g=i(4784),f=i.n(g),_=i(8168),y=i(7098),v=i(642),T=i(279),b=i(4866),S=i(7222),k=i(2010),C=i(8962),E=i.n(C),w=i(1320),x=i(919),I=i(9622),P="8.19.1";let A={},L=function(e,t){return A[e]=A[e]||[],t&&(A[e]=A[e].concat(t)),A[e]},D=function(e,t){let i=L(e).indexOf(t);return!(i<=-1)&&(A[e]=A[e].slice(),A[e].splice(i,1),!0)},O={prefixed:!0},M=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],R=M[0];for(let e=0;e(s,r,n)=>{let a=t.levels[r],o=RegExp(`^(${a})$`),l=e;if("log"!==s&&n.unshift(s.toUpperCase()+":"),i&&(l=`%c${e}`,n.unshift(i)),n.unshift(l+":"),U){U.push([].concat(n));let e=U.length-1e3;U.splice(0,e>0?e:0)}if(!d().console)return;let h=d().console[s];h||"debug"!==s||(h=d().console.info||d().console.log),h&&a&&o.test(s)&&h[Array.isArray(n)?"apply":"call"](d().console,n)},B=function e(t,i=":",s=""){let r,n="info";function a(...e){r("log",n,e)}return r=N(t,a,s),a.createLogger=(r,n,a)=>{let o=void 0!==n?n:i;return e(`${t} ${o} ${r}`,o,void 0!==a?a:s)},a.createNewLogger=(t,i,s)=>e(t,i,s),a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},a.level=e=>{if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw Error(`"${e}" in not a valid log level`);n=e}return n},a.history=()=>U?[].concat(U):[],a.history.filter=e=>(U||[]).filter(t=>RegExp(`.*${e}.*`).test(t[0])),a.history.clear=()=>{U&&(U.length=0)},a.history.disable=()=>{null!==U&&(U.length=0,U=null)},a.history.enable=()=>{null===U&&(U=[])},a.error=(...e)=>r("error",n,e),a.warn=(...e)=>r("warn",n,e),a.debug=(...e)=>r("debug",n,e),a}("VIDEOJS"),j=B.createLogger,F=Object.prototype.toString,$=function(e){return V(e)?Object.keys(e):[]};function q(e,t){$(e).forEach(i=>t(e[i],i))}function H(e,t,i=0){return $(e).reduce((i,s)=>t(i,e[s],s),i)}function V(e){return!!e&&"object"==typeof e}function z(e){return V(e)&&"[object Object]"===F.call(e)&&e.constructor===Object}function W(...e){let t={};return e.forEach(e=>{e&&q(e,(e,i)=>{if(!z(e)){t[i]=e;return}z(t[i])||(t[i]={}),t[i]=W(t[i],e)})}),t}function G(e={}){let t=[];for(let i in e)if(e.hasOwnProperty(i)){let s=e[i];t.push(s)}return t}function K(e,t,i,s=!0){let r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){let e=i();return r(e),e}};return s&&(n.set=r),Object.defineProperty(e,t,n)}var Q=Object.freeze({__proto__:null,each:q,reduce:H,isObject:V,isPlain:z,merge:W,values:G,defineLazyProperty:K});let Y=!1,X=null,J=!1,Z=!1,ee=!1,et=!1,ei=!1,es=null,er=null,en=!!(d().cast&&d().cast.framework&&d().cast.framework.CastReceiverContext),ea=null,eo=!1,el=!1,eh=!1,ed=!1,eu=!1,ec=!1,ep=!1,em=!!(eT()&&("ontouchstart"in d()||d().navigator.maxTouchPoints||d().DocumentTouch&&d().document instanceof d().DocumentTouch)),eg=d().navigator&&d().navigator.userAgentData;if(eg&&eg.platform&&eg.brands&&(J="Android"===eg.platform,ee=!!eg.brands.find(e=>"Microsoft Edge"===e.brand),et=!!eg.brands.find(e=>"Chromium"===e.brand),ei=!ee&&et,es=er=(eg.brands.find(e=>"Chromium"===e.brand)||{}).version||null,el="Windows"===eg.platform),!et){let e=d().navigator&&d().navigator.userAgent||"";Y=/iPod/i.test(e),X=function(){let t=e.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),J=/Android/i.test(e),r=function(){let t=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;let i=t[1]&&parseFloat(t[1]),s=t[2]&&parseFloat(t[2]);return i&&s?parseFloat(t[1]+"."+t[2]):i||null}(),Z=/Firefox/i.test(e),ee=/Edg/i.test(e),et=/Chrome/i.test(e)||/CriOS/i.test(e),ei=!ee&&et,es=er=function(){let t=e.match(/(Chrome|CriOS)\/(\d+)/);return t&&t[2]?parseFloat(t[2]):null}(),ea=function(){let t=/MSIE\s(\d+)\.\d/.exec(e),i=t&&parseFloat(t[1]);return!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e)&&(i=11),i}(),eu=/Tizen/i.test(e),ec=/Web0S/i.test(e),ep=eu||ec,eo=/Safari/i.test(e)&&!ei&&!J&&!ee&&!ep,el=/Windows/i.test(e),eh=/iPad/i.test(e)||eo&&em&&!/iPhone/i.test(e),ed=/iPhone/i.test(e)&&!eh}let ef=ed||eh||Y,e_=(eo||ef)&&!ei;var ey=Object.freeze({__proto__:null,get IS_IPOD(){return Y},get IOS_VERSION(){return X},get IS_ANDROID(){return J},get ANDROID_VERSION(){return r},get IS_FIREFOX(){return Z},get IS_EDGE(){return ee},get IS_CHROMIUM(){return et},get IS_CHROME(){return ei},get CHROMIUM_VERSION(){return es},get CHROME_VERSION(){return er},IS_CHROMECAST_RECEIVER:en,get IE_VERSION(){return ea},get IS_SAFARI(){return eo},get IS_WINDOWS(){return el},get IS_IPAD(){return eh},get IS_IPHONE(){return ed},get IS_TIZEN(){return eu},get IS_WEBOS(){return ec},get IS_SMART_TV(){return ep},TOUCH_ENABLED:em,IS_IOS:ef,IS_ANY_SAFARI:e_});function ev(e){return"string"==typeof e&&!!e.trim()}function eT(){return c()===d().document}function eb(e){return V(e)&&1===e.nodeType}function eS(){try{return d().parent!==d().self}catch(e){return!0}}function ek(e){return function(t,i){if(!ev(t))return c()[e](null);ev(i)&&(i=c().querySelector(i));let s=eb(i)?i:c();return s[e]&&s[e](t)}}function eC(e="div",t={},i={},s){let r=c().createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){let i=t[e];"textContent"===e?eE(r,i):(r[e]!==i||"tabIndex"===e)&&(r[e]=i)}),Object.getOwnPropertyNames(i).forEach(function(e){r.setAttribute(e,i[e])}),s&&eV(r,s),r}function eE(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function ew(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ex(e,t){return!function(e){if(e.indexOf(" ")>=0)throw Error("class has illegal whitespace characters")}(t),e.classList.contains(t)}function eI(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function eP(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(B.warn("removeClass was called with an element that doesn't exist"),null)}function eA(e,t,i){return"function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=void 0),t.split(/\s+/).forEach(t=>e.classList.toggle(t,i)),e}function eL(e,t){Object.getOwnPropertyNames(t).forEach(function(i){let s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)})}function eD(e){let t={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){let s=e.attributes;for(let e=s.length-1;e>=0;e--){let r=s[e].name,n=s[e].value;i.includes(r)&&(n=null!==n),t[r]=n}}return t}function eO(e,t){return e.getAttribute(t)}function eM(e,t,i){e.setAttribute(t,i)}function eR(e,t){e.removeAttribute(t)}function eU(){c().body.focus(),c().onselectstart=function(){return!1}}function eN(){c().onselectstart=function(){return!0}}function eB(e){if(e&&e.getBoundingClientRect&&e.parentNode){let t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(e=>{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(eQ(e,"height"))),i.width||(i.width=parseFloat(eQ(e,"width"))),i}}function ej(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};let t=e.offsetWidth,i=e.offsetHeight,s=0,r=0;for(;e.offsetParent&&e!==c()[O.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function eF(e,t){let i={x:0,y:0};if(ef){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){let e=eQ(t,"transform");if(/^matrix/.test(e)){let t=e.slice(7,-1).split(/,\s/).map(Number);i.x+=t[4],i.y+=t[5]}else if(/^matrix3d/.test(e)){let t=e.slice(9,-1).split(/,\s/).map(Number);i.x+=t[12],i.y+=t[13]}if(t.assignedSlot&&t.assignedSlot.parentElement&&d().WebKitCSSMatrix){let e=d().getComputedStyle(t.assignedSlot.parentElement).transform,s=new(d()).WebKitCSSMatrix(e);i.x+=s.m41,i.y+=s.m42}t=t.parentNode||t.host}}let s={},r=ej(t.target),n=ej(e),a=n.width,o=n.height,l=t.offsetY-(n.top-r.top),h=t.offsetX-(n.left-r.left);return t.changedTouches&&(h=t.changedTouches[0].pageX-n.left,l=t.changedTouches[0].pageY+n.top,ef&&(h-=i.x,l-=i.y)),s.y=1-Math.max(0,Math.min(1,l/o)),s.x=Math.max(0,Math.min(1,h/a)),s}function e$(e){return V(e)&&3===e.nodeType}function eq(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function eH(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>("function"==typeof e&&(e=e()),eb(e)||e$(e))?e:"string"==typeof e&&/\S/.test(e)?c().createTextNode(e):void 0).filter(e=>e)}function eV(e,t){return eH(t).forEach(t=>e.appendChild(t)),e}function ez(e,t){return eV(eq(e),t)}function eW(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||"mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}let eG=ek("querySelector"),eK=ek("querySelectorAll");function eQ(e,t){if(!e||!t)return"";if("function"==typeof d().getComputedStyle){let i;try{i=d().getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}function eY(e){[...c().styleSheets].forEach(t=>{try{let i=[...t.cssRules].map(e=>e.cssText).join(""),s=c().createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(s){let i=c().createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,e.document.head.appendChild(i)}})}var eX=Object.freeze({__proto__:null,isReal:eT,isEl:eb,isInFrame:eS,createEl:eC,textContent:eE,prependTo:ew,hasClass:ex,addClass:eI,removeClass:eP,toggleClass:eA,setAttributes:eL,getAttributes:eD,getAttribute:eO,setAttribute:eM,removeAttribute:eR,blockTextSelection:eU,unblockTextSelection:eN,getBoundingClientRect:eB,findPosition:ej,getPointerPosition:eF,isTextNode:e$,emptyEl:eq,normalizeContent:eH,appendContent:eV,insertContent:ez,isSingleLeftClick:eW,$:eG,$$:eK,computedStyle:eQ,copyStyleSheetsToWindow:eY});let eJ=!1,eZ=function(){if(!1===n.options.autoSetup)return;let e=Array.prototype.slice.call(c().getElementsByTagName("video")),t=Array.prototype.slice.call(c().getElementsByTagName("audio")),i=Array.prototype.slice.call(c().getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&s.length>0)for(let e=0,t=s.length;e-1&&(i={passive:!0}),e.addEventListener(t,s.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,s.dispatcher)}}function ti(e,t,i){if(!e8.has(e))return;let s=e8.get(e);if(!s.handlers)return;if(Array.isArray(t))return e6(ti,e,t,i);let r=function(e,t){s.handlers[t]=[],e3(e,t)};if(void 0===t){for(let t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&r(e,t);return}let n=s.handlers[t];if(n){if(!i){r(e,t);return}if(i.guid)for(let e=0;e=t&&(e(...s),i=r)}},th=function(e,t,i,s=d()){let r;let n=function(){let n=this,a=arguments,o=function(){r=null,o=null,i||e.apply(n,a)};!r&&i&&e.apply(n,a),s.clearTimeout(r),r=s.setTimeout(o,t)};return n.cancel=()=>{s.clearTimeout(r),r=null},n};var td=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:to,throttle:tl,debounce:th});class tu{on(e,t){let i=this.addEventListener;this.addEventListener=()=>{},tt(this,e,t),this.addEventListener=i}off(e,t){ti(this,e,t)}one(e,t){let i=this.addEventListener;this.addEventListener=()=>{},tr(this,e,t),this.addEventListener=i}any(e,t){let i=this.addEventListener;this.addEventListener=()=>{},tn(this,e,t),this.addEventListener=i}trigger(e){let t=e.type||e;"string"==typeof e&&(e={type:t}),e=e7(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ts(this,e)}queueTrigger(e){o||(o=new Map);let t=e.type||e,i=o.get(this);i||(i=new Map,o.set(this,i));let s=i.get(t);i.delete(t),d().clearTimeout(s);let r=d().setTimeout(()=>{i.delete(t),0===i.size&&(i=null,o.delete(this)),this.trigger(e)},0);i.set(t,r)}}tu.prototype.allowedEvents_={},tu.prototype.addEventListener=tu.prototype.on,tu.prototype.removeEventListener=tu.prototype.off,tu.prototype.dispatchEvent=tu.prototype.trigger;let tc=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e,tp=e=>e instanceof tu||!!e.eventBusEl_&&["on","one","off","trigger"].every(t=>"function"==typeof e[t]),tm=(e,t)=>{tp(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))},tg=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,tf=(e,t,i)=>{if(!e||!e.nodeName&&!tp(e))throw Error(`Invalid target for ${tc(t)}#${i}; must be a DOM node or evented object.`)},t_=(e,t,i)=>{if(!tg(e))throw Error(`Invalid event type for ${tc(t)}#${i}; must be a non-empty string or array.`)},ty=(e,t,i)=>{if("function"!=typeof e)throw Error(`Invalid listener for ${tc(t)}#${i}; must be a function.`)},tv=(e,t,i)=>{let s,r,n;let a=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return a?(s=e.eventBusEl_,t.length>=3&&t.shift(),[r,n]=t):(s=t[0],r=t[1],n=t[2]),tf(s,e,i),t_(r,e,i),ty(n,e,i),{isTargetingSelf:a,target:s,type:r,listener:n=to(e,n)}},tT=(e,t,i,s)=>{tf(e,e,t),e.nodeName?ta[t](e,i,s):e[t](i,s)},tb={on(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=tv(this,e,"on");if(tT(i,"on",s,r),!t){let e=()=>this.off(i,s,r);e.guid=r.guid;let t=()=>this.off("dispose",e);t.guid=r.guid,tT(this,"on","dispose",e),tT(i,"on","dispose",t)}},one(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=tv(this,e,"one");if(t)tT(i,"one",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,tT(i,"one",s,e)}},any(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=tv(this,e,"any");if(t)tT(i,"any",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,tT(i,"any",s,e)}},off(e,t,i){!e||tg(e)?ti(this.eventBusEl_,e,t):(tf(e,this,"off"),t_(t,this,"off"),ty(i,this,"off"),i=to(this,i),this.off("dispose",i),e.nodeName?(ti(e,t,i),ti(e,"dispose",i)):tp(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){if(tf(this.eventBusEl_,this,"trigger"),!tg(e&&"string"!=typeof e?e.type:e))throw Error(`Invalid event type for ${tc(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ts(this.eventBusEl_,e,t)}};function tS(e,t={}){let{eventBusKey:i}=t;if(i){if(!e[i].nodeName)throw Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=eC("span",{className:"vjs-event-bus"});return Object.assign(e,tb),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&e8.has(e)&&e8.delete(e)}),d().setTimeout(()=>{e.eventBusEl_=null},0)}),e}let tk={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),q(e,(e,i)=>{this.state[i]!==e&&((t=t||{})[i]={from:this.state[i],to:e}),this.state[i]=e}),t&&tp(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function tC(e,t){return Object.assign(e,tk),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&tp(e)&&e.on("statechanged",e.handleStateChanged),e}let tE=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())},tw=function(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())},tx=function(e,t){return tw(e)===tw(t)};var tI=Object.freeze({__proto__:null,toLowerCase:tE,toTitleCase:tw,titleCaseEquals:tx});class tP{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=W({},this.options_),t=this.options_=W(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){let t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${e5++}`}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(tS(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),tC(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,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&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 e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].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_=W(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return eC(e,t,i)}localize(e,t,i=e){let s=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[s],a=s&&s.split("-")[0],o=r&&r[a],l=i;return n&&n[e]?l=n[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,function(e,i){let s=t[i-1],r=s;return void 0===s&&(r=e),r})),l}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((e,t)=>e.concat(t),[]);let t=this;for(let i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[tw(e.name())]=null,this.childNameIndex_[tE(e.name())]=null;let i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){let e=this.options_.children;if(e){let t;let i=this.options_,s=tP.getComponent("Tech");(t=Array.isArray(e)?e:Object.keys(e)).concat(Object.keys(this.options_).filter(function(e){return!t.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(t=>{let i,s;return"string"==typeof t?s=e[i=t]||this.options_[i]||{}:(i=t.name,s=t),{name:i,opts:s}}).filter(e=>{let t=tP.getComponent(e.opts.componentClass||tw(e.name));return t&&!s.isTech(t)}).forEach(e=>{let t=e.name,s=e.opts;if(void 0!==i[t]&&(s=i[t]),!1===s)return;!0===s&&(s={}),s.playerOptions=this.options_.playerOptions;let r=this.addChild(t,s);r&&(this[t]=r)})}}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(){let e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)}$(e,t){return eG(e,t||this.contentEl())}$$(e,t){return eK(e,t||this.contentEl())}hasClass(e){return ex(this.el_,e)}addClass(...e){eI(this.el_,...e)}removeClass(...e){eP(this.el_,...e)}toggleClass(e,t){eA(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 eO(this.el_,e)}setAttribute(e,t){eM(this.el_,e,t)}removeAttribute(e){eR(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(void 0!==t){(null===t||t!=t)&&(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:"auto"===t?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;let s=this.el_.style[e],r=s.indexOf("px");return -1!==r?parseInt(s.slice(0,r),10):parseInt(this.el_["offset"+tw(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw Error("currentDimension only accepts width or height value");if(0===(t=parseFloat(t=eQ(this.el_,e)))||isNaN(t)){let i=`offset${tw(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(){let e=this.el_.getBoundingClientRect();return{boundingClientRect:{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},center:{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}}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&("Tab"===e.key||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,t=0,i=null;this.on("touchstart",function(s){1===s.touches.length&&(i={pageX:s.touches[0].pageX,pageY:s.touches[0].pageY},t=d().performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(i){let s=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(s*s+r*r)>10&&(e=!1)}});let s=function(){e=!1};this.on("touchleave",s),this.on("touchcancel",s),this.on("touchend",function(s){i=null,!0===e&&d().performance.now()-t<200&&(s.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){let e;if(!this.player()||!this.player().reportUserActivity)return;let t=to(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});let i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=to(this,e),this.clearTimersOnDispose_(),i=d().setTimeout(()=>{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),d().clearTimeout(e)),e}setInterval(e,t){e=to(this,e),this.clearTimersOnDispose_();let i=d().setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),d().clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=to(this,e),t=d().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=to(this,t);let 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),d().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((e,i)=>this[t](i))}),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){var t;function i(e){let t=d().getComputedStyle(e,null),i=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(i)}return e||(e=this.el()),!!(function(e){if(e.offsetWidth+e.offsetHeight+e.getBoundingClientRect().height+e.getBoundingClientRect().width===0)return!1;let t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(t.x<0||t.x>(c().documentElement.clientWidth||d().innerWidth)||t.y<0||t.y>(c().documentElement.clientHeight||d().innerHeight))return!1;let i=c().elementFromPoint(t.x,t.y);for(;i;){if(i===e)return!0;if(!i.parentNode)return!1;i=i.parentNode}}(e)&&i((t=e).parentElement)&&i(t)&&"0"!==t.style.opacity&&"0px"!==d().getComputedStyle(t).height&&"0px"!==d().getComputedStyle(t).width)&&(!e.parentElement||e.tabIndex>=0)}static registerComponent(e,t){if("string"!=typeof e||!e)throw Error(`Illegal component name, "${e}"; must be a non-empty string.`);let i=tP.getComponent("Tech"),s=i&&i.isTech(t),r=tP===t||tP.prototype.isPrototypeOf(t.prototype);if(s||!r){let t;throw t=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",Error(`Illegal component, "${e}"; ${t}.`)}e=tw(e),tP.components_||(tP.components_={});let n=tP.getComponent("Player");if("Player"===e&&n&&n.players){let e=n.players,t=Object.keys(e);if(e&&t.length>0&&t.map(t=>e[t]).every(Boolean))throw Error("Can not register Player component after player has been created.")}return tP.components_[e]=t,tP.components_[tE(e)]=t,t}static getComponent(e){if(e&&tP.components_)return tP.components_[e]}}function tA(e,t,i,s){return!function(e,t,i){if("number"!=typeof t||t<0||t>i)throw Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${t}) is non-numeric or out of bounds (0-${i}).`)}(e,s,i.length-1),i[s][t]}function tL(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw Error("This TimeRanges object is empty")},end(){throw Error("This TimeRanges object is empty")}}:{length:e.length,start:tA.bind(null,"start",0,e),end:tA.bind(null,"end",1,e)},d().Symbol&&d().Symbol.iterator&&(t[d().Symbol.iterator]=()=>(e||[]).values()),t}function tD(e,t){return Array.isArray(e)?tL(e):void 0===e||void 0===t?tL():tL([[e,t]])}tP.registerComponent("Component",tP);let tO=function(e,t){let i=Math.floor((e=e<0?0:e)%60),s=Math.floor(e/60%60),r=Math.floor(e/3600),n=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=s=i="-"),s=(((r=r>0||a>0?r+":":"")||n>=10)&&s<10?"0"+s:s)+":",r+s+(i=i<10?"0"+i:i)},tM=tO;function tR(e){tM=e}function tU(){tM=tO}function tN(e,t=e){return tM(e,t)}var tB=Object.freeze({__proto__:null,createTimeRanges:tD,createTimeRange:tD,setFormatTime:tR,resetFormatTime:tU,formatTime:tN});function tj(e,t){let i,s,r=0;if(!t)return 0;e&&e.length||(e=tD(0,0));for(let n=0;nt&&(s=t),r+=s-i;return r/t}function tF(e){if(e instanceof tF)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:V(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=tF.defaultMessages[this.code]||"")}function t$(e){return null!=e&&"function"==typeof e.then}function tq(e){t$(e)&&e.then(null,e=>{})}tF.prototype.code=0,tF.prototype.message="",tF.prototype.status=null,tF.prototype.metadata=null,tF.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],tF.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."},tF.MEDIA_ERR_CUSTOM=0,tF.prototype.MEDIA_ERR_CUSTOM=0,tF.MEDIA_ERR_ABORTED=1,tF.prototype.MEDIA_ERR_ABORTED=1,tF.MEDIA_ERR_NETWORK=2,tF.prototype.MEDIA_ERR_NETWORK=2,tF.MEDIA_ERR_DECODE=3,tF.prototype.MEDIA_ERR_DECODE=3,tF.MEDIA_ERR_SRC_NOT_SUPPORTED=4,tF.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,tF.MEDIA_ERR_ENCRYPTED=5,tF.prototype.MEDIA_ERR_ENCRYPTED=5;let tH=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,s)=>(e[i]&&(t[i]=e[i]),t),{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})};var tV={textTracksToJson:function(e){let t=e.$$("track"),i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){let t=tH(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return -1===i.indexOf(e)}).map(tH))},jsonToTextTracks:function(e,t){return e.forEach(function(e){let i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>i.addCue(e))}),t.textTracks()}};let tz="vjs-modal-dialog";class tW extends tP{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=eC("div",{className:`${tz}-content`},{role:"document"}),this.descEl_=eC("p",{className:`${tz}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),eE(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`${tz} 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}let 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"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;let 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("boolean"==typeof e){let t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){let e=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,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){let t=this.contentEl(),i=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),ez(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);let r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),eq(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){let e=c().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){let t;if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable()){e.preventDefault(),this.close();return}if("Tab"!==e.key)return;let i=this.focusableEls_(),s=this.el_.querySelector(":focus");for(let e=0;e(e instanceof d().HTMLAnchorElement||e instanceof d().HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof d().HTMLInputElement||e instanceof d().HTMLSelectElement||e instanceof d().HTMLTextAreaElement||e instanceof d().HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof d().HTMLIFrameElement||e instanceof d().HTMLObjectElement||e instanceof d().HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}tW.prototype.options_={pauseOnOpen:!0,temporary:!0},tP.registerComponent("ModalDialog",tW);class tG extends tu{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})},tp(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i=0;t--)if(e[t].enabled){tK(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&tK(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,tK(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)}}let tY=function(e,t){for(let i=0;i=0;t--)if(e[t].selected){tY(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,tY(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 tJ extends tG{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),-1===["metadata","chapters"].indexOf(e.kind)&&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_))}}class tZ{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;tt[e],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}let t3=function(e){return new URL(e,c().baseURI)},t6=function(e){return new URL(e,c().baseURI).href},t7=function(e){if("string"==typeof e){let t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},t9=function(e,t=d().location){return t3(e).origin!==t.origin};var ie=Object.freeze({__proto__:null,parseUrl:t3,getAbsoluteURL:t6,getFileExtension:t7,isCrossOrigin:t9});let it=function(e,t){let i=new(d()).WebVTT.Parser(d(),d().vttjs,d().WebVTT.StringDecoder()),s=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){s.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),s.length>0&&(d().console&&d().console.groupCollapsed&&d().console.groupCollapsed(`Text Track parsing errors for ${t.src}`),s.forEach(e=>B.error(e)),d().console&&d().console.groupEnd&&d().console.groupEnd()),i.flush()},ii=function(e,t){let i={uri:e},s=t9(e);s&&(i.cors=s);let r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),m()(i,to(this,function(e,i,s){if(e)return B.error(e,i);t.loaded_=!0,"function"!=typeof d().WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"===e.type){B.error(`vttjs failed to load, stopping trying to process ${t.src}`);return}return it(s,t)}):it(s,t)}))};class is extends t5{constructor(e={}){if(!e.tech)throw Error("A tech was not provided.");let t=W(e,{kind:t4[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=t8[t.mode]||"disabled",s=t.default;("metadata"===t.kind||"chapters"===t.kind)&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;let r=new t0(this.cues_),n=new t0(this.activeCues_),a=!1;this.timeupdateHandler=to(this,function(e={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,a&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}}),this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==i&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>s,set(){}},mode:{get:()=>i,set(e){t8[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||ii(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return n;let e=this.tech_.currentTime(),t=[];for(let i=0,s=this.cues.length;i=e&&t.push(s)}if(a=!1,t.length!==this.activeCues_.length)a=!0;else for(let e=0;ei,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class ia extends t5{constructor(e={}){let t=W(e,{kind:t1[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get:()=>i,set(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class io extends tu{constructor(e={}){let t;super();let i=new is(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>i}}),t=io.NONE,i.addEventListener("loadeddata",()=>{t=io.LOADED,this.trigger({type:"load",target:this})})}}io.prototype.allowedEvents_={load:"load"},io.NONE=0,io.LOADING=1,io.LOADED=2,io.ERROR=3;let il={audio:{ListClass:tQ,TrackClass:ir,capitalName:"Audio"},video:{ListClass:tX,TrackClass:ia,capitalName:"Video"},text:{ListClass:tJ,TrackClass:is,capitalName:"Text"}};Object.keys(il).forEach(function(e){il[e].getterName=`${e}Tracks`,il[e].privateName=`${e}Tracks_`});let ih={remoteText:{ListClass:tJ,TrackClass:is,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:tZ,TrackClass:io,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},id=Object.assign({},il,ih);ih.names=Object.keys(ih),il.names=Object.keys(il),id.names=[].concat(ih.names).concat(il.names);class iu extends tP{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),id.names.forEach(t=>{let i=id[t];e&&e[i.getterName]&&(this[i.privateName]=e[i.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(t=>{!1===e[`native${t}Tracks`]&&(this[`featuresNative${t}Tracks`]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:(!0===e.nativeCaptions||!0===e.nativeTextTracks)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new id.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(to(this,function(){let e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return tD(0,0)}bufferedPercent(){return tj(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(il.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{let t=this[`${e}Tracks`]()||[],i=t.length;for(;i--;){let s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){let e=this.autoRemoteTextTracks_||[],t=e.length;for(;t--;){let i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new tF(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?tD(0,0):tD()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){il.names.forEach(e=>{let t=il[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!d().WebVTT){if(c().body.contains(this.el())){if(!this.options_["vtt.js"]&&z(f())&&Object.keys(f()).length>0){this.trigger("vttjsloaded");return}let e=c().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}),d().WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}}emulateTextTracks(){let e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),s=t=>e.removeTrack(t.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();let r=()=>this.trigger("texttrackchange"),n=()=>{r();for(let t=0;tthis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){let 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){let t=e5++;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 iu.canPlayType(e.type)}static isTech(e){return e.prototype instanceof iu||e instanceof iu||e===iu}static registerTech(e,t){if(iu.techs_||(iu.techs_={}),!iu.isTech(t))throw Error(`Tech ${e} must be a Tech`);if(!iu.canPlayType)throw Error("Techs must have a static canPlayType method on them");if(!iu.canPlaySource)throw Error("Techs must have a static canPlaySource method on them");return e=tw(e),iu.techs_[e]=t,iu.techs_[tE(e)]=t,"Tech"!==e&&iu.defaultTechOrder_.push(e),t}static getTech(e){return e?iu.techs_&&iu.techs_[e]?iu.techs_[e]:(e=tw(e),d()&&d().videojs&&d().videojs[e])?(B.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),d().videojs[e]):void 0:void 0}}id.names.forEach(function(e){let t=id[e];iu.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),iu.prototype.featuresVolumeControl=!0,iu.prototype.featuresMuteControl=!0,iu.prototype.featuresFullscreenResize=!1,iu.prototype.featuresPlaybackRate=!1,iu.prototype.featuresProgressEvents=!1,iu.prototype.featuresSourceset=!1,iu.prototype.featuresTimeupdateEvents=!1,iu.prototype.featuresNativeTextTracks=!1,iu.prototype.featuresVideoFrameCallback=!1,iu.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let s=e.sourceHandlers;s||(s=e.sourceHandlers=[]),void 0===i&&(i=s.length),s.splice(i,0,t)},e.canPlayType=function(t){let i;let s=e.sourceHandlers||[];for(let e=0;e=0;r--){let n=e[r];n[t]&&n[t](s,i)}}(e,i,o,a),o}let i_={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},iy={setCurrentTime:1,setMuted:1,setVolume:1},iv={play:1,pause:1};function iT(e){return(t,i)=>t===im?im:i[e]?i[e](t):t}let ib={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},iS=function(e=""){return ib[t7(e).toLowerCase()]||""},ik=(e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;let i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;let s=e.$$("source");for(let e=0;e{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){let t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();let e=t.key.substring(5).toLowerCase();this.move(e)}else if(ix.isEventKey(t,"play")||ix.isEventKey(t,"pause")||ix.isEventKey(t,"ff")||ix.isEventKey(t,"rw")){t.preventDefault();let e=ix.getEventName(t);this.performMediaAction_(e)}else ix.isEventKey(t,"Back")&&e.target&&"function"==typeof e.target.closeable&&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()+5);break;case"rw":this.userSeek_(this.player_.currentTime()-5)}}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){let t=e.relatedTarget,i=null,s=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)&&(s&&"CloseButton"===s.name()?this.refocusComponent():(this.pause(),s&&s.el()&&(this.lastFocusedComponent_=s)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){let e=this.player_,t=[];function i(e){for(let s of e)s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())&&t.push(s),s.hasOwnProperty("children_")&&s.children_.length>0&&i(s.children_)}return e.children_.forEach(e=>{if(e.hasOwnProperty("el_")){if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())){t.push(e);return}e.hasOwnProperty("children_")&&e.children_.length>0?i(e.children_):e.hasOwnProperty("items")&&e.items.length>0?i(e.items):this.findSuitableDOMChild(e)&&t.push(e)}if("ErrorDisplay"===e.name_&&e.opened_){let i=e.el_.querySelector(".vjs-errors-ok-button-container");i&&i.querySelectorAll("button").forEach((e,i)=>{t.push({name:()=>"ModalButton"+(i+1),el:()=>e,getPositions:()=>{let t=e.getBoundingClientRect();return{boundingClientRect:{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},center:{x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2}}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:e=>!0,focus:()=>e.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){return e.el()?function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let e=0;e0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){let t=this.getCurrentComponent();if(!t)return;let i=t.getPositions(),s=this.focusableComponents.filter(s=>s!==t&&this.isInDirection_(i.boundingClientRect,s.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,s,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let s=1/0,r=null;for(let n of t){let t=n.getPositions().center,a=this.calculateDistance_(e,t,i);a=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(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&B.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;let s=eC(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(eC("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=eC("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(void 0===e)return this.controlText_||"Need Text";let i=this.localize(e);this.controlText_=e,eE(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"),void 0!==this.tabIndex_&&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"),void 0!==this.tabIndex_&&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||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}tP.registerComponent("ClickableComponent",iA);class iL extends iA{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return eC("div",{className:"vjs-poster"})}crossOrigin(e){if(void 0===e)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(null!==e&&"anonymous"!==e&&"use-credentials"!==e){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){let 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(eC("picture",{className:"vjs-poster",tabIndex:-1},{},eC("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()?tq(this.player_.play()):this.player_.pause())}}iL.prototype.crossorigin=iL.prototype.crossOrigin,tP.registerComponent("PosterImage",iL);let iD="#222",iO="#ccc",iM={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 iR(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else if(7===e.length)i=e.slice(1);else throw Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function iU(e,t,i){try{e.style[t]=i}catch(e){return}}function iN(e){return e?`${e}px`:""}class iB extends tP{constructor(e,t,i){super(e,t,i);let s=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};e.on("loadstart",e=>this.toggleDisplay(e)),e.on("texttrackchange",e=>this.updateDisplay(e)),e.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),e.ready(to(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);let t=d().screen.orientation||d(),i=d().screen.orientation?"change":"orientationchange";t.addEventListener(i,s),e.on("dispose",()=>t.removeEventListener(i,s));let r=this.options_.playerOptions.tracks||[];for(let e=0;e0&&t.forEach(e=>{if(e.style.inset){let t=e.style.inset.split(" ");3===t.length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!d().CSS.supports("inset-inline: 10px"))return;let e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight(),r=0,n=0;Math.abs(i-s)>.1&&(i>s?r=Math.round((e-t*s)/2):n=Math.round((t-e/s)/2)),iU(this.el_,"insetInline",iN(r)),iU(this.el_,"insetBlock",iN(n))}updateDisplayState(e){let t=this.player_.textTrackSettings.getValues(),i=e.activeCues,s=i.length;for(;s--;){let e=i[s];if(!e)continue;let r=e.displayState;if(t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&iU(r.firstChild,"color",iR(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&iU(r.firstChild,"backgroundColor",iR(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?iU(r,"backgroundColor",iR(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow=`2px 2px 3px ${iD}, 2px 2px 4px ${iD}, 2px 2px 5px ${iD}`:"raised"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${iD}, 2px 2px ${iD}, 3px 3px ${iD}`:"depressed"===t.edgeStyle?r.firstChild.style.textShadow=`1px 1px ${iO}, 0 1px ${iO}, -1px -1px ${iD}, 0 -1px ${iD}`:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow=`0 0 4px ${iD}, 0 0 4px ${iD}, 0 0 4px ${iD}, 0 0 4px ${iD}`)),t.fontPercent&&1!==t.fontPercent){let e=d().parseFloat(r.style.fontSize);r.style.fontSize=e*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=iM[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof d().WebVTT||e.every(e=>!e.activeCues))return;let t=[];for(let i=0;ithis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){let t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){tq(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}let i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}let r=()=>s.focus();t$(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}i$.prototype.controlText_="Play Video",tP.registerComponent("BigPlayButton",i$);class iq extends iF{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){"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}tP.registerComponent("CloseButton",iq);class iH extends iF{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?tq(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",e=>this.handleSeeked(e))}}iH.prototype.controlText_="Play",tP.registerComponent("PlayToggle",iH);class iV extends tP{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],e=>this.update(e)),this.updateTextNode_()}createEl(){let e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=eC("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\u00a0`},{role:"presentation"});return t.appendChild(i),this.contentEl_=eC("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||"seeking"!==e.type)&&this.updateContent(e)}updateTextNode_(e=0){e=tN(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,B.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_=c().createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}iV.prototype.labelText_="Time",iV.prototype.controlText_="Time",tP.registerComponent("TimeDisplay",iV);class iz extends iV{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}iz.prototype.labelText_="Current Time",iz.prototype.controlText_="Current Time",tP.registerComponent("CurrentTimeDisplay",iz);class iW extends iV{constructor(e,t){super(e,t);let i=e=>this.updateContent(e);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){let t=this.player_.duration();this.updateTextNode_(t)}}iW.prototype.labelText_="Duration",iW.prototype.controlText_="Duration",tP.registerComponent("DurationDisplay",iW);class iG extends tP{createEl(){let 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}}tP.registerComponent("TimeDivider",iG);class iK extends iV{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){let e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(eC("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){let t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))}}iK.prototype.labelText_="Remaining Time",iK.prototype.controlText_="Remaining Time",tP.registerComponent("RemainingTimeDisplay",iK);class iQ extends tP{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){let e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=eC("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(eC("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\u00a0`})),this.contentEl_.appendChild(c().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()}}tP.registerComponent("LiveDisplay",iQ);class iY extends iF{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){let e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=eC("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()}}function iX(e,t,i){return Math.min(i,Math.max(t,isNaN(e=Number(e))?t:e))}iY.prototype.controlText_="Seek to live, currently playing live",tP.registerComponent("SeekToLive",iY);var iJ=Object.freeze({__proto__:null,clamp:iX});class iZ extends tP{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),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;let 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){let t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||ei||e.preventDefault(),eU(),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){let t=this.bar.el_.ownerDocument;eN(),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;let e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{let t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"})),e}getProgress(){return Number(iX(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){let t=eF(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){let t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,s=t&&t.horizontalSeek;i?s&&"ArrowLeft"===e.key||!s&&"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):s&&"ArrowRight"===e.key||!s&&"ArrowUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):"ArrowUp"===e.key||"ArrowRight"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}tP.registerComponent("Slider",iZ);let i0=(e,t)=>iX(e/t*100,0,100).toFixed(2)+"%";class i1 extends tP{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){let e=super.createEl("div",{className:"vjs-load-progress"}),t=eC("span",{className:"vjs-control-text"}),i=eC("span",{textContent:this.localize("Loaded")}),s=c().createTextNode(": ");return this.percentageEl_=eC("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{let e=this.player_.liveTracker,t=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,n=i0(s,i);this.percent_!==n&&(this.el_.style.width=n,eE(this.percentageEl_,n),this.percent_=n);for(let e=0;et.length;e--)this.el_.removeChild(r[e-1]);r.length=t.length})}}tP.registerComponent("LoadProgressBar",i1);class i2 extends tP{constructor(e,t){super(e,t),this.update=tl(to(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){let s=ej(this.el_),r=eB(this.player_.el()),n=e.width*t;if(!r||!s)return;let a=e.left-r.left+n,o=e.width-n+(r.right-e.right);o||(o=e.width-n,a=n);let l=s.width/2;as.width&&(l=s.width),l=Math.round(l),this.el_.style.right=`-${l}px`,this.write(i)}write(e){eE(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;let n=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){let e=this.player_.liveTracker.liveWindow(),i=e-t*e;r=(i<1?"":"-")+tN(i,e)}else r=tN(i,n);this.update(e,t,r),s&&s()})}}tP.registerComponent("TimeTooltip",i2);class i4 extends tP{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=tl(to(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){let i=this.getChild("timeTooltip");if(!i)return;let s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}i4.prototype.options_={children:[]},ef||J||i4.prototype.options_.children.push("timeTooltip"),tP.registerComponent("PlayProgressBar",i4);class i8 extends tP{constructor(e,t){super(e,t),this.update=tl(to(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){let i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}i8.prototype.options_={children:["timeTooltip"]},tP.registerComponent("MouseTimeDisplay",i8);class i5 extends iZ{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=to(this,this.update),this.update=tl(this.update_,30),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 c()&&"visibilityState"in c()&&this.on(c(),"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===c().visibilityState?(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,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||!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("hidden"===c().visibilityState)return;let t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{let e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker,s=this.player_.duration();i&&i.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),(this.currentTime_!==e||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[tN(e,s),tN(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(eB(this.el()),this.getProgress())}),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()}getPercent(){let e;let t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e}handleMouseDown(e){eW(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){let i;if(!eW(e)||isNaN(this.player_.duration()))return;t||this.player_.scrubbing()||this.player_.scrubbing(!0);let s=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(s>=.99){r.seekToLiveEdge();return}let e=r.seekableStart(),t=r.liveCurrentTime();if((i=e+s*r.liveWindow())>=t&&(i=t),i<=e&&(i=e+.1),i===1/0)return}else(i=s*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();let e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();let e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?tq(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){let t=this.player_.liveTracker;if(" "===e.key||"Enter"===e.key)e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if("Home"===e.key)e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if("End"===e.key)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();let i=.1*parseInt(e.key,10);t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else"PageDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):"PageUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):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 c()&&"visibilityState"in c()&&this.off(c(),"visibilitychange",this.toggleVisibility_),super.dispose()}}i5.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ef||J||i5.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),tP.registerComponent("SeekBar",i5);class i3 extends tP{constructor(e,t){super(e,t),this.handleMouseMove=tl(to(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=tl(to(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){let t=this.getChild("seekBar");if(!t)return;let i=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;let r=t.el(),n=ej(r),a=eF(r,e).x;a=iX(a,0,1),s&&s.update(n,a),i&&i.update(n,t.getProgress())}handleMouseSeek(e){let 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",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){let e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&tq(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",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){let 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){let 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){let t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}i3.prototype.options_={children:["seekBar"]},tP.registerComponent("ProgressControl",i3);class i6 extends iF{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!("audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){c().pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in d()?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(){"function"==typeof c().exitPictureInPicture&&super.show()}}i6.prototype.controlText_="Picture-in-Picture",tP.registerComponent("PictureInPictureToggle",i6);class i7 extends iF{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===c()[e.fsApi_.fullscreenEnabled]&&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()}}i7.prototype.controlText_="Fullscreen",tP.registerComponent("FullscreenToggle",i7);let i9=function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})};class se extends tP{createEl(){let e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}tP.registerComponent("VolumeLevel",se);class st extends tP{constructor(e,t){super(e,t),this.update=tl(to(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){let i=eB(this.el_),s=eB(this.player_.el()),r=e.width*t;if(!s||!i)return;let n=e.left-s.left+r,a=e.width-r+(s.right-e.right),o=i.width/2;ni.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${s}%`)}write(e){eE(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}tP.registerComponent("VolumeLevelTooltip",st);class si extends tP{constructor(e,t){super(e,t),this.update=tl(to(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){this.getChild("volumeLevelTooltip").updateVolume(e,t,i,100*t,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}si.prototype.options_={children:["volumeLevelTooltip"]},tP.registerComponent("MouseVolumeLevelDisplay",si);class ss extends iZ{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),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){eW(e)&&super.handleMouseDown(e)}handleMouseMove(e){let t=this.getChild("mouseVolumeLevelDisplay");if(t){let i=this.el(),s=eB(i),r=this.vertical(),n=eF(i,e);n=iX(n=r?n.y:n.x,0,1),t.update(s,n,r)}eW(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){let t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){let e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}ss.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},ef||J||ss.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),ss.prototype.playerEvent="volumechange",tP.registerComponent("VolumeBar",ss);class sr extends tP{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||z(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i9(this,e),this.throttledHandleMouseMove=tl(to(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),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){let 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){let 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)}}sr.prototype.options_={children:["volumeBar"]},tP.registerComponent("VolumeControl",sr);let sn=function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})};class sa extends iF{constructor(e,t){super(e,t),sn(this,e),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){let t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){let e=this.player_.volume(),t=3;this.setIcon("volume-high"),ef&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||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),eP(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-${t}`,"")),eI(this.el_,`vjs-vol-${t}`)}updateControlText_(){let e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}sa.prototype.controlText_="Mute",tP.registerComponent("MuteToggle",sa);class so extends tP{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||z(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),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){"Escape"===e.key&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),tt(c(),"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ti(c(),"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}so.prototype.options_={children:["muteToggle","volumeControl"]},tP.registerComponent("VolumePanel",so);class sl extends iF{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(){let 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){let t;if(isNaN(this.player_.duration()))return;let i=this.player_.currentTime(),s=this.player_.liveTracker,r=s&&s.isLive()?s.seekableEnd():this.player_.duration();t=i+this.skipTime<=r?i+this.skipTime:r,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}sl.prototype.controlText_="Skip Forward",tP.registerComponent("SkipForward",sl);class sh extends iF{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(){let 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){let t;let i=this.player_.currentTime(),s=this.player_.liveTracker,r=s&&s.isLive()&&s.seekableStart();t=r&&i-this.skipTime<=r?r:i>=this.skipTime?i-this.skipTime:0,this.player_.currentTime(t)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}sh.prototype.controlText_="Skip Backward",tP.registerComponent("SkipBackward",sh);class sd extends tP{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof tP&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof tP&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){let t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){let e=this.options_.contentElType||"ul";this.contentEl_=eC(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");let t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),tt(t,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let t=e.relatedTarget||c().activeElement;if(!this.children().some(e=>e.el()===t)){let e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();let t=this.children();if(!Array.isArray(t))return;let i=t.filter(t=>t.el()===e.target)[0];i&&"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}}handleKeyDown(e){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):("ArrowRight"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){let 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())}}tP.registerComponent("Menu",sd);class su extends tP{constructor(e,t={}){super(e,t),this.menuButton_=new iF(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");let i=iF.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;let s=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),tt(c(),"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){let 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(){let e=new sd(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){let t=eC("li",{className:"vjs-menu-title",textContent:tw(this.options_.title),tabIndex:-1}),i=new tP(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,e)},n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof d().Event)try{e=new(d()).Event("change")}catch(e){}e||(e=c().createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){let t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e-1&&"showing"===s.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){let t=this.player().textTracks(),i=!0;for(let e=0,s=t.length;e-1&&"showing"===s.mode){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()}}tP.registerComponent("OffTextTrackMenuItem",sg);class sf extends sc{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=sm){let i;this.label_&&(i=`${this.label_} off`),e.push(new sg(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;let s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i-1){let i=new t(this.player_,{track:r,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});i.addClass(`vjs-${r.kind}-menu-item`),e.push(i)}}return e}}tP.registerComponent("TextTrackButton",sf);class s_ extends sp{constructor(e,t){let i=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&"chapters"!==e.track.kind)return;let 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_){let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";let e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){let e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){let i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(tw(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){let e=[];if(!this.track_)return e;let t=this.track_.cues;if(!t)return e;for(let i=0,s=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(tw(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 sb(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,sk)}}sC.prototype.kinds_=["captions","subtitles"],sC.prototype.controlText_="Subtitles",tP.registerComponent("SubsCapsButton",sC);class sE extends sp{constructor(e,t){let i=t.track,s=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`);let r=(...e)=>{this.handleTracksChange.apply(this,e)};s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){let s=super.createEl(e,t,i),r=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(eC("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(eC("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){let e=this.player_.audioTracks();for(let t=0;tthis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}sx.prototype.contentElType="button",tP.registerComponent("PlaybackRateMenuItem",sx);class sI extends su{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){let e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=eC("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(){let e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new sx(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){let 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")}}sI.prototype.controlText_="Playback Rate",tP.registerComponent("PlaybackRateMenuButton",sI);class sP extends tP{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}tP.registerComponent("Spacer",sP);class sA extends sP{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:"\xa0"})}}tP.registerComponent("CustomControlSpacer",sA);class sL extends tP{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}sL.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},tP.registerComponent("ControlBar",sL);class sD extends tW{constructor(e,t){super(e,t),this.on(e,"error",e=>{this.open(e)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){let e=this.player().error();return e?this.localize(e.message):""}}sD.prototype.options_=Object.assign({},tW.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),tP.registerComponent("ErrorDisplay",sD);class sO extends tP{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(),eC("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{let t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${e5++}`)+"-"+e[1].replace(/\W+/g,""),i=eC("option",{id:t,value:this.localize(e[0]),textContent:e[1]});return i.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),i}))}}tP.registerComponent("TextTrackSelect",sO);class sM extends tP{constructor(e,t={}){super(e,t);let i=eC("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});for(let t of(this.el().appendChild(i),this.options_.selects)){let i=this.options_.selectConfigs[t],s=i.className,r=i.id.replace("%s",this.options_.id_),n=null,a=`vjs_select_${e5++}`;if("colors"===this.options_.type){n=eC("span",{className:s});let e=eC("label",{id:r,className:"vjs-label",textContent:i.label});e.setAttribute("for",a),n.appendChild(e)}let o=new sO(e,{SelectOptions:i.options,legendId:this.options_.legendId,id:a,labelId:r});this.addChild(o),"colors"===this.options_.type&&(n.appendChild(o.el()),this.el().appendChild(n))}}createEl(){return eC("fieldset",{className:this.options_.className})}}tP.registerComponent("TextTrackFieldset",sM);class sR extends tP{constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,s=new sM(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(s);let r=new sM(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);let n=new sM(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(n)}createEl(){return eC("div",{className:"vjs-track-settings-colors"})}}tP.registerComponent("TextTrackSettingsColors",sR);class sU extends tP{constructor(e,t={}){super(e,t);let i=this.options_.textTrackComponentid,s=new sM(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(s);let r=new sM(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);let n=new sM(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(n)}createEl(){return eC("div",{className:"vjs-track-settings-font"})}}tP.registerComponent("TextTrackSettingsFont",sU);class sN extends tP{constructor(e,t={}){super(e,t);let i=this.localize("restore all settings to the default values"),s=new iF(e,{controlText:i,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);let r=new iF(e,{controlText:i,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Done"),this.addChild(r)}createEl(){return eC("div",{className:"vjs-track-settings-controls"})}}tP.registerComponent("TrackSettingsControls",sN);let sB="vjs-text-track-settings",sj=["#000","Black"],sF=["#00F","Blue"],s$=["#0FF","Cyan"],sq=["#0F0","Green"],sH=["#F0F","Magenta"],sV=["#F00","Red"],sz=["#FFF","White"],sW=["#FF0","Yellow"],sG=["1","Opaque"],sK=["0.5","Semi-Transparent"],sQ=["0","Transparent"],sY={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[sj,sz,sV,sq,sF,sW,sH,s$],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[sG,sK,sQ],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[sz,sj,sV,sq,sF,sW,sH,s$],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:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[sG,sK],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:[sQ,sK,sG],className:"vjs-window-opacity vjs-opacity"}};function sX(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}sY.windowColor.options=sY.backgroundColor.options;class sJ extends tW{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=eC("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){let t=new sR(e,{textTrackComponentid:this.id_,selectConfigs:sY,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);let i=new sU(e,{textTrackComponentid:this.id_,selectConfigs:sY,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);let s=new sN(e);this.addChild(s)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),q(sY,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 H(sY,(e,t,i)=>{var s,r;let n=(s=this.$(t.selector),r=t.parser,sX(s.options[s.options.selectedIndex].value,r));return void 0!==n&&(e[i]=n),e},{})}setValues(e){q(sY,(t,i)=>{!function(e,t,i){if(t){for(let s=0;s{let t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(d().localStorage.getItem(sB))}catch(e){B.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;let e=this.getValues();try{Object.keys(e).length?d().localStorage.setItem(sB,JSON.stringify(e)):d().localStorage.removeItem(sB)}catch(e){B.warn(e)}}updateDisplay(){let e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}tP.registerComponent("TextTrackSettings",sJ);class sZ extends tP{constructor(e,t){let i=t.ResizeObserver||d().ResizeObserver;null===t.ResizeObserver&&(i=!1),super(e,W({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||d().ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=th(()=>{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;let e=this.debouncedHandler_,t=this.unloadListener_=function(){ti(this,"resize",e),ti(this,"unload",t),t=null};tt(this.el_.contentWindow,"unload",t),tt(this.el_.contentWindow,"resize",e)},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()}}tP.registerComponent("ResizeManager",sZ);let s0={trackingThreshold:20,liveTolerance:15};class s1 extends tP{constructor(e,t){super(e,W(s0,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){let e=this.player_.seekable();if(!e||!e.length)return;let t=Number(d().performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;let s=this.liveCurrentTime(),r=this.player_.currentTime(),n=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-r)>this.options_.liveTolerance;this.timeupdateSeen_&&s!==1/0||(n=!1),n!==this.behindLiveEdge_&&(this.behindLiveEdge_=n,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_,30),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(){let 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(){let e=this.player_.seekable(),t=[],i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){let e=this.player_.seekable(),t=[],i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){let 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(){let e=this.seekableEnd();return -1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}tP.registerComponent("LiveTracker",s1);class s2 extends tP{constructor(e,t){super(e,t),this.on("statechanged",e=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:eC("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${e5++}`}),description:eC("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${e5++}`})},eC("div",{className:"vjs-title-bar"},{},G(this.els))}updateDom_(){let e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{let s=this.state[e],r=this.els[e],n=i[e];eq(r),s&&eE(r,s),t&&(t.removeAttribute(n),s&&t.setAttribute(n,r.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){let e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}tP.registerComponent("TitleBar",s2);let s4={initialDisplay:4e3,position:[],takeFocus:!1};class s8 extends iF{constructor(e,t){super(e,t=W(s4,t)),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],e=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){let e=eC("button",{},{type:"button",class:this.buildCSSClass()},eC("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()}}tP.registerComponent("TransientButton",s8);let s5=e=>{let t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;let i=e.$$("source"),s=[],r="";if(!i.length)return!1;for(let e=0;e{let i={};for(let s=0;ss6([e.el(),d().HTMLMediaElement.prototype,d().Element.prototype,s3],"innerHTML"),s9=function(e){let t=e.el();if(t.resetSourceWatch_)return;let i={},s=s7(e),r=i=>(...s)=>{let r=i.apply(t,s);return s5(e),r};["append","appendChild","insertAdjacentHTML"].forEach(e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))}),Object.defineProperty(t,"innerHTML",W(s,{set:r(s.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach(e=>{t[e]=i[e]}),Object.defineProperty(t,"innerHTML",s)},e.one("sourceset",t.resetSourceWatch_)},re=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?t6(d().Element.prototype.getAttribute.call(this,"src")):""},set(e){return d().Element.prototype.setAttribute.call(this,"src",e),e}}),rt=e=>s6([e.el(),d().HTMLMediaElement.prototype,re],"src"),ri=function(e){if(!e.featuresSourceset)return;let t=e.el();if(t.resetSourceset_)return;let i=rt(e),s=t.setAttribute,r=t.load;Object.defineProperty(t,"src",W(i,{set:s=>{let r=i.set.call(t,s);return e.triggerSourceset(t.src),r}})),t.setAttribute=(i,r)=>{let n=s.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),n},t.load=()=>{let i=r.call(t);return s5(e)||(e.triggerSourceset(""),s9(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):s5(e)||s9(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}};class rs extends iu{constructor(e,t){super(e,t);let i=e.source,s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,i&&(this.el_.currentSrc!==i.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){let e=this.el_.childNodes,t=e.length,i=[];for(;t--;){let r=e[t];"track"===r.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),this.textTracks().addTrack(r.track),!s&&!this.el_.hasAttribute("crossorigin")&&t9(r.src)&&(s=!0)):i.push(r))}for(let e=0;e{e=[];for(let i=0;it.removeEventListener("change",i));let s=()=>{for(let t=0;t{t.removeEventListener("change",i),t.removeEventListener("change",s),t.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;let i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(e=>{this.el()[`${i}Tracks`].removeEventListener(e,this[`${i}TracksListeners_`][e])}),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){let t=il[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;let r={change:t=>{let i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[ih.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},n=function(){let e=[];for(let t=0;t{let t=r[e];i.addEventListener(e,t),this.on("dispose",s=>i.removeEventListener(e,t))}),this.on("loadstart",n),this.on("dispose",e=>this.off("loadstart",n))}proxyNativeTracks_(){il.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){let t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),rs.disposeMediaElement(e),e=t}else{e=c().createElement("video");let t=W({},this.options_.tag&&eD(this.options_.tag));em&&!0===this.options_.nativeControlsForTouch||delete t.controls,eL(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&eM(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);let 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(e){this.trigger(e)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&e_?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){B(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&J&&ei&&0===this.el_.currentTime){let 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;let 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_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(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"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)tq(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",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(void 0===e)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return B.error("Invalid source URL."),!1;let i={src:e};t&&(i.type=t);let s=eC("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return B.error("Source URL is required to remove the source element."),!1;for(let t of this.el_.querySelectorAll("source"))if(t.src===e)return this.el_.removeChild(t),!0;return B.warn(`No matching source element found with src: ${e}`),!1}reset(){rs.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);let t=c().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){let i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){let t=this.$$("track"),i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();let e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),d().performance&&(e.creationTime=d().performance.now()),e}}K(rs,"TEST_VID",function(){if(!eT())return;let e=c().createElement("video"),t=c().createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),rs.isSupported=function(){try{rs.TEST_VID.volume=.5}catch(e){return!1}return!!(rs.TEST_VID&&rs.TEST_VID.canPlayType)},rs.canPlayType=function(e){return rs.TEST_VID.canPlayType(e)},rs.canPlaySource=function(e,t){return rs.canPlayType(e.type)},rs.canControlVolume=function(){try{let e=rs.TEST_VID.volume;rs.TEST_VID.volume=e/2+.1;let t=e!==rs.TEST_VID.volume;if(t&&ef)return d().setTimeout(()=>{rs&&rs.prototype&&(rs.prototype.featuresVolumeControl=e!==rs.TEST_VID.volume)}),!1;return t}catch(e){return!1}},rs.canMuteVolume=function(){try{let e=rs.TEST_VID.muted;return rs.TEST_VID.muted=!e,rs.TEST_VID.muted?eM(rs.TEST_VID,"muted","muted"):eR(rs.TEST_VID,"muted","muted"),e!==rs.TEST_VID.muted}catch(e){return!1}},rs.canControlPlaybackRate=function(){if(J&&ei&&er<58)return!1;try{let e=rs.TEST_VID.playbackRate;return rs.TEST_VID.playbackRate=e/2+.1,e!==rs.TEST_VID.playbackRate}catch(e){return!1}},rs.canOverrideAttributes=function(){try{let e=()=>{};Object.defineProperty(c().createElement("video"),"src",{get:e,set:e}),Object.defineProperty(c().createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(c().createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(c().createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},rs.supportsNativeTextTracks=function(){return e_||ef&&ei},rs.supportsNativeVideoTracks=function(){return!!(rs.TEST_VID&&rs.TEST_VID.videoTracks)},rs.supportsNativeAudioTracks=function(){return!!(rs.TEST_VID&&rs.TEST_VID.audioTracks)},rs.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([e,t]){K(rs.prototype,e,()=>rs[t](),!0)}),rs.prototype.featuresVolumeControl=rs.canControlVolume(),rs.prototype.movingMediaElementInDOM=!ef,rs.prototype.featuresFullscreenResize=!0,rs.prototype.featuresProgressEvents=!0,rs.prototype.featuresTimeupdateEvents=!0,rs.prototype.featuresVideoFrameCallback=!!(rs.TEST_VID&&rs.TEST_VID.requestVideoFrameCallback),rs.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},rs.resetMediaElement=function(e){if(!e)return;let t=e.querySelectorAll("source"),i=t.length;for(;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){rs.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){rs.prototype["set"+tw(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){rs.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){rs.prototype["set"+tw(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){rs.prototype[e]=function(){return this.el_[e]()}}),iu.withSourceHandlers(rs),rs.nativeSourceHandler={},rs.nativeSourceHandler.canPlayType=function(e){try{return rs.TEST_VID.canPlayType(e)}catch(e){return""}},rs.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return rs.nativeSourceHandler.canPlayType(e.type);if(e.src){let t=t7(e.src);return rs.nativeSourceHandler.canPlayType(`video/${t}`)}return""},rs.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},rs.nativeSourceHandler.dispose=function(){},rs.registerSourceHandler(rs.nativeSourceHandler),iu.registerTech("Html5",rs);let rr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],rn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ra=["tiny","xsmall","small","medium","large","xlarge","huge"],ro={};ra.forEach(e=>{let t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;ro[e]=`vjs-layout-${t}`});let rl={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class rh extends tP{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${e5++}`,(t=Object.assign(rh.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){let i=e.closest("[lang]");i&&(t.language=i.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.boundUpdatePlayerHeightOnAudioOnlyMode_=e=>this.updatePlayerHeightOnAudioOnlyMode_(e),this.isFullscreen_=!1,this.log=j(this.id_),this.fsApi_=O,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 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&&eD(e),this.language(this.options_.language),t.languages){let e={};Object.getOwnPropertyNames(t.languages).forEach(function(i){e[i.toLowerCase()]=t.languages[i]}),this.languages_=e}else this.languages_=rh.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(e=>{if("function"!=typeof this[e])throw Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),tS(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(tt(c(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);let s=W(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){let e=new(d()).DOMParser().parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml");if(e.querySelector("parsererror"))B.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{let t=e.documentElement;t.style.display="none",this.el_.appendChild(t),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),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 iI(this),this.addClass("vjs-spatial-navigation-enabled")),em&&this.addClass("vjs-touch-enabled"),ef||this.addClass("vjs-workinghover"),rh.players[this.id_]=this;let r=P.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),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"),ti(c(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ti(c(),"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),rh.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),ip.hasOwnProperty(this.id())&&delete ip[this.id()],id.names.forEach(e=>{let t=this[id[e].getterName]();t&&t.off&&t.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,i=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div"));let r=eD(t);if(s){for(e=this.el_=t,t=this.tag=c().createElement("video");e.children.length;)t.appendChild(e.firstChild);ex(e,"video-js")||eI(e,"video-js"),e.appendChild(t),i=this.playerElIngest_=e,Object.keys(e).forEach(i=>{try{t[i]=e[i]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",ei&&el&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(i){s&&"class"===i||e.setAttribute(i,r[i]),s&&t.setAttribute(i,r[i])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused");let n=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(e=>ey[e]).map(e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...n),!0!==d().VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=e2("vjs-styles-dimensions");let e=eG(".vjs-styles-defaults"),t=eG("head");t.insertBefore(this.styleEl_,e?e.nextSibling:t.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);let a=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw 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_(){let e,t,i;if(!0===d().VIDEOJS_NO_DYNAMIC_STYLE){let e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height,i=this.tech_&&this.tech_.el();i&&(e>=0&&(i.width=e),t>=0&&(i.height=t));return}let s=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=s[1]/s[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),e4(this.styleEl_,` + .${i} { + width: ${e}px; + height: ${t}px; + } + + .${i}.vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: ${100*r}%; + } + `)}loadTech_(e,t){this.tech_&&this.unloadTech_();let i=tw(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(iu.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(r=!1);let n={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_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};id.names.forEach(e=>{let t=id[e];n[t.getterName]=this[t.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(n.startTime=this.cache_.currentTime);let a=iu.getTech(e);if(!a)throw Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new a(n),this.tech_.ready(to(this,this.handleTechReady_),!0),tV.jsonToTextTracks(this.textTracksJson_||[],this.tech_),rr.forEach(e=>{this.on(this.tech_,e,t=>this[`handleTech${tw(e)}_`](t))}),Object.keys(rn).forEach(e=>{this.on(this.tech_,e,t=>{if(0===this.tech_.playbackRate()&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${rn[e]}_`].bind(this),event:t});return}this[`handleTech${rn[e]}_`](t)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||ew(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){id.names.forEach(e=>{let t=id[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=tV.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 void 0===e&&B.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}version(){return{"video.js":P}}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.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){let t;if(!this.tech_||"string"!=typeof e)return;let i=()=>{let e=this.muted();this.muted(!0);let t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);let i=this.play();if(t$(i))return i.catch(e=>{throw t(),Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)})};if("any"!==e||this.muted()?t="muted"!==e||this.muted()?this.play():i():t$(t=this.play())&&(t=t.catch(i)),t$(t))return t.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=ik(this,t)),this.cache_.source=W({},e,{src:t,type:i});let s=this.cache_.sources.filter(e=>e.src&&e.src===t),r=[],n=this.$$("source"),a=[];for(let e=0;ethis.updateSourceCaches_(e),i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],e=>{if("sourceset"===e.type)return;let t=this.techGet_("currentSrc");this.lastSource_.tech=t,this.updateSourceCaches_(t)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)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&&0===this.cache_.lastPlaybackRate&&(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");let 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_&&(void 0===this.options_||void 0===this.options_.userActions||void 0===this.options_.userActions.click||!1!==this.options_.userActions.click)&&(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?tq(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.contains(e.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!c().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){let t=e.target.player;if(t&&t!==this)return;let i=this.el(),s=c()[this.fsApi_.fullscreenElement]===i;!s&&i.matches&&(s=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}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_(){let 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 iy){var i;return i=this.middleware_,this.tech_[e](i.reduce(iT(e),t))}if(e in iv)return ig(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw B(e),e}},!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in i_){var t,i;return t=this.middleware_,i=this.tech_,t.reduceRight(iT(e),i[e]())}if(e in iv)return ig(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw B(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t;if("TypeError"===t.name)throw B(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t;throw B(t),t}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=tq){this.playCallbacks_.push(e);let t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(e_||ef);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}let s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===s?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){let e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(e){let t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||tD(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)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(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(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=tD(0,0)),e}seekable(){let e=this.techGet_("seekable");return e&&e.length||(e=tD(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 tj(this.buffered(),this.duration())}bufferedEnd(){let e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(void 0!==e){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return isNaN(t=parseFloat(this.techGet_("volume")))?1:t}muted(e){if(void 0!==e){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return void 0!==e&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0!==e&&0!==e){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){let 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();let t=this;return new Promise((i,s)=>{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){r(),i()}function a(e,t){r(),s(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);let o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0===e||(t=e)),this.fsApi_.requestFullscreen){let e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){let e=this;return new Promise((t,i)=>{function s(){e.off("fullscreenerror",n),e.off("fullscreenchange",r)}function r(){s(),t()}function n(e,t){s(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",n);let a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){let e=c()[this.fsApi_.exitFullscreen]();return e&&tq(e.then(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=c().documentElement.style.overflow,tt(c(),"keydown",this.boundFullWindowOnEscKey_),c().documentElement.style.overflow="hidden",eI(c().body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ti(c(),"keydown",this.boundFullWindowOnEscKey_),c().documentElement.style.overflow=this.docOrigOverflow,eP(c().body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0!==e){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&d().documentPictureInPicture){let e=c().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(eC("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),d().documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(eY(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",t=>{let i=t.target.querySelector(".video-js");e.parentNode.replaceChild(i,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in c()&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return d().documentPictureInPicture&&d().documentPictureInPicture.window?(d().documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in c()?c().exitPictureInPicture():void 0}handleKeyDown(e){let{userActions:t}=this.options_;t&&t.hotkeys&&((e=>{let t=e.tagName.toLowerCase();return!!e.isContentEditable||("input"===t?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type):-1!==["textarea"].indexOf(t))})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){let{fullscreenKey:t=t=>"f"===e.key.toLowerCase(),muteKey:i=t=>"m"===e.key.toLowerCase(),playPauseKey:s=t=>"k"===e.key.toLowerCase()||" "===e.key.toLowerCase()}=this.options_.userActions?this.options_.userActions.hotkeys:{};if(t.call(this,e)){e.preventDefault(),e.stopPropagation();let t=tP.getComponent("FullscreenToggle");!1!==c()[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else i.call(this,e)?(e.preventDefault(),e.stopPropagation(),tP.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),tP.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i[e,iu.getTech(e)]).filter(([e,t])=>t?t.isSupported():(B.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1)),s=function(e,t,i){let s;return e.some(e=>t.some(t=>{if(s=i(e,t))return!0})),s},r=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(t=this.options_.sourceOrder?s(e,i,(e,t)=>r(t,e)):s(i,e,r))||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let i=iC(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]),!function(e,t,i){e.setTimeout(()=>(function e(t={},i=[],s,r,n=[],a=!1){let[o,...l]=i;if("string"==typeof o)e(t,ic[o],s,r,n,a);else if(o){let i=function(e,t){let i=ip[e.id()],s=null;if(null==i)return s=t(e),ip[e.id()]=[[t,s]],s;for(let e=0;e{if(this.middleware_=s,t||(this.cache_.sources=i),this.updateSourceCaches_(e),this.src_(e))return i.length>1?this.handleSrc_(i.slice(1)):(this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void this.triggerReady());!function(e,t){e.forEach(e=>e.setTech&&e.setTech(t))}(s,this.tech_)}),i.length>1){let e=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}src(e){return this.handleSrc_(e,!1)}src_(e){let t=this.selectSource([e]);return!t||(tx(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):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}addSourceElement(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}removeSourceElement(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){this.paused()?this.doReset_():tq(this.play().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}),tp(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);let{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){let e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&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(void 0!==e){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){let t;if(void 0===e)return this.options_.autoplay||!1;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0!==e){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(void 0===e)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){let e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(void 0===e)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(void 0===e)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(void 0===e)return this.error_||null;if(L("beforeerror").forEach(t=>{let i=t(this,e);if(!(V(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&4===e.code){let 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(null===e){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new tF(e),this.addClass("vjs-error"),B.error(`(CODE:${this.error_.code} ${tF.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),L("error").forEach(e=>e(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;if((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(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i,s;let r=to(this,this.reportUserActivity),n=function(t){r(),this.clearInterval(e)};this.on("mousedown",function(){r(),this.clearInterval(e),e=this.setInterval(r,250)}),this.on("mousemove",function(e){(e.screenX!==t||e.screenY!==i)&&(t=e.screenX,i=e.screenY,r())}),this.on("mouseup",n),this.on("mouseleave",n);let a=this.getChild("controlBar");!a||ef||J||(a.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),a.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r),this.setInterval(function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(s);let e=this.options_.inactivityTimeout;e<=0||(s=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))},250)}playbackRate(e){if(void 0!==e){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0!==e){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){let 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");let e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),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("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){let e=[];return this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).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"boolean"!=typeof e||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(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),tp(this)&&this.trigger("languagechange"))}languages(){return W(rh.prototype.options_.languages,this.languages_)}toJSON(){let e=W(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;let e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:h,description:n||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){let e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:iS(t.poster)}]),t}return W(this.cache_.media)}static getTagSettings(e){let t={sources:[],tracks:[]},i=eD(e),s=i["data-setup"];if(ex(e,"vjs-fill")&&(i.fill=!0),ex(e,"vjs-fluid")&&(i.fluid=!0),null!==s)try{Object.assign(i,JSON.parse(s||"{}"))}catch(e){B.error("data-setup",e)}if(Object.assign(t,i),e.hasChildNodes()){let i=e.childNodes;for(let e=0,s=i.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}id.names.forEach(function(e){let t=id[e];rh.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),rh.prototype.crossorigin=rh.prototype.crossOrigin,rh.players={};let rd=d().navigator;rh.prototype.options_={techOrder:iu.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:rd&&(rd.languages&&rd.languages[0]||rd.userLanguage||rd.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},rr.forEach(function(e){rh.prototype[`handleTech${tw(e)}_`]=function(){return this.trigger(e)}}),tP.registerComponent("Player",rh);let ru="plugin",rc="activePlugins_",rp={},rm=e=>rp.hasOwnProperty(e),rg=e=>rm(e)?rp[e]:void 0,rf=(e,t)=>{e[rc]=e[rc]||{},e[rc][t]=!0},r_=(e,t,i)=>{let s=(i?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},ry=function(e,t){let i=function(){r_(this,{name:e,plugin:t,instance:null},!0);let i=t.apply(this,arguments);return rf(this,e),r_(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(e){i[e]=t[e]}),i},rv=(e,t)=>(t.prototype.name=e,function(...i){r_(this,{name:e,plugin:t,instance:null},!0);let s=new t(...[this,...i]);return this[e]=()=>s,r_(this,s.getEventHash()),s});class rT{constructor(e){if(this.constructor===rT)throw Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),tS(this),delete this.trigger,tC(this,this.constructor.defaultState),rf(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 ts(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){let{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[rc][e]=!1,this.player=this.state=null,t[e]=rv(e,rp[e])}static isBasic(e){let t="string"==typeof e?rg(e):e;return"function"==typeof t&&!rT.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(rm(e))B.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(rh.prototype.hasOwnProperty(e))throw Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return rp[e]=t,e!==ru&&(rT.isBasic(t)?rh.prototype[e]=ry(e,t):rh.prototype[e]=rv(e,t)),t}static deregisterPlugin(e){if(e===ru)throw Error("Cannot de-register base plugin.");rm(e)&&(delete rp[e],delete rh.prototype[e])}static getPlugins(e=Object.keys(rp)){let t;return e.forEach(e=>{let i=rg(e);i&&((t=t||{})[e]=i)}),t}static getPluginVersion(e){let t=rg(e);return t&&t.VERSION||""}}function rb(e,t,i,s){var r;let n;return r=`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,n=!1,function(...e){return n||B.warn(r),n=!0,s.apply(this,e)}}rT.getPlugin=rg,rT.BASE_PLUGIN_NAME=ru,rT.registerPlugin(ru,rT),rh.prototype.usingPlugin=function(e){return!!this[rc]&&!0===this[rc][e]},rh.prototype.hasPlugin=function(e){return!!rm(e)};let rS=e=>0===e.indexOf("#")?e.slice(1):e;function rk(e,t,i){let s=rk.getPlayer(e);if(s)return t&&B.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i),s;let r="string"==typeof e?eG("#"+rS(e)):e;if(!eb(r))throw TypeError("The element or ID supplied is not valid. (videojs)");let n="getRootNode"in r&&r.getRootNode()instanceof d().ShadowRoot?r.getRootNode():r.ownerDocument.body;return r.ownerDocument.defaultView&&n.contains(r)||B.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),L("beforesetup").forEach(e=>{let i=e(r,W(t));if(!V(i)||Array.isArray(i)){B.error("please return an object in beforesetup hooks");return}t=W(t,i)}),s=new(tP.getComponent("Player"))(r,t,i),L("setup").forEach(e=>e(s)),s}if(rk.hooks_=A,rk.hooks=L,rk.hook=function(e,t){L(e,t)},rk.hookOnce=function(e,t){L(e,[].concat(t).map(t=>{let i=(...s)=>(D(e,i),t(...s));return i}))},rk.removeHook=D,!0!==d().VIDEOJS_NO_DYNAMIC_STYLE&&eT()){let e=eG(".vjs-styles-defaults");if(!e){e=e2("vjs-styles-defaults");let t=eG("head");t&&t.insertBefore(e,t.firstChild),e4(e,` + .video-js { + width: 300px; + height: 150px; + } + + .vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: 56.25% + } + `)}}e0(1,rk),rk.VERSION=P,rk.options=rh.prototype.options_,rk.getPlayers=()=>rh.players,rk.getPlayer=e=>{let t;let i=rh.players;if("string"==typeof e){let s=rS(e),r=i[s];if(r)return r;t=eG("#"+s)}else t=e;if(eb(t)){let{player:e,playerId:s}=t;if(e||i[s])return e||i[s]}},rk.getAllPlayers=()=>Object.keys(rh.players).map(e=>rh.players[e]).filter(Boolean),rk.players=rh.players,rk.getComponent=tP.getComponent,rk.registerComponent=(e,t)=>(iu.isTech(t)&&B.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),tP.registerComponent.call(tP,e,t)),rk.getTech=iu.getTech,rk.registerTech=iu.registerTech,rk.use=function(e,t){ic[e]=ic[e]||[],ic[e].push(t)},Object.defineProperty(rk,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(rk.middleware,"TERMINATOR",{value:im,writeable:!1,enumerable:!0}),rk.browser=ey,rk.obj=Q,rk.mergeOptions=rb(9,"videojs.mergeOptions","videojs.obj.merge",W),rk.defineLazyProperty=rb(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",K),rk.bind=rb(9,"videojs.bind","native Function.prototype.bind",to),rk.registerPlugin=rT.registerPlugin,rk.deregisterPlugin=rT.deregisterPlugin,rk.plugin=(e,t)=>(B.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),rT.registerPlugin(e,t)),rk.getPlugins=rT.getPlugins,rk.getPlugin=rT.getPlugin,rk.getPluginVersion=rT.getPluginVersion,rk.addLanguage=function(e,t){return e=(""+e).toLowerCase(),rk.options.languages=W(rk.options.languages,{[e]:t}),rk.options.languages[e]},rk.log=B,rk.createLogger=j,rk.time=tB,rk.createTimeRange=rb(9,"videojs.createTimeRange","videojs.time.createTimeRanges",tD),rk.createTimeRanges=rb(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",tD),rk.formatTime=rb(9,"videojs.formatTime","videojs.time.formatTime",tN),rk.setFormatTime=rb(9,"videojs.setFormatTime","videojs.time.setFormatTime",tR),rk.resetFormatTime=rb(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",tU),rk.parseUrl=rb(9,"videojs.parseUrl","videojs.url.parseUrl",t3),rk.isCrossOrigin=rb(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",t9),rk.EventTarget=tu,rk.any=tn,rk.on=tt,rk.one=tr,rk.off=ti,rk.trigger=ts,rk.xhr=m(),rk.TextTrack=is,rk.AudioTrack=ir,rk.VideoTrack=ia,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{rk[e]=function(){return B.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),eX[e].apply(null,arguments)}}),rk.computedStyle=rb(9,"videojs.computedStyle","videojs.dom.computedStyle",eQ),rk.dom=eX,rk.fn=td,rk.num=iJ,rk.str=tI,rk.url=ie,rk.Error={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"};class rC{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:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class rE extends rk.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;let i=this.levels_.length;return t=new rC(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,s=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ts,e.qualityLevels.VERSION=rw,s},rI=function(e){return rx(this,rk.obj.merge({},e))};rk.registerPlugin("qualityLevels",rI),rI.VERSION=rw;let rP=y.A,rA=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,rL=e=>rk.log.debug?rk.log.debug.bind(rk,"VHS:",`${e} >`):function(){};function rD(...e){let t=rk.obj||rk;return(t.merge||t.mergeOptions).apply(t,e)}function rO(...e){let t=rk.time||rk;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}let rM=1/30,rR=1/30*3,rU=function(e,t){let i;let s=[];if(e&&e.length)for(i=0;i=t})},rB=function(e,t){return rU(e,function(e){return e-rM>=t})},rj=function(e){if(e.length<2)return rO();let t=[];for(let i=1;i{let t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},rq=e=>{let t=[];for(let i=0;in)){if(t>r&&t<=n){i+=n-t;continue}i+=n-r}}return i},rW=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach(function(e){i+=e.duration}),(t.preloadHints||[]).forEach(function(t){"PART"===t.type&&(i+=e.partTargetDuration)}),i},rG=e=>(e.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(s,r){e.push({duration:s.duration,segmentIndex:i,partIndex:r,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),rK=e=>{let t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},rQ=({preloadSegment:e})=>{if(!e)return;let{parts:t,preloadHints:i}=e;return(i||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(t&&t.length?t.length:0)},rY=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;let i=rK(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},rX=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if(void 0!==(r=e.segments[s]).end)return{result:i+r.end,precise:!0};if(i+=rW(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},rJ=function(e,t){let i,s=0,r=t-e.mediaSequence;for(;rs&&([i,s]=[s,i]),i<0){for(let t=i;tDate.now()},r8=function(e){return e.excludeUntil&&e.excludeUntil===1/0},r5=function(e){let t=r4(e);return!e.disabled&&!t},r3=function(e,t){return t.attributes&&t.attributes[e]},r6=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!r5(e)&&(e.attributes.BANDWIDTH||0)(!!e||!!t)&&(!!e||!t)&&(!e||!!t)&&(e===t||!!e.id&&!!t.id&&e.id===t.id||!!e.resolvedUri&&!!t.resolvedUri&&e.resolvedUri===t.resolvedUri||!!e.uri&&!!t.uri&&e.uri===t.uri),r9=function(e,t){let i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},s=!1;for(let e in i){for(let r in i[e])if(s=t(i[e][r]))break;if(s)break}return!!s},ne=e=>{if(!e||!e.playlists||!e.playlists.length)return r9(e,e=>e.playlists&&e.playlists.length||e.uri);for(let t=0;t(0,T.fz)(e))||r9(e,e=>r7(i,e))))return!1}return!0};var nt={liveEdgeDelay:rY,duration:r0,seekable:function(e,t,i){let s=t||0,r=r2(e,t,!0,i);return null===r?rO():(r0)for(let t=l-1;t>=0;t--){let i=o[t];if(a+=i.duration,n){if(a<0)continue}else if(a+rM<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r-r1({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(l<0){for(let i=l;i<0;i++)if((a-=e.targetDuration)<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let t=l;trM,h=0===a,d=s&&a+rM>=0;if(!h&&!d||t===o.length-1){if(n){if(a>0)continue}else if(a-rM>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:r+r1({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:r5,isDisabled:function(e){return e.disabled},isExcluded:r4,isIncompatible:r8,playlistEnd:r2,isAes:function(e){for(let t=0;t`${e}-${t}`,nr=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,nn=({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{let a=new v.iX;e&&a.on("warn",e),t&&a.on("info",t),s.forEach(e=>a.addParser(e)),r.forEach(e=>a.addTagMapper(e)),a.push(i),a.end();let o=a.manifest;if(!n&&(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){o.hasOwnProperty(e)&&delete o[e]}),o.segments&&o.segments.forEach(function(e){["parts","preloadHints"].forEach(function(t){e.hasOwnProperty(t)&&delete e[t]})})),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce((e,t)=>Math.max(e,t.duration),0)),e&&e({message:`manifest has no targetDuration defaulting to ${t}`}),o.targetDuration=t}let l=rK(o);if(l.length&&!o.partTargetDuration){let t=l.reduce((e,t)=>Math.max(e,t.duration),0);e&&(e({message:`manifest has no partTargetDuration defaulting to ${t}`}),ni.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.")),o.partTargetDuration=t}return o},na=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(e.mediaGroups[i])for(let s in e.mediaGroups[i])for(let r in e.mediaGroups[i][s])t(e.mediaGroups[i][s][r],i,s,r)})},no=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},nl=e=>{let t=e.playlists.length;for(;t--;){let i=e.playlists[t];no({playlist:i,id:ns(t,i.uri)}),i.resolvedUri=rP(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||ni.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},nh=e=>{na(e,t=>{t.uri&&(t.resolvedUri=rP(e.uri,t.uri))})},nd=(e,t)=>{let i=ns(0,t),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:d().location.href,resolvedUri:d().location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[t]=s.playlists[0],s},nu=(e,t,i=nr)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(s&&"AUDIO"===r&&!t.uri)for(let t=0;t(e.set(t.id,t),e),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];let e={},t=[];for(let i of(this.pendingDateRanges_.forEach((i,s)=>{if(!this.processedDateRanges_.has(s)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),i.class)){if(e[i.class]){let t=e[i.class].push(i);i.classListIndex=t-1}else e[i.class]=[i],i.classListIndex=0}}),t)){let t=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&t[i.classListIndex+1]?i.endTime=t[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((t,i)=>{t.startDate.getTime(){let r=t.status<200||t.status>299,n=t.status>=400&&t.status<=499,a={uri:t.uri,requestType:e};if(i&&n)a.error=(0,_.A)({},i),a.errorType=rk.Error.NetworkRequestFailed;else if(t.aborted)a.errorType=rk.Error.NetworkRequestAborted;else if(t.timedout)a.erroType=rk.Error.NetworkRequestTimeout;else if(r&&!n||s){let e=s?rk.Error.NetworkBodyParserFailed:rk.Error.NetworkBadStatus;a.errorType=e,a.status=t.status,a.headers=t.headers}return a},{EventTarget:nm}=rk,ng=(e,t)=>{if(t.endList||!t.serverControl)return e;let i={};if(t.serverControl.canBlockReload){let{preloadSegment:e}=t,s=t.mediaSequence+t.segments.length;if(e){let r=e.parts||[],n=rQ(t)-1;n>-1&&n!==r.length-1&&(i._HLS_part=n),(n>-1||r.length)&&s--}i._HLS_msn=s}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){let t=new(d()).URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){i.hasOwnProperty(e)&&t.searchParams.set(e,i[e])}),e=t.toString()}return e},nf=(e,t)=>{if(!e)return t;let i=rD(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let s=0;s{let s;let r=e.slice(),n=t.slice();i=i||0;let a=[];for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=rP(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=rP(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=rP(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=rP(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=rP(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=rP(t,e.uri))})},nv=function(e){let t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let e=0;ee===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,nb=(e,t,i=nT)=>{let s=rD(e,{}),r=s.playlists[t.id];if(!r||i(r,t))return null;t.segments=nv(t);let n=rD(r,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{ny(e,n.resolvedUri)});for(let e=0;e{if(e.playlists)for(let i=0;i{let i=e.segments||[],s=i[i.length-1],r=s&&s.parts&&s.parts[s.parts.length-1],n=r&&r.duration||s&&s.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)},nk=(e,t,i)=>{if(!e)return;let s=[];return e.forEach(e=>{if(!e.attributes)return;let{BANDWIDTH:t,RESOLUTION:i,CODECS:r}=e.attributes;s.push({id:e.id,bandwidth:t,resolution:i,codecs:r})}),{type:t,isLive:i,renditions:s}};class nC extends nm{constructor(e,t,i={}){if(super(),!e)throw Error("A non-empty playlist URL or object is required");this.logger_=rL("PlaylistLoader");let{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;let r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new nc,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){let e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);let t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;let e=this.media(),t=rP(this.main.uri,e.uri);this.llhls&&(t=ng(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(e)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){let{uri:s,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: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:np({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return nn({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(e){this.error=e,this.error.metadata={errorType:rk.Error.StreamingHlsPlaylistParserError,error:e}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";let r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});let n=t||this.parseManifest_({url:i,manifestString:e});n.lastRequest=Date.now(),no({playlist:n,uri:i,id:s});let a=nb(this.main,n);this.targetDuration=n.partTargetDuration||n.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(nS(this.media(),!!a)),r.parsedPlaylist=nk(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),d().clearTimeout(this.mediaUpdateTimeout),d().clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new nc,this.off()}stopRequest(){if(this.request){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(d().clearTimeout(this.finalRenditionTimeout),t){let t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=d().setTimeout(this.media.bind(this,e,!1),t);return}let i=this.state,s=!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,s&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(nS(e,!0)),!s)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;let n={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,s)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=rA(e.resolvedUri,s),t)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:n}),this.haveMetadata({playlistString:s.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(d().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(d().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);let t=this.media();if(e){let e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=d().setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(d().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=d().setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,"object"==typeof this.src){this.src.uri||(this.src.uri=d().location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}let 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:np({requestType:i.requestType,request:i,error:t})},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=rA(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});let s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=nk(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,nu(this.main,this.srcUri()),e.playlists.forEach(e=>{e.segments=nv(e),e.segments.forEach(t=>{ny(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}let t=this.srcUri()||d().location.href;this.main=nd(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){let i=this.main,s=e.ID,r=i.playlists.length;for(;r--;){let n=i.playlists[r];if(n.attributes["PATHWAY-ID"]===s){let a=n.resolvedUri,o=n.id;if(t){let t=this.createCloneURI_(n.resolvedUri,e),a=ns(s,t),o=this.createCloneAttributes_(s,n.attributes),l=this.createClonePlaylist_(n,a,e,o);i.playlists[r]=l,i.playlists[a]=l,i.playlists[t]=l}else i.playlists.splice(r,1);delete i.playlists[o],delete i.playlists[a]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{if(i.mediaGroups[e]&&i.mediaGroups[e][s]){for(let t in i.mediaGroups[e])if(t===s){for(let s in i.mediaGroups[e][t])i.mediaGroups[e][t][s].playlists.forEach((e,t)=>{let s=i.playlists[e.id],r=s.id,n=s.resolvedUri;delete i.playlists[r],delete i.playlists[n]});delete i.mediaGroups[e][t]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){let i=this.main,s=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),n=ns(e.ID,r),a=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,n,e,a);i.playlists[s]=o,i.playlists[n]=o,i.playlists[r]=o,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let t=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(s.mediaGroups[r]&&!s.mediaGroups[r][t]){for(let n in s.mediaGroups[r])if(n===i)for(let i in s.mediaGroups[r][t]={},s.mediaGroups[r][n]){let a=s.mediaGroups[r][n][i];s.mediaGroups[r][t][i]=(0,_.A)({},a);let o=s.mediaGroups[r][t][i],l=this.createCloneURI_(a.resolvedUri,e);o.resolvedUri=l,o.uri=l,o.playlists=[],a.playlists.forEach((n,a)=>{let l=s.playlists[n.id],h=nr(r,t,i),d=ns(t,h);if(l&&!s.playlists[d]){let t=this.createClonePlaylist_(l,d,e),i=t.resolvedUri;s.playlists[d]=t,s.playlists[i]=t}o.playlists[a]=this.createClonePlaylist_(n,d,e)})}}})}createClonePlaylist_(e,t,i,s){let r=this.createCloneURI_(e.resolvedUri,i),n={resolvedUri:r,uri:r,id:t};return e.segments&&(n.segments=[]),s&&(n.attributes=s),rD(e,n)}createCloneURI_(e,t){let i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;let s=t["URI-REPLACEMENT"].PARAMS;for(let e of Object.keys(s))i.searchParams.set(e,s[e]);return i.href}createCloneAttributes_(e,t){let i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(i[s]=e)}),i}getKeyIdSet(e){if(e.contentProtection){let t=new Set;for(let i in e.contentProtection){let s=e.contentProtection[i].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}let nE=function(e,t,i,s){let r="arraybuffer"===e.responseType?e.response:e.responseText;t||!r||(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),s(t,e)},nw=(e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach(e=>{i=e(i)}),i},nx=(e,t,i,s)=>{e&&e.size&&e.forEach(e=>{e(t,i,s)})},nI=function(){let e=function e(t,i){t=rD({timeout:45e3},t);let s=e.beforeRequest||rk.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||rk.Vhs.xhr._requestCallbackSet||new Set,n=e._responseCallbackSet||rk.Vhs.xhr._responseCallbackSet;s&&"function"==typeof s&&(rk.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(s));let a=!0===rk.Vhs.xhr.original?rk.xhr:rk.Vhs.xhr,o=nw(r,t);r.delete(s);let l=a(o||t,function(e,t){return nx(n,l,e,t),nE(l,e,t,i)}),h=l.abort;return l.abort=function(){return l.aborted=!0,h.apply(l,arguments)},l.uri=t.uri,l.requestType=t.requestType,l.requestTime=Date.now(),l};return e.original=!0,e},nP=function(e){var t;let i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?d().BigInt(t.offset)+d().BigInt(t.length)-d().BigInt(1):t.offset+t.length-1)),i},nA=function(e,t){let i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},nL=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},nD=function(e){let t={};return Object.keys(e).forEach(i=>{let s=e[i];(0,S.hc)(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s}),t},nO=function(e){let t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},nM=function(e){return e.resolvedUri},nR=e=>{let t=Array.prototype.slice.call(e),i="";for(let e=0;enR(e),textRanges:e=>{let t,i="";for(t=0;t{if(!t.dateTimeObject)return null;let i=t.videoTimingInfo.transmuxerPrependedSeconds,s=t.videoTimingInfo.transmuxedPresentationStart;return new Date(t.dateTimeObject.getTime()+1e3*(e-(s+i)))},nB=e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,nj=(e,t)=>{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(inew Date(n.getTime()+1e3*a)?null:(i>new Date(n)&&(s=r),{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:nt.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"})},nF=(e,t)=>{let i;if(!t||!t.segments||0===t.segments.length)return null;let s=0;for(let r=0;rs){if(e>s+.25*r.duration)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},n$=(e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}let r=i.getTime();return(s.getTime()-r)/1e3},nq=e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{if(!i)throw Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});let s=nF(t,e);if(!s)return i({message:"valid programTime was not found"});if("estimate"===s.type)return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});let r={mediaSeconds:t},n=nN(t,s.segment);return n&&(r.programDateTime=n.toISOString()),i(null,r)},nV=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!s)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!nq(t))return a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});let o=nj(e,t);if(!o)return a({message:`${e} was not found in the stream`});let l=o.segment,h=n$(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(s(o.estimatedStart+h),void n.one("seeked",()=>{nV({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})}));let d=l.start+h;n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),s(d)},nz=(e,t)=>{if(4===e.readyState)return t()},nW=(e,t,i,s)=>{let r,n=[],a=!1,o=function(e,t,s,r){return t.abort(),a=!0,i(e,t,s,r)},l=function(e,t){if(a)return;if(e)return e.metadata=np({requestType:s,request:t,error:e}),o(e,t,"",n);let i=t.responseText.substring(n&&n.byteLength||0,t.responseText.length);if(n=(0,S.Bu)(n,(0,S.Af)(i,!0)),r=r||(0,w.A)(n),n.length<10||r&&n.lengtho(e,t,"",n));let l=(0,x.ne)(n);return"ts"===l&&n.length<188||!l&&n.length<376?nz(t,()=>o(e,t,"",n)):o(null,t,l,n)},h=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({total:t,loaded:i}){return nE(e,null,{statusCode:e.status},l)})}},function(e,t){return nE(h,e,t,l)});return h},{EventTarget:nG}=rk,nK=function(e,t){if(!nT(e,t)||e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length)||!e.sidx&&t.sidx||e.sidx&&!t.sidx||e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(let i=0;i{let r=s.attributes.NAME||i;return`placeholder-uri-${e}-${t}-${r}`},nY=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{let n=(0,k.qg)(e,{manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r});return nu(n,t,nQ),n},nX=(e,t)=>{na(e,(i,s,r,n)=>{t.mediaGroups[s][r]&&n in t.mediaGroups[s][r]||delete e.mediaGroups[s][r][n]})},nJ=(e,t,i)=>{let s=!0,r=rD(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{if(e.playlists&&e.playlists.length){let a=e.playlists[0].id,o=nb(r,e.playlists[0],nK);o&&(n in(r=o).mediaGroups[t][i]||(r.mediaGroups[t][i][n]=e),r.mediaGroups[t][i][n].playlists[0]=r.playlists[a],s=!1)}}),nX(r,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(s=!1),s)?null:r},nZ=(e,t)=>(!!(!e.map&&!t.map)||!!(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,n0=(e,t)=>{let i={};for(let s in e){let r=e[s].sidx;if(r){let e=(0,k.Ze)(r);if(!t[e])break;nZ(t[e].sidxInfo,r)&&(i[e]=t[e])}}return i},n1=(e,t)=>{let i=n0(e.playlists,t);return na(e,(e,s,r,n)=>{if(e.playlists&&e.playlists.length){let s=e.playlists;i=rD(i,n0(s,t))}}),i};class n2 extends nG{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);let{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw 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_=rL("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||((this.request=null,e)?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){let s=e.sidx&&(0,k.Ze)(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){this.mediaRequest_=d().setTimeout(()=>i(!1),0);return}let r=rA(e.sidx.resolvedUri),n=(r,n)=>{let a;if(this.requestErrored_(r,n,t))return;let o=this.mainPlaylistLoader_.sidxMapping_,{requestType:l}=n;try{a=E()((0,S.W_)(n.response).subarray(8))}catch(e){e.metadata=np({requestType:l,request:n,parseFailure:!0}),this.requestErrored_(e,n,t);return}return o[s]={sidxInfo:e.sidx,sidx:a},(0,k.Tt)(e,a,e.sidx.resolvedUri),i(!0)};this.request=nW(r,this.vhs_.xhr,(t,i,s,a)=>{if(t)return n(t,i);if(!s||"mp4"!==s)return n({status:i.status,message:`Unsupported ${s||"unknown"} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i);let{offset:o,length:l}=e.sidx.byterange;if(a.length>=l+o)return n(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:nP({byterange:e.sidx.byterange})},n)},"dash-sidx")}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},d().clearTimeout(this.minimumUpdatePeriodTimeout_),d().clearTimeout(this.mediaRequest_),d().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){let e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw Error("Cannot switch media playlist from "+this.state);let t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}let 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,i=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),d().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(d().clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){d().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;let t=this.media();if(e){let e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=d().setTimeout(()=>this.load(),e);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_){this.mediaRequest_=d().setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){let 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,s)=>{if(i){let{requestType:e}=s;i.metadata=np({requestType:e,request:s,error:i})}if(this.requestErrored_(i,s)){"HAVE_NOTHING"===this.state&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});let r=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=rA(this.mainPlaylistLoader_.srcUrl,s),r){this.handleMain_(),this.syncClientServerClock_(()=>e(s,r));return}return e(s,r)})}syncClientServerClock_(e){let t=(0,k.i6)(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:rP(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{let r;if(this.request){if(i){let{requestType:t}=s;return this.error.metadata=np({requestType:t,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}r="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.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_(){let e;this.mediaRequest_=null;let t=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});try{e=nY({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:t})}catch(e){this.error=e,this.error.metadata={errorType:rk.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}t&&(e=nJ(t,e,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=e||t;let s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!t||e&&e.minimumUpdatePeriod!==t.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(e),e){let{duration:t,endList:s}=e,r=[];e.playlists.forEach(e=>{r.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})}),i.parsedManifest={duration:t,isLive:!s,renditions:r},this.trigger({type:"manifestparsecomplete",metadata:i})}return!!e}updateMinimumUpdatePeriodTimeout_(){let e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(d().clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){let t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=d().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_=n1(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();let t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){let e=()=>{this.media().endList||(this.mediaUpdateTimeout=d().setTimeout(()=>{this.trigger("mediaupdatetimeout"),e()},nS(this.media(),!!i)))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){let e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]}));this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){let t=new Set;for(let i in e.contentProtection){let s=e.contentProtection[i].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var n4={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};let n8=e=>{let t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i-1)},this.trigger=function(t){var i,s,r,n;if(i=e[t]){if(2==arguments.length)for(s=0,r=i.length;s>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},h=function(){return a(I.ftyp,P,A,P,L)},b=function(e){return a(I.hdlr,D[e])},d=function(e){return a(I.mdat,e)},T=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),a(I.mdhd,t)},v=function(e){return a(I.mdia,T(e),b(e.type),c(e))},u=function(e){return a(I.mfhd,new Uint8Array([0,0,0,0,(0xff000000&e)>>24,(0xff0000&e)>>16,(65280&e)>>8,255&e]))},c=function(e){return a(I.minf,"video"===e.type?a(I.vmhd,O):a(I.smhd,M),o(),k(e))},p=function(e,t){for(var i=[],s=t.length;s--;)i[s]=E(t[s]);return a.apply(null,[I.moof,u(e)].concat(i))},m=function(e){for(var t=e.length,i=[];t--;)i[t]=_(e[t]);return a.apply(null,[I.moov,f(0xffffffff)].concat(i).concat(g(e)))},g=function(e){for(var t=e.length,i=[];t--;)i[t]=w(e[t]);return a.apply(null,[I.mvex].concat(i))},f=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(0xff000000&e)>>24,(0xff0000&e)>>16,(65280&e)>>8,255&e,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 a(I.mvhd,t)},S=function(e){var t,i,s=e.samples||[],r=new Uint8Array(4+s.length);for(i=0;i>>8),n.push(255&s[t].byteLength),n=n.concat(Array.prototype.slice.call(s[t]));for(t=0;t>>8),o.push(255&r[t].byteLength),o=o.concat(Array.prototype.slice.call(r[t]));if(i=[I.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,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]),a(I.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],o))),a(I.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],h=e.sarRatio[1];i.push(a(I.pasp,new Uint8Array([(0xff000000&l)>>24,(0xff0000&l)>>16,(65280&l)>>8,255&l,(0xff000000&h)>>24,(0xff0000&h)>>16,(65280&h)>>8,255&h])))}return a.apply(null,i)},t=function(e){return a(I.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),l(e))},y=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(0xff000000&e.id)>>24,(0xff0000&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(0xff000000&e.duration)>>24,(0xff0000&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return a(I.tkhd,t)},E=function(e){var t,i,s,r,n,o;return(t=a(I.tfhd,new Uint8Array([0,0,0,58,(0xff000000&e.id)>>24,(0xff0000&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),n=Math.floor(e.baseMediaDecodeTime/0x100000000),o=Math.floor(e.baseMediaDecodeTime%0x100000000),i=a(I.tfdt,new Uint8Array([1,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type)?(s=x(e,92),a(I.traf,t,i,s)):(r=S(e),s=x(e,r.length+92),a(I.traf,t,i,s,r))},_=function(e){return e.duration=e.duration||0xffffffff,a(I.trak,y(e),v(e))},w=function(e){var t=new Uint8Array([0,0,0,0,(0xff000000&e.id)>>24,(0xff0000&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),a(I.trex,t)},n=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(n=8)),[0,0,i|s|r|n,1,(0xff000000&e.length)>>>24,(0xff0000&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(0xff000000&t)>>>24,(0xff0000&t)>>>16,(65280&t)>>>8,255&t]},r=function(e,t){var i,s,r,o,l,h;for(t+=20+16*(o=e.samples||[]).length,(s=new Uint8Array((r=n(o,t)).length+16*o.length)).set(r),i=r.length,h=0;h>>24,s[i++]=(0xff0000&l.duration)>>>16,s[i++]=(65280&l.duration)>>>8,s[i++]=255&l.duration,s[i++]=(0xff000000&l.size)>>>24,s[i++]=(0xff0000&l.size)>>>16,s[i++]=(65280&l.size)>>>8,s[i++]=255&l.size,s[i++]=l.flags.isLeading<<2|l.flags.dependsOn,s[i++]=l.flags.isDependedOn<<6|l.flags.hasRedundancy<<4|l.flags.paddingValue<<1|l.flags.isNonSyncSample,s[i++]=61440&l.flags.degradationPriority,s[i++]=15&l.flags.degradationPriority,s[i++]=(0xff000000&l.compositionTimeOffset)>>>24,s[i++]=(0xff0000&l.compositionTimeOffset)>>>16,s[i++]=(65280&l.compositionTimeOffset)>>>8,s[i++]=255&l.compositionTimeOffset;return a(I.trun,s)},s=function(e,t){var i,s,r,o,l,h;for(t+=20+8*(o=e.samples||[]).length,(i=new Uint8Array((r=n(o,t)).length+8*o.length)).set(r),s=r.length,h=0;h>>24,i[s++]=(0xff0000&l.duration)>>>16,i[s++]=(65280&l.duration)>>>8,i[s++]=255&l.duration,i[s++]=(0xff000000&l.size)>>>24,i[s++]=(0xff0000&l.size)>>>16,i[s++]=(65280&l.size)>>>8,i[s++]=255&l.size;return a(I.trun,i)},x=function(e,t){return"audio"===e.type?s(e,t):r(e,t)};var em=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},eg=[33,16,5,32,164,27],ef=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],e_=function(e){for(var t=[];e--;)t.push(0);return t};$=function(e){return 9e4*e},q=function(e,t){return e*t},H=function(e){return e/9e4},V=function(e,t){return e/t},z=function(e,t){return $(V(e,t))},W=function(e,t){return q(H(e),t)},G=function(e,t,i){return H(i?e:e-t)};var ey={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:$,videoTsToSeconds:H,audioTsToVideoTs:z,videoTsToAudioTs:W,metadataTsToSeconds:G},ev=function(){if(!F){var e;F=Object.keys(e={96e3:[eg,[227,64],e_(154),[56]],88200:[eg,[231],e_(170),[56]],64e3:[eg,[248,192],e_(240),[56]],48e3:[eg,[255,192],e_(268),[55,148,128],e_(54),[112]],44100:[eg,[255,192],e_(268),[55,163,128],e_(84),[112]],32e3:[eg,[255,192],e_(268),[55,234],e_(226),[112]],24e3:[eg,[255,192],e_(268),[55,255,128],e_(268),[111,112],e_(126),[224]],16e3:[eg,[255,192],e_(268),[55,255,128],e_(268),[111,255],e_(269),[223,108],e_(195),[1,192]],12e3:[ef,e_(268),[3,127,248],e_(268),[6,255,240],e_(268),[13,255,224],e_(268),[27,253,128],e_(259),[56]],11025:[ef,e_(268),[3,127,248],e_(268),[6,255,240],e_(268),[13,255,224],e_(268),[27,255,192],e_(268),[55,175,128],e_(108),[112]],8e3:[ef,e_(268),[3,121,16],e_(47),[7]]}).reduce(function(t,i){return t[i]=new Uint8Array(e[i].reduce(function(e,t){return e.concat(t)},[])),t},{})}return F},eT=function(e){var t,i=0;for(t=0;t=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ex.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ex.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ex.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var eI=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new ex(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};eI.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ex(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},eI.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},eI.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var eP=function(e){e=e||{},eP.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?i.new708Packet():null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e)}};eP.prototype=new ec,eP.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},eP.prototype.add708Bytes=function(e){var t=e.ccData;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t>>>8),this.current708Packet.data.push(255&t)},eP.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,s=null,r=0,n=t[r++];for(e.seq=n>>6,e.sizeCode=63&n;r>5,s=31&n,7===i&&s>0&&(i=n=t[r++]),this.pushServiceBlock(i,r,s),s>0&&(r+=s-1)},eP.prototype.pushServiceBlock=function(e,t,i){var s,r=t,n=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,r));r("0"+(255&e).toString(16)).slice(-2)).join(""),16)):eE((n?4096:0)|l),d.pendingNewLine&&!d.isEmpty()&&d.newLine(this.getPts(e)),d.pendingNewLine=!1,d.addText(s),e},eP.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],r=i[e+2];return ew(s)&&ew(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},eP.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},eP.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],r=7&s;t.setCurrentWindow(r);var n=t.currentWindow;return s=i[++e],n.visible=(32&s)>>5,n.rowLock=(16&s)>>4,n.columnLock=(8&s)>>3,n.priority=7&s,s=i[++e],n.relativePositioning=(128&s)>>7,n.anchorVertical=127&s,s=i[++e],n.anchorHorizontal=s,s=i[++e],n.anchorPoint=(240&s)>>4,n.rowCount=15&s,s=i[++e],n.columnCount=63&s,s=i[++e],n.windowStyle=(56&s)>>3,n.penStyle=7&s,n.virtualRowCount=n.rowCount+1,e},eP.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.winAttr;return s=i[++e],r.fillOpacity=(192&s)>>6,r.fillRed=(48&s)>>4,r.fillGreen=(12&s)>>2,r.fillBlue=3&s,s=i[++e],r.borderType=(192&s)>>6,r.borderRed=(48&s)>>4,r.borderGreen=(12&s)>>2,r.borderBlue=3&s,s=i[++e],r.borderType+=(128&s)>>5,r.wordWrap=(64&s)>>6,r.printDirection=(48&s)>>4,r.scrollDirection=(12&s)>>2,r.justify=3&s,s=i[++e],r.effectSpeed=(240&s)>>4,r.effectDirection=(12&s)>>2,r.displayEffect=3&s,e},eP.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},eP.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},eP.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&s)>>2,r.penSize=3&s,s=i[++e],r.italics=(128&s)>>7,r.underline=(64&s)>>6,r.edgeType=(56&s)>>3,r.fontStyle=7&s,e},eP.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penColor;return s=i[++e],r.fgOpacity=(192&s)>>6,r.fgRed=(48&s)>>4,r.fgGreen=(12&s)>>2,r.fgBlue=3&s,s=i[++e],r.bgOpacity=(192&s)>>6,r.bgRed=(48&s)>>4,r.bgGreen=(12&s)>>2,r.bgBlue=3&s,s=i[++e],r.edgeRed=(48&s)>>4,r.edgeGreen=(12&s)>>2,r.edgeBlue=3&s,e},eP.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,s=i[++e],r.row=15&s,s=i[++e],r.column=63&s,e},eP.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var eA={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},eL=function(e){return null===e?"":String.fromCharCode(e=eA[e]||e)},eD=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],eO=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},eM=function(e,t){eM.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n;if((t=32639&e.ccData)===this.lastControlCode_){this.lastControlCode_=null;return}if((61440&t)==4096?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),s=t>>>8,r=255&t,t!==this.PADDING_){if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?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(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=eO();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=eO();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=eO()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(s,r))n=eL((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isExtCharacter(s,r))"popOn"===this.mode_?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),n=eL((s=(3&s)<<8)|r),this[this.mode_](e.pts,n),this.column_++;else if(this.isMidRowCode(s,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,(14&r)==14&&this.addFormatting(e.pts,["i"]),(1&r)==1&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(s,r)){let e=3&r;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(s,r)){var a=eD.indexOf(7968&t);if("rollUp"===this.mode_&&(a-this.rollUpRows_+1<0&&(a=this.rollUpRows_-1),this.setRollUp(e.pts,a)),a!==this.row_&&a>=0&&a<=14&&(this.clearFormatting(e.pts),this.row_=a),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),(16&t)==16){let e=(14&t)>>1;this.column_=4*e,this.nonDisplayed_[this.row_].indent+=e}this.isColorPAC(r)&&(14&r)==14&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(s)&&(0===r&&(r=null),n=eL(s)+eL(r),this[this.mode_](e.pts,n),this.column_+=n.length)}}};eM.prototype=new ec,eM.prototype.flushDisplayed=function(e){let t=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach((e,s)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(s)}e.text.length&&i.push({text:e.text,line:s+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(s)}),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},eM.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=eO(),this.nonDisplayed_=eO(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},eM.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},eM.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},eM.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},eM.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},eM.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},eM.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},eM.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},eM.prototype.isNormalChar=function(e){return e>=32&&e<=127},eM.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=eO(),this.displayed_=eO()),void 0!==t&&t!==this.row_)for(var i=0;i"},"");this[this.mode_](e,i)},eM.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+""},"");this.formatting_=[],this[this.mode_](e,t)}},eM.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},eM.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},eM.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>0x100000000;)e+=0x200000000*i;return e},eB=function(e){var t,i;eB.prototype.init.call(this),this.type_=e||eU,this.push=function(e){if("metadata"===e.type){this.trigger("data",e);return}(this.type_===eU||e.type===this.type_)&&(void 0===i&&(i=e.dts),e.dts=eN(e.dts,i),e.pts=eN(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};eB.prototype=new ec;var ej=(e,t,i)=>{if(!e)return -1;for(var s=i;s"===e.mimeType?e.url=eq(e.data,s,e.data.length):e.pictureData=e.data.subarray(s,e.data.length)))},"T*":function(e){3===e.data[0]&&(e.value=e$(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;3===e.data[0]&&-1!==(t=ej(e.data,0,1))&&(e.description=e$(e.data,1,t),e.value=e$(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=eq(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;3===e.data[0]&&-1!==(t=ej(e.data,0,1))&&(e.description=e$(e.data,1,t),e.url=eq(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t>>2;d*=4,d+=3&h[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=a}while(i>>4>1&&(s+=t[s]+1),0===i.pid)i.type="pat",e(t.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,s,i]):this.processPes_(t,s,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=eR.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=eR.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new ec,Y.STREAM_TYPES={h264:27,adts:15},(X=function(){var e,t=this,i=!1,s={data:[],size:0},r={data:[],size:0},n={data:[],size:0},a=function(e,t){var i;let s=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===s&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=(4&e[6])!=0,192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))},o=function(e,i,s){var r,n=new Uint8Array(e.size),o={type:i},l=0,h=0,d=!1;if(e.data.length&&!(e.size<9)){for(l=0,o.trackId=e.data[0].pid;l>5,h=(l=((3&t[d+6])+1)*1024)*eQ/eY[(60&t[d+2])>>>2],t.byteLength-d>>6&3)+1,channelcount:(1&t[d+2])<<2|(192&t[d+3])>>>6,samplerate:eY[(60&t[d+2])>>>2],samplingfrequencyindex:(60&t[d+2])>>>2,samplesize:16,data:t.subarray(d+7+a,d+n)}),i++,d+=n}"number"==typeof r&&(this.skipWarn_(r,d),r=null),t=t.subarray(d)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new ec;var eX=J;Z=function(e){var t=e.byteLength,i=0,s=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+s},this.loadWord=function(){var r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw Error("no bytes available");n.set(e.subarray(r,r+a)),i=new DataView(n.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var r;s>e||(e-=s,r=Math.floor(e/8),e-=8*r,t-=r,this.loadWord()),i<<=e,s-=e},this.readBits=function(e){var r=Math.min(s,e),n=i>>>32-r;return((s-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0)?n<>>e)!=0)return i<<=e,s-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},(et=function(){var e,t,i=0;et.prototype.init.call(this),this.push=function(s){t?((r=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),r.set(s.data,t.byteLength),t=r):t=s.data;for(var r,n=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new ec,ei={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 e,t,i,s,r,n,a,o=new et;ee.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,s=e.dts,o.push(e))},o.on("data",function(a){var o={trackId:t,pts:i,dts:s,data:a,nalUnitTypeCode:31&a[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=n(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),o.on("partialdone",function(){e.trigger("partialdone")}),o.on("reset",function(){e.trigger("reset")}),o.on("endedtimeline",function(){e.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){var i,s=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4)?i+20:i+10},e1=function(e,t){return e.length-t<10||73!==e[t]||68!==e[t+1]||51!==e[t+2]?t:(t+=e0(e,t),e1(e,t))},e2=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},e4=function(e,t,i){var s,r="";for(s=t;s=t+2&&(255&e[t])==255&&(240&e[t+1])==240&&(22&e[t+1])==16},parseId3TagSize:e0,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return 73===e[t]&&68===e[t+1]&&51===e[t+2]?"timed-metadata":!0&e[t]&&(240&e[t+1])==240?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2]}return null},parseAacTimestamp:function(e){var t,i,s;t=10,64&e[5]&&(t+=4,t+=e2(e.subarray(10,14)));do{if((i=e2(e.subarray(t+4,t+8)))<1)break;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){s=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return a*=4,a+=3&n[7]}break}}t+=10,t+=i}while(t=3;){if(73===e[o]&&68===e[o+1]&&51===e[o+2]){if(e.length-o<10||(a=e8.parseId3TagSize(e,o),o+a>e.length))break;s={type:"timed-metadata",data:e.subarray(o,o+a)},this.trigger("data",s),o+=a;continue}if((255&e[o])==255&&(240&e[o+1])==240){if(e.length-o<7||(a=e8.parseAdtsSize(e,o),o+a>e.length))break;r={type:"audio",data:e.subarray(o,o+a),pts:t,dts:t},this.trigger("data",r),o+=a;continue}o++}e=e.length-o>0?e.subarray(o):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new ec;var e5=es,e3={mdat:d,moof:p,initSegment:function(e){var t,i=h(),s=m(e);return(t=new Uint8Array(i.byteLength+s.byteLength)).set(i),t.set(s,i.byteLength),t}},e6={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(t=0,r.byteLength=0,r.nalCount=0,r.duration=0,s.byteLength=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var i,s,r,n,a=t||0,o=[];for(i=0;iey.ONE_SECOND_IN_TS/2))){for((n=ev()[e.samplerate])||(n=t[0].data),a=0;a=g?m:(e.minSegmentDts=1/0,m.filter(function(t){return t.dts>=g&&(e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),e.minSegmentPts=e.minSegmentDts,!0)})),e.baseMediaDecodeTime=tt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=e7(e,o,n,a),e.samples=e9(o),h=e3.mdat(te(o)),s=[],d=new Uint8Array((l=e3.moof(i,[e])).byteLength+h.byteLength),i++,d.set(l),d.set(h,l.byteLength),tt.clearDtsInfo(e),u=Math.ceil(1024*ts/e.samplerate),o.length&&(c=o.length*u,this.trigger("segmentTimingInfo",th(ey.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:d}),this.trigger("done","AudioSegmentStream")},this.reset=function(){tt.clearDtsInfo(e),s=[],this.trigger("reset")}}).prototype=new ec,(er=function(e,t){var i,s,r,n=[],a=[];i=(t=t||{}).firstSequenceNumber||0,er.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){tt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.config,e.sps=[t.data],tn.forEach(function(t){e[t]=s[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),n.push(t)},this.flush=function(){for(var s,r,o,l,h,d,u,c,p,m=0;n.length&&"access_unit_delimiter_rbsp"!==n[0].nalUnitType;)n.shift();if(0===n.length){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(r=e6.groupNalsIntoFrames(n),(l=e6.groupFramesIntoGops(r))[0][0].keyFrame||((o=this.getGopForFusion_(n[0],e))?(m=o.duration,l.unshift(o),l.byteLength+=o.byteLength,l.nalCount+=o.nalCount,l.pts=o.pts,l.dts=o.dts,l.duration+=o.duration):l=e6.extendFirstKeyFrame(l)),a.length){if(!(s=t.alignGopsAtEnd?this.alignGopsAtEnd_(l):this.alignGopsAtStart_(l))){this.gopCache_.unshift({gop:l.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}tt.clearDtsInfo(e),l=s}tt.collectDtsInfo(e,l),e.samples=e6.generateSampleTable(l),d=e3.mdat(e6.concatenateNalData(l)),e.baseMediaDecodeTime=tt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",l.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),c=l[0],p=l[l.length-1],this.trigger("segmentTimingInfo",th(e.baseMediaDecodeTime,c.dts,c.pts,p.dts+p.duration,p.pts+p.duration,m)),this.trigger("timingInfo",{start:l[0].pts,end:l[l.length-1].pts+l[l.length-1].duration}),this.gopCache_.unshift({gop:l.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),n=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=new Uint8Array((h=e3.moof(i,[e])).byteLength+d.byteLength),i++,u.set(h),u.set(d,h.byteLength),this.trigger("data",{track:e,boxes:u}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),n=[],this.gopCache_.length=0,a.length=0,this.trigger("reset")},this.resetStream_=function(){tt.clearDtsInfo(e),s=void 0,r=void 0},this.getGopForFusion_=function(t){var i,s,r,n,a,o=1/0;for(a=0;a=-1e4&&i<=45e3&&(!s||o>i)&&(s=n,o=i);return s?s.gop:null},this.alignGopsAtStart_=function(e){var t,i,s,r,n,o,l,h;for(n=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;ts.pts){t++;continue}i++,n-=r.byteLength,o-=r.nalCount,l-=r.duration}return 0===i?e:i===e.length?null:((h=e.slice(i)).byteLength=n,h.duration=l,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(e){for(t=a.length-1,i=e.length-1,n=null,o=!1;t>=0&&i>=0;){if(s=a[t],r=e[i],s.pts===r.pts){o=!0;break}if(s.pts>r.pts){t--;continue}t===a.length-1&&(n=i),i--}if(!o&&null===n)return null;if(0===(l=o?i:n))return e;var t,i,s,r,n,o,l,h=e.slice(l),d=h.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return h.byteLength=d.byteLength,h.duration=d.duration,h.nalCount=d.nalCount,h.pts=h[0].pts,h.dts=h[0].dts,h},this.alignGopsWith=function(e){a=e}}).prototype=new ec,(eo=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,eo.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):void(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),"audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes)))}}).prototype=new ec,eo.prototype.flush=function(e){var t,i,s,r,n=0,a={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,tn.forEach(function(e){a.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,tr.forEach(function(e){a.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,s=e3.initSegment(this.pendingTracks),a.initSegment=new Uint8Array(s.byteLength),a.initSegment.set(s),a.data=new Uint8Array(this.pendingBytes),r=0;r=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},eo.prototype.setRemux=function(e){this.remuxTracks=e},(ea=function(e){var t,i,s=this,r=!0;ea.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new eG.MetadataStream,r.aacStream=new e5,r.audioTimestampRolloverStream=new eG.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new eG.TimestampRolloverStream("timed-metadata"),r.adtsStream=new eX,r.coalesceStream=new eo(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",function(e){r.aacStream.setTimestamp(e.timeStamp)}),r.aacStream.on("data",function(n){"timed-metadata"!==n.type&&"audio"!==n.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new en(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),to(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new eG.MetadataStream,r.packetStream=new eG.TransportPacketStream,r.parseStream=new eG.TransportParseStream,r.elementaryStream=new eG.ElementaryStream,r.timestampRolloverStream=new eG.TimestampRolloverStream,r.adtsStream=new eX,r.h264Stream=new eJ,r.captionStream=new eG.CaptionStream(e),r.coalesceStream=new eo(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(n){var a;if("metadata"===n.type){for(a=n.tracks.length;a--;)t||"video"!==n.tracks[a].type?i||"audio"!==n.tracks[a].type||((i=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new er(t,e),r.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))}),r.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new en(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",function(e){e.dispatchType=r.metadataStream.dispatchType,s.trigger("id3Frame",e)}),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),to(this,r)},this.setBaseMediaDecodeTime=function(s){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,tt.clearDtsInfo(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,tt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=ti(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!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()}}).prototype=new ec;var td=ea,tu=function(e){return e>>>0},tc=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},tp=function(e,t){var i,s,r,n,a,o=[];if(!t.length)return null;for(i=0;i1?i+s:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(i+8,n)):(a=tp(e.subarray(i+8,n),t.slice(1))).length&&(o=o.concat(a))),i=n;return o},tm=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=ep(e.subarray(4)):t.baseMediaDecodeTime=tu(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},tg=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},tf=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],h=8&i.flags[1],d=s.getUint32(4),u=8;for(r&&(i.dataOffset=s.getInt32(u),u+=4),n&&d&&(t={flags:tg(e.subarray(u,u+4))},u+=4,a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),h&&(1===i.version?t.compositionTimeOffset=s.getInt32(u):t.compositionTimeOffset=s.getUint32(u),u+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),l&&(t.flags=tg(e.subarray(u,u+4)),u+=4),h&&(1===i.version?t.compositionTimeOffset=s.getInt32(u):t.compositionTimeOffset=s.getUint32(u),u+=4),i.samples.push(t);return i},t_=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),s={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&s.flags[2],n=2&s.flags[2],a=8&s.flags[2],o=16&s.flags[2],l=32&s.flags[2],h=65536&s.flags[0],d=131072&s.flags[0];return t=8,r&&(t+=4,s.baseDataOffset=i.getUint32(12),t+=4),n&&(s.sampleDescriptionIndex=i.getUint32(t),t+=4),a&&(s.defaultSampleDuration=i.getUint32(t),t+=4),o&&(s.defaultSampleSize=i.getUint32(t),t+=4),l&&(s.defaultSampleFlags=i.getUint32(t)),h&&(s.durationIsEmpty=!0),!r&&d&&(s.baseDataOffsetIsMoof=!0),s};"undefined"!=typeof window?el=window:void 0!==eu?el=eu:"undefined"!=typeof self?el=self:el={};var ty=el,tv=eS.discardEmulationPreventionBytes,tT=function(e,t){for(var i=e,s=0;s0?tm(l[0]).baseMediaDecodeTime:0,d=tp(n,["trun"]);t===o&&d.length>0&&(i=tb(s,tS(d,h,a),o),r[o]||(r[o]={seiNals:[],logs:[]}),r[o].seiNals=r[o].seiNals.concat(i.seiNals),r[o].logs=r[o].logs.concat(i.logs))}),r},tC=function(e,t,i){if(null===t)return null;var s=tk(e,t)[t]||{};return{seiNals:s.seiNals,logs:s.logs,timescale:i}},tE=function(){var e,t,i,s,r,n,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new ek,a=!0,n=!!t&&t.isPartial,e.on("data",function(e){e.startTime=e.startPts/s,e.endTime=e.endPts/s,r.captions.push(e),r.captionStreams[e.stream]=!0}),e.on("log",function(e){r.logs.push(e)})},this.isNewInit=function(e,t){return(!e||0!==e.length)&&(!t||"object"!=typeof t||0!==Object.keys(t).length)&&(i!==e[0]||s!==t[i])},this.parse=function(e,n,a){var o;if(!this.isInitialized()||!n||!a)return null;if(this.isNewInit(n,a))s=a[i=n[0]];else if(null===i||!s)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,n,a)}return((o=tC(e,i,s))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals)?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;n?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,s=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},tw=function(e){for(var t=0,i=String.fromCharCode(e[0]),s="";"\0"!==i;)s+=i,i=String.fromCharCode(e[++t]);return s+i},tx=function(e,t){var i="\0"!==t.scheme_id_uri,s=0===e&&tI(t.presentation_time_delta)&&i,r=1===e&&tI(t.presentation_time)&&i;return!(e>1)&&s||r},tI=function(e){return void 0!==e||null!==e},tP=function(e){return("00"+e.toString(16)).slice(-2)},tA=function(e){var t,i,s,r,n,a,o,l=4,h=e[0];if(0===h){t=tw(e.subarray(l)),l+=t.length,i=tw(e.subarray(l)),l+=i.length;var d=new DataView(e.buffer);s=d.getUint32(l),l+=4,n=d.getUint32(l),l+=4,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4}else if(1===h){var d=new DataView(e.buffer);s=d.getUint32(l),l+=4,r=ep(e.subarray(l)),l+=8,a=d.getUint32(l),l+=4,o=d.getUint32(l),l+=4,t=tw(e.subarray(l)),l+=t.length,i=tw(e.subarray(l)),l+=i.length}var u={scheme_id_uri:t,value:i,timescale:s||1,presentation_time:r,presentation_time_delta:n,event_duration:a,id:o,message_data:new Uint8Array(e.subarray(l,e.byteLength))};return tx(h,u)?u:void 0},tL=function(e,t,i,s){return e||0===e?e/t:s+i/t},tD=ez.parseId3Frames;eh=function(e,t){var i=tp(t,["moof","traf"]).reduce(function(t,i){let s;var r,n=tp(i,["tfhd"])[0],a=e[tu(n[4]<<24|n[5]<<16|n[6]<<8|n[7])]||9e4,o=tp(i,["tfdt"])[0],l=new DataView(o.buffer,o.byteOffset,o.byteLength);return"bigint"==typeof(r=1===o[0]?ep(o.subarray(4,12)):l.getUint32(4))?s=r/ty.BigInt(a):"number"!=typeof r||isNaN(r)||(s=r/a),s11?(t.codec+=".",t.codec+=tP(h[9]),t.codec+=tP(h[10]),t.codec+=tP(h[11])):t.codec="avc1.4d400d":/^mp4[a,v]$/i.test(t.codec)?"esds"===tc((h=u.subarray(28)).subarray(4,8))&&h.length>20&&0!==h[19]?(t.codec+="."+tP(h[19]),t.codec+="."+tP(h[20]>>>2&63).replace(/^0/,"")):t.codec="mp4a.40.2":t.codec=t.codec.toLowerCase())}var c=tp(e,["mdia","mdhd"])[0];c&&(t.timescale=ed(c)),i.push(t)}),i},tM=function(e){var t=31&e[1];return t<<=8,t|=e[2]},tR=function(e){return!!(64&e[1])},tU=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},tN=function(e){switch(e){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}},tB={};tB.ts={parseType:function(e,t){var i=tM(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=tR(e),i=4+tU(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t,i={},s=tR(e),r=4+tU(e);if(s&&(r+=e[r]+1),1&e[r+5]){t=3+((15&e[r+1])<<8|e[r+2])-4;for(var n=12+((15&e[r+10])<<8|e[r+11]);n=e.byteLength)return null;var s=null;return 192&(t=e[i+7])&&((s={}).pts=(14&e[i+9])<<27|(255&e[i+10])<<20|(254&e[i+11])<<12|(255&e[i+12])<<5|(254&e[i+13])>>>3,s.pts*=4,s.pts+=(6&e[i+13])>>>1,s.dts=s.pts,64&t&&(s.dts=(14&e[i+14])<<27|(255&e[i+15])<<20|(254&e[i+16])<<12|(255&e[i+17])<<5|(254&e[i+18])>>>3,s.dts*=4,s.dts+=(6&e[i+18])>>>1)),s},videoPacketContainsKeyFrame:function(e){for(var t=4+tU(e),i=e.subarray(t),s=0,r=0,n=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===tN(31&i[r+3])&&(n=!0),n}},tB.aac=e8;var tj=ey.ONE_SECOND_IN_TS,tF=function(e,t){for(var i,s=0,r=188;r=0;){if(71===e[o]&&(71===e[l]||l===e.byteLength)){if(s=e.subarray(o,l),"pes"===tB.ts.parseType(s,t.pid)&&(r=tB.ts.parsePesType(s,t.table),n=tB.ts.parsePayloadUnitStartIndicator(s),"audio"===r&&n&&(a=tB.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),h=!0)),h)break;o-=188,l-=188;continue}o--,l--}},tq=function(e,t,i){for(var s,r,n,a,o,l,h,d=0,u=188,c=!1,p={data:[],size:0};u=0;){if(71===e[d]&&71===e[u]){if(s=e.subarray(d,u),"pes"===tB.ts.parseType(s,t.pid)&&(r=tB.ts.parsePesType(s,t.table),n=tB.ts.parsePayloadUnitStartIndicator(s),"video"===r&&n&&(a=tB.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0)),c)break;d-=188,u-=188;continue}d--,u--}},tH=function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach(function(e){e.dts=eN(e.dts,i),e.pts=eN(e.pts,i),e.dtsTime=e.dts/tj,e.ptsTime=e.pts/tj})}if(e.video&&e.video.length){var s=t;if((void 0===s||isNaN(s))&&(s=e.video[0].dts),e.video.forEach(function(e){e.dts=eN(e.dts,s),e.pts=eN(e.pts,s),e.dtsTime=e.dts/tj,e.ptsTime=e.pts/tj}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=eN(r.dts,s),r.pts=eN(r.pts,s),r.dtsTime=r.dts/tj,r.ptsTime=r.pts/tj}}},tV=function(e){for(var t,i=!1,s=0,r=null,n=null,a=0,o=0;e.length-o>=3;){switch(tB.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10||(a=tB.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=tB.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7||(a=tB.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=tB.aac.parseSampleRate(t)),s++,o+=a;break;default:o++}if(i)return null}if(null===r||null===n)return null;var l=tj/r;return{audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+1024*s*l,pts:n+1024*s*l}]}},tz=function(e){var t={pid:null,table:null},i={};for(var s in tF(e,t),t.table)if(t.table.hasOwnProperty(s))switch(t.table[s]){case eR.H264_STREAM_TYPE:i.video=[],tq(e,t,i),0===i.video.length&&delete i.video;break;case eR.ADTS_STREAM_TYPE:i.audio=[],t$(e,t,i),0===i.audio.length&&delete i.audio}return i},tW=function(e,t){var i;return(i=tB.aac.isLikelyAacData(e)?tV(e):tz(e))&&(i.audio||i.video)?(tH(i,t),i):null};let tG=function(e,t){t.on("data",function(t){let i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};let s=t.data;t.data=s.buffer,e.postMessage({action:"data",segment:t,byteOffset:s.byteOffset,byteLength:s.byteLength},[t.data])}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){let i={start:{decode:ey.videoTsToSeconds(t.start.dts),presentation:ey.videoTsToSeconds(t.start.pts)},end:{decode:ey.videoTsToSeconds(t.end.dts),presentation:ey.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:ey.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ey.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})}),t.on("audioSegmentTimingInfo",function(t){let i={start:{decode:ey.videoTsToSeconds(t.start.dts),presentation:ey.videoTsToSeconds(t.start.pts)},end:{decode:ey.videoTsToSeconds(t.end.dts),presentation:ey.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:ey.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ey.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})}),t.on("id3Frame",function(t){e.postMessage({action:"id3Frame",id3Frame:t})}),t.on("caption",function(t){e.postMessage({action:"caption",caption:t})}),t.on("trackinfo",function(t){e.postMessage({action:"trackinfo",trackInfo:t})}),t.on("audioTimingInfo",function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ey.videoTsToSeconds(t.start),end:ey.videoTsToSeconds(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ey.videoTsToSeconds(t.start),end:ey.videoTsToSeconds(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})};class tK{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new td(this.options),tG(this.self,this.transmuxer)}pushMp4Captions(e){this.captionParser||(this.captionParser=new tE,this.captionParser.init());let t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){let i=eh(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:t},[t.buffer])}probeMp4Tracks({data:e}){let t=tO(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){let i=function(e,t=0){return tp(e,["emsg"]).map(e=>{var i=tA(new Uint8Array(e)),s=tD(i.message_data);return{cueTime:tL(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:tL(i.event_duration,i.timescale),frames:s}})}(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:i,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){let i=tW(e,"number"!=typeof t||isNaN(t)?void 0:t*ey.ONE_SECOND_IN_TS),s=null;i&&((s={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1}).hasVideo&&(s.videoStart=i.video[0].ptsTime),s.hasAudio&&(s.audioStart=i.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:s,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){let t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}reset(){this.transmuxer.reset()}setTimestampOffset(e){let t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ey.secondsToVideoTs(t)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(ey.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){if("init"===e.data.action&&e.data.options){this.messageHandlers=new tK(self,e.data.options);return}this.messageHandlers||(this.messageHandlers=new tK(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data)}})));let at=(e,t,i)=>{let{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:h}=e.data.segment;t.buffer.push({captions:n,captionStreams:a,metadata:o});let d=e.data.segment.boxes||{data:e.data.segment.data},u={type:s,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};void 0!==l&&(u.videoFrameDtsTime=l),void 0!==h&&(u.videoFramePtsTime=h),i(u)},ai=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},as=(e,t)=>{t.gopInfo=e.data.gopInfo},ar=e=>{let{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:h,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:_,segment:y,triggerSegmentEventFn:v}=e,T={buffer:[]},b=_;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&at(i,T,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&as(i,T),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&h(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&u(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(b=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"!==i.data.type||b||(t.onmessage=null,ai({transmuxedData:T,callback:m}),an(t)))},t.onerror=()=>{m(null,{message:"Received an error message from the transmuxer worker",metadata:{errorType:rk.Error.StreamingFailedToTransmuxSegment,segmentInfo:ou({segment:y})}})},s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength){let e=i instanceof ArrayBuffer?i:i.buffer,s=i instanceof ArrayBuffer?0:i.byteOffset;v({type:"segmenttransmuxingstart",segment:y}),t.postMessage({action:"push",data:e,byteOffset:s,byteLength:i.byteLength},[e])}_&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},an=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():ar(e.currentTransmux))},aa=(e,t)=>{e.postMessage({action:t}),an(e)},ao=(e,t)=>{if(!t.currentTransmux){t.currentTransmux=e,aa(t,e);return}t.transmuxQueue.push(aa.bind(null,t,e))},al=e=>{if(!e.transmuxer.currentTransmux){e.transmuxer.currentTransmux=e,ar(e);return}e.transmuxer.transmuxQueue.push(e)};var ah={reset:e=>{ao("reset",e)},createTransmuxer:e=>{let t=new ae;t.currentTransmux=null,t.transmuxQueue=[];let i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t}};let ad=function(e){let t=e.transmuxer,i=e.endAction||e.action,s=e.callback,r=(0,_.A)({},e,{endAction:null,transmuxer:null,callback:null}),n=r=>{r.data.action===i&&(t.removeEventListener("message",n),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),s(r.data))};if(t.addEventListener("message",n),e.data){let i=e.data instanceof ArrayBuffer;r.byteOffset=i?0:e.data.byteOffset,r.byteLength=e.data.byteLength;let s=[i?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},au={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ac=e=>{e.forEach(e=>{e.abort()})},ap=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),am=e=>{let t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8e3),i},ag=(e,t)=>{let{requestType:i}=t,s=np({requestType:i,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:au.TIMEOUT,xhr:t,metadata:s}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:au.ABORTED,xhr:t,metadata:s}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:au.FAILURE,xhr:t,metadata:s}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:au.FAILURE,xhr:t,metadata:s}:null},af=(e,t,i,s)=>(r,n)=>{let a=n.response,o=ag(r,n);if(o)return i(o,e);if(16!==a.byteLength)return i({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:au.FAILURE,xhr:n},e);let l=new DataView(a),h=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let e=0;e{let i=(0,x.ne)(e.map.bytes);if("mp4"!==i){let s=e.map.resolvedUri||e.map.uri,r=i||"unknown";return t({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${s}`,code:au.FAILURE,metadata:{mediaType:r}})}ad({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:s})=>(e.map.bytes=s,i.forEach(function(t){e.map.tracks=e.map.tracks||{},!e.map.tracks[t.type]&&(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))}),t(null))})},ay=({segment:e,finishProcessingFn:t,triggerSegmentEventFn:i})=>(s,r)=>{let n=ag(s,r);if(n)return t(n,e);let a=new Uint8Array(r.response);if(i({type:"segmentloaded",segment:e}),e.map.key)return e.map.encryptedBytes=a,t(null,e);e.map.bytes=a,a_(e,function(i){if(i)return i.xhr=r,i.status=r.status,t(i,e);t(null,e)})},av=({segment:e,finishProcessingFn:t,responseType:i,triggerSegmentEventFn:s})=>(r,n)=>{let a=ag(r,n);if(a)return t(a,e);s({type:"segmentloaded",segment:e});let o="arraybuffer"!==i&&n.responseText?n8(n.responseText.substring(e.lastReachedChar||0)):n.response;return e.stats=ap(n),e.key?e.encryptedBytes=new Uint8Array(o):e.bytes=new Uint8Array(o),t(null,e)},aT=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=e.map&&e.map.tracks||{},g=!!(m.audio&&m.video),f=s.bind(null,e,"audio","start"),_=s.bind(null,e,"audio","end"),y=s.bind(null,e,"video","start"),v=s.bind(null,e,"video","end"),T=()=>al({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:g,onData:t=>{t.type="combined"===t.type?"video":t.type,d(e,t)},onTrackInfo:t=>{i&&(g&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{f&&void 0!==e.start&&(f(e.start),f=null),_&&void 0!==e.end&&_(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),v&&void 0!==e.end&&v(e.end)},onVideoSegmentTimingInfo:t=>{p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:{pts:{start:t.start.presentation,end:t.end.presentation},dts:{start:t.start.decode,end:t.end.decode}}}),r(t)},onAudioSegmentTimingInfo:t=>{p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:{pts:{start:t.start.pts,end:t.end.pts},dts:{start:t.start.dts,end:t.end.dts}}}),n(t)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{h()},onTransmuxerLog:c,onDone:(t,i)=>{u&&(t.type="combined"===t.type?"video":t.type,p({type:"segmenttransmuxingcomplete",segment:e}),u(i,e,t))},segment:e,triggerSegmentEventFn:p});ad({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data;let r=s.result;r&&(i(e,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:g}),i=null),T()}})},ab=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=new Uint8Array(t);if((0,x.J2)(m)){e.isFmp4=!0;let{tracks:r}=e.map,n={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio};r.audio&&r.audio.codec&&"enca"!==r.audio.codec&&(n.audioCodec=r.audio.codec),r.video&&r.video.codec&&"encv"!==r.video.codec&&(n.videoCodec=r.video.codec),r.video&&r.audio&&(n.isMuxed=!0),i(e,n);let l=(t,i)=>{d(e,{data:m,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),i&&i.length&&a(e,i),t&&t.length&&o(e,t),u(null,e,{})};ad({action:"probeMp4StartTime",timescales:e.map.timescales,data:m,transmuxer:e.transmuxer,callback:({data:i,startTime:a})=>{t=i.buffer,e.bytes=m=i,n.hasAudio&&!n.isMuxed&&s(e,"audio","start",a),n.hasVideo&&s(e,"video","start",a),ad({action:"probeEmsgID3",data:m,transmuxer:e.transmuxer,offset:a,callback:({emsgData:i,id3Frames:s})=>{if(t=i.buffer,e.bytes=m=i,!r.video||!i.byteLength||!e.transmuxer){l(void 0,s);return}ad({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:m,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=m=i.data,i.logs.forEach(function(e){c(rD(e,{stream:"mp4CaptionParser"}))}),l(i.captions,s)}})}})}});return}if(!e.transmuxer){u(null,e,{});return}if(void 0===e.container&&(e.container=(0,x.ne)(m)),"ts"!==e.container&&"aac"!==e.container){i(e,{hasAudio:!1,hasVideo:!1}),u(null,e,{});return}aT({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})},aS=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s,segment:r,doneFn:n},a){let o;let l=t=>{if(t.data.source===e){s.removeEventListener("message",l);let e=t.data.decrypted;a(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};s.onerror=()=>{let e="An error occurred in the decryption worker",t=ou({segment:r});n({message:e,metadata:{error:Error(e),errorType:rk.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}},r)},s.addEventListener("message",l),o=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(nD({source:e,encrypted:i,key:o,iv:t.iv}),[i.buffer,o.buffer])},ak=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),aS({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),ab({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})})},aC=({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=0,g=!1;return(f,_)=>{if(!g){if(f)return g=!0,ac(e),u(f,_);if((m+=1)===e.length){let m=function(){if(_.encryptedBytes)return ak({decryptionWorker:t,segment:_,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p});ab({segment:_,bytes:_.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})};if(_.endOfAllRequests=Date.now(),_.map&&_.map.encryptedBytes&&!_.map.bytes)return p({type:"segmentdecryptionstart",segment:_}),aS({decryptionWorker:t,id:_.requestId+"-init",encryptedBytes:_.map.encryptedBytes,key:_.map.key,segment:_,doneFn:u},t=>{_.map.bytes=t,p({type:"segmentdecryptioncomplete",segment:_}),a_(_,t=>{if(t)return ac(e),u(t,_);m()})});m()}}}},aE=({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)},aw=({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d})=>i=>{if(!i.target.aborted)return e.stats=rD(e.stats,am(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)},ax=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:_})=>{let y=[],v=aC({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:_});if(s.key&&!s.key.bytes){let i=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&i.push(s.map.key);let r=rD(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),n=af(s,i,v,_),a={uri:s.key.resolvedUri};_({type:"segmentkeyloadstart",segment:s,keyInfo:a});let o=e(r,n);y.push(o)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){let i=rD(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),r=af(s,[s.map.key],v,_),n={uri:s.map.key.resolvedUri};_({type:"segmentkeyloadstart",segment:s,keyInfo:n});let a=e(i,r);y.push(a)}let i=rD(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:nP(s.map),requestType:"segment-media-initialization"}),r=ay({segment:s,finishProcessingFn:v,triggerSegmentEventFn:_});_({type:"segmentloadstart",segment:s});let n=e(i,r);y.push(n)}let T=rD(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:nP(s),requestType:"segment"}),b=av({segment:s,finishProcessingFn:v,responseType:T.responseType,triggerSegmentEventFn:_});_({type:"segmentloadstart",segment:s});let S=e(T,b);S.addEventListener("progress",aw({segment:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),y.push(S);let k={};return y.forEach(e=>{e.addEventListener("loadend",aE({loadendState:k,abortFn:r}))}),()=>ac(y)},aI=rL("CodecUtils"),aP=function(e){let t=e.attributes||{};if(t.CODECS)return(0,T.tB)(t.CODECS)},aA=(e,t)=>{let i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},aL=(e,t)=>{if(!aA(e,t))return!0;let i=t.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(let e in s)if(!s[e].uri&&!s[e].playlists)return!0;return!1},aD=function(e){let t={};return e.forEach(({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push((0,T.Et)(`${i}${s}`))}),Object.keys(t).forEach(function(e){if(t[e].length>1){aI(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),t[e]=null;return}t[e]=t[e][0]}),t},aO=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},aM=function(e,t){let i=t.attributes||{},s=aD(aP(t)||[]);if(aA(e,t)&&!s.audio&&!aL(e,t)){let t=aD((0,T.BX)(e,i.AUDIO)||[]);t.audio&&(s.audio=t.audio)}return s},aR=rL("PlaylistSelector"),aU=function(e){if(!e||!e.playlist)return;let t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},aN=function(e,t){if(!e)return"";let i=d().getComputedStyle(e);return i?i[t]:""},aB=function(e,t){let i=e.slice();e.sort(function(e,s){let r=t(e,s);return 0===r?i.indexOf(e)-i.indexOf(s):r})},aj=function(e,t){let i,s;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||d().Number.MAX_VALUE,t.attributes.BANDWIDTH&&(s=t.attributes.BANDWIDTH),i-(s=s||d().Number.MAX_VALUE)},aF=function(e,t,i,s,r,n){let a,o,l,h;if(!e)return;let u={bandwidth:t,width:i,height:s,limitRenditionByPlayerDimensions:r},c=e.playlists;nt.isAudioOnly(e)&&(c=n.getAudioTrackPlaylists_(),u.audioOnly=!0);let p=c.map(e=>{let t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||d().Number.MAX_VALUE,width:t,height:i,playlist:e}});aB(p,(e,t)=>e.bandwidth-t.bandwidth);let m=(p=p.filter(e=>!nt.isIncompatible(e.playlist))).filter(e=>nt.isEnabled(e.playlist));m.length||(m=p.filter(e=>!nt.isDisabled(e.playlist)));let g=m.filter(e=>e.bandwidth*n4.BANDWIDTH_VARIANCEe.bandwidth===f.bandwidth)[0];if(!1===r){let e=_||m[0]||p[0];if(e&&e.playlist){let t="sortedPlaylistReps";return _&&(t="bandwidthBestRep"),m[0]&&(t="enabledPlaylistReps"),aR(`choosing ${aU(e)} using ${t} with options`,u),e.playlist}return aR("could not choose a playlist with options",u),null}let y=g.filter(e=>e.width&&e.height);aB(y,(e,t)=>e.width-t.width);let v=y.filter(e=>e.width===i&&e.height===s);f=v[v.length-1];let T=v.filter(e=>e.bandwidth===f.bandwidth)[0];if(T||(f=(o=(a=y.filter(e=>e.width>i||e.height>s)).filter(e=>e.width===a[0].width&&e.height===a[0].height))[o.length-1],l=o.filter(e=>e.bandwidth===f.bandwidth)[0]),n.leastPixelDiffSelector){let e=y.map(e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-s),e));aB(e,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),h=e[0]}let b=h||l||T||_||m[0]||p[0];if(b&&b.playlist){let e="sortedPlaylistReps";return h?e="leastPixelDiffRep":l?e="resolutionPlusOneRep":T?e="resolutionBestRep":_?e="bandwidthBestRep":m[0]&&(e="enabledPlaylistReps"),aR(`choosing ${aU(b)} using ${e} with options`,u),b.playlist}return aR("could not choose a playlist with options",u),null},a$=function(){let e=this.useDevicePixelRatio&&d().devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),aF(this.playlists.main,this.systemBandwidth,parseInt(aN(this.tech_.el(),"width"),10)*e,parseInt(aN(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},aq=function(e){let{main:t,currentTime:i,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e,h=t.playlists.filter(e=>!nt.isIncompatible(e)),d=h.filter(nt.isEnabled);d.length||(d=h.filter(e=>!nt.isDisabled(e)));let u=d.filter(nt.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{let t=l.getSyncPoint(e,r,o,i),h=nt.estimateSegmentRequestTime(n,s,e);return{playlist:e,rebufferingImpact:h*(t?1:2)-a}}),c=u.filter(e=>e.rebufferingImpact<=0);return(aB(c,(e,t)=>aj(t.playlist,e.playlist)),c.length)?c[0]:(aB(u,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),u[0]||null)},aH=e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach(e=>{t.set(e,i),i+=e.byteLength})),t};function aV(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}let az=function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let s=i;/^cc708_/.test(i)&&(s="SERVICE"+i.split("_")[1]);let r=t.textTracks().getTrackById(s);if(r)e[i]=r;else{let r=t.options_.vhs&&t.options_.vhs.captionServices||{},n=i,a=i,o=!1,l=r[s];l&&(n=l.label,a=l.language,o=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:s,default:o,label:n,language:a},!1).track}}},aW=function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;let s=d().WebKitDataCue||d().VTTCue;t.forEach(t=>{let r=t.stream;t.content?t.content.forEach(n=>{let a=new s(t.startTime+i,t.endTime+i,n.text);a.line=n.line,a.align="left",a.position=n.position,a.positionAlign="line-left",e[r].addCue(a)}):e[r].addCue(new s(t.startTime+i,t.endTime+i,t.text))})},aG=function(e){Object.defineProperties(e.frame,{id:{get:()=>(rk.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(rk.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(rk.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})},aK=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(!t)return;let r=d().WebKitDataCue||d().VTTCue,n=e.metadataTrack_;if(!n||(t.forEach(e=>{let t=e.cueTime+i;!("number"!=typeof t||d().isNaN(t))&&!(t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{let i=new r(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,aG(i),n.addCue(i)})}),!n.cues||!n.cues.length))return;let a=n.cues,o=[];for(let e=0;e{let i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),h=Object.keys(l).sort((e,t)=>Number(e)-Number(t));h.forEach((e,t)=>{let i=l[e],r=isFinite(s)?s:e,n=Number(h[t+1])||r;i.forEach(e=>{e.endTime=n})})},aQ={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"},aY=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),aX=({inbandTextTracks:e,dateRanges:t})=>{let i=e.metadataTrack_;if(!i)return;let s=d().WebKitDataCue||d().VTTCue;t.forEach(e=>{for(let t of Object.keys(e)){if(aY.has(t))continue;let r=new s(e.startTime,e.endTime,"");r.id=e.id,r.type="com.apple.quicktime.HLS",r.value={key:aQ[t],data:e[t]},("scte35Out"===t||"scte35In"===t)&&(r.value.data=new Uint8Array(r.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(r)}e.processDateRange()})},aJ=(e,t,i)=>{!e.metadataTrack_&&(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,rk.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},aZ=function(e,t,i){let s,r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},a0=function(e){let t=e.cues;if(!t)return;let i={};for(let s=t.length-1;s>=0;s--){let r=t[s],n=`${r.startTime}-${r.endTime}-${r.text}`;i[n]?e.removeCue(r):i[n]=r}},a1=(e,t,i)=>{let s;if(null==t||!e.length)return[];let r=Math.ceil((t-i+3)*I.ONE_SECOND_IN_TS);for(s=0;sr);s++);return e.slice(s)},a2=(e,t,i)=>{if(!t.length)return e;if(i)return t.slice();let s=t[0].pts,r=0;for(;r=s);r++);return e.slice(0,r).concat(t)},a4=(e,t,i,s)=>{let r=Math.ceil((t-s)*I.ONE_SECOND_IN_TS),n=Math.ceil((i-s)*I.ONE_SECOND_IN_TS),a=e.slice(),o=e.length;for(;o--&&!(e[o].pts<=n););if(-1===o)return a;let l=o+1;for(;l--&&!(e[l].pts<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a},a8=function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;let i=Object.keys(e).sort(),s=Object.keys(t).sort();if(i.length!==s.length)return!1;for(let r=0;ri))return n}return 0===s.length?0:s[s.length-1]},a3=e=>"number"==typeof e&&isFinite(e),a6=1/60,a7=(e,t,i)=>"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.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.":!t.hasVideo&&i.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:"Neither audio nor video found in segment.":null,a9=(e,t,i)=>{let s=t-n4.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)},oe=e=>{let{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:h,timeline:d}=e,u=o.length-1,c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);let p="number"==typeof h,m=e.segment.uri?"segment":"pre-segment",g=p?rQ({preloadSegment:s})-1:0;return`${m} [${n+l}/${n+u}]`+(p?` part [${h}/${g}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(p?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},ot=e=>`${e}TimingInfo`,oi=({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r})=>r||e!==t?e{if(t===i)return!1;if("audio"===s){let t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===s&&r){let t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},or=e=>{if(!e)return!1;let t=e.pendingTimelineChange({type:"audio"}),i=e.pendingTimelineChange({type:"main"}),s=t&&i,r=s&&t.to!==i.to;return!!s&&-1!==t.from&&-1!==i.from&&!!r},on=e=>{e&&(e.pause(),e.resetEverything(),e.load())},oa=e=>{let t=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=e.timelineChangeController_.pendingTimelineChange({type:"main"});return t&&i&&t.to{let t=e.pendingSegment_;if(t&&os({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:t.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&or(e.timelineChangeController_)){if(oa(e)){e.timelineChangeController_.trigger("audioTimelineBehind");return}on(e)}},ol=e=>{let t=0;return["video","audio"].forEach(function(i){let s;let r=e[`${i}TimingInfo`];if(!r)return;let{start:n,end:a}=r;"bigint"==typeof n||"bigint"==typeof a?s=d().BigInt(a)-d().BigInt(n):"number"==typeof n&&"number"==typeof a&&(s=a-n),void 0!==s&&s>t&&(t=s)}),"bigint"==typeof t&&t!!e&&Math.round(e)>t+rM,od=(e,t)=>{if("hls"!==t)return null;let i=ol({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!i)return null;let s=e.playlist.targetDuration,r=oh({segmentDuration:i,maxDuration:2*s}),n=oh({segmentDuration:i,maxDuration:s}),a=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${i} when the reported duration is ${e.duration} and the target duration is ${s}. 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 r||n?{severity:r?"warn":"info",message:a}:null},ou=({type:e,segment:t})=>{if(!t)return;let i=!!(t.key||t.map&&t.map.ke),s=!!(t.map&&!t.map.bytes),r=void 0===t.startOfSegment?t.start:t.startOfSegment;return{type:e||t.type,uri:t.resolvedUri||t.uri,start:r,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class oc extends rk.EventTarget{constructor(e,t={}){if(super(),!e)throw TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw TypeError("No currentTime getter specified");if(!e.mediaSource)throw 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_=rL(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():oo(this)}),this.sourceUpdater_.on("codecschange",e=>{this.trigger((0,_.A)({type:"codecschange"},e))}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():oo(this)}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",e=>{this.trigger((0,_.A)({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():oo(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():oo(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return ah.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_&&d().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("WAITING"!==this.state){this.pendingSegment_&&(this.pendingSegment_=null);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,d().clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&ah.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){let e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return rO();if("main"===this.loaderType_){let{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;let i=nO(e),s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;let i=nM(e),s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});let r={resolvedUri:(s||e).resolvedUri};return s&&(r.bytes=s.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_){if("INIT"===this.state&&this.couldBeginLoading_())return this.init_();this.couldBeginLoading_()&&("READY"===this.state||"INIT"===this.state)&&(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;let i=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&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: ${rV(this.buffered_())} +`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}let n=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${n}]`),null!==this.mediaIndex){if(this.mediaIndex-=n,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{let e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){let e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}}s&&(s.mediaIndex-=n,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(d().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}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_&&ah.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;let e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"!==this.sourceType_||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=()=>{},s=!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,n=()=>{0==--r&&i()};for(let i in(s||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,n)),(s||"main"===this.loaderType_)&&(this.gopBuffer_=a4(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,n)),this.inbandTextTracks_)aZ(e,t,this.inbandTextTracks_[i]);aZ(e,t,this.segmentMetadataTrack_),n()}monitorBuffer_(){this.checkBufferTimeout_&&d().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=d().setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&d().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=d().setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;let e=this.chooseNextRequest_();if(!e)return;let t={segmentInfo:ou({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),"number"==typeof e.timestampOffset&&(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;let s="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,n=!s||!s.parts||i+1===s.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&n}chooseNextRequest_(){let e=this.buffered_(),t=rV(e)||0,i=rz(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),n=this.playlist_.segments;if(!n.length||s||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);let a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(a.isSyncRequest)a.mediaIndex=a5(this.currentTimeline_,n,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${a.mediaIndex}`);else if(null!==this.mediaIndex){let e=n[this.mediaIndex],i="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=e.end?e.end:t,e.parts&&e.parts[i+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=i+1):a.mediaIndex=this.mediaIndex+1}else{let e,i,s;let r=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: +For TargetTime: ${r}. +CurrentTime: ${this.currentTime_()} +BufferedEnd: ${t} +Fetch At Buffer: ${this.fetchAtBuffer_} +`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){let t=this.getSyncInfoFromMediaSequenceSync_(r);if(!t){let e="No sync info found while using media sequence sync";return this.error({message:e,metadata:{errorType:rk.Error.StreamingFailedToSelectNextSegment,error:Error(e)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${t.start} --> ${t.end})`),e=t.segmentIndex,i=t.partIndex,s=t.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");let t=nt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:r,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=t.segmentIndex,i=t.partIndex,s=t.startTime}a.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${r}`:`currentTime ${r}`,a.mediaIndex=e,a.startOfSegment=s,a.partIndex=i,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${a.mediaIndex} `)}let o=n[a.mediaIndex],l=o&&"number"==typeof a.partIndex&&o.parts&&o.parts[a.partIndex];if(!o||"number"==typeof a.partIndex&&!l)return null;"number"!=typeof a.partIndex&&o.parts&&(a.partIndex=0,l=o.parts[0]);let h=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&l&&!h&&!l.independent){if(0===a.partIndex){let e=n[a.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(a.mediaIndex-=1,a.partIndex=e.parts.length-1,a.independent="previous segment")}else o.parts[a.partIndex-1].independent&&(a.partIndex-=1,a.independent="previous part")}let d=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=n.length-1&&d&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,a.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(a))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;let t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);let i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;let s=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return s?(s.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),s):null}generateSegmentInfo_(e){let{independent:t,playlist:i,mediaIndex:s,startOfSegment:r,isSyncRequest:n,partIndex:a,forceTimestampOffset:o,getMediaInfoForTime:l}=e,h=i.segments[s],d="number"==typeof a&&h.parts[a],u={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||h.resolvedUri,mediaIndex:s,partIndex:d?a:null,isSyncRequest:n,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:h.timeline,duration:d&&d.duration||h.duration,segment:h,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},c=void 0!==o?o:this.isPendingTimestampOffset_;u.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:h.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:c});let p=rV(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(u.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(u.gopsToAlignWith=a1(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),u}timestampOffsetForSegment_(e){return oi(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;let t=this.currentTime_(),i=e.bandwidth,s=this.pendingSegment_.duration,r=nt.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),n=function(e,t,i=1){return((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=n)return;let a=aq({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:n,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!a)return;let o=r-n-a.rebufferingImpact,l=.5;n<=rM&&(l=1),a.playlist&&a.playlist.uri!==this.playlist_.uri&&!(o{s[e.stream]=s[e.stream]||{startTime:1/0,captions:[],endTime:0};let t=s[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)}),Object.keys(s).forEach(e=>{let{startTime:t,endTime:r,captions:n}=s[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${r} for ${e}`),az(a,this.vhs_.tech_,e),aZ(t,r,a[e]),aW({captionArray:n,inbandTextTracks:a,timestampOffset:i})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){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_(){let e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){let e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;let e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!os({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}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;let e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;let{hasAudio:i,hasVideo:s,isMuxed:r}=t;return!(s&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||os({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_()){oo(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}let i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){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[ot(t.type)].start;else{let e;let t=this.getCurrentMediaInfo_(),s="main"===this.loaderType_&&t&&t.hasVideo;s&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:e,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:"main"===this.loaderType_});let e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.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){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||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:s}){if(i){let e=nO(i);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){let r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+rq(r).join(", ")),n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+rq(n).join(", "));let a=r.length?r.start(0):0,o=r.length?r.end(r.length-1):0,l=n.length?n.start(0):0,h=n.length?n.end(n.length-1):0;if(o-a<=1&&h-l<=1){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${rq(r).join(", ")}, video buffer: ${rq(n).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}));let u=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${u}`),this.remove(0,u,()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=d().setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){if(s){if(22===s.code){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:rk.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){let e=[s],t=s.byteLength;i&&(e.unshift(i),t+=i.byteLength),r=aH({bytes:t,segments:e})}let n={segmentInfo:ou({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:n}),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;let s=this.pendingSegment_.segment,r=`${e}TimingInfo`;s[r]||(s[r]={}),s[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[r].transmuxedPresentationStart=i.start.presentation,s[r].transmuxedDecodeStart=i.start.decode,s[r].transmuxedPresentationEnd=i.end.presentation,s[r].transmuxedDecodeEnd=i.end.decode,s[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){let{type:i,data:s}=t;if(!s||!s.byteLength||"audio"===i&&this.audioDisabled_)return;let 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:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){oo(this),this.loadQueue_.push(()=>{let t=(0,_.A)({},e,{forceTimestampOffset:!0});(0,_.A)(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}));let t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&e.timeline>0;this.logger_(`Requesting +${aV(e.uri)} +${oe(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=ax({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:i||s&&r,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:s})=>{this.logger_(`${oe(e)} logged from transmuxer stream ${s} as a ${i}: ${t}`)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{let n={segmentInfo:ou({segment:t})};i&&(n.keyInfo=i),s&&(n.trackInfo=s),r&&(n.timingInfo=r),this.trigger({type:e,metadata:n})}})}trimBackBuffer_(e){let t=a9(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){let t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,n={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:s,isMediaInitialization:r},a=e.playlist.segments[e.mediaIndex-1];if(a&&a.timeline===t.timeline&&(a.videoTimingInfo?n.baseStartTime=a.videoTimingInfo.transmuxedDecodeEnd:a.audioTimingInfo&&(n.baseStartTime=a.audioTimingInfo.transmuxedDecodeEnd)),t.key){let i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=i}return t.map&&(n.map=this.initSegmentForMap(t.map)),n}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e3*e.playlist.targetDuration,n=s&&s.end&&this.currentTime_()-s.end>3*e.playlist.partTargetDuration;if(r||n){this.logger_(`bad ${r?"segment":"part"} ${oe(e)}`),this.resetEverything();return}null!==this.mediaIndex&&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())},og=["video","audio"],of=(e,t)=>{let i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},o_=(e,t)=>{for(let i=0;i{if(0===t.queue.length)return;let i=0,s=t.queue[i];if("mediaSource"===s.type){t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),s.action(t),s.doneFn&&s.doneFn(),oy("audio",t),oy("video",t));return}if(!("mediaSource"===e||!t.ready()||"closed"===t.mediaSource.readyState||of(e,t))){if(s.type!==e){if(null===(i=o_(e,t.queue)))return;s=t.queue[i]}if(t.queue.splice(i,1),t.queuePending[e]=s,s.action(e,t),!s.doneFn){t.queuePending[e]=null,oy(e,t);return}}},ov=(e,t)=>{let i=t[`${e}Buffer`],s=om(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},oT=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),ob={appendBuffer:(e,t,i)=>(s,r)=>{let n=r[`${s}Buffer`];if(oT(r.mediaSource,n)){r.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{n.appendBuffer(e)}catch(e){r.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${s}Buffer`),r.queuePending[s]=null,i(e)}}},remove:(e,t)=>(i,s)=>{let r=s[`${i}Buffer`];if(oT(s.mediaSource,r)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(r){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},timestampOffset:e=>(t,i)=>{let s=i[`${t}Buffer`];oT(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),s.timestampOffset=e)},callback:e=>(t,i)=>{e()},endOfStream:e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){rk.log.warn("Failed to call media source endOfStream",e)}}},duration:e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){rk.log.warn("Failed to set media source duration",e)}},abort:()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;let i=t[`${e}Buffer`];if(oT(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){rk.log.warn(`Failed to abort on ${e}Buffer`,t)}}},addSourceBuffer:(e,t)=>i=>{let s=om(e),r=(0,T.UD)(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);let n=i.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",i[`on${s}UpdateEnd_`]),n.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=n},removeSourceBuffer:e=>t=>{let i=t[`${e}Buffer`];if(ov(e,t),oT(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){rk.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},changeType:e=>(t,i)=>{let s=i[`${t}Buffer`],r=(0,T.UD)(e);if(!oT(i.mediaSource,s))return;let n=e.substring(0,e.indexOf(".")),a=i.codecs[t];if(a.substring(0,a.indexOf("."))===n)return;let o={codecsChangeInfo:{from:a,to:e}};i.trigger({type:"codecschange",metadata:o}),i.logger_(`changing ${t}Buffer codec from ${a} to ${e}`);try{s.changeType(r),i.codecs[t]=e}catch(e){o.errorType=rk.Error.StreamingCodecsChangeError,o.error=e,e.metadata=o,i.error_=e,i.trigger("error"),rk.log.warn(`Failed to changeType on ${t}Buffer`,e)}}},oS=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),oy(e,t)},ok=(e,t)=>i=>{let s=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let i=0;i ${r}. Duration (${r-s}) +`}return t}(t[`${e}Buffered`]());if(t.logger_(`received "updateend" event for ${e} Source Buffer: `,s),t.queuePending[e]){let i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}oy(e,t)};class oC extends rk.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>oy("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=rL("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=ok("video",this),this.onAudioUpdateEnd_=ok("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},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){oS({type:"mediaSource",sourceUpdater:this,action:ob.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){oS({type:e,sourceUpdater:this,action:ob.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){rk.log.error("removeSourceBuffer is not supported!");return}oS({type:"mediaSource",sourceUpdater:this,action:ob.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!rk.browser.IS_FIREFOX&&d().MediaSource&&d().MediaSource.prototype&&"function"==typeof d().MediaSource.prototype.removeSourceBuffer}static canChangeType(){return d().SourceBuffer&&d().SourceBuffer.prototype&&"function"==typeof d().SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){rk.log.error("changeType is not supported!");return}oS({type:e,sourceUpdater:this,action:ob.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{let i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){let{segmentInfo:i,type:s,bytes:r}=e;if(this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}if(oS({type:s,sourceUpdater:this,action:ob.appendBuffer(r,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===s){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;let e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach(e=>{this.appendBuffer.apply(this,e)})}}audioBuffered(){return oT(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:rO()}videoBuffered(){return oT(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:rO()}buffered(){let e=oT(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=oT(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():rF(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=op){oS({type:"mediaSource",sourceUpdater:this,action:ob.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=op){"string"!=typeof e&&(e=void 0),oS({type:"mediaSource",sourceUpdater:this,action:ob.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=op){if(!this.audioBuffered().length||0===this.audioBuffered().end(0)){i();return}oS({type:"audio",sourceUpdater:this,action:ob.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=op){if(!this.videoBuffered().length||0===this.videoBuffered().end(0)){i();return}oS({type:"video",sourceUpdater:this,action:ob.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(of("audio",this)||of("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(oS({type:"audio",sourceUpdater:this,action:ob.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(oS({type:"video",sourceUpdater:this,action:ob.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&oS({type:"audio",sourceUpdater:this,action:ob.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&oS({type:"video",sourceUpdater:this,action:ob.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),og.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>ov(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}let oE=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),ow=e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join(""),ox=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class oI extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class oP extends oc{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return rO();let e=this.subtitlesTrack_.cues;return rO([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;let i=nO(e),s=this.initSegments_[i];if(t&&!s&&e.bytes){let t=new Uint8Array(ox.byteLength+e.bytes.byteLength);t.set(e.bytes),t.set(ox,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){aZ(e,t,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),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===au.TIMEOUT&&this.handleTimeout_(),e.code===au.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}let s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");let r=s.segment;if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof d().WebVTT&&"function"==typeof this.loadVttJs){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}r.requested=!0;try{this.parseVTTCues_(s)}catch(e){this.stopForError({message:e.message,metadata:{errorType:rk.Error.StreamingVttParserError,error:e}});return}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new(d()).VTTCue(e.startTime,e.endTime,e.text):e)}),a0(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t;let i=!1;if("function"!=typeof d().WebVTT)throw new oI;"function"==typeof d().TextDecoder?t=new(d()).TextDecoder("utf8"):(t=d().WebVTT.StringDecoder(),i=!0);let s=new(d()).WebVTT.Parser(d(),d().vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=t=>{e.timestampmap=t},s.onparsingerror=e=>{rk.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=oE(t)),s.parse(t)}let r=e.bytes;i&&(r=oE(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){let s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}let{MPEGTS:r,LOCAL:n}=e.timestampmap,a=r/I.ONE_SECOND_IN_TS-n+t.mapping;if(e.cues.forEach(e=>{let i=e.endTime-e.startTime,s=this.handleRollover_(e.startTime+a,t.time);e.startTime=Math.max(s,0),e.endTime=Math.max(s+i,0)}),!i.syncInfo){let t=e.cues[0].startTime,r=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,r-s.duration)}}}handleRollover_(e,t){let i;if(null===t)return e;let s=e*I.ONE_SECOND_IN_TS,r=t*I.ONE_SECOND_IN_TS;for(i=r0x100000000;)s+=i;return s/I.ONE_SECOND_IN_TS}}let oA=function(e,t){let i=e.cues;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null},oL=function(e,t,i=0){let s;if(!e.segments)return;let r=i;for(let i=0;i=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class oM{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){let{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),this.isReliable_)return this.updateStorage_(s,i,this.calculateBaseTime_(i,t))}getSyncInfoForTime(e){for(let{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(let t of i)if(t.isInRange(e))return t}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let s=new Map,r="\n",n=i,a=t;this.start_=n,e.forEach((e,t)=>{let i=this.storage_.get(a),o=n,l=o+e.duration,h=!!(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),d=new oD({start:o,end:l,appended:h,segmentIndex:t});e.syncInfo=d;let u=n,c=(e.parts||[]).map((e,s)=>{let n=u,o=u+e.duration,l=!!(i&&i.partsSyncInfo&&i.partsSyncInfo[s]&&i.partsSyncInfo[s].isAppended),h=new oD({start:n,end:o,appended:l,segmentIndex:t,partIndex:s});return u=o,r+=`Media Sequence: ${a}.${s} | Range: ${n} --> ${o} | Appended: ${l} +`,e.syncInfo=h,h});s.set(a,new oO(d,c)),r+=`${aV(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --> ${l} | Appended: ${h} +`,a++,n=l}),this.end_=n,this.storage_=s,this.diagnostics_=r}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class oR extends oM{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){let t=this.parent_.getSyncInfoForMediaSequence(e);return t?t.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}let oU=[{name:"VOD",run:(e,t,i,s,r)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,s,r,n)=>{let a=e.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;let o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,s,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null,o=rG(t);r=r||0;for(let i=0;i{let n=null,a=null;r=r||0;let o=rG(t);for(let e=0;e=e)&&(a=e,n={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,s,r)=>{let n=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class oN extends rk.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let t=new oM,i=new oR(t),s=new oR(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=rL("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(t!==1/0)return oU.find(({name:e})=>"VOD"===e).run(this,e,t);let n=this.runStrategies_(e,t,i,s,r);if(!n.length)return null;for(let t of n){let{syncPoint:i,strategy:r}=t,{segmentIndex:n,time:a}=i;if(n<0)continue;let o=a+e.segments[n].duration;if(this.logger_(`Strategy: ${r}. Current time: ${s}. selected segment: ${n}. Time: [${a} -> ${o}]}`),s>=a&&s0&&(s.time*=-1),Math.abs(s.time+r1({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s,r){let n=[];for(let a=0;a86400){rk.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let s=i-1;s>=0;s--){let i=e.segments[s];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+s,time:i.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){let t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));let r=s.dateTimeObject;s.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[s.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){let s,r;let n=e.segment,a=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),s=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;s=t.start+o.mapping,r=t.end+o.mapping}return a&&(a.start=s,a.end=r),(!n.start||so){let s;s=a<0?i.start-r1({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+r1({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:s,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class oB extends rk.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger({type:"timelinechange",metadata:{timelineChangeInfo:{from:t,to:i}}})),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var oj=n6(n7(n9(function(){var e,t,s,r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t){if(2==arguments.length)for(var i=t.length,s=0;s>7)*283)^e]=e;for(t=i=0;!u[t];t^=s||1,i=m[i]||1)for(e=0,n=(n=i^i<<1^i<<2^i<<3^i<<4)>>8^255&n^99,u[t]=n,c[n]=t,o=0x1010101*p[r=p[s=p[t]]]^65537*r^257*s^0x1010100*t,a=257*p[n]^0x1010100*n;e<4;e++)h[e][t]=a=a<<24^a>>>8,d[e][n]=o=o<<24^o>>>8;for(e=0;e<5;e++)h[e]=h[e].slice(0),d[e]=d[e].slice(0);return l},a=null;class o{constructor(e){let t,i,s;a||(a=n()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];let r=this._tables[0][4],o=this._tables[1],l=e.length,h=1;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size");let d=e.slice(0),u=[];for(this._key=[d,u],t=l;t<4*l+28;t++)s=d[t-1],(t%l==0||8===l&&t%l==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%l==0&&(s=s<<8^s>>>24^h<<24,h=h<<1^(h>>7)*283)),d[t]=d[t-l]^s;for(i=0;t;i++,t--)s=d[3&i?t:t-4],t<=4||i<4?u[i]=s:u[i]=o[0][r[s>>>24]]^o[1][r[s>>16&255]]^o[2][r[s>>8&255]]^o[3][r[255&s]]}decrypt(e,t,i,s,r,n){let a,o,l,h;let d=this._key[1],u=e^d[0],c=s^d[1],p=i^d[2],m=t^d[3],g=d.length/4-2,f=4,_=this._tables[1],y=_[0],v=_[1],T=_[2],b=_[3],S=_[4];for(h=0;h>>24]^v[c>>16&255]^T[p>>8&255]^b[255&m]^d[f],o=y[c>>>24]^v[p>>16&255]^T[m>>8&255]^b[255&u]^d[f+1],l=y[p>>>24]^v[m>>16&255]^T[u>>8&255]^b[255&c]^d[f+2],m=y[m>>>24]^v[u>>16&255]^T[c>>8&255]^b[255&p]^d[f+3],f+=4,u=a,c=o,p=l;for(h=0;h<4;h++)r[(3&-h)+n]=S[u>>>24]<<24^S[c>>16&255]<<16^S[p>>8&255]<<8^S[255&m]^d[f++],a=u,u=c,c=p,p=m,m=a}}class l extends r{constructor(){super(r),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))}}let h=function(e){return e<<24|(65280&e)<<8|(0xff0000&e)>>8|e>>>24},d=function(e,t,i){let s,r,n,a,l,d,u,c,p;let m=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),g=new o(Array.prototype.slice.call(t)),f=new Uint8Array(e.byteLength),_=new Int32Array(f.buffer);for(p=0,s=i[0],r=i[1],n=i[2],a=i[3];p{let s=e[i];("function"===ArrayBuffer.isView?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s}),t};self.onmessage=function(e){let t=e.data;new u(new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4),function(e,i){self.postMessage(m({source:t.source,decrypted:i}),[i.buffer])})}})));let oF=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},o$=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},oq=(e,t)=>{t.activePlaylistLoader=e,e.load()},oH=(e,t)=>()=>{let{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:r}}=t,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;if((!a||!l||a.id!==l.id)&&(r.lastGroup_=a,r.lastTrack_=n,o$(i,r),a&&!a.isMainPlaylist)){if(!a.playlistLoader){o&&s.resetEverything();return}i.resyncLoader(),oq(a.playlistLoader,r)}},oV=(e,t)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()},oz=(e,t)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:r},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,h=n.lastTrack_;if((!h||!a||h.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,o$(s,n),o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;let e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;n.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),i.pause(),r.resetEverything(),e.fastQualityChange_(s);return}if("AUDIO"===e){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}s.setAudio(!0),r.setAudio(!1)}if(l===o.playlistLoader){oq(o.playlistLoader,n);return}s.track&&s.track(a),s.resetEverything(),oq(o.playlistLoader,n)}},oW={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:s}=t,r=i.activeTrack(),n=i.activeGroup(),a=(n.filter(e=>e.default)[0]||n[0]).id,o=i.tracks[a];if(r===o){s({error:{message:"Problem encountered loading the default audio track."}});return}for(let e in rk.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:i}}=t;rk.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let s=i.activeTrack();s&&(s.mode="disabled"),i.onTrackChanged()}},oG={AUDIO:(e,t,i)=>{if(!t)return;let{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",oW[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",oW[e](e,i))}},oK={AUDIO:(e,t)=>{let{vhs:i,sourceType:s,segmentLoaders:{[e]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:h}},mainPlaylistLoader:d}=t,u=ne(d.main);for(let r in(!a[e]||0===Object.keys(a[e]).length)&&(a[e]={main:{default:{default:!0}}},u&&(a[e].main.default.playlists=d.main.playlists)),a[e])for(let c in o[r]||(o[r]=[]),a[e][r]){let p,m=a[e][r][c];if(u?(h(`AUDIO group '${r}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new nC(m.playlists[0],i,n):m.resolvedUri?new nC(m.resolvedUri,i,n):m.playlists&&"dash"===s?new n2(m.playlists[0],i,n,d):null,m=rD({id:c,playlistLoader:p},m),oG[e](e,m.playlistLoader,t),o[r].push(m),void 0===l[c]){let e=new rk.AudioTrack({id:c,kind:oF(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}r.on("error",oW[e](e,t))},SUBTITLES:(e,t)=>{let{tech:i,vhs:s,sourceType:r,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:h}},mainPlaylistLoader:d}=t;for(let n in o[e])for(let u in l[n]||(l[n]=[]),o[e][n]){let c;if(!s.options_.useForcedSubtitles&&o[e][n][u].forced)continue;let p=o[e][n][u];if("hls"===r)c=new nC(p.resolvedUri,s,a);else if("dash"===r){if(!p.playlists.filter(e=>e.excludeUntil!==1/0).length)return;c=new n2(p.playlists[0],s,a,d)}else"vhs-json"===r&&(c=new nC(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=rD({id:u,playlistLoader:c},p),oG[e](e,p.playlistLoader,t),l[n].push(p),void 0===h[u]){let e=i.addRemoteTextTrack({id:u,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:u},!1).track;h[u]=e}}n.on("error",oW[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{let{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(let t in s[e])for(let a in r[t]||(r[t]=[]),s[e][t]){let o=s[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let l=i.options_.vhs&&i.options_.vhs.captionServices||{},h={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[h.instreamId]&&(h=rD(h,l[h.instreamId])),void 0===h.default&&delete h.default,r[t].push(rD({id:a},o)),void 0===n[a]){let e=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;n[a]=e}}}},oQ=(e,t)=>{for(let i=0;ii=>{let{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:r}}}=t,n=s.media();if(!n)return null;let a=null;n.attributes[e]&&(a=r[n.attributes[e]]);let o=Object.keys(r);if(!a){if("AUDIO"===e&&o.length>1&&ne(t.main))for(let e=0;ee.id===i.id)[0]||null},oX={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},oJ=(e,{mediaTypes:t})=>()=>{let i=t[e].activeTrack();return i?t[e].activeGroup(i):null},oZ=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{oK[t](t,e)});let{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach(i=>{t[i].activeGroup=oY(i,e),t[i].activeTrack=oX[i](i,e),t[i].onGroupChanged=oH(i,e),t[i].onGroupChanging=oV(i,e),t[i].onTrackChanged=oz(i,e),t[i].getActiveGroup=oJ(i,e)});let o=t.AUDIO.activeGroup();if(o){let e=(o.filter(e=>e.default)[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanging())});let l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};for(let e in s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),s.clearTracks("audio"),t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[e])},o0=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:op,activeTrack:op,getActiveGroup:op,onGroupChanged:op,onTrackChanged:op,lastTrack_:null,logger_:rL(`MediaGroups[${t}]`)}}),e};class o1{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=rP(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(e=>[e.ID,e])))}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_}}class o2 extends rk.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new o1,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_=rL("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";let 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=rP(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){let t=this.steeringManifest.reloadUri;if(!t)return;let 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}let s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(e,t)=>{let r;if(e){if(410===t.status){this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(429===t.status){let i=t.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),this.startTTLTimeout_(parseInt(i,10));return}this.logger_(`manifest failed to load ${e}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});try{r=JSON.parse(this.request_.responseText)}catch(t){let e={errorType:rk.Error.StreamingContentSteeringParserError,error:t};this.trigger({type:"error",metadata:e})}this.assignSteeringProperties_(r);let n={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:n}),this.startTTLTimeout_()})}setProxyServerUrl_(e){let t=new(d()).URL(e),i=new(d()).URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let t=JSON.parse(d().atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){let t=new(d()).URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){let e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(s){let e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,s)}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());let t=(e=>{for(let t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){let i=this.setProxyServerUrl_(e);if(!t(i))return i}let i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=d().setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){d().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 o1}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&&(rP(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let o4=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],o8=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},o5=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!s)return rk.log.warn("We received no playlist to switch to. Please check your stream."),!1;let h=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${h} as current playlist is not set`),!0;if(s.id===e.id)return!1;let d=!!rN(t,i).length;if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${h} as current playlist is live`),!0):(l(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);let u=rz(t,i),c=o?n4.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:n4.MAX_BUFFER_LOW_WATER_LINE;if(am)&&u>=r){let e=`${h} as forwardBuffer >= bufferLowWaterLine (${u} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${h} as no switching criteria met`),!1};class o3 extends rk.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:s,bandwidth:r,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:h,sourceType:u,cacheEncryptionKeys:c,bufferBasedABR:p,leastPixelDiffSelector:m,captionServices:g,experimentalUseMMS:f}=e;if(!t)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:_}=e;null==_&&(_=1/0),l=n,this.bufferBasedABR=!!p,this.leastPixelDiffSelector=!!m,this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=u,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=_,this.enableLowInitialPlaylist=h,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:_,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=o0(),f&&d().ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new(d()).ManagedMediaSource,rk.log("Using ManagedMediaSource")):d().MediaSource&&(this.mediaSource=new(d()).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_=rO(),this.hasPlayed_=!1,this.syncController_=new oN(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new oj,this.sourceUpdater_=new oC(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new oB,this.keyStatusMap_=new Map;let y={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:g,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:c,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new n2(t,this.vhs_,rD(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new nC(t,this.vhs_,rD(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new oc(rD(y,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new oc(rD(y,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new oP(rD(y,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){s.off("vttjserror",r),e()}function r(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",r),s.addWebVttScript_()})}),e),this.contentSteeringController_=new o2(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),o4.forEach(e=>{this[e+"_"]=o8.bind(this,e)}),this.logger_=rL("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(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;let v="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(v,()=>{let e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return -1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){let s=this.media(),r=s&&(s.id||s.uri),n=e&&(e.id||e.uri);if(r&&r!==n){this.logger_(`switch media ${r} -> ${n} from ${t}`);let i={renditionInfo:{id:n,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:i}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{let t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){let t=(i.length?i[0].playlists:i.playlists).filter(e=>e.attributes.serviceLocation===s);t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=d().setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(d().clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){let e;let t=this.main(),i=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return i;let s=t.mediaGroups.AUDIO,r=Object.keys(s);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)e=this.mediaTypes_.AUDIO.activeTrack();else{let t=s.main||r.length&&s[r[0]];for(let i in t)if(t[i].default){e={label:i};break}}if(!e)return i;let n=[];for(let i in s)if(s[i][e.label]){let r=s[i][e.label];if(r.playlists&&r.playlists.length)n.push.apply(n,r.playlists);else if(r.uri)n.push(r);else if(t.playlists.length)for(let e=0;e{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;r6(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),oZ({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(),e),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 e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{let e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;r6(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(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(e=>{this.mainPlaylistLoader_.on(e,e=>{this.player_.trigger((0,_.A)({},e))})})}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){let i=e.mediaGroups||{},s=!0,r=Object.keys(i.AUDIO);for(let e in i.AUDIO)for(let t in i.AUDIO[e])i.AUDIO[e][t].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),l.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){let t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return o5({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,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",()=>{let e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),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",()=>{let e=this.audioSegmentLoader_.pendingSegment_;if(!e||!e.segment||!e.segment.syncInfo)return;let t=e.segment.syncInfo.end+.01;this.tech_.setCurrentTime(t)}),this.mainSegmentLoader_.on("earlyabort",e=>{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:10}))});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};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(e=>{this.mainSegmentLoader_.on(e,e=>{this.player_.trigger((0,_.A)({},e))}),this.audioSegmentLoader_.on(e,e=>{this.player_.trigger((0,_.A)({},e))}),this.subtitleSegmentLoader_.on(e,e=>{this.player_.trigger((0,_.A)({},e))})})}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.mainSegmentLoader_.load()})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let 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){let t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;let i=l.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-s<=rR;let n=r.end(r.length-1);return n-s<=rR&&i-n<=rR}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){let s;if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let r=this.mainPlaylistLoader_.main.playlists,n=r.filter(r5),a=1===n.length&&n[0]===e;if(1===r.length&&i!==1/0)return rk.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){let t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(t)},i);return}let t=!1;r.forEach(i=>{if(i===e)return;let s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)}),t&&(rk.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}s=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=s,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let o=this.selectPlaylist();if(!o){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let l=t.internal?this.logger_:rk.log.warn,h=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${h} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);let d=o.targetDuration/2*1e3||5e3,u="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",a||u)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){let i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);let r=[];(s||"audio"===e)&&r.push("AUDIO"),(s||"subtitle"===e)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{let t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(t=>{let s=this[`${t}SegmentLoader_`];s&&(e===t||"all"===e)&&i.push(s)}),i.forEach(e=>t.forEach(t=>{"function"==typeof e[t]&&e[t]()}))}setCurrentTime(e){let t=rN(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:void(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()):0}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:l.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e,t,i;if(!this.mainPlaylistLoader_)return;let s=this.mainPlaylistLoader_.media();if(!s)return;let r=this.syncController_.getExpiredTime(s,this.duration());if(null===r)return;let n=this.mainPlaylistLoader_.main,a=l.Playlist.seekable(s,r,l.Playlist.liveEdgeDelay(n,s));if(0===a.length||this.mediaTypes_.AUDIO.activePlaylistLoader&&(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration()))||0===(e=l.Playlist.seekable(s,r,l.Playlist.liveEdgeDelay(n,s))).length)||(this.seekable_&&this.seekable_.length&&(t=this.seekable_.end(0),i=this.seekable_.start(0)),e?e.start(0)>a.end(0)||a.start(0)>e.end(0)?this.seekable_=a:this.seekable_=rO([[e.start(0)>a.start(0)?e.start(0):a.start(0),e.end(0)0&&(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=>{let t=this.mediaTypes_[e].groups;for(let e in t)t[e].forEach(e=>{e.playlistLoader&&e.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_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!!t&&!!i}getCodecsOrExclude_(){let e;let t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let s=aM(this.main(),i),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(r.video=s.video||t.main.videoCodec||T.dv),t.main.isMuxed&&(r.video+=`,${s.audio||t.main.audioCodec||T.Yg}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||n)&&(r.audio=s.audio||t.main.audioCodec||t.audio.audioCodec||T.Yg,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let a=(e,t)=>e?(0,T.TY)(t):(0,T.YZ)(t),o={};if(["video","audio"].forEach(function(i){if(r.hasOwnProperty(i)&&!a(t[i].isFmp4,r[i])){let s=t[i].isFmp4?"browser":"muxer";o[s]=o[s]||[],o[s].push(r[i]),"audio"===i&&(e=s)}}),n&&e&&i.attributes.AUDIO){let t=i.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===t&&e!==i&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${t} as ${e} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){let e=Object.keys(o).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${o[t].join(",")}"`),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let e=[];if(["video","audio"].forEach(t=>{let i=((0,T.tB)(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,s=((0,T.tB)(r[t]||"")[0]||{}).type;i&&s&&i.toLowerCase()!==s.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${r[t]}"`)}),e.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){let e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{let s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);let r=aM(this.main,s),n=[];!r.audio||(0,T.YZ)(r.audio)||(0,T.TY)(r.audio)||n.push(`audio codec ${r.audio}`),!r.video||(0,T.YZ)(r.video)||(0,T.TY)(r.video)||n.push(`video codec ${r.video}`),r.text&&"stpp.ttml.im1t"===r.text&&n.push(`text codec ${r.text}`),n.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${n.join(", ")}`))})}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,s=aD((0,T.tB)(e)),r=aO(s),n=s.video&&(0,T.tB)(s.video)[0]||null,a=s.audio&&(0,T.tB)(s.audio)[0]||null;Object.keys(i).forEach(e=>{let s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);let o=[],l=aM(this.mainPlaylistLoader_.main,s),h=aO(l);if(l.audio||l.video){if(h!==r&&o.push(`codec count "${h}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){let e=l.video&&(0,T.tB)(l.video)[0]||null,t=l.audio&&(0,T.tB)(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}})}updateAdCues_(e){let t=0,i=this.seekable();i.length&&(t=i.start(0)),oL(e,this.cueTagsTrack_,t)}goalBufferLength(){let e=this.tech_.currentTime(),t=n4.GOAL_BUFFER_LENGTH,i=n4.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,n4.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){let e=this.tech_.currentTime(),t=n4.BUFFER_LOW_WATER_LINE,i=n4.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,n4.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,n4.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return n4.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){aJ(this.inbandTextTracks_,"com.apple.streaming",this.tech_),aX({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){let s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();aJ(this.inbandTextTracks_,e,this.tech_),aK({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(e.contentSteering){for(let 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(e=>{this.contentSteeringController_.on(e,e=>{this.trigger((0,_.A)({},e))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{let t=this.contentSteeringController_.getAvailablePathways(),i=[];for(let s of e.playlists){let e=s.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!i.length&&!!t.size})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let t=this.main().playlists,i=new Set,s=!1;Object.keys(t).forEach(r=>{let n=t[r],a=this.pathwayAttribute_(n),o=a&&e!==a;n.excludeUntil!==1/0||"content-steering"!==n.lastExcludeReason_||o||(delete n.excludeUntil,delete n.lastExcludeReason_,s=!0);let l=!n.excludeUntil&&n.excludeUntil!==1/0;!i.has(n.id)&&o&&l&&(i.add(n.id),n.excludeUntil=1/0,n.lastExcludeReason_="content-steering",this.logger_(`excluding ${n.id} for ${n.lastExcludeReason_}`))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(t=>{let i=this.mediaTypes_[t];if(i.activePlaylistLoader){let t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(s=!0)}}),s&&this.changeSegmentPathway_()}handlePathwayClones_(){let e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(let[e,s]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(e));for(let[s,r]of i.entries()){let i=t.get(s);if(!i){e.filter(e=>e.attributes["PATHWAY-ID"]===r["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(r,e)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(i,r)||(this.mainPlaylistLoader_.updateOrDeleteClone(r,!0),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(let e in i)if(i[e]!==s[e])return!1;for(let e in s)if(i[e]!==s[e])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{let s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach(s=>{let r="usable",n=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===r,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is ${r}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${r}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{let i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,s=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&s&&(delete e.excludeUntil,rk.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){let i=("string"==typeof e?e:ow(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${i} added to the keyStatusMap`),this.keyStatusMap_.set(i,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_()}}let o6=(e,t,i)=>s=>{let r=e.main.playlists[t],n=r8(r),a=r5(r);if(void 0===s)return a;s?delete r.disabled:r.disabled=!0;let o={renditionInfo:{id:t,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return s===a||n||(i(r),s?e.trigger({type:"renditionenabled",metadata:o}):e.trigger({type:"renditiondisabled",metadata:o})),s};class o7{constructor(e,t,i){let{playlistController_:s}=e,r=s.fastQualityChange_.bind(s);if(t.attributes){let e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=aM(s.main(),t),this.playlist=t,this.id=i,this.enabled=o6(e.playlists,t.id,r)}}let o9=function(e){e.representations=()=>{let t=e.playlistController_.main(),i=ne(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(e=>!r8(e)).map((t,i)=>new o7(e,t,t.id)):[]}},le=["seeking","seeked","pause","playing","error"];class lt extends rk.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_=rL("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)});let l=e=>{["main","audio"].forEach(t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(le,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(le,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&d().clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&d().clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=d().setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let 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){let t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),r=rH(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,r){t.trigger({type:"bufferedrangeschanged",metadata:{bufferedRanges:s}}),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:rq(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+rR>=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(rO([this.lastRecordedTime,e]));let t={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){let e;if(!this.tech_.seeking())return!1;let t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){let i=t.start(0);e=i+(i===t.end(0)?0:rR)}if(void 0!==e)return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${r$(t)}. Seeking to ${e}.`),this.tech_.setCurrentTime(e),!0;let s=this.playlistController_.sourceUpdater_,r=this.tech_.buffered(),n=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-rM)*2,h=[n,a];for(let e=0;e ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){let i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,s=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;let r=rB(s,t);return r.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${r.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+rR,n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||s)&&(r=e.end(e.length-1)+3*i.targetDuration),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:s,end:r}}return null}}let li={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},ls=function(e,t){let i=0,s=0,r=rD(li,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*r.errorInterval){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!r.getSource||"function"!=typeof r.getSource){rk.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),r.getSource.call(e,a)},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),ls(e,t)}};var lr="3.15.0";let ln={PlaylistLoader:nC,Playlist:nt,utils:nU,STANDARD_PLAYLIST_SELECTOR:a$,INITIAL_PLAYLIST_SELECTOR:function(){let e=this.playlists.main.playlists.filter(nt.isEnabled);return aB(e,(e,t)=>aj(e,t)),e.filter(e=>!!aM(this.playlists.main,e).video)[0]||null},lastBandwidthSelector:a$,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio&&d().devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),aF(this.playlists.main,t,parseInt(aN(this.tech_.el(),"width"),10)*s,parseInt(aN(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:aj,comparePlaylistResolution:function(e,t){let i,s;return(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||d().Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),i===(s=s||d().Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s},xhr:nI()};Object.keys(n4).forEach(e=>{Object.defineProperty(ln,e,{get:()=>(rk.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),n4[e]),set(t){if(rk.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0){rk.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}n4[e]=t}})});let la="videojs-vhs",lo=function(e,t){let i=t.media(),s=-1;for(let t=0;t{e.addQualityLevel(t)}),lo(e,t.playlists)};ln.canPlaySource=function(){return rk.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};let lh=(e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=aD((0,T.tB)(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);let r=(0,T.UD)(s.video),n=(0,T.UD)(s.audio),a={};for(let i in e)a[i]={},n&&(a[i].audioContentType=n),r&&(a[i].videoContentType=r),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return rD(e,a)},ld=(e,t)=>e.reduce((e,i)=>{if(!i.contentProtection)return e;let s=t.reduce((e,t)=>{let s=i.contentProtection[t];return s&&s.pssh&&(e[t]={pssh:s.pssh}),e},{});return Object.keys(s).length&&e.push(s),e},[]),lu=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let r=ld(i?s.concat([i]):s,Object.keys(t)),n=[],a=[];return r.forEach(t=>{a.push(new Promise((t,i)=>{e.tech_.one("keysessioncreated",t)})),n.push(new Promise((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},e=>{if(e){s(e);return}i()})}))}),Promise.race([Promise.all(n),Promise.race(a)])},lc=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{let r=lh(t,i,s);return!!r&&(e.currentSource().keySystems=r,!r||!!e.eme||(rk.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},lp=()=>{if(!d().localStorage)return null;let e=d().localStorage.getItem(la);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},lm=e=>{if(!d().localStorage)return!1;let t=lp();t=t?rD(t,e):e;try{d().localStorage.setItem(la,JSON.stringify(t))}catch(e){return!1}return t},lg=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,lf=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},l_=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},ly=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},lv=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};ln.supportsNativeHls=function(){if(!c()||!c().createElement)return!1;let e=c().createElement("video");return!!rk.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(e.canPlayType(t))})}(),ln.supportsNativeDash=!!(c()&&c().createElement&&rk.getTech("Html5").isSupported())&&/maybe|probably/i.test(c().createElement("video").canPlayType("application/dash+xml")),ln.supportsTypeNatively=e=>"hls"===e?ln.supportsNativeHls:"dash"===e&&ln.supportsNativeDash,ln.isSupported=function(){return rk.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},ln.xhr.onRequest=function(e){lf(ln.xhr,e)},ln.xhr.onResponse=function(e){l_(ln.xhr,e)},ln.xhr.offRequest=function(e){ly(ln.xhr,e)},ln.xhr.offResponse=function(e){lv(ln.xhr,e)};let lT=rk.getComponent("Component");class lb extends lT{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=rL("VhsHandler"),t.options_&&t.options_.playerId){let e=rk.getPlayer(t.options_.playerId);this.player_=e}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 Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(c(),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{let t=c().fullscreenElement||c().webkitFullscreenElement||c().mozFullScreenElement||c().msFullscreenElement;t&&t.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_=rD(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,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=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){let e=lp();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=n4.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===n4.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;let t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=lg(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=ln,this.options_.sourceType=(0,b.I)(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new o3(this.options_);let i=rD({liveRangeSafeTimeDelta:rR},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new lt(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{let e=rk.players[this.tech_.options_.playerId],t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});let s=this.options_.bufferBasedABR?ln.movingAverageBandwidthSelector(.55):ln.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=ln.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(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth,t=d().navigator.connection||d().navigator.mozConnection||d().navigator.webkitConnection;if(this.options_.useNetworkInformationApi&&t){let i=1e6*t.downlink;e=i>=1e7&&e>=1e7?Math.max(e,i):i}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){return Math.floor(1/(1/(this.bandwidth||1)+(this.throughput>0?1/this.throughput:0)))},set(){rk.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:()=>rq(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:()=>rq(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&&lm({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{o9(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_=d().URL.createObjectURL(this.playlistController_.mediaSource),(rk.browser.IS_ANY_SAFARI||rk.browser.IS_IOS)&&this.options_.overrideNative&&"hls"===this.options_.sourceType&&"function"==typeof this.tech_.addSourceElement?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),lu({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(e=>{this.logger_("error while creating EME key session",e),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_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=lc({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=rk.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{ll(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{lo(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":lr,"mux.js":"7.0.3","mpd-parser":"1.3.1","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}version(){return this.constructor.version()}canChangeType(){return oC.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_&&d().URL.revokeObjectURL&&(d().URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return nH({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return nV({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lf(this.xhr,e)},this.xhr.onResponse=e=>{l_(this.xhr,e)},this.xhr.offRequest=e=>{ly(this.xhr,e)},this.xhr.offResponse=e=>{lv(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.playlistController_.on(e,e=>{this.player_.trigger((0,_.A)({},e))})}),["gapjumped","playedrangeschanged"].forEach(e=>{this.playbackWatcher_.on(e,e=>{this.player_.trigger((0,_.A)({},e))})})}}let lS={name:"videojs-http-streaming",VERSION:lr,canHandleSource(e,t={}){let i=rD(rk.options,t);return!!(i.vhs.experimentalUseMMS||(0,T.TY)("avc1.4d400d,mp4a.40.2",!1))&&lS.canPlayType(e.type,i)},handleSource(e,t,i={}){let s=rD(rk.options,i);return t.vhs=new lb(e,t,s),t.vhs.xhr=nI(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){let i=(0,b.I)(e);if(!i)return"";let s=lS.getOverrideNative(t);return!ln.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){let{vhs:t={}}=e,i=!(rk.browser.IS_ANY_SAFARI||rk.browser.IS_IOS),{overrideNative:s=i}=t;return s}};(0,T.TY)("avc1.4d400d,mp4a.40.2",!0)&&rk.getTech("Html5").registerSourceHandler(lS,0),rk.VhsHandler=lb,rk.VhsSourceHandler=lS,rk.Vhs=ln,rk.use||rk.registerComponent("Vhs",ln),rk.options.vhs=rk.options.vhs||{},rk.getPlugin&&rk.getPlugin("reloadSourceOnError")||rk.registerPlugin("reloadSourceOnError",function(e){ls(this,e)})}}]); \ No newline at end of file diff --git a/_next/static/chunks/d6e1aeb5-b67145be142cd9e2.js b/_next/static/chunks/d6e1aeb5-b67145be142cd9e2.js deleted file mode 100644 index a8e204b4..00000000 --- a/_next/static/chunks/d6e1aeb5-b67145be142cd9e2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[544],{5215:function(e,t,i){for(var n,r=i(8908),a=i.n(r),s=i(9144),o=i.n(s),l=i(7462),u=i(7537),d=i.n(u),c=i(7326),h=i(4578),p=i(5974),f=i.n(p),m=i(9603),g=i.n(m),_=i(3407),v=i.n(_),y=i(8852),T=i(136),b=i(779),S=i(9323),k=i(2260),C=i(8485),E=i(562),w=i(2955),I=i(4221),x=i.n(I),P=i(8925),A=i(6185),L=i(1489),O="7.20.3",D={},M=function(e,t){return D[e]=D[e]||[],t&&(D[e]=D[e].concat(t)),D[e]},R=function(e,t){var i=M(e).indexOf(t);return!(i<=-1)&&(D[e]=D[e].slice(),D[e].splice(i,1),!0)},U={prefixed:!0},B=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],N=B[0],F=0;F0?l:0)}if(a().console){var u=a().console[i];u||"debug"!==i||(u=a().console.info||a().console.log),u&&s&&o.test(i)&&u[Array.isArray(r)?"apply":"call"](a().console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"===typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return H?[].concat(H):[]}).filter=function(e){return(H||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){H&&(H.length=0)},r.history.disable=function(){null!==H&&(H.length=0,H=null)},r.history.enable=function(){null===H&&(H=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),n=1;n=0)throw new Error("class has illegal whitespace characters")}function Te(){return o()===a().document}function be(e){return Z(e)&&1===e.nodeType}function Se(){try{return a().parent!==a().self}catch(e){return!0}}function ke(e){return function(t,i){if(!ve(t))return o()[e](null);ve(i)&&(i=o().querySelector(i));var n=be(i)?i:o();return n[e]&&n[e](t)}}function Ce(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=o().createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(q.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?Ee(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&We(r,n),r}function Ee(e,t){return"undefined"===typeof e.textContent?e.innerText=t:e.textContent=t,e}function we(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Ie(e,t){return ye(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function xe(e,t){return e.classList?e.classList.add(t):Ie(e,t)||(e.className=(e.className+" "+t).trim()),e}function Pe(e,t){return e?(e.classList?e.classList.remove(t):(ye(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(q.warn("removeClass was called with an element that doesn't exist"),null)}function Ae(e,t,i){var n=Ie(e,t);if("function"===typeof i&&(i=i(e,t)),"boolean"!==typeof i&&(i=!n),i!==n)return i?xe(e,t):Pe(e,t),e}function Le(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null===n||"undefined"===typeof n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function Oe(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!==typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function De(e,t){return e.getAttribute(t)}function Me(e,t,i){e.setAttribute(t,i)}function Re(e,t){e.removeAttribute(t)}function Ue(){o().body.focus(),o().onselectstart=function(){return!1}}function Be(){o().onselectstart=function(){return!0}}function Ne(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(X(e,"height"))),i.width||(i.width=parseFloat(X(e,"width"))),i}}function Fe(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==o()[U.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function je(e,t){var i={x:0,y:0};if(me)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=X(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},l=Fe(t.target),u=Fe(e),d=u.width,c=u.height,h=t.offsetY-(u.top-l.top),p=t.offsetX-(u.left-l.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-u.left,h=t.changedTouches[0].pageY+u.top,me&&(p-=i.x,h-=i.y)),o.y=1-Math.max(0,Math.min(1,h/c)),o.x=Math.max(0,Math.min(1,p/d)),o}function He(e){return Z(e)&&3===e.nodeType}function qe(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Ve(e){return"function"===typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"===typeof e&&(e=e()),be(e)||He(e)?e:"string"===typeof e&&/\S/.test(e)?o().createTextNode(e):void 0})).filter((function(e){return e}))}function We(e,t){return Ve(t).forEach((function(t){return e.appendChild(t)})),e}function ze(e,t){return We(qe(e),t)}function Ge(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var Ke,Ze=ke("querySelector"),Qe=ke("querySelectorAll"),Xe=Object.freeze({__proto__:null,isReal:Te,isEl:be,isInFrame:Se,createEl:Ce,textContent:Ee,prependTo:we,hasClass:Ie,addClass:xe,removeClass:Pe,toggleClass:Ae,setAttributes:Le,getAttributes:Oe,getAttribute:De,setAttribute:Me,removeAttribute:Re,blockTextSelection:Ue,unblockTextSelection:Be,getBoundingClientRect:Ne,findPosition:Fe,getPointerPosition:je,isTextNode:He,emptyEl:qe,normalizeContent:Ve,appendContent:We,insertContent:ze,isSingleLeftClick:Ge,$:Ze,$$:Qe}),Ye=!1,$e=function(){if(!1!==Ke.options.autoSetup){var e=Array.prototype.slice.call(o().getElementsByTagName("video")),t=Array.prototype.slice.call(o().getElementsByTagName("audio")),i=Array.prototype.slice.call(o().getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function pt(e,t,i){if(ot.has(e)){var n=ot.get(e);if(n.handlers){if(Array.isArray(t))return ut(pt,e,t,i);var r=function(e,t){n.handlers[t]=[],lt(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s=t&&(e.apply(void 0,arguments),i=n)}},St=function(){};St.prototype.allowedEvents_={},St.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ht(this,e,t),this.addEventListener=i},St.prototype.addEventListener=St.prototype.on,St.prototype.off=function(e,t){pt(this,e,t)},St.prototype.removeEventListener=St.prototype.off,St.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},mt(this,e,t),this.addEventListener=i},St.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},gt(this,e,t),this.addEventListener=i},St.prototype.trigger=function(e){var t=e.type||e;"string"===typeof e&&(e={type:t}),e=dt(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ft(this,e)},St.prototype.dispatchEvent=St.prototype.trigger,St.prototype.queueTrigger=function(e){var t=this;_t||(_t=new Map);var i=e.type||e,n=_t.get(this);n||(n=new Map,_t.set(this,n));var r=n.get(i);n.delete(i),a().clearTimeout(r);var s=a().setTimeout((function(){0===n.size&&(n=null,_t.delete(t)),t.trigger(e)}),0);n.set(i,s)};var kt=function(e){return"function"===typeof e.name?e.name():"string"===typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},Ct=function(e){return e instanceof St||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"===typeof e[t]}))},Et=function(e){return"string"===typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},wt=function(e,t,i){if(!e||!e.nodeName&&!Ct(e))throw new Error("Invalid target for "+kt(t)+"#"+i+"; must be a DOM node or evented object.")},It=function(e,t,i){if(!Et(e))throw new Error("Invalid event type for "+kt(t)+"#"+i+"; must be a non-empty string or array.")},xt=function(e,t,i){if("function"!==typeof e)throw new Error("Invalid listener for "+kt(t)+"#"+i+"; must be a function.")},Pt=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),wt(n,e,i),It(r,e,i),xt(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=Tt(e,a)}},At=function(e,t,i,n){wt(e,e,t),e.nodeName?vt[t](e,i,n):e[t](i,n)},Lt={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n=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}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=Bt(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return Ce(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],l=i;return a&&a[e]?l=a[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return"undefined"===typeof n&&(r=e),r}))),l},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Ut(e.name())]=null,this.childNameIndex_[Rt(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"===typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"===typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||Ut(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return Ze(e,t||this.contentEl())},t.$$=function(e,t){return Qe(e,t||this.contentEl())},t.hasClass=function(e){return Ie(this.el_,e)},t.addClass=function(e){xe(this.el_,e)},t.removeClass=function(e){Pe(this.el_,e)},t.toggleClass=function(e,t){Ae(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return De(this.el_,e)},t.setAttribute=function(e,t){Me(this.el_,e,t)},t.removeAttribute=function(e){Re(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t===t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Ut(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=X(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Ut(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(d().isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=a().performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(a().performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=Tt(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=Tt(this,e),this.clearTimersOnDispose_(),i=a().setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),a().clearTimeout(e)),e},t.setInterval=function(e,t){e=Tt(this,e),this.clearTimersOnDispose_();var i=a().setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),a().clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=Tt(this,e),t=a().requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=Tt(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),a().cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!==typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),a=r&&r.isTech(i),s=e===i||e.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=Ut(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var l=o.players,u=Object.keys(l);if(l&&u.length>0&&u.map((function(e){return l[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[Rt(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function Vt(e,t,i,n){return function(e,t,i){if("number"!==typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function Wt(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Vt.bind(null,"start",0,e),end:Vt.bind(null,"end",1,e)},a().Symbol&&a().Symbol.iterator&&(t[a().Symbol.iterator]=function(){return(e||[]).values()}),t}function zt(e,t){return Array.isArray(e)?Wt(e):void 0===e||void 0===t?Wt():Wt([[e,t]])}function Gt(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=zt(0,0));for(var a=0;at&&(n=t),r+=n-i;return r/t}function Kt(e){if(e instanceof Kt)return e;"number"===typeof e?this.code=e:"string"===typeof e?this.message=e:Z(e)&&("number"===typeof e.code&&(this.code=e.code),K(this,e)),this.message||(this.message=Kt.defaultMessages[this.code]||"")}qt.prototype.supportsRaf_="function"===typeof a().requestAnimationFrame&&"function"===typeof a().cancelAnimationFrame,qt.registerComponent("Component",qt),Kt.prototype.code=0,Kt.prototype.message="",Kt.prototype.status=null,Kt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Kt.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."};for(var Zt=0;Zt=0;n--)if(t[n].enabled){ni(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}(0,h.Z)(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&ni(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,ni(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(ti),ai=function(e,t){for(var i=0;i=0;n--)if(t[n].selected){ai(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty((0,c.Z)(i),"selectedIndex",{get:function(){for(var e=0;e0&&(a().console&&a().console.groupCollapsed&&a().console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return q.error(e)})),a().console&&a().console.groupEnd&&a().console.groupEnd()),i.flush()},bi=function(e,t){var i={uri:e},n=vi(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),g()(i,Tt(this,(function(e,i,n){if(e)return q.error(e,i);t.loaded_=!0,"function"!==typeof a().WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return Ti(n,t);q.error("vttjs failed to load, stopping trying to process "+t.src)})):Ti(n,t)})))},Si=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=Bt(t,{kind:hi[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=pi[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new ui(i.cues_),o=new ui(i.activeCues_),l=!1;i.timeupdateHandler=Tt((0,c.Z)(i),(function(e){void 0===e&&(e={}),this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));return i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==r&&i.startTracking(),Object.defineProperties((0,c.Z)(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){pi[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||bi(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(l=!1,t.length!==this.activeCues_.length)l=!0;else for(var a=0;a0)return void this.trigger("vttjsloaded");var t=o().createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),a().WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var Ri={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Ui={setCurrentTime:1,setMuted:1,setVolume:1},Bi={play:1,pause:1};function Ni(e){return function(t,i){return t===Oi?Oi:i[e]?i[e](t):t}}function Fi(e,t,i,n,r,a){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a=!1);var s=t,o=s[0],l=s.slice(1);if("string"===typeof o)Fi(e,Ai[o],i,n,r,a);else if(o){var u=function(e,t){var i=Li[e.id()],n=null;if(void 0===i||null===i)return n=t(e),Li[e.id()]=[[t,n]],n;for(var r=0;r0;!this.player_.tech(!0)||(ue||se)&&t||this.player_.tech(!0).focus(),this.player_.paused()?Xt(this.player_.play()):this.player_.pause()}},t}(zi);qt.registerComponent("PosterImage",Gi);var Ki={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 Zi(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Qi(e,t,i){try{e.style[t]=i}catch(n){return}}var Xi=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var s=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",s),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(Tt((0,c.Z)(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",s),t.on("playerresize",s),a().addEventListener("orientationchange",s),t.on("dispose",(function(){return a().removeEventListener("orientationchange",s)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i0;return Xt(t),void(!this.player_.tech(!0)||(ue||se)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};Qt(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}($i);Ji.prototype.controlText_="Play Video",qt.registerComponent("BigPlayButton",Ji);var en=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){d().isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}($i);qt.registerComponent("CloseButton",en);var tn=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?Xt(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}($i);tn.prototype.controlText_="Play",qt.registerComponent("PlayToggle",tn);var nn=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},rn=nn;function an(e,t){return void 0===t&&(t=e),rn(e,t)}var sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=Ce("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+"\xa0"},{role:"presentation"});return i.appendChild(n),this.contentEl_=Ce("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=an(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,q.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=o().createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(qt);sn.prototype.labelText_="Time",sn.prototype.controlText_="Time",qt.registerComponent("TimeDisplay",sn);var on=function(e){function t(){return e.apply(this,arguments)||this}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(sn);on.prototype.labelText_="Current Time",on.prototype.controlText_="Current Time",qt.registerComponent("CurrentTimeDisplay",on);var ln=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(sn);ln.prototype.labelText_="Duration",ln.prototype.controlText_="Duration",qt.registerComponent("DurationDisplay",ln);var un=function(e){function t(){return e.apply(this,arguments)||this}return(0,h.Z)(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(qt);qt.registerComponent("TimeDivider",un);var dn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(Ce("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"===typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(sn);dn.prototype.labelText_="Remaining Time",dn.prototype.controlText_="Remaining Time",qt.registerComponent("RemainingTimeDisplay",dn);var cn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Ce("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Ce("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+"\xa0"})),this.contentEl_.appendChild(o().createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(qt);qt.registerComponent("LiveDisplay",cn);var hn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=Ce("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!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"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}($i);hn.prototype.controlText_="Seek to live, currently playing live",qt.registerComponent("SeekToLive",hn);var pn=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},fn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}(0,h.Z)(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){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)},i.disable=function(){if(this.enabled()){var 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}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=K({tabIndex:0},i),n=K({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||oe||e.preventDefault(),Ue(),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)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;Be(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),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.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(pn(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=je(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){d().isEventKey(t,"Left")||d().isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):d().isEventKey(t,"Right")||d().isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(qt);qt.registerComponent("Slider",fn);var mn=function(e,t){return pn(e/t*100,0,100).toFixed(2)+"%"},gn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=Ce("span",{className:"vjs-control-text"}),n=Ce("span",{textContent:this.localize("Loaded")}),r=o().createTextNode(": ");return this.percentageEl_=Ce("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=mn(r,n);t.percent_!==s&&(t.el_.style.width=s,Ee(t.percentageEl_,s),t.percent_=s);for(var o=0;oi.length;c--)t.el_.removeChild(a[c-1]);a.length=i.length}))},t}(qt);qt.registerComponent("LoadProgressBar",gn);var _n=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=bt(Tt((0,c.Z)(n),n.update),yt),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=Fe(this.el_),r=Ne(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),l=n.width/2;sn.width&&(l=n.width),l=Math.round(l),this.el_.style.right="-"+l+"px",this.write(i)}},i.write=function(e){Ee(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),l=o-t*o;a=(l<1?"":"-")+an(l,o)}else a=an(i,s);r.update(e,t,a),n&&n()}))},t}(qt);qt.registerComponent("TimeTooltip",_n);var vn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=bt(Tt((0,c.Z)(n),n.update),yt),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(qt);vn.prototype.options_={children:[]},me||ie||vn.prototype.options_.children.push("timeTooltip"),qt.registerComponent("PlayProgressBar",vn);var yn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=bt(Tt((0,c.Z)(n),n.update),yt),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(qt);yn.prototype.options_={children:["timeTooltip"]},qt.registerComponent("MouseTimeDisplay",yn);var Tn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}(0,h.Z)(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=Tt(this,this.update),this.update=bt(this.update_,yt),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in o()&&"visibilityState"in o()&&this.on(o(),"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===o().visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,yt))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==o().visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[an(e,r),an(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(Ne(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){Ge(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),Ge(e)){var i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var n=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(n>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((i=a+n*r.liveWindow())>=s&&(i=s),i<=a&&(i=a+.1),i===1/0)return}else(i=n*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xt(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(d().isEventKey(t,"Space")||d().isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(d().isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(d().isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(d()(t))){t.preventDefault(),t.stopPropagation();var n=10*(d().codes[d()(t)]-d().codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else d().isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):d().isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],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 o()&&"visibilityState"in o()&&this.off(o(),"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(fn);Tn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},me||ie||Tn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),qt.registerComponent("SeekBar",Tn);var bn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=bt(Tt((0,c.Z)(n),n.handleMouseMove),yt),n.throttledHandleMouseSeek=bt(Tt((0,c.Z)(n),n.handleMouseSeek),yt),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=Fe(r),s=je(r,e).x;s=pn(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Xt(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var 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_)},i.handleMouseDown=function(e){var 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_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(qt);bn.prototype.options_={children:["seekBar"]},qt.registerComponent("ProgressControl",bn);var Sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){o().pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}($i);Sn.prototype.controlText_="Picture-in-Picture",qt.registerComponent("PictureInPictureToggle",Sn);var kn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===o()[t.fsApi_.fullscreenEnabled]&&n.disable(),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}($i);kn.prototype.controlText_="Fullscreen",qt.registerComponent("FullscreenToggle",kn);var Cn=function(e){function t(){return e.apply(this,arguments)||this}return(0,h.Z)(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(qt);qt.registerComponent("VolumeLevel",Cn);var En=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=bt(Tt((0,c.Z)(n),n.update),yt),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=Ne(this.el_),a=Ne(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,l=e.width-s+(a.right-e.right),u=r.width/2;or.width&&(u=r.width),this.el_.style.right="-"+u+"px"}this.write(n+"%")},i.write=function(e){Ee(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(qt);qt.registerComponent("VolumeLevelTooltip",En);var wn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=bt(Tt((0,c.Z)(n),n.update),yt),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(qt);wn.prototype.options_={children:["volumeLevelTooltip"]},qt.registerComponent("MouseVolumeLevelDisplay",wn);var In=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){Ge(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=Ne(i),r=this.vertical(),a=je(i,e);a=r?a.y:a.x,a=pn(a,0,1),t.update(n,a,r)}Ge(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(fn);In.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},me||ie||In.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),In.prototype.playerEvent="volumechange",qt.registerComponent("VolumeBar",In);var xn=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,("undefined"===typeof i.volumeBar||Q(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}((0,c.Z)(n),t),n.throttledHandleMouseMove=bt(Tt((0,c.Z)(n),n.handleMouseMove),yt),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}(0,h.Z)(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var 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_)},i.handleMouseUp=function(e){var 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_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(qt);xn.prototype.options_={children:["volumeBar"]},qt.registerComponent("VolumeControl",xn);var Pn=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}((0,c.Z)(n),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;me&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)Pe(this.el_,"vjs-vol-"+i);xe(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}($i);Pn.prototype.controlText_="Mute",qt.registerComponent("MuteToggle",Pn);var An=function(e){function t(t,i){var n;return void 0===i&&(i={}),"undefined"!==typeof i.inline?i.inline=i.inline:i.inline=!0,("undefined"===typeof i.volumeControl||Q(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}(0,h.Z)(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){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")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){d().isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),ht(o(),"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),pt(o(),"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){d().isEventKey(e,"Esc")&&this.handleMouseOut()},t}(qt);An.prototype.options_={children:["muteToggle","volumeControl"]},qt.registerComponent("VolumePanel",An);var Ln=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}(0,h.Z)(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof qt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof qt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"===typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=Ce(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),ht(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||o().activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){d().isEventKey(e,"Left")||d().isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(d().isEventKey(e,"Right")||d().isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var 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())},t}(qt);qt.registerComponent("Menu",Ln);var On=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new $i(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=$i.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),ht(o(),"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.update=function(){var 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"))},i.createMenu=function(){var e=new Ln(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=Ce("li",{className:"vjs-menu-title",textContent:Ut(this.options_.title),tabIndex:-1}),i=new qt(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(Un);qt.registerComponent("OffTextTrackMenuItem",Bn);var Nn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return(0,h.Z)(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=Un),this.label_&&(i=this.label_+" off"),e.push(new Bn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(Dn);qt.registerComponent("TextTrackButton",Nn);var Fn=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ut(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i-1&&(n.label_="captions"),n.menuButton_.controlText(Ut(n.label_)),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Vn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,zn)},t}(Nn);Gn.prototype.kinds_=["captions","subtitles"],Gn.prototype.controlText_="Subtitles",qt.registerComponent("SubsCapsButton",Gn);var Kn=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)t.push(new Qn(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),n=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[n])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(On);Xn.prototype.controlText_="Playback Rate",qt.registerComponent("PlaybackRateMenuButton",Xn);var Yn=function(e){function t(){return e.apply(this,arguments)||this}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(qt);qt.registerComponent("Spacer",Yn);var $n=function(e){function t(){return e.apply(this,arguments)||this}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:"\xa0"})},t}(Yn);qt.registerComponent("CustomControlSpacer",$n);var Jn=function(e){function t(){return e.apply(this,arguments)||this}return(0,h.Z)(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(qt);Jn.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in o()&&Jn.prototype.options_.children.splice(Jn.prototype.options_.children.length-1,0,"pictureInPictureToggle"),qt.registerComponent("ControlBar",Jn);var er=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}(0,h.Z)(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(ei);er.prototype.options_=(0,l.Z)({},ei.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),qt.registerComponent("ErrorDisplay",er);var tr="vjs-text-track-settings",ir=["#000","Black"],nr=["#00F","Blue"],rr=["#0FF","Cyan"],ar=["#0F0","Green"],sr=["#F0F","Magenta"],or=["#F00","Red"],lr=["#FFF","White"],ur=["#FF0","Yellow"],dr=["1","Opaque"],cr=["0.5","Semi-Transparent"],hr=["0","Transparent"],pr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ir,lr,or,ar,nr,ur,sr,rr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[dr,cr,hr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[lr,ir,or,ar,nr,ur,sr,rr]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",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:"captions-font-size-%s",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:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[dr,cr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[hr,cr,dr]}};function fr(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}pr.windowColor.options=pr.backgroundColor.options;var mr=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind((0,c.Z)(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=Ce("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),G(pr,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}(0,h.Z)(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=pr[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"",'").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['
','',this.localize("Text"),"",this.createElSelect_("color",e),'',this.createElSelect_("textOpacity",e),"","
"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['
','',this.localize("Background"),"",this.createElSelect_("backgroundColor",e),'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['
','',this.localize("Window"),"",this.createElSelect_("windowColor",e),'',this.createElSelect_("windowOpacity",e),"","
"].join("")},i.createElColors_=function(){return Ce("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return Ce("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return Ce("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,fr(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),z(e=pr).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;G(pr,(function(i,n){!function(e,t,i){if(t)for(var n=0;nthis.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(s=!1),s!==this.behindLiveEdge_&&(this.behindLiveEdge_=s,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){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())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,yt),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_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){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_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"===typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(o(),"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(qt);qt.registerComponent("LiveTracker",vr);var yr,Tr=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&ge?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){q(t,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&ie&&oe&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"===typeof this.el_.webkitEnterFullScreen){var e=a().navigator&&a().navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xt(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)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=o().createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"===typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return"undefined"!==typeof this.el().webkitDroppedFrameCount&&"undefined"!==typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),a().performance&&"function"===typeof a().performance.now?e.creationTime=a().performance.now():a().performance&&a().performance.timing&&"number"===typeof a().performance.timing.navigationStart&&(e.creationTime=a().Date.now()-a().performance.timing.navigationStart),e},t}(Pi);wr(Ir,"TEST_VID",(function(){if(Te()){var e=o().createElement("video"),t=o().createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),Ir.isSupported=function(){try{Ir.TEST_VID.volume=.5}catch(e){return!1}return!(!Ir.TEST_VID||!Ir.TEST_VID.canPlayType)},Ir.canPlayType=function(e){return Ir.TEST_VID.canPlayType(e)},Ir.canPlaySource=function(e,t){return Ir.canPlayType(e.type)},Ir.canControlVolume=function(){try{var e=Ir.TEST_VID.volume;Ir.TEST_VID.volume=e/2+.1;var t=e!==Ir.TEST_VID.volume;return t&&me?(a().setTimeout((function(){Ir&&Ir.prototype&&(Ir.prototype.featuresVolumeControl=e!==Ir.TEST_VID.volume)})),!1):t}catch(i){return!1}},Ir.canMuteVolume=function(){try{var e=Ir.TEST_VID.muted;return Ir.TEST_VID.muted=!e,Ir.TEST_VID.muted?Me(Ir.TEST_VID,"muted","muted"):Re(Ir.TEST_VID,"muted"),e!==Ir.TEST_VID.muted}catch(t){return!1}},Ir.canControlPlaybackRate=function(){if(ie&&oe&&le<58)return!1;try{var e=Ir.TEST_VID.playbackRate;return Ir.TEST_VID.playbackRate=e/2+.1,e!==Ir.TEST_VID.playbackRate}catch(t){return!1}},Ir.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(o().createElement("video"),"src",{get:e,set:e}),Object.defineProperty(o().createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(o().createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(o().createElement("audio"),"innerHTML",{get:e,set:e})}catch(t){return!1}return!0},Ir.supportsNativeTextTracks=function(){return ge||me&&oe},Ir.supportsNativeVideoTracks=function(){return!(!Ir.TEST_VID||!Ir.TEST_VID.videoTracks)},Ir.supportsNativeAudioTracks=function(){return!(!Ir.TEST_VID||!Ir.TEST_VID.audioTracks)},Ir.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(e){var t=e[0],i=e[1];wr(Ir.prototype,t,(function(){return Ir[i]()}),!0)})),Ir.prototype.featuresVolumeControl=Ir.canControlVolume(),Ir.prototype.movingMediaElementInDOM=!me,Ir.prototype.featuresFullscreenResize=!0,Ir.prototype.featuresProgressEvents=!0,Ir.prototype.featuresTimeupdateEvents=!0,Ir.prototype.featuresVideoFrameCallback=!(!Ir.TEST_VID||!Ir.TEST_VID.requestVideoFrameCallback),Ir.patchCanPlayType=function(){ne>=4&&!ae&&!oe&&(yr=Ir.TEST_VID&&Ir.TEST_VID.constructor.prototype.canPlayType,Ir.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":yr.call(this,e)})},Ir.unpatchCanPlayType=function(){var e=Ir.TEST_VID.constructor.prototype.canPlayType;return yr&&(Ir.TEST_VID.constructor.prototype.canPlayType=yr),e},Ir.patchCanPlayType(),Ir.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"===typeof e.load&&function(){try{e.load()}catch(t){}}()}},Ir.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"===typeof e.load&&function(){try{e.load()}catch(t){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Ir.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Ir.prototype["set"+Ut(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Ir.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Ir.prototype["set"+Ut(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Ir.prototype[e]=function(){return this.el_[e]()}})),Pi.withSourceHandlers(Ir),Ir.nativeSourceHandler={},Ir.nativeSourceHandler.canPlayType=function(e){try{return Ir.TEST_VID.canPlayType(e)}catch(t){return""}},Ir.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Ir.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=_i(e.src);return Ir.nativeSourceHandler.canPlayType("video/"+i)}return""},Ir.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Ir.nativeSourceHandler.dispose=function(){},Ir.registerSourceHandler(Ir.nativeSourceHandler),Pi.registerTech("Html5",Ir);var xr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Pr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ar=["tiny","xsmall","small","medium","large","xlarge","huge"],Lr={};Ar.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Lr[e]="vjs-layout-"+t}));var Or={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Dr=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+at(),(n=K(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"===typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var l=i;l&&1===l.nodeType;){if(Oe(l).hasOwnProperty("lang")){n.language=l.getAttribute("lang");break}l=l.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=V(a.id_),a.fsApi_=U,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,a.audioOnlyMode_=!1,a.audioPosterMode_=!1,a.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!a.options_||!a.options_.techOrder||!a.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(a.tag=i,a.tagAttributes=i&&Oe(i),a.language(a.options_.language),n.languages){var u={};Object.getOwnPropertyNames(n.languages).forEach((function(e){u[e.toLowerCase()]=n.languages[e]})),a.languages_=u}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!==typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),Ot((0,c.Z)(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(ht(o(),a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var d=Bt(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=d,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),he&&a.addClass("vjs-touch-enabled"),me||a.addClass("vjs-workinghover"),t.players[a.id_]=(0,c.Z)(a);var h=O.split(".")[0];return a.addClass("vjs-v"+h),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a.on("ready",(function(){a.audioPosterMode(a.options_.audioPosterMode),a.audioOnlyMode(a.options_.audioOnlyMode)})),a}(0,h.Z)(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),pt(o(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),pt(o(),"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.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),Li[this.id()]=null,xi.names.forEach((function(e){var t=xi[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var s=Oe(i);if(r){for(t=this.el_=i,i=this.tag=o().createElement("video");t.children.length;)i.appendChild(t.firstChild);Ie(t,"video-js")||xe(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(n){}}))}if(i.setAttribute("tabindex","-1"),s.tabindex="-1",(ue||oe&&ce)&&(i.setAttribute("role","application"),s.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach((function(e){r&&"class"===e||t.setAttribute(e,s[e]),r&&i.setAttribute(e,s[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==a().VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=it("vjs-styles-dimensions");var l=Ze(".vjs-styles-defaults"),u=Ze("head");u.insertBefore(this.styleEl_,l?l.nextSibling:u.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);for(var d=i.getElementsByTagName("a"),c=0;c0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),nt(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*r+"%;\n }\n ")}else{var s="number"===typeof this.width_?this.width_:this.options_.width,o="number"===typeof this.height_?this.height_:this.options_.height,l=this.tech_&&this.tech_.el();l&&(s>=0&&(l.width=s),o>=0&&(l.height=o))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=Ut(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Pi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"===typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_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,Promise:this.options_.Promise};xi.names.forEach((function(e){var t=xi[e];s[t.getterName]=i[t.privateName]})),K(s,this.options_[n]),K(s,this.options_[r]),K(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Pi.getTech(e);if(!o)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new o(s),this.tech_.ready(Tt(this,this.handleTechReady_),!0),Jt(this.textTracksJson_||[],this.tech_),xr.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+Ut(e)+"_"](t)}))})),Object.keys(Pr).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Pr[e]+"_"].bind(i),event:t}):i["handleTech"+Pr[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||we(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;xi.names.forEach((function(t){var i=xi[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=$t(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&q.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){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_)},i.removeTechControlsListeners_=function(){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_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"===typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(Qt(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():Qt(i=this.play())&&(i=i.catch(n)),Qt(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!==typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(q.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"===typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Xt(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"===typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=o()[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){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}},i.techCall_=function(e,t){this.ready((function(){if(e in Ui)return function(e,t,i,n){return t[i](e.reduce(Ni(i),n))}(this.middleware_,this.tech_,e,t);if(e in Bi)return Mi(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw q(i),i}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Ri)return function(e,t,i){return e.reduceRight(Ni(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Bi)return Mi(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw q("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw q("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw q(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||a().Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=Xt),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!ge&&!me||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||zt(0,0)},i.scrubbing=function(e){if("undefined"===typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return"undefined"!==typeof e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(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"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=zt(0,0)),e},i.bufferedPercent=function(){return Gt(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||a().Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&!0===!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||a().Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=o()[this.fsApi_.exitFullscreen]();return t&&Xt(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&!0===!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=o().documentElement.style.overflow,ht(o(),"keydown",this.boundFullWindowOnEscKey_),o().documentElement.style.overflow="hidden",xe(o().body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){d().isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,pt(o(),"keydown",this.boundFullWindowOnEscKey_),o().documentElement.style.overflow=this.docOrigOverflow,Pe(o().body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in o()&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in o())return o().exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"===typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return d().isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return d().isEventKey(e,"m")}:r,s=t.playPauseKey,l=void 0===s?function(e){return d().isEventKey(e,"k")||d().isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=qt.getComponent("FullscreenToggle");!1!==o()[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),qt.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(l.call(this,e)){e.preventDefault(),e.stopPropagation(),qt.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void i.triggerReady());a=r,s=i.tech_,a.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,Ut(t)!==Ut(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||a().Promise;this.paused()||!t?this.doReset_():Xt(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Ct(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"===typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"===typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"===typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)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_()))},i.usingNativeControls=function(e){if(void 0===e)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")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(M("beforeerror").forEach((function(i){var n=i(t,e);Z(n)&&!Array.isArray(n)||"string"===typeof n||"number"===typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Kt(e),this.addClass("vjs-error"),q.error("(CODE:"+this.error_.code+" "+Kt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),M("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=Tt(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||me||ie||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var t=this;if("boolean"!==typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||a().Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var t=this;if("boolean"!==typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||a().Promise;return i?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Ct(this)&&this.trigger("languagechange"))},i.languages=function(){return Bt(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=Bt(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i"):function(){}},Xr=1/30,Yr=.1,$r=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i=t}))},ea=function(e,t){return $r(e,(function(e){return e-Xr>=t}))},ta=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i "+e.end(i));return t.join(", ")},ia=function(e){for(var t=[],i=0;ia||(i+=t>r&&t<=a?a-t:a-r)}return i},aa=Wr.createTimeRange,sa=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},oa=function(e){return(e.segments||[]).reduce((function(e,t,i){return 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}),[])},la=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},ua=function(e){var t=e.preloadSegment;if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0);return n+=i&&i.length?i.length:0}},da=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=la(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},ca=function(e,t,i){if("undefined"===typeof t&&(t=e.mediaSequence+e.segments.length),tr){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;oDate.now()},ga=function(e){return e.excludeUntil&&e.excludeUntil===1/0},_a=function(e){var t=ma(e);return!e.disabled&&!t},va=function(e,t){return t.attributes&&t.attributes[e]},ya=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!_a(e)&&(e.attributes.BANDWIDTH||0)0)for(var h=u-1;h>=0;h--){var p=l[h];if(o+=p.duration,s){if(o<0)continue}else if(o+Xr<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-pa({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:h})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i}}if(u<0){for(var f=u;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i};u=0}for(var m=u;m0)continue}else if(o-Xr>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+pa({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:m})}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:i}},isEnabled:_a,isDisabled:function(e){return e.disabled},isBlacklisted:ma,isIncompatible:ga,playlistEnd:fa,isAes:function(e){for(var t=0;t-1&&o!==s.length-1&&(i._HLS_part=o),(o>-1||s.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var l=new(a().URL)(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&l.searchParams.set(e,i[e])})),e=l.toString()}return e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,l=e.experimentalLLHLS,u=new S._b;t&&u.on("warn",t),i&&u.on("info",i),a.forEach((function(e){return u.addParser(e)})),o.forEach((function(e){return u.addTagMapper(e)})),u.push(n),u.end();var d=u.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){d.hasOwnProperty(e)&&delete d[e]})),d.segments&&d.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!d.targetDuration){var c=10;d.segments&&d.segments.length&&(c=d.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+c),d.targetDuration=c}var h=la(d);if(h.length&&!d.partTargetDuration){var p=h.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+p),Ca.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.")),d.partTargetDuration=p}return d}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),Ia({playlist:a,uri:n,id:r});var s=Ra(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Ua(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),a().clearTimeout(this.mediaUpdateTimeout),a().clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"===typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(a().clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=a().setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,s=!this.media_||e.id!==this.media_.id,o=this.master.playlists[e.id];if(o&&o.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(s&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Ua(e,!0)),s){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,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=Zr(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=a().setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=a().setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"===typeof this.src)return this.src.uri||(this.src.uri=a().location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=Zr(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"===typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,xa(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=Da(e),e.segments.forEach((function(t){Oa(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||a().location.href;this.master=function(e,t){var i=Ea(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:a().location.href,resolvedUri:a().location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(Aa),Na=Wr.xhr,Fa=Wr.mergeOptions,ja=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},Ha=function(){var e=function e(t,i){t=Fa({timeout:45e3},t);var n=e.beforeRequest||Wr.Vhs.xhr.beforeRequest;if(n&&"function"===typeof n){var r=n(t);r&&(t=r)}var a=(!0===Wr.Vhs.xhr.original?Na:Wr.Vhs.xhr)(t,(function(e,t){return ja(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},qa=function(e){var t,i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"===typeof t.offset||"bigint"===typeof t.length?a().BigInt(t.offset)+a().BigInt(t.length)-a().BigInt(1):t.offset+t.length-1)),i},Va=function(e,t){return e.start(t)+"-"+e.end(t)},Wa=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},za=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Ga=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];(0,E.Au)(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Ka=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Za=function(e){return e.resolvedUri},Qa=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;rn){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},$a=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,l=void 0===o||o,u=t.tech,d=t.callback;if(!d)throw new Error("seekToProgramTime: callback must be provided");if("undefined"===typeof i||!n||!s)return d({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!u.hasStarted_)return d({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;tnew Date(o.getTime()+1e3*l)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:ka.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!c)return d({message:i+" was not found in the stream"});var h=c.segment,p=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(a){}var r=i.getTime();return(n.getTime()-r)/1e3}(h.dateTimeObject,i);if("estimate"===c.type)return 0===a?d({message:i+" is not buffered yet. Try again"}):(s(c.estimatedStart+p),void u.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:l,tech:u,callback:d})})));var f=h.start+p;u.one("seeked",(function(){return d(null,u.currentTime())})),l&&u.pause(),s(f)},Ja=function(e,t){if(4===e.readyState)return t()},es=Wr.EventTarget,ts=Wr.mergeOptions,is=function(e,t){if(!Ma(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i=d+u)return o(t,{response:a.subarray(u,u+d),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:qa({byterange:e.sidx.byterange})},o)}))}else this.mediaRequest_=a().setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},a().clearTimeout(this.minimumUpdatePeriodTimeout_),a().clearTimeout(this.mediaRequest_),a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"===typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(a().clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;a().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=a().setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=a().setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=Zr(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=(0,w.LG)(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:Kr(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e=this.masterPlaylistLoader_.master,t=function(e){var t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=e.previousManifest,s=(0,w.Qc)(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:a});return xa(s,i),s}({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=function(e,t,i){for(var n=!0,r=ts(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},a=function(){return t(C.ftyp,E,w,E,I)},_=function(e){return t(C.hdlr,A[e])},s=function(e){return t(C.mdat,e)},g=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(C.mdhd,i)},m=function(e){return t(C.mdia,g(e),_(e.type),l(e))},o=function(e){return t(C.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},l=function(e){return t(C.minf,"video"===e.type?t(C.vmhd,L):t(C.smhd,O),n(),y(e))},u=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]);return t.apply(null,[C.moof,o(e)].concat(n))},d=function(e){for(var i=e.length,n=[];i--;)n[i]=p(e[i]);return t.apply(null,[C.moov,h(4294967295)].concat(n).concat(c(e)))},c=function(e){for(var i=e.length,n=[];i--;)n[i]=S(e[i]);return t.apply(null,[C.mvex].concat(n))},h=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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 t(C.mvhd,i)},v=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[C.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,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]),t(C.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(C.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];n.push(t(C.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return t.apply(null,n)},i=function(e){return t(C.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))}}(),f=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(C.tkhd,i)},b=function(e){var i,n,r,a,s,o;return i=t(C.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/H),o=Math.floor(e.baseMediaDecodeTime%H),n=t(C.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===e.type?(r=k(e,92),t(C.traf,i,n,r)):(a=v(e),r=k(e,a.length+92),t(C.traf,i,n,r,a))},p=function(e){return e.duration=e.duration||4294967295,t(C.trak,f(e),m(e))},S=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(C.trex,i)},function(){var e,i,n;n=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},i=function(e,i){var r,a,s,o,l,u;for(i+=20+16*(o=e.samples||[]).length,s=n(o,i),(a=new Uint8Array(s.length+16*o.length)).set(s),r=s.length,u=0;u>>24,a[r++]=(16711680&l.duration)>>>16,a[r++]=(65280&l.duration)>>>8,a[r++]=255&l.duration,a[r++]=(4278190080&l.size)>>>24,a[r++]=(16711680&l.size)>>>16,a[r++]=(65280&l.size)>>>8,a[r++]=255&l.size,a[r++]=l.flags.isLeading<<2|l.flags.dependsOn,a[r++]=l.flags.isDependedOn<<6|l.flags.hasRedundancy<<4|l.flags.paddingValue<<1|l.flags.isNonSyncSample,a[r++]=61440&l.flags.degradationPriority,a[r++]=15&l.flags.degradationPriority,a[r++]=(4278190080&l.compositionTimeOffset)>>>24,a[r++]=(16711680&l.compositionTimeOffset)>>>16,a[r++]=(65280&l.compositionTimeOffset)>>>8,a[r++]=255&l.compositionTimeOffset;return t(C.trun,a)},e=function(e,i){var r,a,s,o,l,u;for(i+=20+8*(o=e.samples||[]).length,s=n(o,i),(r=new Uint8Array(s.length+8*o.length)).set(s),a=s.length,u=0;u>>24,r[a++]=(16711680&l.duration)>>>16,r[a++]=(65280&l.duration)>>>8,r[a++]=255&l.duration,r[a++]=(4278190080&l.size)>>>24,r[a++]=(16711680&l.size)>>>16,r[a++]=(65280&l.size)>>>8,r[a++]=255&l.size;return t(C.trun,r)},k=function(t,n){return"audio"===t.type?e(t,n):i(t,n)}}();var q,V,W,z,G,K,Z,Q,X=s,Y=u,$=function(e){var t,i=a(),n=d(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},J=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ee=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},ne=function(e,t){var i,n,r,a,s,o=t||0,l=[];for(i=0;ide/2))){for((s=le()[e.samplerate])||(s=t[0].data),o=0;o=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},ve=function(e){var t,i,n=[];for(t=0;t=this.virtualRowCount&&"function"===typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Oe.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Oe.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Oe.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var De=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Oe(-1),this.windows=[],this.stream=i,"string"===typeof t&&this.createTextDecoder(t)};De.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Oe(i),"function"===typeof t&&(this.windows[i].beforeRowOverflow=t)},De.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},De.prototype.createTextDecoder=function(e){if("undefined"===typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Me=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Me.prototype=new N,Me.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Me.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Me.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},Me.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},Me.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},Me.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Me.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Me.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},Me.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},Me.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Me.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Re={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},Ue=function(e){return null===e?"":(e=Re[e]||e,String.fromCharCode(e))},Be=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ne=function(){for(var e=[],t=15;t--;)e.push("");return e},Fe=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096===(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ne();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ne();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ne()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Ue((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Ue((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14===(14&r)&&this.addFormatting(e.pts,["i"]),1===(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Be.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16===(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14===(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Ue(n),a+=Ue(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Fe.prototype=new N,Fe.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(i){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Fe.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ne(),this.nonDisplayed_=Ne(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Fe.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Fe.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Fe.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Fe.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Fe.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Fe.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Fe.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Fe.prototype.isNormalChar=function(e){return e>=32&&e<=127},Fe.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ne(),this.displayed_=Ne()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Fe.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Fe.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Fe.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Fe.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},We=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||qe,this.push=function(e){this.type_!==qe&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ve(e.dts,n),e.pts=Ve(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};We.prototype=new N;var ze,Ge=We,Ke=Ve,Ze=function(e,t,i){var n,r="";for(n=t;n>>2;d*=4,d+=3&u[7],o.timeStamp=d,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=He.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=He.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},Je.prototype=new N,Je.STREAM_TYPES={h264:27,adts:15},et=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},l=0,u=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,l=0;l>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))}(s,o),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};et.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case He.H264_STREAM_TYPE:e=n,t="video";break;case He.ADTS_STREAM_TYPE:e=r,t="audio";break;case He.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}},et.prototype=new N;var rt={PAT_PID:0,MP2T_PACKET_LENGTH:nt,TransportPacketStream:$e,TransportParseStream:Je,ElementaryStream:et,TimestampRolloverStream:it,CaptionStream:je.CaptionStream,Cea608Stream:je.Cea608Stream,Cea708Stream:je.Cea708Stream,MetadataStream:tt};for(var at in He)He.hasOwnProperty(at)&&(rt[at]=He[at]);var st,ot=rt,lt=de,ut=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];st=function(e){var t,i=0;st.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,l,u=0;if(e||(i=0),"audio"===n.type){var d;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;u+7>5,l=(o=1024*(1+(3&t[u+6])))*lt/ut[(60&t[u+2])>>>2],t.byteLength-u>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:ut[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+a,u+r)}),i++,u+=r}else"number"!==typeof d&&(d=u),u++;"number"===typeof d&&(this.skipWarn_(d,u),d=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},st.prototype=new N;var dt,ct,ht,pt=st,ft=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};ct=function(){var e,t,i=0;ct.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},ct.prototype=new N,ht={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 e,t,i,n,r,a,s,o=new ct;dt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},yt=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=vt(t,i))},Tt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},bt={isLikelyAacData:function(e){var t=yt(e,0);return e.length>=t+2&&255===(255&e[t])&&240===(240&e[t+1])&&16===(22&e[t+1])},parseId3TagSize:vt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240===(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=Tt(e.subarray(10,14)));do{if((i=Tt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return o*=4,o+=3&s[7]}break}}t+=10,t+=i}while(t=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!==(255&e[l])||240!==(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(o=bt.parseAdtsSize(e,l))>e.length)break;a={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",a),l+=o}else{if(e.length-l<10)break;if(l+(o=bt.parseId3TagSize(e,l))>e.length)break;r={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",r),l+=o}n=e.length-l,e=n>0?e.subarray(l):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new N;var St,kt,Ct,Et,wt=mt,It=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],xt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Pt=gt.H264Stream,At=bt.isLikelyAacData,Lt=de,Ot=function(e,t){t.stream=e,this.trigger("log",t)},Dt=function(e,t){for(var i=Object.keys(t),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,l,u;for(a=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;tn.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,l-=r.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=a,u.duration=l,u.nalCount=o,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,l;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(l=o?i:a))return e;var u=e.slice(l),d=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=d.byteLength,u.duration=d.duration,u.nalCount=d.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){s=e}},St.prototype=new N,Et=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!==typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"===typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Et.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},Et.prototype=new N,Et.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,xt.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,It.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=$(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Et.prototype.setRemux=function(e){this.remuxTracks=e},Ct=function(e){var t,i,n=this,r=!0;Ct.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new ot.MetadataStream,r.aacStream=new wt,r.audioTimestampRolloverStream=new ot.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new ot.TimestampRolloverStream("timed-metadata"),r.adtsStream=new pt,r.coalesceStream=new Et(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Dt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new ot.MetadataStream,r.packetStream=new ot.TransportPacketStream,r.parseStream=new ot.TransportParseStream,r.elementaryStream=new ot.ElementaryStream,r.timestampRolloverStream=new ot.TimestampRolloverStream,r.adtsStream=new pt,r.h264Stream=new Pt,r.captionStream=new ot.CaptionStream(e),r.coalesceStream=new Et(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new St(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Dt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,be(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,be(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=At(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!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()}},Ct.prototype=new N;var Ut,Bt,Nt,Ft={Transmuxer:Ct,VideoSegmentStream:St,AudioSegmentStream:kt,AUDIO_PROPERTIES:It,VIDEO_PROPERTIES:xt,generateSegmentTimingInfo:Rt},jt=function(e){return e>>>0},Ht=function(e){return("00"+e.toString(16)).slice(-2)},qt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Vt=jt,Wt=function e(t,i){var n,r,a,s,o,l=[];if(!i.length)return null;for(n=0;n1?n+r:t.byteLength,a===i[0]&&(1===i.length?l.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(l=l.concat(o))),n=s;return l},zt=jt,Gt=j.getUint64,Kt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Gt(e.subarray(4)):t.baseMediaDecodeTime=zt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Zt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Qt=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],d=n.getUint32(4),c=8;for(r&&(i.dataOffset=n.getInt32(c),c+=4),a&&d&&(t={flags:Zt(e.subarray(c,c+4))},c+=4,s&&(t.duration=n.getUint32(c),c+=4),o&&(t.size=n.getUint32(c),c+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(c):t.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(t),d--);d--;)t={},s&&(t.duration=n.getUint32(c),c+=4),o&&(t.size=n.getUint32(c),c+=4),l&&(t.flags=Zt(e.subarray(c,c+4)),c+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(c):t.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(t);return i},Xt=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],l=32&n.flags[2],u=65536&n.flags[0],d=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),l&&(n.defaultSampleFlags=i.getUint32(t)),u&&(n.durationIsEmpty=!0),!r&&d&&(n.baseDataOffsetIsMoof=!0),n},Yt="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof i.g?i.g:"undefined"!==typeof self?self:{},$t="undefined"!==typeof window?window:"undefined"!==typeof Yt?Yt:"undefined"!==typeof self?self:{},Jt=Ie,ei=je.CaptionStream,ti=function(e,t){for(var i=e,n=0;n0?Kt(d[0]).baseMediaDecodeTime:0,h=Wt(s,["trun"]);t===u&&h.length>0&&(i=function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach((function(e){var t=Qt(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"===typeof n?(e.pts=n+$t.BigInt(e.compositionTimeOffset),n+=$t.BigInt(e.duration)):(e.pts=n+e.compositionTimeOffset,n+=e.duration)})),o=o.concat(t)})),o}(h,c,l),n=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(r=0;r+40;){var l=t.shift();this.parse(l,a,s)}return o=function(e,t,i){if(null===t)return null;var n=ii(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n),o&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},ri=jt,ai=Ht,si=j.getUint64;Ut=function(e,t){var i=Wt(t,["moof","traf"]).reduce((function(t,i){var n,r,a=Wt(i,["tfhd"])[0],s=ri(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,l=Wt(i,["tfdt"])[0],u=new DataView(l.buffer,l.byteOffset,l.byteLength);return"bigint"===typeof(n=1===l[0]?si(l.subarray(4,12)):u.getUint32(4))?r=n/$t.BigInt(o):"number"!==typeof n||isNaN(n)||(r=n/o),r11?(r.codec+=".",r.codec+=ai(d[9]),r.codec+=ai(d[10]),r.codec+=ai(d[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(d=c.subarray(28),"esds"===qt(d.subarray(4,8))&&d.length>20&&0!==d[19]?(r.codec+="."+ai(d[19]),r.codec+="."+ai(d[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=Wt(e,["mdia","mdhd"])[0];h&&(r.timescale=Nt(h)),i.push(r)})),i};var oi=Ut,li=Bt,ui=function(e){var t=31&e[1];return t<<=8,t|=e[2]},di=function(e){return!!(64&e[1])},ci=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},hi=function(e){switch(e){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}},pi={parseType:function(e,t){var i=ui(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=di(e),i=4+ci(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=di(e),n=4+ci(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+ci(e),i=e.subarray(t),n=0,r=0,a=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===hi(31&i[r+3])&&(a=!0),a}},fi=Ke,mi={};mi.ts=pi,mi.aac=bt;var gi=de,_i=188,vi=71,yi=function(e,t,i){for(var n,r,a,s,o=0,l=_i,u=!1;l<=e.byteLength;)if(e[o]!==vi||e[l]!==vi&&l!==e.byteLength)o++,l++;else{if(n=e.subarray(o,l),"pes"===mi.ts.parseType(n,t.pid))r=mi.ts.parsePesType(n,t.table),a=mi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=mi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0);if(u)break;o+=_i,l+=_i}for(o=(l=e.byteLength)-_i,u=!1;o>=0;)if(e[o]!==vi||e[l]!==vi&&l!==e.byteLength)o--,l--;else{if(n=e.subarray(o,l),"pes"===mi.ts.parseType(n,t.pid))r=mi.ts.parsePesType(n,t.table),a=mi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=mi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0);if(u)break;o-=_i,l-=_i}},Ti=function(e,t,i){for(var n,r,a,s,o,l,u,d=0,c=_i,h=!1,p={data:[],size:0};c=0;)if(e[d]!==vi||e[c]!==vi)d--,c--;else{if(n=e.subarray(d,c),"pes"===mi.ts.parseType(n,t.pid))r=mi.ts.parsePesType(n,t.table),a=mi.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=mi.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0);if(h)break;d-=_i,c-=_i}},bi=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=_i;r=3;){switch(mi.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=mi.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=mi.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=mi.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=mi.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var l=gi/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*l,pts:a+1024*n*l}]}}(e):bi(e),i&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;("undefined"===typeof i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=fi(e.dts,i),e.pts=fi(e.pts,i),e.dtsTime=e.dts/gi,e.ptsTime=e.pts/gi}))}if(e.video&&e.video.length){var n=t;if(("undefined"===typeof n||isNaN(n))&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=fi(e.dts,n),e.pts=fi(e.pts,n),e.dtsTime=e.dts/gi,e.ptsTime=e.pts/gi})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=fi(r.dts,n),r.pts=fi(r.pts,n),r.dtsTime=r.dts/gi,r.ptsTime=r.pts/gi}}}(i,t),i):null},ki=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Ft.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:he(t.start.dts),presentation:he(t.start.pts)},end:{decode:he(t.end.dts),presentation:he(t.end.pts)},baseMediaDecodeTime:he(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=he(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:he(t.start.dts),presentation:he(t.start.pts)},end:{decode:he(t.end.dts),presentation:he(t.end.pts)},baseMediaDecodeTime:he(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=he(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:he(t.start),end:he(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:he(t.start),end:he(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}(this.self,this.transmuxer)},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new ni,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,i=e.data,n=oi(t,i);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:i},[i.buffer])},t.probeMp4Tracks=function(e){var t=e.data,i=li(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,n="number"!==typeof i||isNaN(i)?void 0:i*de,r=Si(t,n),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ce(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(ce(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new ki(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new ki(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}}))),cs=os(ds),hs=function(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,l=e.onAudioTimingInfo,u=e.onVideoTimingInfo,d=e.onVideoSegmentTimingInfo,c=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,_=e.isEndOfTimeline,v={buffer:[]},y=_;if(t.onmessage=function(i){t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,l=n.metadata,u=n.videoFrameDtsTime,d=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:l});var c=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(c.data,c.data.byteOffset,c.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};"undefined"!==typeof u&&(h.videoFrameDtsTime=u),"undefined"!==typeof d&&(h.videoFramePtsTime=d),i(h)}(i,v,s),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(i,v),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&c(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&h([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(y=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"===i.data.type&&(y||(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:v,callback:f}),ps(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!==typeof a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){var T=i instanceof ArrayBuffer?i:i.buffer,b=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:T,byteOffset:b,byteLength:i.byteLength},[T])}_&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},ps=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"===typeof e.currentTransmux?e.currentTransmux():hs(e.currentTransmux))},fs=function(e,t){e.postMessage({action:t}),ps(e)},ms=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void fs(t,e);t.transmuxQueue.push(fs.bind(null,t,e))},gs=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void hs(e);e.transmuxer.transmuxQueue.push(e)},_s=function(e){ms("reset",e)},vs=function(e){var t=new cs;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},ys=function(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=(0,l.Z)({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",(function r(a){a.data.action===i&&(t.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,e.byteOffset||0,e.byteLength||a.data.data.byteLength),e.data&&(e.data=a.data.data)),n(a.data))})),e.data){var a=e.data instanceof ArrayBuffer;r.byteOffset=a?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var s=[a?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},Ts=2,bs=-101,Ss=-102,ks=function(e){e.forEach((function(e){e.abort()}))},Cs=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:bs,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Ss,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Ts,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Ts,xhr:t}:null},Es=function(e,t,i){return function(n,r){var a=r.response,s=Cs(n,r);if(s)return i(s,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Ts,xhr:r},e);for(var o=new DataView(a),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),u=0;u1)return Ms("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},Bs=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},Ns=function(e,t){var i=t.attributes||{},n=Us(function(e){var t=e.attributes||{};if(t.CODECS)return(0,k.kS)(t.CODECS)}(t)||[]);if(Rs(e,t)&&!n.audio&&!function(e,t){if(!Rs(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=Us((0,k.Jg)(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Fs=Qr("PlaylistSelector"),js=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},Hs=function(e,t){if(!e)return"";var i=a().getComputedStyle(e);return i?i[t]:""},qs=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Vs=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||a().Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||a().Number.MAX_VALUE)},Ws=function(e,t,i,n,r,s){if(e){var o={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},l=e.playlists;ka.isAudioOnly(e)&&(l=s.getAudioTrackPlaylists_(),o.audioOnly=!0);var u=l.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||a().Number.MAX_VALUE,width:t,height:i,playlist:e}}));qs(u,(function(e,t){return e.bandwidth-t.bandwidth}));var d=(u=u.filter((function(e){return!ka.isIncompatible(e.playlist)}))).filter((function(e){return ka.isEnabled(e.playlist)}));d.length||(d=u.filter((function(e){return!ka.isDisabled(e.playlist)})));var c=d.filter((function(e){return e.bandwidth*as.BANDWIDTH_VARIANCEi||e.height>n}))).filter((function(e){return e.width===v[0].width&&e.height===v[0].height})),h=y[y.length-1],T=y.filter((function(e){return e.bandwidth===h.bandwidth}))[0]),s.experimentalLeastPixelDiffSelector){var k=g.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));qs(k,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),b=k[0]}var C=b||T||S||p||d[0]||u[0];if(C&&C.playlist){var E="sortedPlaylistReps";return b?E="leastPixelDiffRep":T?E="resolutionPlusOneRep":S?E="resolutionBestRep":p?E="bandwidthBestRep":d[0]&&(E="enabledPlaylistReps"),Fs("choosing "+js(C)+" using "+E+" with options",o),C.playlist}return Fs("could not choose a playlist with options",o),null}},zs=function(){var e=this.useDevicePixelRatio&&a().devicePixelRatio||1;return Ws(this.playlists.master,this.systemBandwidth,parseInt(Hs(this.tech_.el(),"width"),10)*e,parseInt(Hs(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},Gs=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var s=a().WebKitDataCue||a().VTTCue,o=t.metadataTrack_;if(o&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!==typeof t||a().isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new s(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return Wr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return Wr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return Wr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),o.addCue(i)}))})),o.cues&&o.cues.length)){for(var l=o.cues,u=[],d=0;d=e&&r.endTime<=t&&i.removeCue(r)},Zs=function(e){return"number"===typeof e&&isFinite(e)},Qs=1/60,Xs=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,l=a.segments,u=void 0===l?[]:l,d=e.mediaIndex,c=e.partIndex,h=e.timeline,p=u.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"===typeof c,g=e.segment.uri?"segment":"pre-segment",_=m?ua({preloadSegment:n})-1:0;return g+" ["+(s+d)+"/"+(s+p)+"]"+(m?" part ["+c+"/"+_+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+h+"] selected by ["+f+"] playlist ["+o+"]"},Ys=function(e){return e+"TimingInfo"},$s=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},Js=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+Xr},eo=function(e,t){if("hls"!==t)return null;var i=function(e){var t=0;return["video","audio"].forEach((function(i){var n=e[i+"TimingInfo"];if(n){var r,s=n.start,o=n.end;"bigint"===typeof s||"bigint"===typeof o?r=a().BigInt(o)-a().BigInt(s):"number"===typeof s&&"number"===typeof o&&(r=o-s),"undefined"!==typeof r&&r>t&&(t=r)}})),"bigint"===typeof t&&t=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=Qr("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty((0,c.Z)(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}(0,h.Z)(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return vs({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&a().clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){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,a().clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return"undefined"!==typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&_s(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Wr.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Ka(e),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},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Za(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}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)}},i.pause=function(){this.checkBufferTimeout_&&(a().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,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"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&_s(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*L.ONE_SECOND_IN_TS),a=Math.ceil((i-n)*L.ONE_SECOND_IN_TS),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var l=o+1;l--&&!(e[l].pts<=r););return l=Math.max(l,0),s.splice(l,o-l+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)Ks(e,t,this.inbandTextTracks_[s]);Ks(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&a().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=a().setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&a().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=a().setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"===typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"===typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=this.buffered_(),t=na(e)||0,i=ra(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_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){var o=a[this.mediaIndex],l="number"===typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[l+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=l+1):s.mediaIndex=this.mediaIndex+1}else{var u=ka.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),d=u.segmentIndex,c=u.startTime,h=u.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=d,s.startOfSegment=c,s.partIndex=h}var p=a[s.mediaIndex],f=p&&"number"===typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"===typeof s.partIndex&&!f)return null;if("number"!==typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=a[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var _=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,l=e.getMediaInfoForTime,u=i.segments[n],d="number"===typeof s&&u.parts[s],c={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||u.resolvedUri,mediaIndex:n,partIndex:d?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:d&&d.duration||u.duration,segment:u,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},h="undefined"!==typeof o?o:this.isPendingTimestampOffset_;c.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=na(this.sourceUpdater_.audioBuffered());return"number"===typeof p&&(c.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(c.gopsToAlignWith=function(e,t,i){if("undefined"===typeof t||null===t||!e.length)return[];var n,r=Math.ceil((t-i+3)*L.ONE_SECOND_IN_TS);for(n=0;nr);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),c},i.timestampOffsetForSegment_=function(e){return function(e){var t=e.segmentTimeline,i=e.currentTimeline,n=e.startOfSegment,r=e.buffered;return e.overrideCheck||t!==i?t "+o+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,l=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];l&&(a=l.label,s=l.language,o=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(u,i.vhs_.tech_,e),Ks(s,o,u[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=a().WebKitDataCue||a().VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:l,inbandTextTracks:u,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),Gs({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!$s({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!$s({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){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[Ys(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:n,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:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!==typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=Ka(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,s=e.bytes,o=this.sourceUpdater_.audioBuffered(),l=this.sourceUpdater_.videoBuffered();o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ia(o).join(", ")),l.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ia(l).join(", "));var u=o.length?o.start(0):0,d=o.length?o.end(o.length-1):0,c=l.length?l.start(0):0,h=l.length?l.end(l.length-1):0;if(d-u<=1&&h-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+s.byteLength+", audio buffer: "+ia(o).join(", ")+", video buffer: "+ia(l).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:s}));var p=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+p),this.remove(0,p,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=a().setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t=e.segmentInfo,i=e.type,n=e.initSegment,r=e.data,a=e.bytes;if(!a){var s=[r],o=r.byteLength;n&&(s.unshift(n),o+=n.byteLength),a=function(e){var t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((function(e){t.set(e,i),i+=e.byteLength}))),t}({bytes:o,segments:s})}this.sourceUpdater_.appendBuffer({segmentInfo:t,type:i,bytes:a},this.handleAppendError_.bind(this,{segmentInfo:t,type:i,bytes:a}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var 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}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var 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})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"===typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=(0,l.Z)({},e,{forceTimestampOffset:!0});(0,l.Z)(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;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}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+Xs(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ds({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,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:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(Xs(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-as.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={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},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"===typeof e.start&&"number"===typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,l=e.audioTimingInfo;if("undefined"!==typeof t)return t;if(!s)return l.start;var u=i.segments[n-1];return 0!==n&&u&&"undefined"!==typeof u.start&&u.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!==typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.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.":!t.hasVideo&&i.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:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"===typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var 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")}},i.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo,n=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"===typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"===typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:n.start:n.start},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"===typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=eo(e,this.sourceType_);if(t&&("warn"===t.severity?Wr.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_("Appended "+Xs(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,a=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||a)return this.logger_("bad "+(r?"segment":"part")+" "+Xs(e)),void this.resetEverything();null!==this.mediaIndex&&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_()}else this.logger_("Throwing away un-appended sync request "+Xs(e))},i.recordThroughput_=function(e){if(e.duration=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},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===bs&&this.handleTimeout_(),e.code===Ss?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var s=r.segment;if(s.map&&(s.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!==typeof a().WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var o,l=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",o),n.stopForError({message:"Error loading vtt.js"})};return o=function(){n.subtitlesTrack_.tech_.off("vttjserror",l),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",o),void this.subtitlesTrack_.tech_.one("vttjserror",l)}s.requested=!0;try{this.parseVTTCues_(r)}catch(u){return void this.stopForError({message:u.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new(a().VTTCue)(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"===typeof a().TextDecoder?t=new(a().TextDecoder)("utf8"):(t=a().WebVTT.StringDecoder(),i=!0);var n=new(a().WebVTT.Parser)(a(),a().vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){Wr.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=Co(r)),n.parse(r)}var s=e.bytes;i&&(s=Co(s)),n.parse(s),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/L.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(to),Io=function(e,t){for(var i=e.cues,n=0;n=r.adStartTime&&t<=r.adEndTime)return r}return null},xo=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=oa(t);r=r||0;for(var l=0;l=h)&&(s=h,a={time:c,segmentIndex:u.segmentIndex,partIndex:u.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o=c)&&(s=c,a={time:d.time,segmentIndex:l,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],Po=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=Qr("SyncController"),i}(0,h.Z)(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+pa({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a86400)Wr.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&"undefined"!==typeof r.start){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}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return"undefined"===typeof this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return"undefined"===typeof this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"===typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||no){var l=void 0;l=s<0?i.start-pa({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+pa({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:l,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(Wr.EventTarget),Ao=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}(0,h.Z)(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"===typeof i&&"number"===typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"===typeof i&&"number"===typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(Wr.EventTarget),Lo=ls(us((function(){var e="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof i.g?i.g:"undefined"!==typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&i.path)}},i.exports),i.exports}var n=t((function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^e]=e;for(t=i=0;!c[t];t^=n||1,i=f[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,c[t]=a,h[a]=t,o=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)u[e][t]=s=s<<24^s>>>8,d[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0);return l}()),this._tables=[[l[0][0].slice(),l[0][1].slice(),l[0][2].slice(),l[0][3].slice(),l[0][4].slice()],[l[1][0].slice(),l[1][1].slice(),l[1][2].slice(),l[1][3].slice(),l[1][4].slice()]];var r=this._tables[0][4],a=this._tables[1],s=e.length,o=1;if(4!==s&&6!==s&&8!==s)throw new Error("Invalid aes key size");var u=e.slice(0),d=[];for(this._key=[u,d],t=s;t<4*s+28;t++)n=u[t-1],(t%s===0||8===s&&t%s===4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%s===0&&(n=n<<8^n>>>24^o<<24,o=o<<1^283*(o>>7))),u[t]=u[t-s]^n;for(i=0;t;i++,t--)n=u[3&i?t:t-4],d[i]=t<=4||i<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,l,u,d=this._key[1],c=e^d[0],h=n^d[1],p=i^d[2],f=t^d[3],m=d.length/4-2,g=4,_=this._tables[1],v=_[0],y=_[1],T=_[2],b=_[3],S=_[4];for(u=0;u>>24]^y[h>>16&255]^T[p>>8&255]^b[255&f]^d[g],o=v[h>>>24]^y[p>>16&255]^T[f>>8&255]^b[255&c]^d[g+1],l=v[p>>>24]^y[f>>16&255]^T[c>>8&255]^b[255&h]^d[g+2],f=v[f>>>24]^y[c>>16&255]^T[h>>8&255]^b[255&p]^d[g+3],g+=4,c=s,h=o,p=l;for(u=0;u<4;u++)r[(3&-u)+a]=S[c>>>24]<<24^S[h>>16&255]<<16^S[p>>8&255]<<8^S[255&f]^d[g++],s=c,c=h,h=p,p=f,f=s},e}(),d=function(e){function t(){var t;return(t=e.call(this,s)||this).jobs=[],t.delay=1,t.timeout_=null,t}a(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(s),c=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},h=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),o=new Uint8Array(t.byteLength),l=0;for(this.asyncStream_=new d,this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+a),i,n,o)),l=a;l>2),m=new u(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),_=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],s=i[3],p=0;p=0&&(t="main-desc"),t},Mo=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Ro=function(e,t){t.activePlaylistLoader=e,e.load()},Uo={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;Mo(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,l=n.tracks[o];if(a!==l){for(var u in Wr.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[u].enabled=n.tracks[u]===l;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];Wr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Mo(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},Bo={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",Uo[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",Uo[e](e,i))}},No={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],l=o.groups,u=o.tracks,d=o.logger_,c=t.masterPlaylistLoader,h=Sa(c.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=c.master.playlists)),s[e])for(var f in l[p]||(l[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(d("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new Ba(m.playlists[0],i,a):m.resolvedUri?new Ba(m.resolvedUri,i,a):m.playlists&&"dash"===n?new rs(m.playlists[0],i,a,c):null,m=Wr.mergeOptions({id:f,playlistLoader:g},m),Bo[e](e,m.playlistLoader,t),l[p].push(m),"undefined"===typeof u[f]){var _=new Wr.AudioTrack({id:f,kind:Do(m),enabled:!1,language:m.language,default:m.default,label:f});u[f]=_}}r.on("error",Uo[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,l=t.mediaTypes[e],u=l.groups,d=l.tracks,c=t.masterPlaylistLoader;for(var h in o[e])for(var p in u[h]||(u[h]=[]),o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new Ba(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new rs(f.playlists[0],n,s,c)}else"vhs-json"===r&&(m=new Ba(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=Wr.mergeOptions({id:p,playlistLoader:m},f),Bo[e](e,f.playlistLoader,t),u[h].push(f),"undefined"===typeof d[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;d[p]=g}}a.on("error",Uo[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var l in a[o]||(a[o]=[]),n[e][o]){var u=n[e][o][l];if(/^(?:CC|SERVICE)/.test(u.instreamId)){var d=i.options_.vhs&&i.options_.vhs.captionServices||{},c={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(d[c.instreamId]&&(c=Wr.mergeOptions(c,d[c.instreamId])),void 0===c.default&&delete c.default,a[o].push(Wr.mergeOptions({id:l},u)),"undefined"===typeof s[l]){var h=i.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;s[l]=h}}}}},Fo=function e(t,i){for(var n=0;n1&&Sa(t.master))for(var l=0;l "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=a().setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(a().clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var l in n)if(n[l][i.label]){var u=n[l][i.label];if(u.playlists&&u.playlists.length)o.push.apply(o,u.playlists);else if(u.uri)o.push(u);else if(e.playlists.length)for(var d=0;d1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,l=e.experimentalBufferBasedABR,u=e.log;if(!r)return Wr.log.warn("We received no playlist to switch to. Please check your stream."),!1;var d="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return u(d+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var c=Boolean(Jr(i,n).length);if(!t.endList)return c||"number"!==typeof t.partTargetDuration?(u(d+" as current playlist is live"),!0):(u("not "+d+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var h=ra(i,n),p=l?as.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:as.MAX_BUFFER_LOW_WATER_LINE;if(om)&&h>=a){var _=d+" as forwardBuffer >= bufferLowWaterLine ("+h+" >= "+a+")";return l&&(_+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),u(_),!0}return u("not "+d+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){Wr.browser.IE_VERSION||Wr.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var l=this.selectPlaylist();if(!l)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var u=e.internal?this.logger_:Wr.log.warn,d=e.message?" "+e.message:"";u((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+d+" Switching to playlist "+l.id+"."),l.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var c=l.targetDuration/2*1e3||5e3,h="number"===typeof l.lastRequest&&Date.now()-l.lastRequest<=c;return this.switchMedia_(l,"exclude",s||h)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"===typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=Jr(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:no.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=no.Playlist.seekable(t,i,no.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=no.Playlist.seekable(t,i,no.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=Wr.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.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()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=Ns(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||k.xz),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||k.lA)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||k.lA,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?(0,k.p7)(o):(0,k.Hi)(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach((function(t){var i=((0,k.kS)(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=((0,k.kS)(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&l.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),l.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+l.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var u=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:u,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=Ns(e.master,r),s=[];!a.audio||(0,k.Hi)(a.audio)||(0,k.p7)(a.audio)||s.push("audio codec "+a.audio),!a.video||(0,k.Hi)(a.video)||(0,k.p7)(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=Us((0,k.kS)(e)),a=Bs(r),s=r.video&&(0,k.kS)(r.video)[0]||null,o=r.audio&&(0,k.kS)(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var l=[],u=Ns(t.masterPlaylistLoader_.master,r),d=Bs(u);if(u.audio||u.video){if(d!==a&&l.push('codec count "'+d+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var c=u.video&&(0,k.kS)(u.video)[0]||null,h=u.audio&&(0,k.kS)(u.audio)[0]||null;c&&s&&c.type.toLowerCase()!==s.type.toLowerCase()&&l.push('video codec "'+c.type+'" !== "'+s.type+'"'),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&l.push('audio codec "'+h.type+'" !== "'+o.type+'"')}l.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+l.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,s=0;s0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:Yr)}if("undefined"!==typeof e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+ta(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,l=this.media(),u=l.partTargetDuration?l.partTargetDuration:2*(l.targetDuration-Xr),d=[s,o],c=0;c "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=ea(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+Yr;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null},e}(),Zo={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Qo=function e(t,i){var n=0,r=0,a=Wr.mergeOptions(Zo,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!==e&&void 0!==e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},l=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"===typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void Wr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},u=function e(){t.off("loadedmetadata",s),t.off("error",l),t.off("dispose",e)};t.on("error",l),t.on("dispose",u),t.reloadSourceOnError=function(i){u(),e(t,i)}},Xo="2.14.3",Yo={PlaylistLoader:Ba,Playlist:ka,utils:Xa,STANDARD_PLAYLIST_SELECTOR:zs,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(ka.isEnabled);return qs(t,(function(e,t){return Vs(e,t)})),t.filter((function(t){return!!Ns(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:zs,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&a().devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Ws(this.playlists.master,t,parseInt(Hs(this.tech_.el(),"width"),10)*n,parseInt(Hs(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:Vs,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||a().Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||a().Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Ha()};Object.keys(as).forEach((function(e){Object.defineProperty(Yo,e,{get:function(){return Wr.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),as[e]},set:function(t){Wr.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!==typeof t||t<0?Wr.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):as[e]=t}})}));var $o="videojs-vhs",Jo=function(e,t){for(var i=t.media(),n=-1,r=0;r=i&&e>=i?Math.max(e,n):n}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){Wr.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:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return ia(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return ia(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!a().localStorage)return!1;var t=il();t=t?Wr.mergeOptions(t,e):e;try{a().localStorage.setItem($o,JSON.stringify(t))}catch(i){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=Sa(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!ga(e)})).map((function(t,i){return new zo(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=a().URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),el({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=tl({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){if("output-restricted"===t.status){var i=e.masterPlaylistController_.master();if(i&&i.playlists){var n,r=[];if(i.playlists.forEach((function(e){e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,r.push(e))})),r.length)(n=Wr.log).warn.apply(n,['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(r)),e.masterPlaylistController_.fastQualityChange_()}}})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==Wr.browser.IE_VERSION&&i?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=Wr.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),Jo(t,i.playlists)})),this.playlists.on("mediachange",(function(){Jo(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":Xo,"mux.js":"6.0.1","mpd-parser":"0.21.1","m3u8-parser":"4.7.1","aes-decrypter":"3.1.3"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return ko.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&a().URL.revokeObjectURL&&(a().URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return Ya({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),$a({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(Wr.getComponent("Component")),rl={name:"videojs-http-streaming",VERSION:Xo,canHandleSource:function(e,t){void 0===t&&(t={});var i=Wr.mergeOptions(Wr.options,t);return rl.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=Wr.mergeOptions(Wr.options,i);return t.vhs=new nl(e,t,n),Wr.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return Wr.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Ha(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=Wr.mergeOptions(Wr.options,t),n=i.vhs,r=(n=void 0===n?{}:n).overrideNative,a=void 0===r?!Wr.browser.IS_ANY_SAFARI:r,s=i.hls,o=(s=void 0===s?{}:s).overrideNative,l=void 0!==o&&o,u=(0,C.t)(e);return u&&(!Yo.supportsTypeNatively(u)||l||a)?"maybe":""}};((0,k.p7)("avc1.4d400d,mp4a.40.2")&&Wr.getTech("Html5").registerSourceHandler(rl,0),Wr.VhsHandler=nl,Object.defineProperty(Wr,"HlsHandler",{get:function(){return Wr.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),nl},configurable:!0}),Wr.VhsSourceHandler=rl,Object.defineProperty(Wr,"HlsSourceHandler",{get:function(){return Wr.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),rl},configurable:!0}),Wr.Vhs=Yo,Object.defineProperty(Wr,"Hls",{get:function(){return Wr.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Yo},configurable:!0}),Wr.use||(Wr.registerComponent("Hls",Yo),Wr.registerComponent("Vhs",Yo)),Wr.options.vhs=Wr.options.vhs||{},Wr.options.hls=Wr.options.hls||{},Wr.getPlugin&&Wr.getPlugin("reloadSourceOnError"))||(Wr.registerPlugin||Wr.plugin)("reloadSourceOnError",(function(e){Qo(this,e)}));t.Z=Wr}}]); \ No newline at end of file diff --git a/_next/static/chunks/framework-a6b3d2fb26bce5d1.js b/_next/static/chunks/framework-a6b3d2fb26bce5d1.js new file mode 100644 index 00000000..8845f8a2 --- /dev/null +++ b/_next/static/chunks/framework-a6b3d2fb26bce5d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[593],{2551:(e,n,t)=>{var r,l,a,u,o,i,s=t(6540),c=t(9982);function f(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t