diff --git a/.babelrc b/.babelrc deleted file mode 100644 index a037113..0000000 --- a/.babelrc +++ /dev/null @@ -1,35 +0,0 @@ -{ - "presets": [ - [ "env", { - "modules": false, - "targets": { - "browsers": [ - "last 2 Chrome versions", - "last 2 Firefox versions", - "last 2 Safari versions", - "last 2 Edge versions", - "last 2 Opera versions", - "last 2 iOS versions", - "last 1 Android version", - "last 1 ChromeAndroid version", - "ie 11", - "> 1%" - ] - } - } ] - ], - "plugins": [ - "transform-object-rest-spread", - [ "transform-react-jsx", { - "pragma": "wp.element.createElement" - } ] - ], - "env": { - "default": { - "plugins": [ - "lodash", - "transform-runtime" - ] - }, - } -} diff --git a/.eslintignore b/.eslintignore index a818601..e224ba1 100755 --- a/.eslintignore +++ b/.eslintignore @@ -2,6 +2,7 @@ **/*.build.js **/node_modules/** **/vendor/** +assets/** build node_modules Gruntfile.js diff --git a/.github/workflows/phpcs_on_pull_request.yml b/.github/workflows/phpcs_on_pull_request.yml index b431e11..98adbff 100644 --- a/.github/workflows/phpcs_on_pull_request.yml +++ b/.github/workflows/phpcs_on_pull_request.yml @@ -11,7 +11,7 @@ jobs: - name: Run PHPCS inspection uses: rtCamp/action-phpcs-code-review@master env: - SKIP_FOLDERS: "tests,.github" + SKIP_FOLDERS: "tests,.github,assets/build" GH_BOT_TOKEN: ${{ secrets.RTBOT_TOKEN }} with: args: WordPress,WordPress-Core,WordPress-Docs diff --git a/.gitignore b/.gitignore index 8c9338d..2b1d3e1 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ sftp-config.json *.sublime-workspace .editorconfig .cache/ +package-lock.json \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index 31c1ced..5f09eed 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v13.1.0 +v18.20.3 diff --git a/admin/css/rt-progress-bar.css b/admin/css/rt-progress-bar.css new file mode 100644 index 0000000..a5ecf58 --- /dev/null +++ b/admin/css/rt-progress-bar.css @@ -0,0 +1,20 @@ +.transcoder-progress-bar { + position: absolute; + left: 0; + right: 0; + bottom: -10px; + height: 10px; + background: rgba(0, 0, 0, 0.1); +} +.transcoder-progress-bar .progress { + height: 100%; + background: #21759b; + transition: width 0.3s ease; + display: flex; + align-items: center; + justify-content: flex-end; +} + +.transcoder-progress-bar .progress .progress-text { + color: #fff; +} diff --git a/admin/css/rt-progress-bar.min.css b/admin/css/rt-progress-bar.min.css new file mode 100644 index 0000000..e24739a --- /dev/null +++ b/admin/css/rt-progress-bar.min.css @@ -0,0 +1 @@ +.transcoder-progress-bar{background:rgba(0,0,0,.1);bottom:-10px;height:10px;left:0;position:absolute;right:0}.transcoder-progress-bar .progress{align-items:center;background:#21759b;display:flex;height:100%;justify-content:flex-end;transition:width .3s ease}.transcoder-progress-bar .progress .progress-text{color:#fff} \ No newline at end of file diff --git a/admin/css/rt-transcoder-admin.css b/admin/css/rt-transcoder-admin.css index 990bab3..2b72c32 100644 --- a/admin/css/rt-transcoder-admin.css +++ b/admin/css/rt-transcoder-admin.css @@ -134,9 +134,15 @@ .transcoder-setting-form .form-table td { font-size: 13px; - padding: 0 0 5px; - vertical-align: top; -} + padding: 5px; + display: inline-flex; + align-items: center; + flex-wrap: wrap; + + & > p { + margin: 0; + } + } .rtm-button-container { margin-left: -20px; @@ -167,7 +173,7 @@ .transcoder-setting-form .dashicons-info { color: #aaa; font-size: 14px; - height: 26px; + height: 100%; line-height: 14px; position: relative; } @@ -238,3 +244,9 @@ #adminmenu li.menu-top.current .wp-menu-image img { opacity: 1; } + +.rtt-premium-feature { + opacity: 0.9; + background-color: rgba(250, 235, 215, 0.63); + border-radius: 0.5rem; +} \ No newline at end of file diff --git a/admin/css/rt-transcoder-admin.min.css b/admin/css/rt-transcoder-admin.min.css index 1c59f25..5de4de0 100644 --- a/admin/css/rt-transcoder-admin.min.css +++ b/admin/css/rt-transcoder-admin.min.css @@ -1,3 +1 @@ -/*! - * Transcoder Styles - */#rtt-settings_updated{display:none}.transcoder-settings-boxes-wrapper{float:left;width:75%;margin:10px 0 0 2px}#transcoder-usage strong{display:inline-block;min-width:120px}#transcoder-usage p{overflow:hidden}.transcoding-remaining,.transcoding-used{background:#7ad03a;float:right;height:12px;margin-top:3px;width:12px}.transcoding-remaining{background:#dedede}#rttprogressbar{background:#dedede;height:10px;position:relative}#rttprogressbar div{background:#7ad03a;height:10px;left:0;position:absolute}.transcoder-setting-container{background-color:#fff;margin-top:10px;padding:10px 20px 0;border:1px solid #e7e7e7}.transcoder-sidebar{float:right;margin:10px 0 0;width:23%}.transcoder-setting-container .transcoder-plan-table{border-collapse:collapse;clear:none;box-shadow:none}.transcoder-plan-table td,.transcoder-plan-table th{border:1px solid #e7e7e7}.transcoder-plan-table th{font-size:13px;font-weight:600}#trascoder-unsubscribe-dialog{display:none}.transcoder-sidebar .button{display:block;opacity:.8;position:relative;text-decoration:none}.rtm-social-share .dashicons{font-size:18px;position:absolute;right:10px;top:4px}.rtm-social-share .twitter .dashicons{color:#45b0e3}.rtm-social-share .facebook .dashicons{color:#3b5998}.rtm-social-share .wordpress .dashicons{color:#21759b}.rtm-social-share .rss .dashicons{color:#f60}#mce-EMAIL{width:100%}#mc-embedded-subscribe{display:block;margin:10px auto 0;width:100%}.transcoder-setting-form{margin-top:30px}.transcoder-setting-form .form-table td{color:#444;font-size:13px;font-weight:400;padding:5px 30px 5px 0;vertical-align:top;width:48%}.transcoder-setting-form .form-table td{font-size:13px;padding:0 0 5px;vertical-align:top}.rtm-button-container{margin-left:-20px;margin-right:-20px;overflow:hidden;padding:10px 10px;position:relative;text-align:right;background:#eee none repeat scroll 0 0;border-bottom:1px solid #e7e7e7;margin-top:20px;z-index:999}.rtm-social-links a{display:inline-block;margin:4px 0 4px 4px;text-decoration:none}.rtm-tooltip{display:inline-block;margin-left:3px;position:relative;z-index:9999}.transcoder-setting-form .dashicons-info{color:#aaa;font-size:14px;height:26px;line-height:14px;position:relative}.rtm-tip{background:#fffaf0 none repeat scroll 0 0;border:1px solid #f5deaf;border-radius:3px;font-size:12px;left:24px;line-height:1.5;margin-left:-10px;margin-top:-4px;opacity:0;padding:6px 12px;position:absolute;top:-7px;-webkit-transition:all .4s ease-in-out 0s;transition:all .4s ease-in-out 0s;visibility:hidden;width:210px;z-index:10}.rtm-tip::after,.rtm-tip::before{border:medium solid transparent;content:" ";height:0;pointer-events:none;position:absolute;right:100%;top:15px;width:0}.rtm-tip::after{border-color:rgba(255,250,240,0) #fffaf0 rgba(255,250,240,0) rgba(255,250,240,0);border-width:6px;margin-top:-6px}.rtm-tip::after,.rtm-tip::before{content:" ";height:0;pointer-events:none;position:absolute;right:100%;top:15px;width:0}.rtm-tip::before{border-color:rgba(221,204,170,0) #f5deaf rgba(221,204,170,0) rgba(221,204,170,0);border-width:7px;margin-top:-7px}.rtm-tooltip:hover .rtm-tip{margin-left:0;opacity:1;visibility:visible}.rtt-loader{margin-left:5px}#adminmenu li.menu-top.current .wp-menu-image img{opacity:1} \ No newline at end of file +#rtt-settings_updated{display:none}.transcoder-settings-boxes-wrapper{float:left;margin:10px 0 0 2px;width:75%}#transcoder-usage strong{display:inline-block;min-width:120px}#transcoder-usage p{overflow:hidden}.transcoding-remaining,.transcoding-used{background:#7ad03a;float:right;height:12px;margin-top:3px;width:12px}#rttprogressbar,.transcoding-remaining{background:#dedede}#rttprogressbar{height:10px;position:relative}#rttprogressbar div{background:#7ad03a;height:10px;left:0;position:absolute}.transcoder-setting-container{background-color:#fff;border:1px solid #e7e7e7;margin-top:10px;padding:10px 20px 0}.transcoder-sidebar{float:right;margin:10px 0 0;width:23%}.transcoder-setting-container .transcoder-plan-table{border-collapse:collapse;box-shadow:none;clear:none}.transcoder-plan-table td,.transcoder-plan-table th{border:1px solid #e7e7e7}.transcoder-plan-table th{font-size:13px;font-weight:600}#trascoder-unsubscribe-dialog{display:none}.transcoder-sidebar .button{display:block;opacity:.8;position:relative;text-decoration:none}.rtm-social-share .dashicons{font-size:18px;position:absolute;right:10px;top:4px}.rtm-social-share .twitter .dashicons{color:#45b0e3}.rtm-social-share .facebook .dashicons{color:#3b5998}.rtm-social-share .wordpress .dashicons{color:#21759b}.rtm-social-share .rss .dashicons{color:#f60}#mce-EMAIL{width:100%}#mc-embedded-subscribe{display:block;margin:10px auto 0;width:100%}.transcoder-setting-form{margin-top:30px}.transcoder-setting-form .form-table td{color:#444;font-weight:400;padding:5px 30px 5px 0;vertical-align:top;width:48%}.transcoder-setting-form .form-table td{align-items:center;display:inline-flex;flex-wrap:wrap;font-size:13px;padding:5px;&>p{margin:0}}.rtm-button-container{background:#eee none repeat scroll 0 0;border-bottom:1px solid #e7e7e7;margin-left:-20px;margin-right:-20px;margin-top:20px;overflow:hidden;padding:10px;position:relative;text-align:right;z-index:999}.rtm-social-links a{display:inline-block;margin:4px 0 4px 4px;text-decoration:none}.rtm-tooltip{display:inline-block;margin-left:3px;position:relative;z-index:9999}.transcoder-setting-form .dashicons-info{color:#aaa;font-size:14px;height:100%;line-height:14px;position:relative}.rtm-tip{background:#fffaf0 none repeat scroll 0 0;border:1px solid #f5deaf;border-radius:3px;font-size:12px;left:24px;line-height:1.5;margin-left:-10px;margin-top:-4px;opacity:0;padding:6px 12px;position:absolute;top:-7px;transition:all .4s ease-in-out 0s;visibility:hidden;width:210px;z-index:10}.rtm-tip:after,.rtm-tip:before{border:solid transparent}.rtm-tip:after{border-color:rgba(255,250,240,0) #fffaf0 rgba(255,250,240,0) rgba(255,250,240,0);border-width:6px;margin-top:-6px}.rtm-tip:after,.rtm-tip:before{content:" ";height:0;pointer-events:none;position:absolute;right:100%;top:15px;width:0}.rtm-tip:before{border-color:hsla(40,43%,77%,0) #f5deaf hsla(40,43%,77%,0) hsla(40,43%,77%,0);border-width:7px;margin-top:-7px}.rtm-tooltip:hover .rtm-tip{margin-left:0;opacity:1;visibility:visible}.rtt-loader{margin-left:5px}#adminmenu li.menu-top.current .wp-menu-image img{opacity:1}.rtt-premium-feature{background-color:hsla(34,78%,91%,.63);border-radius:.5rem;opacity:.9} \ No newline at end of file diff --git a/admin/css/rt-transcoder-client.min.css b/admin/css/rt-transcoder-client.min.css index 7462e3b..3035f48 100755 --- a/admin/css/rt-transcoder-client.min.css +++ b/admin/css/rt-transcoder-client.min.css @@ -1,3 +1 @@ -/*! - * Transcoder Styles - */.btn_check_transcode_status{padding:4px 5px;margin:5px 5px;font-size:11px;font-style:normal}.transcode_status_box{border:none;padding:10px;background:#f7f7f7;box-shadow:1px 2px 12px #888;margin:3px;width:95%;font-size:13px;font-style:normal;white-space:normal}.transcoding-in-progress{font-size:14px;font-style:normal;text-overflow:ellipsis;white-space:normal;display:block} \ No newline at end of file +.btn_check_transcode_status{font-size:11px;font-style:normal;margin:5px;padding:4px 5px}.transcode_status_box{background:#f7f7f7;border:none;box-shadow:1px 2px 12px #888;font-size:13px;font-style:normal;margin:3px;padding:10px;white-space:normal;width:95%}.transcoding-in-progress{display:block;font-size:14px;font-style:normal;text-overflow:ellipsis;white-space:normal} \ No newline at end of file diff --git a/admin/js/build/rt-transcoder-block-editor-support.build.asset.php b/admin/js/build/rt-transcoder-block-editor-support.build.asset.php new file mode 100644 index 0000000..b531131 --- /dev/null +++ b/admin/js/build/rt-transcoder-block-editor-support.build.asset.php @@ -0,0 +1 @@ + array('react', 'wp-api-fetch'), 'version' => 'af1c6d65e659f17b25f0'); diff --git a/admin/js/build/rt-transcoder-block-editor-support.build.js b/admin/js/build/rt-transcoder-block-editor-support.build.js index b01dae7..f3b8a9e 100644 --- a/admin/js/build/rt-transcoder-block-editor-support.build.js +++ b/admin/js/build/rt-transcoder-block-editor-support.build.js @@ -1 +1 @@ -!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=4)}([function(t,e,r){var n;!function(){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function i(t){return function(t,e){var r,n,a,u,c,s,l,f,p,h=1,d=t.length,y="";for(n=0;n=0),u.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,u.width?parseInt(u.width):0);break;case"e":r=u.precision?parseFloat(r).toExponential(u.precision):parseFloat(r).toExponential();break;case"f":r=u.precision?parseFloat(r).toFixed(u.precision):parseFloat(r);break;case"g":r=u.precision?String(Number(r.toPrecision(u.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=u.precision?r.substring(0,u.precision):r;break;case"t":r=String(!!r),r=u.precision?r.substring(0,u.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=u.precision?r.substring(0,u.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=u.precision?r.substring(0,u.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}o.json.test(u.type)?y+=r:(!o.number.test(u.type)||f&&!u.sign?p="":(p=f?"+":"-",r=r.toString().replace(o.sign,"")),s=u.pad_char?"0"===u.pad_char?"0":u.pad_char.charAt(1):" ",l=u.width-(p+r).length,c=u.width&&l>0?s.repeat(l):"",y+=u.align?p+r+c:"0"===s?p+c+r:c+p+r)}return y}(function(t){if(u[t])return u[t];for(var e,r=t,n=[],i=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){i|=1;var a=[],c=e[2],s=[];if(null===(s=o.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(s[1]);""!==(c=c.substring(s[0].length));)if(null!==(s=o.key_access.exec(c)))a.push(s[1]);else{if(null===(s=o.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(s[1])}e[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}r=r.substring(e[0].length)}return u[t]=n}(t),arguments)}function a(t,e){return i.apply(null,[t].concat(e||[]))}var u=Object.create(null);e.sprintf=i,e.vsprintf=a,"undefined"!=typeof window&&(window.sprintf=i,window.vsprintf=a,void 0===(n=function(){return{sprintf:i,vsprintf:a}}.call(e,r,e,t))||(t.exports=n))}()},function(t,e,r){var n=r(5)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){t.exports=function(t,e){var r,n,o=0;function i(){var i,a,u=r,c=arguments.length;t:for(;u;){if(u.args.length===arguments.length){for(a=0;a=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e);if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===n(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}r.r(e);var u,c,s,l,f=r(2),p=r.n(f);r(0),p()(console.error),u={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},c=["(","?"],s={")":["("],":":["?","?:"]},l=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var h={"!":function(t){return!t},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"<":function(t,e){return t":function(t,e){return t>e},">=":function(t,e){return t>=e},"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},"?:":function(t,e,r){if(t)throw e;return r}};var d={contextDelimiter:"",onMissingKey:null};function y(t,e){var r;for(r in this.data=t,this.pluralForms={},this.options={},d)this.options[r]=void 0!==e&&r in e?e[r]:d[r]}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e=0||u[o]3&&void 0!==arguments[3]?arguments[3]:10,a=t[e];if(w(r)&&x(n))if("function"==typeof o)if("number"==typeof i){var u={callback:o,priority:i,namespace:n};if(a[r]){var c,s=a[r].handlers;for(c=s.length;c>0&&!(i>=s[c-1].priority);c--);c===s.length?s[c]=u:s.splice(c,0,u),a.__current.forEach((function(t){t.name===r&&t.currentIndex>=c&&t.currentIndex++}))}else a[r]={handlers:[u],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,n,o,i)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}},O=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n,o){var i=t[e];if(w(n)&&(r||x(o))){if(!i[n])return 0;var a=0;if(r)a=i[n].handlers.length,i[n]={runs:i[n].runs,handlers:[]};else for(var u=i[n].handlers,c=function(t){u[t].namespace===o&&(u.splice(t,1),a++,i.__current.forEach((function(e){e.name===n&&e.currentIndex>=t&&e.currentIndex--})))},s=u.length-1;s>=0;s--)c(s);return"hookRemoved"!==n&&t.doAction("hookRemoved",n,o),a}}},j=function(t,e){return function(r,n){var o=t[e];return void 0!==n?r in o&&o[r].handlers.some((function(t){return t.namespace===n})):r in o}};function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r2&&void 0!==arguments[2]&&arguments[2];return function(n){var o=t[e];o[n]||(o[n]={handlers:[],runs:0}),o[n].runs++;for(var i=o[n].handlers,a=arguments.length,u=new Array(a>1?a-1:0),c=1;c1&&void 0!==arguments[1]?arguments[1]:"default";n.data[e]=g(g(g({},m),n.data[e]),t),n.data[e][""]=g(g({},m[""]),n.data[e][""])},u=function(t,e){a(t,e),i()},c=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;return n.data[t]||a(void 0,t),n.dcnpgettext(t,e,r,o,i)},s=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default"},l=function(t,e,n){var o=c(n,e,t);return r?(o=r.applyFilters("i18n.gettext_with_context",o,t,e,n),r.applyFilters("i18n.gettext_with_context_"+s(n),o,t,e,n)):o};if(r){var f=function(t){b.test(t)&&i()};r.addAction("hookAdded","core/i18n",f),r.addAction("hookRemoved","core/i18n",f)}return{getLocaleData:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return n.data[t]},setLocaleData:u,resetLocaleData:function(t,e){n.data={},n.pluralForms={},u(t,e)},subscribe:function(t){return o.add(t),function(){return o.delete(t)}},__:function(t,e){var n=c(e,void 0,t);return r?(n=r.applyFilters("i18n.gettext",n,t,e),r.applyFilters("i18n.gettext_"+s(e),n,t,e)):n},_x:l,_n:function(t,e,n,o){var i=c(o,void 0,t,e,n);return r?(i=r.applyFilters("i18n.ngettext",i,t,e,n,o),r.applyFilters("i18n.ngettext_"+s(o),i,t,e,n,o)):i},_nx:function(t,e,n,o,i){var a=c(i,o,t,e,n);return r?(a=r.applyFilters("i18n.ngettext_with_context",a,t,e,n,o,i),r.applyFilters("i18n.ngettext_with_context_"+s(i),a,t,e,n,o,i)):a},isRTL:function(){return"rtl"===l("ltr","text direction")},hasTranslation:function(t,e,o){var i,a,u=e?e+""+t:t,c=!(null===(i=n.data)||void 0===i||null===(a=i[null!=o?o:"default"])||void 0===a||!a[u]);return r&&(c=r.applyFilters("i18n.has_translation",c,t,e,o),c=r.applyFilters("i18n.has_translation_"+s(o),c,t,e,o)),c}}}(0,0,F)),L=(T.getLocaleData.bind(T),T.setLocaleData.bind(T),T.resetLocaleData.bind(T),T.subscribe.bind(T),T.__.bind(T));T._x.bind(T),T._n.bind(T),T._nx.bind(T),T.isRTL.bind(T),T.hasTranslation.bind(T);var I=function(t,e){var r,n,o=t.path;return"string"==typeof t.namespace&&"string"==typeof t.endpoint&&(r=t.namespace.replace(/^\/|\/$/g,""),o=(n=t.endpoint.replace(/^\//,""))?r+"/"+n:r),delete t.namespace,delete t.endpoint,e(i({},t,{path:o}))},M=r(1),N=r.n(M);function D(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function C(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function G(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0;if(!e||!Object.keys(e).length)return t;var r=t,n=t.indexOf("?");return-1!==n&&(e=Object.assign(U(t),e),r=r.substr(0,n)),r+"?"+function(t){for(var e,r="",n=Object.entries(t);e=n.shift();){var o=C(e,2),i=o[0],a=o[1];if(Array.isArray(a)||a&&a.constructor===Object){var u,c=z(Object.entries(a).reverse());try{for(c.s();!(u=c.n()).done;){var s=C(u.value,2),l=s[0],f=s[1];n.unshift(["".concat(i,"[").concat(l,"]"),f])}}catch(t){c.e(t)}finally{c.f()}}else void 0!==a&&(null===a&&(a=""),r+="&"+[i,a].map(encodeURIComponent).join("="))}return r.substr(1)}(e)}var W=function(t){return t.json?t.json():Promise.reject(t)},Z=function(t){return function(t){if(!t)return{};var e=t.match(/<([^>]+)>; rel="next"/);return e?{next:e[1]}:{}}(t.headers.get("link")).next},B=function(t){var e=t.path&&-1!==t.path.indexOf("per_page=-1"),r=t.url&&-1!==t.url.indexOf("per_page=-1");return e||r},H=function(){var t,e=(t=N.a.mark((function t(e,r){var n,o,u,c,s,l;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!1!==e.parse){t.next=2;break}return t.abrupt("return",r(e));case 2:if(B(e)){t.next=4;break}return t.abrupt("return",r(e));case 4:return t.next=6,r(i({},(p={per_page:100},h=(f=e).path,d=f.url,i({},a(f,["path","url"]),{url:d&&X(d,p),path:h&&X(h,p)})),{parse:!1}));case 6:return n=t.sent,t.next=9,W(n);case 9:if(o=t.sent,Array.isArray(o)){t.next=12;break}return t.abrupt("return",o);case 12:if(u=Z(n)){t.next=15;break}return t.abrupt("return",o);case 15:c=[].concat(o);case 16:if(!u){t.next=27;break}return t.next=19,r(i({},e,{path:void 0,url:u,parse:!1}));case 19:return s=t.sent,t.next=22,W(s);case 22:l=t.sent,c=c.concat(l),u=Z(s),t.next=16;break;case 27:return t.abrupt("return",c);case 28:case"end":return t.stop()}var f,p,h,d}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){D(i,n,o,a,u,"next",t)}function u(t){D(i,n,o,a,u,"throw",t)}a(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),J=new Set(["PATCH","PUT","DELETE"]);function K(t,e){return void 0!==function(t,e){return U(t)[e]}(t,e)}var Y={Accept:"application/json, */*;q=0.1"},q={credentials:"include"},Q=[function(t,e){return"string"!=typeof t.url||K(t.url,"_locale")||(t.url=X(t.url,{_locale:"user"})),"string"!=typeof t.path||K(t.path,"_locale")||(t.path=X(t.path,{_locale:"user"})),e(t,e)},I,function(t,e){var r=t.method,n=void 0===r?"GET":r;return J.has(n.toUpperCase())&&(t=i({},t,{headers:i({},t.headers,{"X-HTTP-Method-Override":n,"Content-Type":"application/json"}),method:"POST"})),e(t,e)},H],V=function(t){if(t.status>=200&&t.status<300)return t;throw t},tt=function(t){var e=t.url,r=t.path,n=t.data,o=t.parse,u=void 0===o||o,c=a(t,["url","path","data","parse"]),s=t.body,l=t.headers;return l=i({},Y,l),n&&(s=JSON.stringify(n),l["Content-Type"]="application/json"),window.fetch(e||r,i({},q,c,{body:s,headers:l})).then(V).then((function(t){return u?204===t.status?null:t.json?t.json():Promise.reject(t):t})).catch((function(t){if(!u)throw t;var e={code:"invalid_json",message:L("The response is not a valid JSON response.")};if(!t||!t.json)throw e;return t.json().catch((function(){throw e})).then((function(t){var e={code:"unknown_error",message:L("An unknown error occurred.")};throw t||e}))}))};function et(t){var e=[].concat(Q,[tt]);return new Promise((function(r,n){(function t(r){return function(n){var o=e[r];return r===e.length-1?o(n):o(n,t(r+1))}})(0)(t).then(r).catch((function(e){if("rest_cookie_invalid_nonce"!==e.code)return n(e);window.fetch(et.nonceEndpoint).then(V).then((function(t){return t.text()})).then((function(e){et.nonceMiddleware.nonce=e,et(t).then(r).catch(n)})).catch(n)}))}))}et.use=function(t){Q.unshift(t)},et.setFetchHandler=function(t){tt=t},et.createNonceMiddleware=function(t){function e(t,r){var n=t.headers,o=void 0===n?{}:n;for(var a in o)if("x-wp-nonce"===a.toLowerCase())return r(t);return r(i({},t,{headers:i({},o,{"X-WP-Nonce":e.nonce})}))}return e.nonce=t,e},et.createPreloadingMiddleware=function(t){return function(e,r){var n=e.parse,o=void 0===n||n;if("string"==typeof e.path){var i=e.method||"GET",a=function(t){var e=t.split("?"),r=e[1],n=e[0];return r?n+"?"+r.split("&").map((function(t){return t.split("=")})).sort((function(t,e){return t[0].localeCompare(e[0])})).map((function(t){return t.join("=")})).join("&"):n}(e.path);if(o&&"GET"===i&&t[a])return Promise.resolve(t[a].body);if("OPTIONS"===i&&t[i]&&t[i][a])return Promise.resolve(t[i][a])}return r(e)}},et.createRootURLMiddleware=function(t){return function(e,r){return I(e,(function(e){var n,o=e.url,a=e.path;return"string"==typeof a&&(n=t,-1!==t.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r(i({},e,{url:o}))}))}},et.fetchAllMiddleware=H;var rt=et,nt=window.rtTranscoderBlockEditorSupport;wp.hooks.addFilter("editor.BlockEdit","rt-transcoder-amp/set-media-attributes",(function(t){return function(e){var r=e.attributes,n="amp/amp-story-page"===e.name,o="core/video"===e.name,i=n?r.mediaId:r.id;return void 0!==i&&(void 0===r.poster?n&&void 0!==r.mediaType&&"video"===r.mediaType&&!r.mediaUrl.endsWith("mp4")?e.setAttributes({poster:nt.amp_story_fallback_poster}):o&&void 0!==r.src&&0!==r.src.indexOf("blob:")&&!r.src.endsWith("mp4")&&e.setAttributes({poster:nt.amp_video_fallback_poster}):r.poster.endsWith("-fallback-poster.png")&&rt({path:"/wp-json/transcoder/v1/amp-media / "+i}).then((function(t){!1!==t&&null!==t&&t.poster.length&&t.transcodedMedia.length&&(n&&void 0!==r.mediaType&&"video"===r.mediaType?e.setAttributes({poster:t.poster,mediaUrl:t.transcodedMedia}):o&&e.setAttributes({poster:t.poster,src:t.transcodedMedia}))}))),wp.element.createElement(t,e)}}))}]); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,r=window.wp.apiFetch;var o=e.n(r);const{rtTranscoderBlockEditorSupport:a}=window;wp.hooks.addFilter("editor.BlockEdit","rt-transcoder-amp/set-media-attributes",(e=>r=>{const d=r.attributes,s="amp/amp-story-page"===r.name,i="core/video"===r.name,p=s?d.mediaId:d.id;if(void 0!==p)if(void 0===d.poster)s&&void 0!==d.mediaType&&"video"===d.mediaType&&!d.mediaUrl.endsWith("mp4")?r.setAttributes({poster:a.amp_story_fallback_poster}):i&&void 0!==d.src&&0!==d.src.indexOf("blob:")&&!d.src.endsWith("mp4")&&r.setAttributes({poster:a.amp_video_fallback_poster});else if(d.poster.endsWith("-fallback-poster.png")){const e="/wp-json/transcoder/v1/amp-media";o()({path:`${e} / ${p}`}).then((e=>{!1!==e&&null!==e&&e.poster.length&&e.transcodedMedia.length&&(s&&void 0!==d.mediaType&&"video"===d.mediaType?r.setAttributes({poster:e.poster,mediaUrl:e.transcodedMedia}):i&&r.setAttributes({poster:e.poster,src:e.transcodedMedia}))}))}return(0,t.createElement)(e,{...r})}))})(); \ No newline at end of file diff --git a/admin/js/jquery.ui.progressbar.min.1.7.2.min.js b/admin/js/jquery.ui.progressbar.min.1.7.2.min.js new file mode 100644 index 0000000..f2fd9c6 --- /dev/null +++ b/admin/js/jquery.ui.progressbar.min.1.7.2.min.js @@ -0,0 +1 @@ +(()=>{var e;(e=jQuery).widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()}),this.valueDiv=e('
').appendTo(this.element),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar"),this.valueDiv.remove(),e.widget.prototype.destroy.apply(this,arguments)},value:function(e){return void 0===e?this._value():(this._setData("value",e),this)},_setData:function(a,t){"value"===a&&(this.options.value=t,this._refreshValue(),this._trigger("change",null,{})),e.widget.prototype._setData.apply(this,arguments)},_value:function(){var e=this.options.value;return ethis._valueMax()&&(e=this._valueMax()),e},_valueMin:function(){return 0},_valueMax:function(){return 100},_refreshValue:function(){var e=this.value();this.valueDiv[e==this._valueMax()?"addClass":"removeClass"]("ui-corner-right"),this.valueDiv.width(e+"%"),this.element.attr("aria-valuenow",e)}}),e.extend(e.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(); \ No newline at end of file diff --git a/admin/js/rt-transcoder-admin.js b/admin/js/rt-transcoder-admin.js index 2ca9061..f7ce57d 100644 --- a/admin/js/rt-transcoder-admin.js +++ b/admin/js/rt-transcoder-admin.js @@ -114,6 +114,18 @@ } } ); + + $( document ).on( + 'click', + '#watermark-checkbox', + function( e ) { + if ( $( this ).is( ':checked' ) ) { + $( '#watermark-text' ).closest('tr').show(); + } else { + $( '#watermark-text' ).closest('tr').hide(); + } + } + ); } ); diff --git a/admin/js/rt-transcoder-admin.min.js b/admin/js/rt-transcoder-admin.min.js index b107490..db15c71 100644 --- a/admin/js/rt-transcoder-admin.min.js +++ b/admin/js/rt-transcoder-admin.min.js @@ -1,6 +1 @@ -/*! - * Transcoder Library - * @package Transcoder - */ - -!function(a){a(document).ready(function(){a(document).on("click","#api-key-submit",function(b){if(!document.getElementById("new-api-key").value){a("#api-key-error").remove();var c=a("
",{id:"api-key-error",class:"error"});a("h1:first").after(c.html(a("

").text(rt_transcoder_script.error_empty_key))),b.preventDefault()}}),a(document).on("click","#disable-transcoding",function(b){if(b.preventDefault(),confirm(rt_transcoder_script.disable_encoding)){var c={action:"rt_disable_transcoding",rt_transcoder_nonce:rt_transcoder_script.security_nonce_for_disabling_encoding};0===a(this).next("img").length&&a(this).after(a("").attr("src",rt_transcoder_script.loader_image).addClass("rtt-loader")),a.post(ajaxurl,c,function(b){b&&(a("#rtt-settings_updated").length>0&&(a("#rtt-settings_updated p").text(b),a("#rtt-settings_updated").show()),a("#disable-transcoding").next("img").remove(),a("#disable-transcoding").hide(),a("#enable-transcoding").css("display","inline"))})}}),a(document).on("click","#enable-transcoding",function(b){if(b.preventDefault(),confirm(rt_transcoder_script.enable_encoding)){var c={action:"rt_enable_transcoding",rt_transcoder_nonce:rt_transcoder_script.security_nonce_for_enabling_encoding};0===a(this).next("img").length&&a(this).after(a("").attr("src",rt_transcoder_script.loader_image).addClass("rtt-loader")),a.post(ajaxurl,c,function(b){b?(a("#rtt-settings_updated").length>0&&(a("#rtt-settings_updated p").text(b),a("#rtt-settings_updated").show()),a("#enable-transcoding").next("img").remove(),a("#enable-transcoding").hide(),a("#disable-transcoding").css("display","inline")):a("#settings-error-transcoding-disabled").remove()})}})})}(jQuery); \ No newline at end of file +(()=>{var t;(t=jQuery)(document).ready((function(){t(document).on("click","#api-key-submit",(function(e){if(!document.getElementById("new-api-key").value){t("#api-key-error").remove();var r=t("

",{id:"api-key-error",class:"error"});t("h1:first").after(r.html(t("

").text(rt_transcoder_script.error_empty_key))),e.preventDefault()}})),t(document).on("click","#disable-transcoding",(function(e){if(e.preventDefault(),confirm(rt_transcoder_script.disable_encoding)){var r={action:"rt_disable_transcoding",rt_transcoder_nonce:rt_transcoder_script.security_nonce_for_disabling_encoding};0===t(this).next("img").length&&t(this).after(t("").attr("src",rt_transcoder_script.loader_image).addClass("rtt-loader")),t.post(ajaxurl,r,(function(e){e&&(t("#rtt-settings_updated").length>0&&(t("#rtt-settings_updated p").text(e),t("#rtt-settings_updated").show()),t("#disable-transcoding").next("img").remove(),t("#disable-transcoding").hide(),t("#enable-transcoding").css("display","inline"))}))}})),t(document).on("click","#enable-transcoding",(function(e){if(e.preventDefault(),confirm(rt_transcoder_script.enable_encoding)){var r={action:"rt_enable_transcoding",rt_transcoder_nonce:rt_transcoder_script.security_nonce_for_enabling_encoding};0===t(this).next("img").length&&t(this).after(t("").attr("src",rt_transcoder_script.loader_image).addClass("rtt-loader")),t.post(ajaxurl,r,(function(e){e?(t("#rtt-settings_updated").length>0&&(t("#rtt-settings_updated p").text(e),t("#rtt-settings_updated").show()),t("#enable-transcoding").next("img").remove(),t("#enable-transcoding").hide(),t("#disable-transcoding").css("display","inline")):t("#settings-error-transcoding-disabled").remove()}))}})),t(document).on("click","#watermark-checkbox",(function(e){t(this).is(":checked")?t("#watermark-text").closest("tr").show():t("#watermark-text").closest("tr").hide()}))}))})(); \ No newline at end of file diff --git a/admin/js/rt-transcoder-uploader.js b/admin/js/rt-transcoder-uploader.js new file mode 100644 index 0000000..b0d1b07 --- /dev/null +++ b/admin/js/rt-transcoder-uploader.js @@ -0,0 +1,99 @@ +(function($) { + $(document).ready(function() { + if (typeof wp === 'undefined' || typeof wp.Uploader === 'undefined') { + console.error('wp.Uploader is not available.'); + return; + } + + const progressBars = new Map(); + + // Check for existing video files in the media library. + setTimeout(checkExistingVideoProgress, 500); + + // Listen for new files added to the queue. + wp.Uploader.queue.on('add', function(file) { + wp.Uploader.queue.on('reset', function() { + // Only show progress bar for video files. + if (file.attributes.type !== 'video') return; + + attachmentId = file.id; + initializeProgressBar(attachmentId); + }); + }); + + /** + * Initialize progress bar for the given attachment. + * + * @param {number} attachmentId + */ + function initializeProgressBar(attachmentId) { + const progressBar = $( + `

` + ); + + const mediaItemPreview = $(`.attachments .attachment[data-id="${attachmentId}"] .attachment-preview`); + if (!mediaItemPreview.length) return; + + mediaItemPreview.append(progressBar); + progressBars.set(attachmentId, progressBar); + monitorProgress(attachmentId); + } + + + /** + * Check for existing video files in the media. + * + */ + function checkExistingVideoProgress() { + const videoQuery = wp.media.query({ + type: 'video', + posts_per_page: -1, + }); + + videoQuery.more().done(function() { + const videoAttachments = videoQuery.models; + videoAttachments.forEach(function(attachment) { + const attachmentId = attachment.id; + initializeProgressBar(attachmentId); + }) + }); + } + + + /** + * Monitor the transcoding progress of the given attachment. + * + * @param {number} attachmentId + */ + function monitorProgress(attachmentId) { + const progressBar = progressBars.get(attachmentId); + if (!progressBar) return; + + $.ajax({ + url: `${transcoderSettings.restUrl}/${attachmentId}`, + method: 'GET', + beforeSend: xhr => xhr.setRequestHeader('X-WP-Nonce', transcoderSettings.nonce), + success: function(data) { + const progress = parseFloat(data.progress) || 0; + progressBar.show(); + progressBar.find('.progress').css('width', `${progress}%`); + progressBar.find('.progress-text').text(`${progress}%`); + + if (progress < 100) { + setTimeout(() => monitorProgress(attachmentId), 5000); + } else { + progressBar.remove(); + progressBars.delete(attachmentId); + } + }, + error: function() { + setTimeout(() => monitorProgress(attachmentId), 5000); + } + }); + } + }); +})(jQuery); \ No newline at end of file diff --git a/admin/js/rt-transcoder-uploader.min.js b/admin/js/rt-transcoder-uploader.min.js new file mode 100644 index 0000000..e578621 --- /dev/null +++ b/admin/js/rt-transcoder-uploader.min.js @@ -0,0 +1 @@ +(()=>{var e;(e=jQuery)(document).ready((function(){if("undefined"==typeof wp||void 0===wp.Uploader)return void console.error("wp.Uploader is not available.");const t=new Map;function n(n){const s=e(''),r=e(`.attachments .attachment[data-id="${n}"] .attachment-preview`);r.length&&(r.append(s),t.set(n,s),o(n))}function o(n){const s=t.get(n);s&&e.ajax({url:`${transcoderSettings.restUrl}/${n}`,method:"GET",beforeSend:e=>e.setRequestHeader("X-WP-Nonce",transcoderSettings.nonce),success:function(e){const r=parseFloat(e.progress)||0;s.show(),s.find(".progress").css("width",`${r}%`),s.find(".progress-text").text(`${r}%`),r<100?setTimeout((()=>o(n)),5e3):(s.remove(),t.delete(n))},error:function(){setTimeout((()=>o(n)),5e3)}})}setTimeout((function(){const e=wp.media.query({type:"video",posts_per_page:-1});e.more().done((function(){e.models.forEach((function(e){n(e.id)}))}))}),500),wp.Uploader.queue.on("add",(function(e){wp.Uploader.queue.on("reset",(function(){"video"===e.attributes.type&&(attachmentId=e.id,n(attachmentId))}))}))}))})(); \ No newline at end of file diff --git a/admin/js/rt-transcoder.min.js b/admin/js/rt-transcoder.min.js index 6a55e0c..44e68ee 100755 --- a/admin/js/rt-transcoder.min.js +++ b/admin/js/rt-transcoder.min.js @@ -1,6 +1 @@ -/*! - * Transcoder Library - * @package Transcoder - */ - -!function(a){a(document).ready(function(){transcoding_status.load_flag&&a('[name="check_status_btn"]').click(function(b){var c=a(this).data("value"),d=a("#btn_check_status"+c).text(),e=a("#span_status"+c),f=a("#btn_check_status"+c);e.text(""),f.text("Checking..."),e.hide(),f.prop("disabled",!0);var g={action:"checkstatus",postid:c,security:transcoding_status.security_nonce};jQuery.post(ajaxurl,g,function(a){var b=jQuery.parseJSON(a.replace(/"/g,'"'));"Success"===b.status&&f.hide(),e.text(b.message),e.show(),f.text(d),f.prop("disabled",!1)})})})}(jQuery); \ No newline at end of file +(()=>{var t;(t=jQuery)(document).ready((function(){transcoding_status.load_flag&&t('[name="check_status_btn"]').click((function(s){var a=t(this).data("value"),e=t("#btn_check_status"+a).text(),c=t("#span_status"+a),u=t("#btn_check_status"+a);c.text(""),u.text("Checking..."),c.hide(),u.prop("disabled",!0);var n={action:"checkstatus",postid:a,security:transcoding_status.security_nonce};jQuery.post(ajaxurl,n,(function(t){var s=jQuery.parseJSON(t.replace(/"/g,'"'));"Success"===s.status&&u.hide(),c.text(s.message),c.show(),u.text(e),u.prop("disabled",!1)}))}))}))})(); \ No newline at end of file diff --git a/admin/partials/rt-transcoder-admin-display.php b/admin/partials/rt-transcoder-admin-display.php index 5af85ba..1a4d05c 100755 --- a/admin/partials/rt-transcoder-admin-display.php +++ b/admin/partials/rt-transcoder-admin-display.php @@ -1,4 +1,5 @@ api_key] ?? null; +$has_access = ! empty($this->api_key) && + is_object($usage) && + ! empty($usage->status) && + (! isset($usage->remaining) || $usage->remaining > 0); +// Temporarily allow access to all users. +// $has_access = true; ?>

- + - rtCamp + title="rtCamp : "> + rtCamp

-

+ - - - + + +

@@ -47,144 +58,144 @@ $enable_btn_style = 'display:none;'; $disable_btn_style = 'display:none;'; - if ( $this->api_key ) { + if ($this->api_key) { $enable_btn_style = 'display:inline;'; - } elseif ( $this->stored_api_key ) { + } elseif ($this->stored_api_key) { $disable_btn_style = 'display:inline;'; } ?> - - + +

- - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + $button = $this->transcoding_subscription_button('silver', 9); + echo wp_kses($button, $allowed_tags); + ?> + +
- - - - - -
+ + + + + +
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
-   - - + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+   + + array( - 'href' => array(), - 'target' => array(), - 'title' => array(), - 'class' => array(), - ), - 'div' => array( - 'title' => array(), - 'id' => array(), - ), - 'button' => array( - 'disabled' => array(), - 'data-plan' => array(), - 'data-price' => array(), - 'type' => array(), - 'class' => array(), - ), - 'textarea' => array( - 'rows' => array(), - 'cols' => array(), - 'id' => array(), - ), - 'p' => array(), - ); + $allowed_tags = array( + 'a' => array( + 'href' => array(), + 'target' => array(), + 'title' => array(), + 'class' => array(), + ), + 'div' => array( + 'title' => array(), + 'id' => array(), + ), + 'button' => array( + 'disabled' => array(), + 'data-plan' => array(), + 'data-price' => array(), + 'type' => array(), + 'class' => array(), + ), + 'textarea' => array( + 'rows' => array(), + 'cols' => array(), + 'id' => array(), + ), + 'p' => array(), + ); - $button = $this->transcoding_subscription_button( 'free', 0 ); - echo wp_kses( $button, $allowed_tags ); - ?> - - transcoding_subscription_button('free', 0); + echo wp_kses($button, $allowed_tags); + ?> + + transcoding_subscription_button( 'silver', 9 ); - echo wp_kses( $button, $allowed_tags ); - ?> -
@@ -196,7 +207,7 @@ 'i' => array(), 'strong' => array(), ); - printf( wp_kses( __( 'Note: Transcoder will only work on publicly accessible websites. If you are using Transcoder on a locally hosted website (i.e. localhost), we will be unable to identify the source of your audio/video transcoding requests.', 'transcoder' ), $allowed_tags ) ); + printf(wp_kses(__('Note: Transcoder will only work on publicly accessible websites. If you are using Transcoder on a locally hosted website (i.e. localhost), we will be unable to identify the source of your audio/video transcoding requests.', 'transcoder'), $allowed_tags)); ?>

@@ -206,29 +217,29 @@
+ + + + + + + + + + + +
- + - + Edit > Video Thumbnails. Thumbnails are only generated when the video is first uploaded. Maximum value is 10.', 'transcoder' ); + esc_html_e('This field specifies the number of video thumbnails that will be generated by the Transcoder. To choose from the generated thumbnails for a video, go to ​Media > Edit > Video Thumbnails. Thumbnails are only generated when the video is first uploaded. Maximum value is 10.', 'transcoder'); ?> @@ -236,20 +247,20 @@
- + - /> + /> @@ -257,20 +268,77 @@
- + - /> + /> + + +
+ + + + /> + + + + + + +
+ + + + /> + + + + + + +
+ + + + /> + + + + @@ -283,7 +351,7 @@ echo wp_kses( sprintf( /* translators: 1. URL of documentation page. */ - __( 'Visit our documentation page for more details', 'transcoder' ), + __('Visit our documentation page for more details', 'transcoder'), 'https://rtmedia.io/docs/transcoder/' ), array( @@ -317,11 +385,11 @@
- +

- +

@@ -329,29 +397,29 @@

-

-

- - + +

- - + +

@@ -361,7 +429,7 @@

- +

@@ -371,9 +439,9 @@ method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
- + - +
@@ -383,4 +451,4 @@
-
+
\ No newline at end of file diff --git a/admin/rt-retranscode-admin.php b/admin/rt-retranscode-admin.php index 45fcccf..3629473 100644 --- a/admin/rt-retranscode-admin.php +++ b/admin/rt-retranscode-admin.php @@ -48,6 +48,8 @@ public function __construct() { $this->stored_api_key = get_site_option( 'rt-transcoding-api-key-stored' ); $this->usage_info = get_site_option( 'rt-transcoding-usage' ); + // Load Rest Endpoints. + $this->load_rest_endpoints(); // Do not activate re-transcoding without valid license key // Or usage are fully utilized. @@ -80,9 +82,6 @@ public function __construct() { // Allow people to change what capability is required to use this feature. $this->capability = apply_filters( 'retranscode_media_cap', 'manage_options' ); - - // Load Rest Endpoints. - $this->load_rest_endpoints(); } /** diff --git a/admin/rt-transcoder-actions.php b/admin/rt-transcoder-actions.php index d5322d7..e36367c 100644 --- a/admin/rt-transcoder-actions.php +++ b/admin/rt-transcoder-actions.php @@ -231,3 +231,148 @@ function rtt_update_wp_media_thumbnail( $thumb_url, $attachment_id ) { } add_action( 'transcoded_thumb_added', 'rtt_update_wp_media_thumbnail', 10, 2 ); + +/** + * Add a field for the transcoded URL to the media attachment edit screen. + * + * @param array $form_fields An array of attachment form fields. + * @param object $post The attachment post object. + * @return array The modified array of attachment form fields. + */ +function add_transcoded_url_field( $form_fields, $post ) { + $transcoded_url = get_post_meta( $post->ID, '_rt_transcoded_url', true ); + + // Check if adaptive bitrate streaming is enabled. + $adaptive_bitrate_enabled = get_option( 'rtt_adaptive_bitrate_streaming', false ); + + // Add the transcoded URL field. + $form_fields['transcoded_url'] = array( + 'label' => __( 'Transcoded MPD URL', 'transcoder' ), + 'input' => 'html', + 'html' => '', + 'value' => esc_url( $transcoded_url ), + 'helps' => __( 'Enter or edit the URL of the transcoded .mpd file stored on Amazon S3.', 'transcoder' ), + ); + + // Add a note if adaptive bitrate streaming is disabled. + if ( ! $adaptive_bitrate_enabled ) { + $form_fields['transcoded_url']['helps'] = __( 'This feature is available only when adaptive bitrate streaming is enabled.', 'transcoder' ); + } + + return $form_fields; +} + +add_filter( 'attachment_fields_to_edit', 'add_transcoded_url_field', 10, 2 ); + +/** + * Save the transcoded URL field when the attachment is saved. + * + * @param array $post The post data for the attachment. + * @param array $attachment The attachment data. + * @return array The post data for the attachment. + */ +function save_transcoded_url_field( $post, $attachment ) { + // Check if adaptive bitrate streaming is enabled. + $adaptive_bitrate_enabled = get_option( 'rtt_adaptive_bitrate_streaming', false ); + if ( ! $adaptive_bitrate_enabled ) { + return $post; + } + + if ( isset( $attachment['transcoded_url'] ) ) { + // Check the user's permissions. + if ( ! current_user_can( 'edit_post', $post['ID'] ) ) { + return $post; + } + // Update the post meta with the new value. + update_post_meta( $post['ID'], '_rt_transcoded_url', esc_url_raw( $attachment['transcoded_url'] ) ); + } + + return $post; +} + +add_filter( 'attachment_fields_to_save', 'save_transcoded_url_field', 10, 2 ); + +/** + * Register the transcoded URL meta field. + */ +function register_rt_transcoded_url_meta() { + register_post_meta( + 'attachment', + '_rt_transcoded_url', + array( + 'type' => 'string', + 'single' => true, + 'show_in_rest' => true, + 'auth_callback' => function () { + return current_user_can( 'edit_posts' ); + }, + ) + ); +} +add_action( 'init', 'register_rt_transcoded_url_meta' ); + +/** + * Add a watermark to the media using FFmpeg. + * + * @param array $upload The uploaded file data. + * + * @return array The modified uploaded file data. + */ +function add_text_watermark_to_media( $upload ) { + + // Check if the uploaded file is a video or image. + $file_type = wp_check_filetype( $upload['file'] ); + $video_extensions = array( 'mp4', 'mov', 'avi', 'mkv' ); + $image_extensions = array( 'jpg', 'jpeg', 'png', 'gif', 'bmp' ); + + if ( in_array( $file_type['ext'], $video_extensions ) ) { + $is_video = true; + } elseif ( in_array( $file_type['ext'], $image_extensions ) ) { + $is_video = false; + } else { + return $upload; + } + + // Check if the watermark is enabled. + $watermark_enabled = get_option( 'rtt_watermark', false ); + if ( ! $watermark_enabled ) { + return $upload; + } + + // Get the watermark text from settings. + $watermark_text = get_option( 'rtt_watermark_text', 'Your Watermark' ); + if ( empty( $watermark_text ) ) { + return $upload; + } + + // Define paths. + $uploaded_file_path = $upload['file']; + $output_file_path = str_replace( '.', '-watermarked.', $uploaded_file_path ); + + // Define the FFmpeg command. + $ffmpeg_path = '/opt/homebrew/bin/ffmpeg'; // TODO: Update the path to FFmpeg. + $drawtext_filter = "drawtext=text='" . addslashes( $watermark_text ) . + "':fontcolor=white:fontsize=32:x=w-text_w-20:y=h-text_h-20"; + + if ( $is_video ) { + $ffmpeg_command = $ffmpeg_path . ' -i ' . escapeshellarg( $uploaded_file_path ) . + ' -vf "' . $drawtext_filter . '" -codec:a copy -codec:v libx264 -crf 18 -preset veryfast ' . + escapeshellarg( $output_file_path ); + } else { + $ffmpeg_command = $ffmpeg_path . ' -i ' . escapeshellarg( $uploaded_file_path ) . + ' -vf "' . $drawtext_filter . '" ' . + escapeshellarg( $output_file_path ); + } + + // Execute the FFmpeg command. + exec( $ffmpeg_command, $output, $return_var ); + + if ( 0 === $return_var && file_exists( $output_file_path ) ) { + unlink( $uploaded_file_path ); + rename( $output_file_path, $uploaded_file_path ); + } + + return $upload; +} + +add_filter( 'wp_handle_upload', 'add_text_watermark_to_media' ); diff --git a/admin/rt-transcoder-admin.php b/admin/rt-transcoder-admin.php index 570d759..1c0c2e2 100755 --- a/admin/rt-transcoder-admin.php +++ b/admin/rt-transcoder-admin.php @@ -125,7 +125,14 @@ public function add_settings_errors() { * @since 1.0.0 */ public function menu() { - add_menu_page( 'Transcoder', 'Transcoder', 'manage_options', 'rt-transcoder', array( $this, 'settings_page' ), RT_TRANSCODER_URL . 'admin/images/menu-icon.png', '40.2222' ); + add_submenu_page( + 'upload.php', + __( 'EasyDAM Settings', 'transcoder' ), + __( 'EasyDAM Settings', 'transcoder' ), + 'manage_options', + 'rt-transcoder', + array( $this, 'settings_page' ) + ); } /** @@ -137,6 +144,78 @@ public function register_transcoder_settings() { register_setting( 'rt-transcoder-settings-group', 'number_of_thumbs' ); register_setting( 'rt-transcoder-settings-group', 'rtt_override_thumbnail' ); register_setting( 'rt-transcoder-settings-group', 'rtt_client_check_status_button' ); + + // Check if the user has an active paid subscription. + $usage_details = get_site_option( 'rt-transcoding-usage' ); + $usage = $usage_details[ $this->api_key ] ?? null; + $has_access = ! empty( $this->api_key ) && + is_object( $usage ) && + ! empty( $usage->status ) && + ( ! isset( $usage->remaining ) || $usage->remaining > 0 ); + // Temporarily allow access to all users. + $has_access = true; + + // Register adaptive bitrate streaming setting with conditional default. + register_setting( + 'rt-transcoder-settings-group', + 'rtt_adaptive_bitrate_streaming', + array( + 'type' => 'boolean', + 'description' => __( 'Enable adaptive bitrate streaming for videos.', 'transcoder' ), + 'sanitize_callback' => array( $this, 'sanitize_adaptive_bitrate' ), + 'default' => $has_access, + ) + ); + + // Register watermark settings. + register_setting( + 'rt-transcoder-settings-group', + 'rtt_watermark', + array( + 'type' => 'boolean', + 'description' => __( 'Enable watermark on uploaded media.', 'transcoder' ), + 'sanitize_callback' => 'absint', + 'default' => 0, + ) + ); + + // Register watermark text setting. + register_setting( + 'rt-transcoder-settings-group', + 'rtt_watermark_text', + array( + 'type' => 'string', + 'description' => __( 'Enter watermark text.', 'transcoder' ), + 'sanitize_callback' => 'sanitize_text_field', + 'default' => '', + ) + ); + } + + /** + * Sanitize adaptive bitrate streaming setting. + * + * @since 1.0.0 + * + * @param bool $value The value to sanitize. + * @return bool + */ + public function sanitize_adaptive_bitrate( $value ) { + $usage_details = get_site_option( 'rt-transcoding-usage' ); + $usage = $usage_details[ $this->api_key ] ?? null; + $has_access = ! empty( $this->api_key ) && + is_object( $usage ) && + ! empty( $usage->status ) && + ( ! isset( $usage->remaining ) || $usage->remaining > 0 ); + // Temporarily allow access to all users. + $has_access = true; + + if ( ! $has_access ) { + add_settings_error( 'rt-transcoder-settings-group', 'rtt_adaptive_bitrate_streaming', __( 'You need to have an active subscription to enable adaptive bitrate streaming.', 'transcoder' ), 'error' ); + return false; + } + + return isset( $value ) && ( '1' === $value || 1 === $value || true === $value ); } /** @@ -187,13 +266,13 @@ public function enqueue_scripts_styles() { $page = transcoder_filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); - if ( 'admin.php' !== $pagenow || 'rt-transcoder' !== $page ) { + if ( 'upload.php' !== $pagenow && ( 'admin.php' !== $pagenow && 'rt-transcoder' !== $page ) ) { return; } $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; - wp_enqueue_style( 'rt-transcoder-admin-css', RT_TRANSCODER_URL . 'admin/css/rt-transcoder-admin' . $suffix . '.css', array(), RT_TRANSCODER_VERSION ); - wp_register_script( 'rt-transcoder-main', RT_TRANSCODER_URL . 'admin/js/rt-transcoder-admin' . $suffix . '.js', array( 'jquery' ), RT_TRANSCODER_VERSION, true ); + wp_enqueue_style( 'rt-transcoder-admin-css', RT_TRANSCODER_URL . 'admin/css/rt-transcoder-admin' . $suffix . '.css', array(), filemtime( RT_TRANSCODER_PATH . 'admin/css/rt-transcoder-admin' . $suffix . '.css' ) ); + wp_register_script( 'rt-transcoder-main', RT_TRANSCODER_URL . 'admin/js/rt-transcoder-admin' . $suffix . '.js', array( 'jquery' ), filemtime( RT_TRANSCODER_PATH . 'admin/js/rt-transcoder-admin' . $suffix . '.js' ), true ); $localize_script_data = array( 'admin_url' => esc_url( admin_url() ), @@ -209,6 +288,34 @@ public function enqueue_scripts_styles() { wp_localize_script( 'rt-transcoder-main', 'rt_transcoder_script', $localize_script_data ); wp_enqueue_script( 'rt-transcoder-main' ); + + wp_register_script( + 'rt-transcoder-uploader', + RT_TRANSCODER_URL . 'admin/js/rt-transcoder-uploader.js', + array( 'jquery' ), + RT_TRANSCODER_VERSION, + true + ); + + wp_localize_script( + 'rt-transcoder-uploader', + 'transcoderSettings', + array( + 'restUrl' => esc_url_raw( rest_url( 'transcoder/v1/transcoding-status' ) ), + 'nonce' => wp_create_nonce( 'wp_rest' ), + ) + ); + + wp_enqueue_script( 'rt-transcoder-uploader' ); + + wp_register_style( + 'rt-progress-bar', + RT_TRANSCODER_URL . 'admin/css/rt-progress-bar.css', + array(), + RT_TRANSCODER_VERSION + ); + + wp_enqueue_style( 'rt-progress-bar' ); } /** diff --git a/admin/rt-transcoder-handler.php b/admin/rt-transcoder-handler.php index c155f2e..fef3425 100755 --- a/admin/rt-transcoder-handler.php +++ b/admin/rt-transcoder-handler.php @@ -29,7 +29,7 @@ class RT_Transcoder_Handler { * @access protected * @var string $transcoding_api_url The URL of the api. */ - protected $transcoding_api_url = 'https://api.rtmedia.io/api/v1/'; + public $transcoding_api_url = 'http://frappe-transcoder-api.rt.gw/api/'; /** * The URL of the EDD store. @@ -38,7 +38,7 @@ class RT_Transcoder_Handler { * @access protected * @var string $store_url The URL of the transcoder api. */ - protected $store_url = 'https://rtmedia.io/'; + protected $store_url = 'http://frappe-transcoder-api.rt.gw/api/'; /** * Contain uploaded media information. @@ -74,7 +74,7 @@ class RT_Transcoder_Handler { * @access public * @var string $video_extensions Video extensions with comma separated. */ - public $video_extensions = ',mov,m4v,m2v,avi,mpg,flv,wmv,mkv,webm,ogv,mxf,asf,vob,mts,qt,mpeg,x-msvideo,3gp'; + public $video_extensions = ',mov,m4v,m2v,avi,mpg,flv,wmv,mkv,webm,ogv,mxf,asf,vob,mts,qt,mpeg,x-msvideo,3gp,mpd'; /** * Audio extensions with comma separated. @@ -118,6 +118,9 @@ public function __construct( $no_init = false ) { $this->api_key = get_site_option( 'rt-transcoding-api-key' ); $this->stored_api_key = get_site_option( 'rt-transcoding-api-key-stored' ); + // Temporarily inclduing rt-retranscode-admin.php file here. + include_once RT_TRANSCODER_PATH . 'admin/rt-retranscode-admin.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant + /** * Allow other plugin and wp-config to overwrite API URL. */ @@ -136,7 +139,8 @@ public function __construct( $no_init = false ) { } add_action( 'admin_init', array( $this, 'save_api_key' ), 10, 1 ); - + + // phpcs:disable if ( $this->api_key ) { // Store api key as different db key if user disable transcoding service. if ( ! $this->stored_api_key ) { @@ -147,24 +151,24 @@ public function __construct( $no_init = false ) { $usage_info = get_site_option( 'rt-transcoding-usage' ); if ( isset( $usage_info ) && is_array( $usage_info ) && array_key_exists( $this->api_key, $usage_info ) ) { - if ( isset( $usage_info[ $this->api_key ]->plan->expires ) - && strtotime( $usage_info[ $this->api_key ]->plan->expires ) < time() ) { - $usage_info = $this->update_usage( $this->api_key ); - } - if ( array_key_exists( $this->api_key, $usage_info ) && is_object( $usage_info[ $this->api_key ] ) && isset( $usage_info[ $this->api_key ]->status ) && $usage_info[ $this->api_key ]->status ) { + // if ( isset( $usage_info[ $this->api_key ]->plan->expires ) + // && strtotime( $usage_info[ $this->api_key ]->plan->expires ) < time() ) { + // $usage_info = $this->update_usage( $this->api_key ); + // } + if ( array_key_exists( $this->api_key, $usage_info ) && is_object( $usage_info[ $this->api_key ] ) && isset( $usage_info[ $this->api_key ]->status ) && 'Active' === $usage_info[ $this->api_key ]->status ) { if ( isset( $usage_info[ $this->api_key ]->remaining ) && $usage_info[ $this->api_key ]->remaining > 0 ) { // Enable re-transcoding. include_once RT_TRANSCODER_PATH . 'admin/rt-retranscode-admin.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant - if ( $usage_info[ $this->api_key ]->remaining < 524288000 && ! get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { - $this->nearing_usage_limit( $usage_info ); - } elseif ( $usage_info[ $this->api_key ]->remaining > 524288000 && get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { - update_site_option( 'rt-transcoding-usage-limit-mail', 0 ); - } - if ( strtotime( $usage_info[ $this->api_key ]->plan->expires ) > time() ) { - add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); - } + // if ( $usage_info[ $this->api_key ]->remaining < 524288000 && ! get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { + // $this->nearing_usage_limit( $usage_info ); + // } elseif ( $usage_info[ $this->api_key ]->remaining > 524288000 && get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { + // update_site_option( 'rt-transcoding-usage-limit-mail', 0 ); + // } + // if ( strtotime( $usage_info[ $this->api_key ]->plan->expires ) > time() ) { + // add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); + // } /* Do not let the user to upload non supported media types on localhost */ $blacklist = rtt_get_blacklist_ip_addresses(); @@ -178,11 +182,16 @@ public function __construct( $no_init = false ) { } } } + // phpcs:enable add_action( 'init', array( $this, 'handle_callback' ), 20 ); add_action( 'wp_ajax_rt_disable_transcoding', array( $this, 'disable_transcoding' ), 1 ); add_action( 'wp_ajax_rt_enable_transcoding', array( $this, 'enable_transcoding' ), 1 ); add_action( 'add_attachment', array( $this, 'after_upload_pdf' ) ); + add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); + add_filter( 'rtmedia_plupload_files_filter', array( $this, 'allowed_types' ), 10, 1 ); + add_filter( 'rtmedia_allowed_types', array( $this, 'allowed_types_admin_settings' ), 10, 1 ); + add_filter( 'rtmedia_valid_type_check', array( $this, 'bypass_video_audio' ), 10, 2 ); } /** @@ -234,7 +243,7 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat $options_video_thumb = 5; } - $job_type = 'video'; + $job_type = 'stream'; if ( ( ! empty( $type_array ) && 'audio' === $type_array[0] ) || in_array( $extension, explode( ',', $this->audio_extensions ), true ) ) { $job_type = 'audio'; @@ -256,26 +265,34 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat } } + // Media settings. + $rtt_adaptive_bitrate_streaming = $rtt_enable_adaptive_bitrate = get_option('rtt_adaptive_bitrate_streaming', false); + $rtt_watermark = get_option('rtt_watermark', false); + $rtt_watermark_text = get_option('rtt_watermark_text', false); + $rtt_watermark_text = sanitize_text_field( $rtt_watermark_text ); + $args = array( 'method' => 'POST', 'sslverify' => false, 'timeout' => 60, // phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout 'body' => array( - 'api_token' => $this->api_key, - 'job_type' => $job_type, - 'job_for' => $job_for, - 'file_url' => rawurlencode( $url ), - 'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), - 'force' => 0, - 'formats' => ( true === $autoformat ) ? ( ( 'video' === $type_array[0] ) ? 'mp4' : 'mp3' ) : $autoformat, - 'thumb_count' => $options_video_thumb, + 'api_token' => $this->api_key, + 'job_type' => $job_type, + 'job_for' => $job_for, + 'file_origin' => rawurlencode( $url ), + 'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), + 'force' => 0, + 'formats' => ( true === $autoformat ) ? ( ( 'video' === $type_array[0] ) ? 'mp4' : 'mp3' ) : $autoformat, + 'thumbnail_count' => $options_video_thumb, + 'stream' => boolval($rtt_adaptive_bitrate_streaming), + 'watermark' => boolval($rtt_watermark), + 'watermark_text' => $rtt_watermark_text, ), ); - $transcoding_url = $this->transcoding_api_url . 'job/'; + $transcoding_url = $this->transcoding_api_url . 'resource/Transcoder Job'; $upload_page = wp_remote_post( $transcoding_url, $args ); - if ( ! is_wp_error( $upload_page ) && ( isset( $upload_page['response']['code'] ) && @@ -283,8 +300,9 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat ) ) { $upload_info = json_decode( $upload_page['body'] ); - if ( isset( $upload_info->status ) && $upload_info->status && isset( $upload_info->job_id ) && $upload_info->job_id ) { - $job_id = $upload_info->job_id; + error_log( json_encode( $upload_info ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.WP.AlternativeFunctions.json_encode_json_encode + if ( isset( $upload_info->data ) && isset( $upload_info->data->name ) ) { + $job_id = $upload_info->data->name; update_post_meta( $attachment_id, '_rt_transcoding_job_id', $job_id ); } } @@ -350,7 +368,7 @@ public function bypass_video_audio( $flag, $file ) { * @return boolean $status If true then key is valid else key is not valid. */ public function is_valid_key( $key ) { - $validate_url = trailingslashit( $this->store_url ) . 'rt-eddsl-api/?rt-eddsl-license-key=' . $key; + $validate_url = trailingslashit( $this->store_url ) . '/resource/Transcoder License/' . $key; if ( function_exists( 'vip_safe_wp_remote_get' ) ) { $validation_page = vip_safe_wp_remote_get( $validate_url, '', 3, 3 ); } else { @@ -358,8 +376,8 @@ public function is_valid_key( $key ) { } if ( ! is_wp_error( $validation_page ) ) { $validation_info = json_decode( $validation_page['body'] ); - if ( isset( $validation_info->status ) ) { - $status = $validation_info->status; + if ( isset( $validation_info->data->status ) && 'Active' === $validation_info->data->status ) { + $status = true; } } else { $status = false; @@ -378,7 +396,7 @@ public function is_valid_key( $key ) { * @return array $usage_info An array containing usage information. */ public function update_usage( $key ) { - $usage_url = trailingslashit( $this->transcoding_api_url ) . 'usage/' . $key; + $usage_url = trailingslashit( $this->transcoding_api_url ) . 'resource/Transcoder License/' . $key; if ( function_exists( 'vip_safe_wp_remote_get' ) ) { $usage_page = vip_safe_wp_remote_get( $usage_url, '', 3, 3 ); } else { @@ -386,6 +404,7 @@ public function update_usage( $key ) { } if ( ! is_wp_error( $usage_page ) ) { $usage_info = json_decode( $usage_page['body'] ); + $usage_info = $usage_info->data; } else { $usage_info = null; } @@ -463,7 +482,7 @@ public function usage_quota_over() { */ public function save_api_key() { $is_api_key_updated = transcoder_filter_input( INPUT_GET, 'api-key-updated', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); - $is_invalid_license_key = transcoder_filter_input( INPUT_GET, 'invalid-license-key', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); + $is_invalid_license_key = false; $is_localhost = transcoder_filter_input( INPUT_GET, 'need-public-host', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); if ( $is_api_key_updated ) { @@ -514,7 +533,7 @@ public function save_api_key() { $return_page = add_query_arg( array( 'page' => 'rt-transcoder', - 'api-key-updated' => $usage_info->plan->name ? ucfirst( strtolower( $usage_info->plan->name ) ) : 'Free', + 'api-key-updated' => $usage_info->plan ? ucfirst( strtolower( $usage_info->plan ) ) : 'Free', ), admin_url( 'admin.php' ) ); @@ -1151,7 +1170,11 @@ public function handle_callback() { } if ( ! empty( $post_array['files'] ) ) { - $this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); + if ( ! empty( $post_array['files']['mpd'] ) ) { + update_post_meta( $attachment_id, '_rt_transcoded_url', $post_array['download_url'] ); + } else { + $this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); + } } } else { $flag = esc_html__( 'Something went wrong. The required attachment id does not exists. It must have been deleted.', 'transcoder' ); @@ -1632,6 +1655,8 @@ private function filter_transcoder_response() { $post_array['files']['mp4'][] = filter_var( $post_var['files']['mp4'][0], FILTER_SANITIZE_URL ); } elseif ( ! empty( $post_var['files']['mp3'][0] ) ) { $post_array['files']['mp3'][] = filter_var( $post_var['files']['mp3'][0], FILTER_SANITIZE_URL ); + } elseif ( ! empty( $post_var['files']['mpd'][0] ) ) { + $post_array['files']['mpd'][] = filter_var( $post_var['files']['mpd'][0], FILTER_SANITIZE_URL ); } $post_array['thumbnail'] = array(); diff --git a/admin/rt-transcoder-progressbar.php b/admin/rt-transcoder-progressbar.php index 009292d..6113153 100644 --- a/admin/rt-transcoder-progressbar.php +++ b/admin/rt-transcoder-progressbar.php @@ -27,7 +27,6 @@ class RT_Progress { * @return void */ public function __construct() { - } /** diff --git a/admin/rt-transcoder-rest-routes.php b/admin/rt-transcoder-rest-routes.php index c3576d2..21aa4c8 100644 --- a/admin/rt-transcoder-rest-routes.php +++ b/admin/rt-transcoder-rest-routes.php @@ -24,6 +24,25 @@ class Transcoder_Rest_Routes extends WP_REST_Controller { */ public $namespace_prefix = 'transcoder/v'; + /** + * RT Transcoder Handler object. + * + * @var RT_Transcoder_Handler + */ + public $rt_transcoder_handler; + + /** + * Constructor + * + * @since 1.0.0 + * + * @access public + * @return void + */ + public function __construct() { + $this->rt_transcoder_handler = new RT_Transcoder_Handler( true ); + } + /** * Function to register routes. */ @@ -50,6 +69,17 @@ public function register_routes() { 'permission_callback' => '__return_true', ) ); + + // Register `transcoding-status` route to get transcoding status of a media. + register_rest_route( + $this->namespace_prefix . $this->version, + '/transcoding-status/(?P\d+)', + array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_transcoding_status' ), + 'permission_callback' => '__return_true', + ) + ); } /** @@ -152,4 +182,140 @@ private function get_media_data_by_id( $media_id ) { ); } + /** + * Return transcoding status of a media. + * + * @since 1.2 + * + * @param WP_REST_Request $request REST request object. + * + * @return WP_REST_Response|WP_Error + */ + public function get_transcoding_status( WP_REST_Request $request ) { + $post_id = (int) $request['id']; + + if ( empty( $post_id ) ) { + return new WP_Error( + 'invalid_post_id', + __( 'Something went wrong. Please try again!', 'transcoder' ), + array( 'status' => 400 ) + ); + } + + $job_id = get_post_meta( $post_id, '_rt_transcoding_job_id', true ); + $transcoded_files = get_post_meta( $post_id, '_rt_media_transcoded_files', true ); + $transcoded_thumbs = get_post_meta( $post_id, '_rt_media_thumbnails', true ); + $thumbnail = get_post_meta( $post_id, '_rt_media_video_thumbnail', true ); + + $status_url = trailingslashit( $this->rt_transcoder_handler->transcoding_api_url ) . 'job/status/' . $job_id . '/' . get_site_option( 'rt-transcoding-api-key-stored' ); + + $message = ''; + $response = array(); + $status = 'running'; + $progress = 0; + + if ( ! empty( $transcoded_files ) && ! empty( $transcoded_thumbs ) ) { + + $message = __( 'Your file is transcoded successfully. Please refresh the page.', 'transcoder' ); + $status = 'Success'; + $progress = 100; + $upload_dir = wp_upload_dir(); + + $response['files'] = $upload_dir['baseurl'] . '/' . $transcoded_files['mp4'][0]; + $response['thumbnail'] = $upload_dir['baseurl'] . '/' . $thumbnail; + + global $wpdb; + $media_id = wp_cache_get( 'post_' . $post_id, 'transcoder' ); + if ( empty( $media_id ) ) { + $results = $wpdb->get_results( $wpdb->prepare( 'SELECT id FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE media_id = %d', $post_id ), OBJECT ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery + $media_id = $results[0]->id; + wp_cache_set( 'post_' . $post_id, $media_id, 'transcoder', 3600 ); + } + $response['media_id'] = $media_id; + + } else { + + if ( function_exists( 'vip_safe_wp_remote_get' ) ) { + $status_page = vip_safe_wp_remote_get( $status_url, '', 3, 3 ); + } else { + $status_page = wp_safe_remote_get( $status_url, array( 'timeout' => 120 ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout + } + + if ( ! is_wp_error( $status_page ) ) { + $status_info = json_decode( $status_page['body'] ); + } else { + $status_info = null; + } + + $messages = array( + 'null-response' => __( 'Looks like the server is taking too long to respond, Please try again in sometime.', 'transcoder' ), + 'failed' => __( 'Unfortunately, Transcoder failed to transcode this file.', 'transcoder' ), + 'running' => __( 'Your file is getting transcoded. Please refresh after some time.', 'transcoder' ), + 'in-queue' => __( 'This file is still in the queue. Please refresh after some time.', 'transcoder' ), + 'receiving-back' => __( 'Your server should be ready to receive the transcoded file.', 'transcoder' ), + 'success' => __( 'Your file is transcoded successfully. Please refresh the page.', 'transcoder' ), + ); + + /** + * Filters the transcoding process status messages. + * + * @since 1.2 + * + * @param array $messages Default transcoding process status messages. + */ + $messages = apply_filters( 'rtt_transcoder_status_message', $messages ); + + if ( empty( $status_info ) || ! is_object( $status_info ) || empty( $status_info->job_id ) ) { + + $message = $messages['null-response']; + + } elseif ( ! empty( $status_info->error_code ) && ! empty( $status_info->error_msg ) ) { + + $message = $messages['failed']; + + } elseif ( 'processing' === $status_info->status && empty( $status_info->error_code ) && empty( $status_info->error_msg ) ) { + + $message = $messages['running']; + $progress = ! empty( $status_info->progress ) ? floatval( $status_info->progress ) : 0; + + } elseif ( 'processing' !== $status_info->status && '100' !== $status_info->progress && empty( $status_info->error_code ) && empty( $status_info->error_msg ) ) { + + $message = $messages['in-queue']; + $progress = ! empty( $status_info->progress ) ? floatval( $status_info->progress ) : 0; + + } elseif ( 'processed' === $status_info->status && 'video' === $status_info->job_type && ( empty( $transcoded_files ) || empty( $transcoded_thumbs ) ) ) { + + $message = $messages['receiving-back']; + $progress = 100; + + } elseif ( 'processed' === $status_info->status && ! empty( $transcoded_thumbs ) && ( ! empty( $transcoded_files ) || 'thumbnail' === $status_info->job_type ) ) { + + $message = $messages['success']; + $status = 'Success'; + $progress = 100; + + $upload_dir = wp_upload_dir(); + $response['files'] = $upload_dir['baseurl'] . '/' . $transcoded_files['mp4'][0]; + $response['thumbnail'] = $upload_dir['baseurl'] . '/' . $thumbnail; + + global $wpdb; + $results = $wpdb->get_results( $wpdb->prepare( 'SELECT id FROM ' . $wpdb->prefix . 'rt_rtm_media WHERE media_id = %d', $post_id ), OBJECT ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery + $response['media_id'] = $results[0]->id; + + } elseif ( 'processed' === $status_info->status && 'pdf' === $status_info->job_type ) { + $message = $messages['success']; + $status = 'Success'; + $progress = 100; + + } elseif ( ! empty( $status_info ) ) { + $message = $status_info->status; + } + } + + $response['message'] = esc_html( $message ); + $response['status'] = esc_html( $status ); + $response['progress'] = $progress; + + return rest_ensure_response( $response ); + } } diff --git a/assets/build/blocks/rt-player/block.json b/assets/build/blocks/rt-player/block.json new file mode 100644 index 0000000..06cc8ab --- /dev/null +++ b/assets/build/blocks/rt-player/block.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "transcoder/rt-player", + "version": "1.0.0", + "title": "RT Player", + "category": "media", + "icon": "video-alt3", + "description": "A block for embedding videos with a custom player.", + "supports": { + "html": false + }, + "attributes": { + "videoId": { + "type": "string" + }, + "videoUrl": { + "type": "string" + }, + "videoAlt": { + "type": "string" + }, + "useCustomSize": { + "type": "boolean", + "default": false + }, + "videoSize": { + "type": "object", + "default": {} + }, + "videoType": { + "type": "string" + }, + "videoPosterUrl": { + "type": "string" + } + }, + "textdomain": "transcoder", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "viewScript": "file:./frontend.js" +} \ No newline at end of file diff --git a/assets/build/blocks/rt-player/frontend.asset.php b/assets/build/blocks/rt-player/frontend.asset.php new file mode 100644 index 0000000..6d96075 --- /dev/null +++ b/assets/build/blocks/rt-player/frontend.asset.php @@ -0,0 +1 @@ + array(), 'version' => '48d40798ad322c0dbf90'); diff --git a/assets/build/blocks/rt-player/frontend.js b/assets/build/blocks/rt-player/frontend.js new file mode 100644 index 0000000..d7102f8 --- /dev/null +++ b/assets/build/blocks/rt-player/frontend.js @@ -0,0 +1 @@ +document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".video-js").forEach((e=>{const t=JSON.parse(e.getAttribute("data-attributes"));videojs(e,{...t,plugins:{qualityMenu:{}}})}))})); \ No newline at end of file diff --git a/assets/build/blocks/rt-player/index-rtl.css b/assets/build/blocks/rt-player/index-rtl.css new file mode 100644 index 0000000..695ce8d --- /dev/null +++ b/assets/build/blocks/rt-player/index-rtl.css @@ -0,0 +1,3 @@ +.vjs-svg-icon{background-position:50%;background-repeat:no-repeat;display:inline-block;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{height:100%;right:0;position:absolute;top:0;width:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;font-style:normal;font-weight:400;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff")}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-style:normal;font-weight:400}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-style:normal;font-weight:400}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{background-color:#000;box-sizing:border-box;color:#fff;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:10px;font-style:normal;font-weight:400;line-height:1;padding:0;position:relative;vertical-align:top;word-break:normal}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{height:100%!important;width:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{max-width:100%;width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js .vjs-tech,.video-js.vjs-fill:not(.vjs-audio-only-mode){height:100%;width:100%}.video-js .vjs-tech{right:0;position:absolute;top:0}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{height:100%;margin:0;padding:0}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{bottom:0;right:0;overflow:hidden;position:fixed;left:0;top:0;z-index:1000}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{display:block;height:100%!important;padding-top:0!important;width:100%!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{background-color:rgba(0,0,0,.7);bottom:10%;font-size:2em;padding:.5em;position:absolute;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{cursor:default;opacity:.5}.video-js .vjs-offscreen{height:1px;right:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{background-color:#000;color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:18px;height:150px;margin:0 auto;padding:20px;text-align:center;width:300px}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{background-color:#2b333f;background-color:rgba(43,51,63,.7);border:.06666em solid #fff;border-radius:.3em;cursor:pointer;display:block;font-size:3em;height:1.63332em;right:50%;line-height:1.5em;margin-right:-1.5em;margin-top:-.81666em;opacity:1;padding:0;position:absolute;top:50%;transition:all .4s;width:3em}.vjs-big-play-button .vjs-svg-icon{height:1em;right:50%;line-height:1;position:absolute;top:50%;transform:translate(50%,-50%);width:1em}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{background-color:#73859f;background-color:rgba(115,133,159,.5);border-color:#fff;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-decoration:none;text-transform:none;transition:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{box-shadow:none;outline:.0625em solid #fff}.vjs-control .vjs-button{height:100%;width:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;left:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(-180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;font-family:Arial,Helvetica,sans-serif;margin:0;overflow:auto;padding:0}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;font-size:1.2em;justify-content:center;line-height:1.4em;list-style:none;margin:0;padding:.2em 0;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:none}.vjs-menu li.vjs-menu-title{cursor:default;font-size:1em;font-weight:700;line-height:2em;margin:0 0 .3em;padding:0;text-align:center;text-transform:uppercase}.vjs-menu-button-popup .vjs-menu{border-top-color:rgba(43,51,63,.7);bottom:0;display:none;height:0;right:-3em;margin-bottom:1.5em;position:absolute;width:10em}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{right:unset;left:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:1.5em;max-height:15em;position:absolute;width:100%}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{overflow:hidden;transition:all .4s}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{height:100%;right:4em;margin:0;opacity:0;padding:0;position:absolute;top:0;transition:all .4s;width:auto}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{height:100%;margin:0;overflow:hidden;width:auto}.video-js .vjs-control-bar{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:0;display:none;height:3em;right:0;position:absolute;left:0;width:100%}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;opacity:1;transition:visibility .1s,opacity .1s;visibility:visible}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s;visibility:visible}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;pointer-events:auto;visibility:visible}.video-js .vjs-control{flex:none;height:100%;margin:0;padding:0;position:relative;text-align:center;width:4em}.video-js .vjs-control.vjs-visible-text{padding-right:1em;padding-left:1em;width:auto}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{align-items:center;cursor:pointer;display:flex;flex:auto;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{align-items:center;display:flex}.video-js .vjs-progress-holder{flex:auto;height:.3em;transition:all .2s}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{display:block;height:100%;margin:0;padding:0;position:absolute;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;line-height:.35em;position:absolute;left:-.5em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{height:.9em;line-height:.15em;pointer-events:none;position:absolute;left:-.4em;top:-.35em;width:.9em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:hsla(0,0%,100%,.8);border-radius:.3em;color:#000;float:left;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{background-color:#000;display:none;height:100%;position:absolute;width:1px;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{opacity:0;transition:visibility 1s,opacity 1s;visibility:hidden}.vjs-mouse-display .vjs-time-tooltip{background-color:#000;background-color:rgba(0,0,0,.8);color:#fff}.video-js .vjs-slider{cursor:pointer;margin:0 .45em;padding:0;position:relative;-webkit-touch-callout:none;background-color:#73859f;background-color:rgba(115,133,159,.5);-webkit-user-select:none;-moz-user-select:none;user-select:none}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{box-shadow:0 0 1em #fff;text-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;display:flex;margin-left:1em}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{height:1px;margin-right:-1px;opacity:0;visibility:visible;width:1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,right 0s,top 0s;visibility:visible}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{height:3em;margin-left:0;width:5em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{right:-3.5em;transition:right 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{transition:width .1s;width:10em}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;right:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,right 1s 1s,top 1s 1s;width:3em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,right 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{height:.3em;width:5em}.vjs-volume-bar.vjs-slider-vertical{height:5em;margin:1.35em auto;width:.3em}.video-js .vjs-volume-level{background-color:#fff;bottom:0;right:0;position:absolute}.video-js .vjs-volume-level:before{font-size:.9em;position:absolute;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{right:-.3em;top:-.5em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{height:.9em;pointer-events:none;position:absolute;width:.9em;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;left:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{left:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:8em;height:8em;width:3em}.video-js .vjs-volume-horizontal .vjs-menu{right:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:hsla(0,0%,100%,.8);border-radius:.3em;color:#000;float:left;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{right:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{background-color:#000;display:none;height:1px;position:absolute;width:100%;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{height:100%;width:1px}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{opacity:0;transition:visibility 1s,opacity 1s;visibility:hidden}.vjs-mouse-display .vjs-volume-tooltip{background-color:#000;background-color:rgba(0,0,0,.8);color:#fff}.vjs-poster{bottom:0;cursor:pointer;display:inline-block;height:100%;right:0;margin:0;padding:0;position:absolute;left:0;top:0;vertical-align:middle}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.video-js .vjs-live-control{align-items:flex-start;display:flex;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;display:inline-flex;flex:none;font-size:1em;height:100%;line-height:3em;min-width:4em;padding-right:.5em;padding-left:.5em;width:auto}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{color:#888;margin-left:.5em}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{height:1em;pointer-events:none;width:1em;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;padding-right:1em;padding-left:1em;width:auto}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{bottom:3em;right:0;pointer-events:none;position:absolute;left:0;top:0}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;margin-bottom:.1em;text-align:center}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset:10px){.video-js .vjs-text-track-display>div{bottom:0;right:0;left:0;top:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{height:100%;right:0;position:absolute;top:0;width:100%}.vjs-playback-rate .vjs-playback-rate-value{font-size:1.5em;line-height:2;pointer-events:none;text-align:center}.vjs-playback-rate .vjs-menu{right:0;width:4em}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{background-clip:padding-box;border:.6em solid rgba(43,51,63,.7);border-radius:50%;box-sizing:border-box;display:none;height:5em;right:50%;opacity:.85;position:absolute;text-align:right;top:50%;transform:translate(50%,-50%);visibility:hidden;width:5em}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{align-items:center;animation:vjs-spinner-show 0s linear .3s forwards;display:flex;justify-content:center}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{border:inherit;border-color:#fff transparent transparent;border-radius:inherit;box-sizing:inherit;content:"";height:inherit;opacity:1;position:absolute;width:inherit}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{animation-delay:.44s;border-top-color:#fff}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(-1turn)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{height:1.5em;width:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{display:inline-block;margin-bottom:-.1em;vertical-align:middle}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{content:"\f10c";font-family:VideoJS;font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{display:inline-block;margin-bottom:-.1em;vertical-align:middle}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{content:" \f12e";font-family:VideoJS;font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{display:block;flex:auto}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:left;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-bottom:.5em;margin-left:1em}.vjs-text-track-settings fieldset{border:none;margin:10px}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-size:1.2em;font-weight:700}.vjs-text-track-settings .vjs-label{margin:0 0 .5em .5em}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{background-image:linear-gradient(0deg,#fff 88%,#73859f);outline-style:solid;outline-width:medium}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(180deg,#fff 88%,#73859f);border-radius:2px;color:#2b333f;cursor:pointer}.vjs-track-settings-controls .vjs-default-button{margin-left:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(-180deg,rgba(0,0,0,.9),rgba(0,0,0,.7) 60%,transparent);font-size:1.2em;line-height:1.5;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;transition:opacity .1s;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-transient-button{align-items:center;background-color:rgba(50,50,50,.5);cursor:pointer;display:flex;height:3em;justify-content:center;opacity:1;position:absolute;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{right:1em}.video-js .vjs-transient-button.vjs-right{left:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:rgba(50,50,50,.9)}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{border:none;height:100%;right:0;position:absolute;top:0;width:100%;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:none}.video-js :focus:not(:focus-visible){outline:none} +.video-js.vjs-quality-menu{display:block}.video-js.vjs-quality-menu .vjs-quality-menu-button{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-button li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-button.vjs-menu-button-popup .vjs-menu .vjs-menu-content{right:0;max-height:25em;width:10em}.video-js.vjs-quality-menu .vjs-menu-item .vjs-control-text{position:absolute}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper.vjs-menu-wrapper-popup .vjs-menu .vjs-menu-content{right:0;max-height:25em;width:10em}.video-js.vjs-quality-menu .vjs-quality-menu-item-sub-label{font-size:75%;font-weight:700;position:absolute;left:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-use-resolution .vjs-quality-menu-item-sub-label{position:absolute;left:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after,.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{background-color:#2b333f;border-radius:2em;color:inherit;content:"";font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:.7em;font-weight:300;height:2.2em;letter-spacing:.1em;line-height:2.2em;padding:0;position:absolute;left:0;text-align:center;top:.5em;width:2.2em}.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{content:"HD"}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after{content:"4K"}.video-js.vjs-quality-menu .vjs-quality-menu-button-waiting:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite} +.block-editor-block-inspector .components-panel__row{margin-bottom:1em}.block-editor-block-inspector .components-panel__row .upload-controls{display:flex;flex-direction:column;gap:1em} diff --git a/assets/build/blocks/rt-player/index.asset.php b/assets/build/blocks/rt-player/index.asset.php new file mode 100644 index 0000000..a3a1434 --- /dev/null +++ b/assets/build/blocks/rt-player/index.asset.php @@ -0,0 +1 @@ + array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '5ba82104109bc2331e11'); diff --git a/assets/build/blocks/rt-player/index.css b/assets/build/blocks/rt-player/index.css new file mode 100644 index 0000000..69c33a4 --- /dev/null +++ b/assets/build/blocks/rt-player/index.css @@ -0,0 +1,3 @@ +.vjs-svg-icon{background-position:50%;background-repeat:no-repeat;display:inline-block;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{height:100%;left:0;position:absolute;top:0;width:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;font-style:normal;font-weight:400;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff")}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-style:normal;font-weight:400}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-style:normal;font-weight:400}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-style:normal;font-weight:400}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-style:normal;font-weight:400}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{background-color:#000;box-sizing:border-box;color:#fff;display:inline-block;font-family:Arial,Helvetica,sans-serif;font-size:10px;font-style:normal;font-weight:400;line-height:1;padding:0;position:relative;vertical-align:top;word-break:normal}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{height:100%!important;width:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{max-width:100%;width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js .vjs-tech,.video-js.vjs-fill:not(.vjs-audio-only-mode){height:100%;width:100%}.video-js .vjs-tech{left:0;position:absolute;top:0}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{height:100%;margin:0;padding:0}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{bottom:0;left:0;overflow:hidden;position:fixed;right:0;top:0;z-index:1000}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{display:block;height:100%!important;padding-top:0!important;width:100%!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{background-color:rgba(0,0,0,.7);bottom:10%;font-size:2em;padding:.5em;position:absolute;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{cursor:default;opacity:.5}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{background-color:#000;color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:18px;height:150px;margin:0 auto;padding:20px;text-align:center;width:300px}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{background-color:#2b333f;background-color:rgba(43,51,63,.7);border:.06666em solid #fff;border-radius:.3em;cursor:pointer;display:block;font-size:3em;height:1.63332em;left:50%;line-height:1.5em;margin-left:-1.5em;margin-top:-.81666em;opacity:1;padding:0;position:absolute;top:50%;transition:all .4s;width:3em}.vjs-big-play-button .vjs-svg-icon{height:1em;left:50%;line-height:1;position:absolute;top:50%;transform:translate(-50%,-50%);width:1em}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{background-color:#73859f;background-color:rgba(115,133,159,.5);border-color:#fff;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-decoration:none;text-transform:none;transition:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{box-shadow:none;outline:.0625em solid #fff}.vjs-control .vjs-button{height:100%;width:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;font-family:Arial,Helvetica,sans-serif;margin:0;overflow:auto;padding:0}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;font-size:1.2em;justify-content:center;line-height:1.4em;list-style:none;margin:0;padding:.2em 0;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:none}.vjs-menu li.vjs-menu-title{cursor:default;font-size:1em;font-weight:700;line-height:2em;margin:0 0 .3em;padding:0;text-align:center;text-transform:uppercase}.vjs-menu-button-popup .vjs-menu{border-top-color:rgba(43,51,63,.7);bottom:0;display:none;height:0;left:-3em;margin-bottom:1.5em;position:absolute;width:10em}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:1.5em;max-height:15em;position:absolute;width:100%}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{overflow:hidden;transition:all .4s}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{height:100%;left:4em;margin:0;opacity:0;padding:0;position:absolute;top:0;transition:all .4s;width:auto}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{height:100%;margin:0;overflow:hidden;width:auto}.video-js .vjs-control-bar{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:0;display:none;height:3em;left:0;position:absolute;right:0;width:100%}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;opacity:1;transition:visibility .1s,opacity .1s;visibility:visible}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s;visibility:visible}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;pointer-events:auto;visibility:visible}.video-js .vjs-control{flex:none;height:100%;margin:0;padding:0;position:relative;text-align:center;width:4em}.video-js .vjs-control.vjs-visible-text{padding-left:1em;padding-right:1em;width:auto}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{align-items:center;cursor:pointer;display:flex;flex:auto;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{align-items:center;display:flex}.video-js .vjs-progress-holder{flex:auto;height:.3em;transition:all .2s}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{display:block;height:100%;margin:0;padding:0;position:absolute;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;line-height:.35em;position:absolute;right:-.5em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{height:.9em;line-height:.15em;pointer-events:none;position:absolute;right:-.4em;top:-.35em;width:.9em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:hsla(0,0%,100%,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{background-color:#000;display:none;height:100%;position:absolute;width:1px;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{opacity:0;transition:visibility 1s,opacity 1s;visibility:hidden}.vjs-mouse-display .vjs-time-tooltip{background-color:#000;background-color:rgba(0,0,0,.8);color:#fff}.video-js .vjs-slider{cursor:pointer;margin:0 .45em;padding:0;position:relative;-webkit-touch-callout:none;background-color:#73859f;background-color:rgba(115,133,159,.5);-webkit-user-select:none;-moz-user-select:none;user-select:none}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{box-shadow:0 0 1em #fff;text-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;display:flex;margin-right:1em}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{height:1px;margin-left:-1px;opacity:0;visibility:visible;width:1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s;visibility:visible}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{height:3em;margin-right:0;width:5em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{transition:width .1s;width:10em}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s;width:3em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{height:.3em;width:5em}.vjs-volume-bar.vjs-slider-vertical{height:5em;margin:1.35em auto;width:.3em}.video-js .vjs-volume-level{background-color:#fff;bottom:0;left:0;position:absolute}.video-js .vjs-volume-level:before{font-size:.9em;position:absolute;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{left:-.3em;top:-.5em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{height:.9em;pointer-events:none;position:absolute;width:.9em;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{background-color:#2b333f;background-color:rgba(43,51,63,.7);bottom:8em;height:8em;width:3em}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:hsla(0,0%,100%,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{background-color:#000;display:none;height:1px;position:absolute;width:100%;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{height:100%;width:1px}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{opacity:0;transition:visibility 1s,opacity 1s;visibility:hidden}.vjs-mouse-display .vjs-volume-tooltip{background-color:#000;background-color:rgba(0,0,0,.8);color:#fff}.vjs-poster{bottom:0;cursor:pointer;display:inline-block;height:100%;left:0;margin:0;padding:0;position:absolute;right:0;top:0;vertical-align:middle}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.video-js .vjs-live-control{align-items:flex-start;display:flex;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;display:inline-flex;flex:none;font-size:1em;height:100%;line-height:3em;min-width:4em;padding-left:.5em;padding-right:.5em;width:auto}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{color:#888;margin-right:.5em}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{height:1em;pointer-events:none;width:1em;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;padding-left:1em;padding-right:1em;width:auto}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{bottom:3em;left:0;pointer-events:none;position:absolute;right:0;top:0}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;margin-bottom:.1em;text-align:center}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset:10px){.video-js .vjs-text-track-display>div{bottom:0;left:0;right:0;top:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{height:100%;left:0;position:absolute;top:0;width:100%}.vjs-playback-rate .vjs-playback-rate-value{font-size:1.5em;line-height:2;pointer-events:none;text-align:center}.vjs-playback-rate .vjs-menu{left:0;width:4em}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{background-clip:padding-box;border:.6em solid rgba(43,51,63,.7);border-radius:50%;box-sizing:border-box;display:none;height:5em;left:50%;opacity:.85;position:absolute;text-align:left;top:50%;transform:translate(-50%,-50%);visibility:hidden;width:5em}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{align-items:center;animation:vjs-spinner-show 0s linear .3s forwards;display:flex;justify-content:center}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{border:inherit;border-color:#fff transparent transparent;border-radius:inherit;box-sizing:inherit;content:"";height:inherit;opacity:1;position:absolute;width:inherit}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{animation-delay:.44s;border-top-color:#fff}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(1turn)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{height:1.5em;width:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{display:inline-block;margin-bottom:-.1em;vertical-align:middle}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{content:"\f10c";font-family:VideoJS;font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{display:inline-block;margin-bottom:-.1em;vertical-align:middle}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{content:" \f12e";font-family:VideoJS;font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{display:block;flex:auto}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-bottom:.5em;margin-right:1em}.vjs-text-track-settings fieldset{border:none;margin:10px}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-size:1.2em;font-weight:700}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{background-image:linear-gradient(0deg,#fff 88%,#73859f);outline-style:solid;outline-width:medium}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);border-radius:2px;color:#2b333f;cursor:pointer}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9),rgba(0,0,0,.7) 60%,transparent);font-size:1.2em;line-height:1.5;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;transition:opacity .1s;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-transient-button{align-items:center;background-color:rgba(50,50,50,.5);cursor:pointer;display:flex;height:3em;justify-content:center;opacity:1;position:absolute;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:rgba(50,50,50,.9)}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{border:none;height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:none}.video-js :focus:not(:focus-visible){outline:none} +.video-js.vjs-quality-menu{display:block}.video-js.vjs-quality-menu .vjs-quality-menu-button{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-button li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-button.vjs-menu-button-popup .vjs-menu .vjs-menu-content{left:0;max-height:25em;width:10em}.video-js.vjs-quality-menu .vjs-menu-item .vjs-control-text{position:absolute}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper.vjs-menu-wrapper-popup .vjs-menu .vjs-menu-content{left:0;max-height:25em;width:10em}.video-js.vjs-quality-menu .vjs-quality-menu-item-sub-label{font-size:75%;font-weight:700;position:absolute;right:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-use-resolution .vjs-quality-menu-item-sub-label{position:absolute;right:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after,.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{background-color:#2b333f;border-radius:2em;color:inherit;content:"";font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:.7em;font-weight:300;height:2.2em;letter-spacing:.1em;line-height:2.2em;padding:0;position:absolute;right:0;text-align:center;top:.5em;width:2.2em}.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{content:"HD"}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after{content:"4K"}.video-js.vjs-quality-menu .vjs-quality-menu-button-waiting:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite} +.block-editor-block-inspector .components-panel__row{margin-bottom:1em}.block-editor-block-inspector .components-panel__row .upload-controls{display:flex;flex-direction:column;gap:1em} diff --git a/assets/build/blocks/rt-player/index.js b/assets/build/blocks/rt-player/index.js new file mode 100644 index 0000000..22e7ce7 --- /dev/null +++ b/assets/build/blocks/rt-player/index.js @@ -0,0 +1 @@ +(()=>{var e,t={495:(e,t,i)=>{"use strict";var s=i(840);e.exports=function(e,t){return void 0===t&&(t=!1),function(i,n,r){if(i)e(i);else if(n.statusCode>=400&&n.statusCode<=599){var a=r;if(t)if(s.TextDecoder){var o=(void 0===(l=n.headers&&n.headers["content-type"])&&(l=""),l.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),s=i[0],n=i[1];return"charset"===s.trim()?n.trim():e}),"utf-8"));try{a=new TextDecoder(o).decode(r)}catch(e){}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a})}else e(null,r);var l}}},36:(e,t,i)=>{"use strict";var s=i(840),n=i(634),r=i(56),a=i(162),o=i(670);d.httpHandler=i(495),d.requestInterceptorsStorage=new a,d.responseInterceptorsStorage=new a,d.retryManager=new o;var l=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),s=e.slice(0,i).trim().toLowerCase(),n=e.slice(i+1).trim();void 0===t[s]?t[s]=n:Array.isArray(t[s])?t[s].push(n):t[s]=[t[s],n]})),t):t};function h(e,t,i){var s=e;return r(t)?(i=t,"string"==typeof e&&(s={uri:e})):s=n({},t,{uri:e}),s.callback=i,s}function d(e,t,i){return u(t=h(e,t,i))}function u(e){if(void 0===e.callback)throw new Error("callback argument missing");if(e.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var t={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},i=d.requestInterceptorsStorage.execute(e.requestType,t);e.uri=i.uri,e.headers=i.headers,e.body=i.body,e.metadata=i.metadata,e.retry=i.retry,e.timeout=i.timeout}var s=!1,n=function(t,i,n){s||(s=!0,e.callback(t,i,n))};function r(){var e=void 0;if(e=p.response?p.response:p.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(p),b)try{e=JSON.parse(e)}catch(e){}return e}function a(t){if(clearTimeout(m),clearTimeout(e.retryTimeout),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,c||!d.retryManager.getIsEnabled()||!e.retry||!e.retry.shouldRetry()){if(e.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var i={headers:T.headers||{},body:T.body,responseUrl:p.responseURL,responseType:p.responseType},s=d.responseInterceptorsStorage.execute(e.requestType,i);T.body=s.body,T.headers=s.headers}return n(t,T)}e.retryTimeout=setTimeout((function(){e.retry.moveToNextAttempt(),e.xhr=p,u(e)}),e.retry.getCurrentFuzzedDelay())}function o(){if(!c){var t;clearTimeout(m),clearTimeout(e.retryTimeout),t=e.useXDR&&void 0===p.status?200:1223===p.status?204:p.status;var i=T,s=null;if(0!==t?(i={body:r(),statusCode:t,method:f,headers:{},url:g,rawRequest:p},p.getAllResponseHeaders&&(i.headers=l(p.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),e.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var a={headers:i.headers||{},body:i.body,responseUrl:p.responseURL,responseType:p.responseType},o=d.responseInterceptorsStorage.execute(e.requestType,a);i.body=o.body,i.headers=o.headers}return n(s,i,i.body)}}var h,c,p=e.xhr||null;p||(p=e.cors||e.useXDR?new d.XDomainRequest:new d.XMLHttpRequest);var m,g=p.url=e.uri||e.url,f=p.method=e.method||"GET",y=e.body||e.data,_=p.headers=e.headers||{},v=!!e.sync,b=!1,T={body:void 0,headers:{},statusCode:0,method:f,url:g,rawRequest:p};if("json"in e&&!1!==e.json&&(b=!0,_.accept||_.Accept||(_.Accept="application/json"),"GET"!==f&&"HEAD"!==f&&(_["content-type"]||_["Content-Type"]||(_["Content-Type"]="application/json"),y=JSON.stringify(!0===e.json?y:e.json))),p.onreadystatechange=function(){4!==p.readyState||d.responseInterceptorsStorage.getIsEnabled()||setTimeout(o,0)},p.onload=o,p.onerror=a,p.onprogress=function(){},p.onabort=function(){c=!0,clearTimeout(e.retryTimeout)},p.ontimeout=a,p.open(f,g,!v,e.username,e.password),v||(p.withCredentials=!!e.withCredentials),!v&&e.timeout>0&&(m=setTimeout((function(){if(!c){c=!0,p.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",a(e)}}),e.timeout)),p.setRequestHeader)for(h in _)_.hasOwnProperty(h)&&p.setRequestHeader(h,_[h]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(p.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(p),p.send(y||null),p}e.exports=d,e.exports.default=d,d.XMLHttpRequest=s.XMLHttpRequest||function(){},d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:s.XDomainRequest,function(e,t){for(var i=0;i{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(this.getForType(e));!(s=n()).done;){var r=s.value;try{i=r(i)}catch(e){}}return i},e}();e.exports=i},670:e=>{"use strict";var t=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(e){this.maxAttempts_=e},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(e){this.delayFactor_=e},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(e){this.fuzzFactor_=e},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(e){this.initialDelay_=e},t.createRetry=function(e){var t=void 0===e?{}:e,s=t.maxAttempts,n=t.delayFactor,r=t.fuzzFactor,a=t.initialDelay;return new i({maxAttempts:s||this.maxAttempts_,delayFactor:n||this.delayFactor_,fuzzFactor:r||this.fuzzFactor_,initialDelay:a||this.initialDelay_})},e}(),i=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_{"use strict";function i(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var s=i({HTML:"text/html",isHTML:function(e){return e===s.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),n=i({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===n.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.find=function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s{var s=i(582),n=i(722),r=i(559),a=i(466),o=n.DOMImplementation,l=s.NAMESPACE,h=a.ParseError,d=a.XMLReader;function u(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function c(e){this.options=e||{locator:{}}}function p(){this.cdata=!1}function m(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function g(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function f(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function y(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}c.prototype.parseFromString=function(e,t){var i=this.options,s=new d,n=i.domBuilder||new p,a=i.errorHandler,o=i.locator,h=i.xmlns||{},c=/\/x?html?$/.test(t),m=c?r.HTML_ENTITIES:r.XML_ENTITIES;o&&n.setDocumentLocator(o),s.errorHandler=function(e,t,i){if(!e){if(t instanceof p)return t;e=t}var s={},n=e instanceof Function;function r(t){var r=e[t];!r&&n&&(r=2==e.length?function(i){e(t,i)}:e),s[t]=r&&function(e){r("[xmldom "+t+"]\t"+e+g(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),s}(a,n,o),s.domBuilder=i.domBuilder||n,c&&(h[""]=l.HTML),h.xml=h.xml||l.XML;var f=i.normalizeLineEndings||u;return e&&"string"==typeof e?s.parse(f(e),h,m):s.errorHandler.error("invalid doc source"),n.doc},p.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var n=this.doc,r=n.createElementNS(e,i||t),a=s.length;y(this,r),this.currentElement=r,this.locator&&m(this.locator,r);for(var o=0;o{var s=i(582),n=s.find,r=s.NAMESPACE;function a(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function l(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(a):[]}(e);return Object.keys(t.reduce(o,{}))}function h(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function d(e,t){var i=e.prototype;if(!(i instanceof t)){function s(){}s.prototype=t.prototype,h(i,s=new s),e.prototype=i=s}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var u={},c=u.ELEMENT_NODE=1,p=u.ATTRIBUTE_NODE=2,m=u.TEXT_NODE=3,g=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,y=u.ENTITY_NODE=6,_=u.PROCESSING_INSTRUCTION_NODE=7,v=u.COMMENT_NODE=8,b=u.DOCUMENT_NODE=9,T=u.DOCUMENT_TYPE_NODE=10,S=u.DOCUMENT_FRAGMENT_NODE=11,E=u.NOTATION_NODE=12,w={},C={},k=(w.INDEX_SIZE_ERR=(C[1]="Index size error",1),w.DOMSTRING_SIZE_ERR=(C[2]="DOMString size error",2),w.HIERARCHY_REQUEST_ERR=(C[3]="Hierarchy request error",3)),I=(w.WRONG_DOCUMENT_ERR=(C[4]="Wrong document",4),w.INVALID_CHARACTER_ERR=(C[5]="Invalid character",5),w.NO_DATA_ALLOWED_ERR=(C[6]="No data allowed",6),w.NO_MODIFICATION_ALLOWED_ERR=(C[7]="No modification allowed",7),w.NOT_FOUND_ERR=(C[8]="Not found",8)),x=(w.NOT_SUPPORTED_ERR=(C[9]="Not supported",9),w.INUSE_ATTRIBUTE_ERR=(C[10]="Attribute in use",10));function A(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,C[e]),this.message=C[e],Error.captureStackTrace&&Error.captureStackTrace(this,A);return i.code=e,t&&(this.message=this.message+": "+t),i}function D(){}function P(e,t){this._node=e,this._refresh=t,L(this)}function L(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var i=e._refresh(e._node);if(_e(e,"length",i.length),!e.$$length||i.length=0))throw new A(I,new Error(e.tagName+"@"+i));for(var n=t.length-1;s"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function q(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(q(e,t))return!0}while(e=e.nextSibling)}function j(){this.ownerDocument=this}function $(e,t,i,s){e&&e._inc++,i.namespaceURI===r.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function H(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var n=t.firstChild,r=0;n;)s[r++]=n,n=n.nextSibling;s.length=r,delete s[s.length]}}}function V(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,H(e.ownerDocument,e),t}function z(e){return e&&e.nodeType===B.DOCUMENT_TYPE_NODE}function W(e){return e&&e.nodeType===B.ELEMENT_NODE}function G(e){return e&&e.nodeType===B.TEXT_NODE}function X(e,t){var i=e.childNodes||[];if(n(i,W)||z(t))return!1;var s=n(i,z);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function K(e,t){var i=e.childNodes||[];if(n(i,(function(e){return W(e)&&e!==t})))return!1;var s=n(i,z);return!(t&&s&&i.indexOf(s)>i.indexOf(t))}function Y(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===B.DOCUMENT_FRAGMENT_NODE){var a=r.filter(W);if(a.length>1||n(r,G))throw new A(k,"More than one element or text in fragment");if(1===a.length&&!X(e,i))throw new A(k,"Element in fragment can not be inserted before doctype")}if(W(t)&&!X(e,i))throw new A(k,"Only one element can be added and only after doctype");if(z(t)){if(n(s,z))throw new A(k,"Only one doctype is allowed");var o=n(s,W);if(i&&s.indexOf(o)1||n(r,G))throw new A(k,"More than one element or text in fragment");if(1===a.length&&!K(e,i))throw new A(k,"Element in fragment can not be inserted before doctype")}if(W(t)&&!K(e,i))throw new A(k,"Only one element can be added and only after doctype");if(z(t)){if(n(s,(function(e){return z(e)&&e!==i})))throw new A(k,"Only one doctype is allowed");var o=n(s,W);if(i&&s.indexOf(o)=0;E--)if(""===(w=n[E]).prefix&&w.namespace===e.namespaceURI){u=w.namespace;break}if(u!==e.namespaceURI)for(E=n.length-1;E>=0;E--){var w;if((w=n[E]).namespace===e.namespaceURI){w.prefix&&(d=w.prefix+":"+h);break}}}t.push("<",d);for(var C=0;C"),i&&/^script$/i.test(h))for(;l;)l.data?t.push(l.data):ge(l,t,i,s,n.slice()),l=l.nextSibling;else for(;l;)ge(l,t,i,s,n.slice()),l=l.nextSibling;t.push("")}else t.push("/>");return;case b:case S:for(l=e.firstChild;l;)ge(l,t,i,s,n.slice()),l=l.nextSibling;return;case p:return me(t,e.name,e.value);case m:return t.push(e.data.replace(/[<&>]/g,F));case g:return t.push("");case v:return t.push("\x3c!--",e.data,"--\x3e");case T:var A=e.publicId,D=e.systemId;if(t.push("");else if(D&&"."!=D)t.push(" SYSTEM ",D,">");else{var P=e.internalSubset;P&&t.push(" [",P,"]"),t.push(">")}return;case _:return t.push("");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function fe(e,t,i){var s;switch(t.nodeType){case c:(s=t.cloneNode(!1)).ownerDocument=e;case S:break;case p:i=!0}if(s||(s=t.cloneNode(!1)),s.ownerDocument=e,s.parentNode=null,i)for(var n=t.firstChild;n;)s.appendChild(fe(e,n,i)),n=n.nextSibling;return s}function ye(e,t,i){var s=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];"object"!=typeof r&&r!=s[n]&&(s[n]=r)}switch(t.childNodes&&(s.childNodes=new D),s.ownerDocument=e,s.nodeType){case c:var a=t.attributes,o=s.attributes=new O,l=a.length;o._ownerElement=s;for(var h=0;h=0&&e0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s;t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==p?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},h(u,B),h(u,B.prototype),j.prototype={nodeName:"#document",nodeType:b,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==S){for(var i=e.firstChild;i;){var s=i.nextSibling;this.insertBefore(i,t),i=s}return e}return J(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===c&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),V(this,e)},replaceChild:function(e,t){J(this,e,t,Q),e.ownerDocument=this,t&&this.removeChild(t),W(e)&&(this.documentElement=e)},importNode:function(e,t){return fe(this,e,t)},getElementById:function(e){var t=null;return q(this.documentElement,(function(i){if(i.nodeType==c&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=l(e);return new P(this,(function(i){var s=[];return t.length>0&&q(i.documentElement,(function(n){if(n!==i&&n.nodeType===c){var r=n.getAttribute("class");if(r){var a=e===r;if(!a){var o=l(r);a=t.every((h=o,function(e){return h&&-1!==h.indexOf(e)}))}a&&s.push(n)}}var h})),s}))},createElement:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new D,(t.attributes=new O)._ownerElement=t,t},createDocumentFragment:function(){var e=new he;return e.ownerDocument=this,e.childNodes=new D,e},createTextNode:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new se;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ne;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new de;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new ee;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new le;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Z,s=t.split(":"),n=i.attributes=new O;return i.childNodes=new D,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,n._ownerElement=i,i},createAttributeNS:function(e,t){var i=new ee,s=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,i}},d(j,B),Z.prototype={nodeType:c,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===S?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,H(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var s=this.ownerDocument.createAttributeNS(e,t);s.value=s.nodeValue=""+i,this.setAttributeNode(s)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new P(this,(function(t){var i=[];return q(t,(function(s){s===t||s.nodeType!=c||"*"!==e&&s.tagName!=e||i.push(s)})),i}))},getElementsByTagNameNS:function(e,t){return new P(this,(function(i){var s=[];return q(i,(function(n){n===i||n.nodeType!==c||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||s.push(n)})),s}))}},j.prototype.getElementsByTagName=Z.prototype.getElementsByTagName,j.prototype.getElementsByTagNameNS=Z.prototype.getElementsByTagNameNS,d(Z,B),ee.prototype.nodeType=p,d(ee,B),te.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(C[k])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},d(te,B),ie.prototype={nodeName:"#text",nodeType:m,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var s=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},d(ie,te),se.prototype={nodeName:"#comment",nodeType:v},d(se,te),ne.prototype={nodeName:"#cdata-section",nodeType:g},d(ne,te),re.prototype.nodeType=T,d(re,B),ae.prototype.nodeType=E,d(ae,B),oe.prototype.nodeType=y,d(oe,B),le.prototype.nodeType=f,d(le,B),he.prototype.nodeName="#document-fragment",he.prototype.nodeType=S,d(he,B),de.prototype.nodeType=_,d(de,B),ue.prototype.serializeToString=function(e,t,i){return ce.call(e,t,i)},B.prototype.toString=ce;try{if(Object.defineProperty){function ve(e){switch(e.nodeType){case c:case S:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(ve(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(P.prototype,"length",{get:function(){return L(this),this.$$length}}),Object.defineProperty(B.prototype,"textContent",{get:function(){return ve(this)},set:function(e){switch(this.nodeType){case c:case S:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),_e=function(e,t,i){e["$$"+t]=i}}}catch(be){}t.DocumentType=re,t.DOMException=A,t.DOMImplementation=U,t.Element=Z,t.Node=B,t.NodeList=D,t.XMLSerializer=ue},559:(e,t,i)=>{"use strict";var s=i(582).freeze;t.XML_ENTITIES=s({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=s({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES},978:(e,t,i)=>{var s=i(722);s.DOMImplementation,s.XMLSerializer,t.DOMParser=i(752).DOMParser},466:(e,t,i)=>{var s=i(582).NAMESPACE,n=/[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]/,r=new RegExp("[\\-\\.0-9"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),a=new RegExp("^"+n.source+r.source+"*(?::"+n.source+r.source+"*)?$");function o(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function l(){}function h(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function d(e,t,i,n,r,a){function o(e,t,s){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),s)}for(var l,h=++t,d=0;;){var u=e.charAt(h);switch(u){case"=":if(1===d)l=e.slice(t,h),d=3;else{if(2!==d)throw new Error("attribute equal must after attrName");d=3}break;case"'":case'"':if(3===d||1===d){if(1===d&&(a.warning('attribute value must after "="'),l=e.slice(t,h)),t=h+1,!((h=e.indexOf(u,t))>0))throw new Error("attribute value no end '"+u+"' match");o(l,c=e.slice(t,h),t-1),d=5}else{if(4!=d)throw new Error('attribute value must after "="');o(l,c=e.slice(t,h),t),a.warning('attribute "'+l+'" missed start quot('+u+")!!"),t=h+1,d=5}break;case"/":switch(d){case 0:i.setTagName(e.slice(t,h));case 5:case 6:case 7:d=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==d&&i.setTagName(e.slice(t,h)),h;case">":switch(d){case 0:i.setTagName(e.slice(t,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=e.slice(t,h)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===d&&(c=l),4==d?(a.warning('attribute "'+c+'" missed quot(")!'),o(l,c,t)):(s.isHTML(n[""])&&c.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,t));break;case 3:throw new Error("attribute value missed!!")}return h;case"€":u=" ";default:if(u<=" ")switch(d){case 0:i.setTagName(e.slice(t,h)),d=6;break;case 1:l=e.slice(t,h),d=2;break;case 4:var c=e.slice(t,h);a.warning('attribute "'+c+'" missed quot(")!!'),o(l,c,t);case 5:d=6}else switch(d){case 2:i.tagName,s.isHTML(n[""])&&l.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,t),t=h,d=1;break;case 5:a.warning('attribute space is required"'+l+'"!!');case 6:d=1,t=h;break;case 3:d=4,t=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function u(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var o=e[a],l=o.qName,h=o.value;if((p=l.indexOf(":"))>0)var d=o.prefix=l.slice(0,p),u=l.slice(p+1),c="xmlns"===d&&u;else u=l,d=null,c="xmlns"===l&&"";o.localName=u,!1!==c&&(null==r&&(r={},m(i,i={})),i[c]=r[c]=h,o.uri=s.XMLNS,t.startPrefixMapping(c,h))}for(a=e.length;a--;)(d=(o=e[a]).prefix)&&("xml"===d&&(o.uri=s.XML),"xmlns"!==d&&(o.uri=i[d||""]));var p;(p=n.indexOf(":"))>0?(d=e.prefix=n.slice(0,p),u=e.localName=n.slice(p+1)):(d=null,u=e.localName=n);var g=e.uri=i[d||""];if(t.startElement(g,u,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(g,u,n),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function c(e,t,i,s,n){if(/^(?:script|textarea)$/i.test(i)){var r=e.indexOf("",t),a=e.substring(t+1,r);if(/[&<]/.test(a))return/^script$/i.test(i)?(n.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,s),n.characters(a,0,a.length),r)}return t+1}function p(e,t,i,s){var n=s[i];return null==n&&((n=e.lastIndexOf(""))t?(i.comment(e,t+4,n-t-4),n+3):(s.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3}var r=function(e,t){var i,s=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=t,n.exec(e);i=n.exec(e);)if(s.push(i),i[1])return s}(e,t),a=r.length;if(a>1&&/!doctype/i.test(r[0][0])){var o=r[1][0],l=!1,h=!1;a>3&&(/^public$/i.test(r[2][0])?(l=r[3][0],h=a>4&&r[4][0]):/^system$/i.test(r[2][0])&&(h=r[3][0]));var d=r[a-1];return i.startDTD(o,l,h),i.endDTD(),d.index+d[0].length}return-1}function f(e,t,i){var s=e.indexOf("?>",t);if(s){var n=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,i.processingInstruction(n[1],n[2]),s+2):-1}return-1}function y(){this.attributeNames={}}o.prototype=new Error,o.prototype.name=o.name,l.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),m(t,t={}),function(e,t,i,n,r){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function l(t){if(t>w){var i=e.substring(w,t).replace(/&#?\w+;/g,a);T&&m(w),n.characters(i,0,t-w),w=t}}function m(t,i){for(;t>=v&&(i=b.exec(e));)_=i.index,v=_+i[0].length,T.lineNumber++;T.columnNumber=t-_+1}for(var _=0,v=0,b=/.*(?:\r\n?|\n)|.*$/g,T=n.locator,S=[{currentNSMap:t}],E={},w=0;;){try{var C=e.indexOf("<",w);if(C<0){if(!e.substr(w).match(/^\s*$/)){var k=n.doc,I=k.createTextNode(e.substr(w));k.appendChild(I),n.currentElement=I}return}switch(C>w&&l(C),e.charAt(C+1)){case"/":var x=e.indexOf(">",C+3),A=e.substring(C+2,x).replace(/[ \t\n\r]+$/g,""),D=S.pop();x<0?(A=e.substring(C+2).replace(/[\s<].*/,""),r.error("end tag name: "+A+" is not complete:"+D.tagName),x=C+1+A.length):A.match(/\sw?w=x:l(Math.max(C,w)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},y.prototype={setTagName:function(e){if(!a.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!a.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},t.XMLReader=l,t.ParseError=o},673:(e,t,i)=>{"use strict";const s=window.wp.blocks,n=JSON.parse('{"UU":"transcoder/rt-player","DD":"RT Player","L1":"media","Kk":"video-alt3","h_":"A block for embedding videos with a custom player."}'),r=window.React,a=window.wp.i18n,o=window.wp.blockEditor,l=window.wp.components,h=window.wp.element,d=window.wp.apiFetch;var u=i.n(d),c=i(840),p=i.n(c),m=i(697),g=i.n(m),f=i(36),y=i.n(f),_=i(784),v=i.n(_);function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const C=String.fromCharCode(9),k=function(e){const t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},I=function(e){const t={};if(!e)return t;const i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let s,n=i.length;for(;n--;)""!==i[n]&&(s=/([^=]*)=(.*)/.exec(i[n]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),t[s[0]]=s[1]);return t},x=e=>{const t=e.split("x"),i={};return t[0]&&(i.width=parseInt(t[0],10)),t[1]&&(i.height=parseInt(t[1],10)),i};class A extends S{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(((t,i)=>{const s=i(e);return s===e?t:t.concat([s])}),[e]).forEach((e=>{for(let t=0;te),this.customParsers.push((n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:s}),!0}))}addTagMapper({expression:e,map:t}){this.tagMappers.push((i=>e.test(i)?t(i):i))}}const D=function(e){const t={};return Object.keys(e).forEach((function(i){var s;t[(s=i,s.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase())))]=e[i]})),t},P=function(e){const{serverControl:t,targetDuration:i,partTargetDuration:s}=e;if(!t)return;const n="#EXT-X-SERVER-CONTROL",r="holdBack",a="partHoldBack",o=i&&3*i,l=s&&2*s;i&&!t.hasOwnProperty(r)&&(t[r]=o,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&t[r]{r.uri||!r.parts&&!r.preloadHints||(!r.map&&s&&(r.map=s),!r.key&&n&&(r.key=n),r.timeline||"number"!=typeof h||(r.timeline=h),this.manifest.preloadSegment=r)})),this.parseStream.on("data",(function(e){let p,m;if(t.manifest.definitions)for(const i in t.manifest.definitions)if(e.uri&&(e.uri=e.uri.replace(`{$${i}}`,t.manifest.definitions[i])),e.attributes)for(const s in e.attributes)"string"==typeof e.attributes[s]&&(e.attributes[s]=e.attributes[s].replace(`{$${i}}`,t.manifest.definitions[i]));({tag(){({version(){e.version&&(this.manifest.version=e.version)},"allow-cache"(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const t={};"length"in e&&(r.byterange=t,t.length=e.length,"offset"in e||(e.offset=d)),"offset"in e&&(r.byterange=t,t.offset=e.offset),d=t.offset+t.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"})),e.title&&(r.title=e.title),e.duration>0&&(r.duration=e.duration),0===e.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:E(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.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"(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence"(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,h=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type"(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map(){s={},e.uri&&(s.uri=e.uri),e.byterange&&(s.byterange=e.byterange),n&&(s.key=n)},"stream-inf"(){this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes?(r.attributes||(r.attributes={}),b(r.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const t=this.manifest.mediaGroups[e.attributes.TYPE];t[e.attributes["GROUP-ID"]]=t[e.attributes["GROUP-ID"]]||{},p=t[e.attributes["GROUP-ID"]],m={default:/yes/i.test(e.attributes.DEFAULT)},m.default?m.autoselect=!0:m.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(m.language=e.attributes.LANGUAGE),e.attributes.URI&&(m.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(m.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(m.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(m.forced=/yes/i.test(e.attributes.FORCED)),p[e.attributes.NAME]=m},discontinuity(){h+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),r.dateTimeString=e.dateTimeString,r.dateTimeObject=e.dateTimeObject;const{lastProgramDateTime:t}=this;this.lastProgramDateTime=new Date(e.dateTimeString).getTime(),null===t&&this.manifest.segments.reduceRight(((e,t)=>(t.programDateTime=e-1e3*t.duration,t.programDateTime)),this.lastProgramDateTime)},targetduration(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,P.call(this,this.manifest))},start(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){r.cueOut=e.data},"cue-out-cont"(){r.cueOutCont=e.data},"cue-in"(){r.cueIn=e.data},skip(){this.manifest.skip=D(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const t=this.manifest.segments.length,i=D(e.attributes);r.parts=r.parts||[],r.parts.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=u),u=i.byterange.offset+i.byterange.length);const s=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${s} for segment #${t}`,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const t=this.manifest.serverControl=D(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),P.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const t=this.manifest.segments.length,i=D(e.attributes),s=i.type&&"PART"===i.type;r.preloadHints=r.preloadHints||[],r.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=s?u:0,s&&(u=i.byterange.offset+i.byterange.length)));const n=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${n} for segment #${t}`,e.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===i.id));this.manifest.dateRanges[e]=b(this.manifest.dateRanges[e],i),c[i.id]=b(c[i.id],i),this.manifest.dateRanges.pop()}else c[i.id]=i},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=D(e.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",e.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const t=(e,t)=>{e in this.manifest.definitions?this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${e}`}):this.manifest.definitions[e]=t};if("QUERYPARAM"in e.attributes){if("NAME"in e.attributes||"IMPORT"in e.attributes)return void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});const i=this.params.get(e.attributes.QUERYPARAM);return i?void t(e.attributes.QUERYPARAM,decodeURIComponent(i)):void this.trigger("error",{message:`EXT-X-DEFINE: No query param ${e.attributes.QUERYPARAM}`})}return"NAME"in e.attributes?"IMPORT"in e.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in e.attributes&&"string"==typeof e.attributes.VALUE?void t(e.attributes.NAME,e.attributes.VALUE):void this.trigger("error",{message:`EXT-X-DEFINE: No value for ${e.attributes.NAME}`}):"IMPORT"in e.attributes?this.mainDefinitions[e.attributes.IMPORT]?void t(e.attributes.IMPORT,this.mainDefinitions[e.attributes.IMPORT]):void this.trigger("error",{message:`EXT-X-DEFINE: No value ${e.attributes.IMPORT} to import, or IMPORT used on main playlist`}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:e.attributes,uri:e.uri,timeline:h}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",e.attributes,["BANDWIDTH","URI"])}}[e.tagType]||o).call(t)},uri(){r.uri=e.uri,i.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),n&&(r.key=n),r.timeline=h,s&&(r.map=s),u=0,null!==this.lastProgramDateTime&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*r.duration),r={}},comment(){},custom(){e.segment?(r.custom=r.custom||{},r.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(t)}))}requiredCompatibilityversion(e,t){(eh&&(l-=h,l-=h,l-=Y(2))}return Number(l)}),Z=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),s=0;s=t.length&&l.call(t,(function(t,i){return t===(o[i]?o[i]&e[r+i]:e[r+i])}))},te=i(978);const ie=e=>!!e&&"object"==typeof e,se=(...e)=>e.reduce(((e,t)=>("object"!=typeof t||Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):ie(e[i])&&ie(t[i])?e[i]=se(e[i],t[i]):e[i]=t[i]})),e)),{}),ne=e=>Object.keys(e).map((t=>e[t])),re=e=>e.reduce(((e,t)=>e.concat(t)),[]),ae=e=>{if(!e.length)return[];const t=[];for(let i=0;i{const n={uri:t,resolvedUri:T(e||"",t)};if(i||s){const e=(i||s).split("-");let t,r=p().BigInt?p().BigInt(e[0]):parseInt(e[0],10),a=p().BigInt?p().BigInt(e[1]):parseInt(e[1],10);r(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),he={static(e){const{duration:t,timescale:i=1,sourceDuration:s,periodDuration:n}=e,r=le(e.endNumber),a=t/i;return"number"==typeof r?{start:0,end:r}:"number"==typeof n?{start:0,end:n/a}:{start:0,end:s/a}},dynamic(e){const{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:n=1,duration:r,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,h=le(e.endNumber),d=(t+i)/1e3,u=s+a,c=d+o-u,p=Math.ceil(c*n/r),m=Math.floor((d-u-l)*n/r),g=Math.floor((d-u)*n/r);return{start:Math.max(0,m),end:"number"==typeof h?h:Math.min(p,g)}}},de=e=>{const{type:t,duration:i,timescale:s=1,periodDuration:n,sourceDuration:r}=e,{start:a,end:o}=he[t](e),l=((e,t)=>{const i=[];for(let s=e;st=>{const{duration:i,timescale:s=1,periodStart:n,startNumber:r=1}=e;return{number:r+t,duration:i/s,timeline:n,time:t*i}})(e));if("static"===t){const e=l.length-1,t="number"==typeof n?n:r;l[e].duration=t-i/s*e}return l},ue=e=>{const{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:n="",periodStart:r,presentationTime:a,number:o=0,duration:l}=e;if(!t)throw new Error("NO_BASE_URL");const h=oe({baseUrl:t,source:i.sourceURL,range:i.range}),d=oe({baseUrl:t,source:t,indexRange:n});if(d.map=h,l){const t=de(e);t.length&&(d.duration=t[0].duration,d.timeline=t[0].timeline)}else s&&(d.duration=s,d.timeline=r);return d.presentationTime=a||r,d.number=o,[d]},ce=(e,t,i)=>{const s=e.sidx.map?e.sidx.map:null,n=e.sidx.duration,r=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,l=t.timescale,h=t.references.filter((e=>1!==e.referenceType)),d=[],u=e.endList?"static":"dynamic",c=e.sidx.timeline;let m,g=c,f=e.mediaSequence||0;m="bigint"==typeof t.firstOffset?p().BigInt(o)+t.firstOffset:o+t.firstOffset;for(let e=0;e{return(t=e,i=({timeline:e})=>e,ne(t.reduce(((e,t)=>(t.forEach((t=>{e[i(t)]=t})),e)),{}))).sort(((e,t)=>e.timeline>t.timeline?1:-1));var t,i},fe=e=>{let t=[];var i,s;return i=e,s=(e,i,s,n)=>{t=t.concat(e.playlists||[])},pe.forEach((function(e){for(var t in i.mediaGroups[e])for(var n in i.mediaGroups[e][t]){var r=i.mediaGroups[e][t][n];s(r)}})),t},ye=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},_e=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?p().BigInt(e.offset)+p().BigInt(e.length)-p().BigInt(1):e.offset+e.length-1,`${e.offset}-${t}`})(e.byterange),ve=e=>{const t=e.reduce((function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e}),{});let i=[];return Object.values(t).forEach((e=>{const t=ne(e.reduce(((e,t)=>{const i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{}));i=i.concat(t)})),i.map((e=>{var t;return e.discontinuityStarts=(t=e.segments||[],t.reduce(((e,t,i)=>(t.discontinuity&&e.push(i),e)),[])),e}))},be=(e,t)=>{const i=_e(e.sidx),s=i&&t[i]&&t[i].sidx;return s&&ce(e,s,e.sidx.resolvedUri),e},Te=(e,t={})=>{if(!Object.keys(t).length)return e;for(const i in e)e[i]=be(e[i],t);return e},Se=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{const n={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(n.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(n.contentProtection=e.contentProtection),e.serviceLocation&&(n.attributes.serviceLocation=e.serviceLocation),i&&(n.sidx=i),n},Ee=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,we=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Ce=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,ke=e=>e?Object.keys(e).reduce(((t,i)=>{const s=e[i];return t.concat(s.playlists)}),[]):[],Ie=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:n,eventStream:r})=>{if(!e.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:h}=e[0].attributes,d=ve(e.filter(Ee)).map(Se),u=ve(e.filter(we)),c=ve(e.filter(Ce)),p=e.map((e=>e.attributes.captionServices)).filter(Boolean),m={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:Te(d,s)};h>=0&&(m.minimumUpdatePeriod=1e3*h),t&&(m.locations=t),i&&(m.contentSteering=i),"dynamic"===o&&(m.suggestedPresentationDelay=l),r&&r.length>0&&(m.eventStream=r);const g=0===m.playlists.length,f=u.length?((e,t={},i=!1)=>{let s;const n=e.reduce(((e,n)=>{const r=n.attributes.role&&n.attributes.role.value||"",a=n.attributes.lang||"";let o=n.attributes.label||"main";if(a&&!n.attributes.label){const e=r?` (${r})`:"";o=`${n.attributes.lang}${e}`}e[o]||(e[o]={language:a,autoselect:!0,default:"main"===r,playlists:[],uri:""});const l=be((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:n,discontinuityStarts:r},a)=>{const o={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:n,discontinuityStarts:r,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(o.contentProtection=e.contentProtection),e.serviceLocation&&(o.attributes.serviceLocation=e.serviceLocation),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o})(n,i),t);return e[o].playlists.push(l),void 0===s&&"main"===r&&(s=n,s.default=!0),e}),{});return s||(n[Object.keys(n)[0]].default=!0),n})(u,s,g):null,y=c.length?((e,t={})=>e.reduce(((e,i)=>{const s=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";return e[s]||(e[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[s].playlists.push(be((({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:n})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);const r={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};e.codecs&&(r.CODECS=e.codecs);const a={attributes:r,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:n,mediaSequence:i,segments:t};return e.serviceLocation&&(a.attributes.serviceLocation=e.serviceLocation),a})(i),t)),e}),{}))(c,s):null,_=d.concat(ke(f),ke(y)),v=_.map((({timelineStarts:e})=>e));var b,T;return m.timelineStarts=ge(v),b=_,T=m.timelineStarts,b.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=T.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))})),f&&(m.mediaGroups.AUDIO.audio=f),y&&(m.mediaGroups.SUBTITLES.subs=y),p.length&&(m.mediaGroups["CLOSED-CAPTIONS"].cc=p.reduce(((e,t)=>t?(t.forEach((t=>{const{channel:i,language:s}=t;e[s]={autoselect:!1,default:!1,instreamId:i,language:s},t.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[s].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[s]["3D"]=t["3D"])})),e):e),{})),n?(({oldManifest:e,newManifest:t})=>{const i=e.playlists.concat(fe(e)),s=t.playlists.concat(fe(t));return t.timelineStarts=ge([e.timelineStarts,t.timelineStarts]),(({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));const s=((e,t)=>{for(let i=0;is.timeline||s.segments.length&&t.timeline>s.segments[s.segments.length-1].timeline)&&t.discontinuitySequence--);s.segments[r].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),ye({playlist:t,mediaSequence:s.segments[r].number})}))})({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t})({oldManifest:n,newManifest:m}):m},xe=(e,t,i)=>{const{NOW:s,clientOffset:n,availabilityStartTime:r,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=e,h=(s+n)/1e3+l-(r+o);return Math.ceil((h*a-t)/i)},Ae=(e,t)=>{const{type:i,minimumUpdatePeriod:s=0,media:n="",sourceDuration:r,timescale:a=1,startNumber:o=1,periodStart:l}=e,h=[];let d=-1;for(let u=0;ud&&(d=g),m<0){const o=u+1;f=o===t.length?"dynamic"===i&&s>0&&n.indexOf("$Number$")>0?xe(e,d,p):(r*a-d)/p:(t[o].t-d)/p}else f=m+1;const y=o+h.length+f;let _=o+h.length;for(;_e.replace(De,(e=>(t,i,s,n)=>{if("$$"===t)return"$";if(void 0===e[i])return t;const r=""+e[i];return"RepresentationID"===i?r:(n=s?parseInt(n,10):1,r.length>=n?r:`${new Array(n-r.length+1).join("0")}${r}`)})(t)),Le=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=e,n=oe({baseUrl:e.baseUrl,source:Pe(s.sourceURL,i),range:s.range}),r=((e,t)=>e.duration||t?e.duration?de(e):Ae(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}])(e,t);return r.map((t=>{i.Number=t.number,i.Time=t.time;const s=Pe(e.media||"",i),r=e.timescale||1,a=e.presentationTimeOffset||0,o=e.periodStart+(t.time-a)/r;return{uri:s,timeline:t.timeline,duration:t.duration,resolvedUri:T(e.baseUrl||"",s),map:n,number:t.number,presentationTime:o}}))},Oe=(e,t)=>{const{duration:i,segmentUrls:s=[],periodStart:n}=e;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");const r=s.map((t=>((e,t)=>{const{baseUrl:i,initialization:s={}}=e,n=oe({baseUrl:i,source:s.sourceURL,range:s.range}),r=oe({baseUrl:i,source:t.media,range:t.mediaRange});return r.map=n,r})(e,t)));let a;return i&&(a=de(e)),t&&(a=Ae(e,t)),a.map(((t,i)=>{if(r[i]){const s=r[i],a=e.timescale||1,o=e.presentationTimeOffset||0;return s.timeline=t.timeline,s.duration=t.duration,s.number=t.number,s.presentationTime=n+(t.time-o)/a,s}})).filter((e=>e))},Re=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Le,i=se(e,t.template)):t.base?(s=ue,i=se(e,t.base)):t.list&&(s=Oe,i=se(e,t.list));const n={attributes:e};if(!s)return n;const r=s(i,t.segmentTimeline);if(i.duration){const{duration:e,timescale:t=1}=i;i.duration=e/t}else r.length?i.duration=r.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0;return n.attributes=i,n.segments=r,t.base&&i.indexRange&&(n.sidx=r[0],n.segments=[]),n},Ne=(e,t)=>ae(e.childNodes).filter((({tagName:e})=>e===t)),Me=e=>e.textContent.trim(),Ue=e=>{const t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;const[i,s,n,r,a,o]=t.slice(1);return 31536e3*parseFloat(i||0)+2592e3*parseFloat(s||0)+86400*parseFloat(n||0)+3600*parseFloat(r||0)+60*parseFloat(a||0)+parseFloat(o||0)},Be={mediaPresentationDuration:e=>Ue(e),availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:e=>Ue(e),suggestedPresentationDelay:e=>Ue(e),type:e=>e,timeShiftBufferDepth:e=>Ue(e),start:e=>Ue(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>(e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))))(e),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){const t=parseInt(e,10);return isNaN(t)?Ue(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},Fe=e=>e&&e.attributes?ae(e.attributes).reduce(((e,t)=>{const i=Be[t.name]||Be.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},qe={"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"},je=(e,t)=>t.length?re(e.map((function(e){return t.map((function(t){const i=Me(t),s=T(e.baseUrl,i),n=se(Fe(t),{baseUrl:s});return s!==i&&!n.serviceLocation&&e.serviceLocation&&(n.serviceLocation=e.serviceLocation),n}))}))):e,$e=e=>{const t=Ne(e,"SegmentTemplate")[0],i=Ne(e,"SegmentList")[0],s=i&&Ne(i,"SegmentURL").map((e=>se({tag:"SegmentURL"},Fe(e)))),n=Ne(e,"SegmentBase")[0],r=i||t,a=r&&Ne(r,"SegmentTimeline")[0],o=i||n||t,l=o&&Ne(o,"Initialization")[0],h=t&&Fe(t);h&&l?h.initialization=l&&Fe(l):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});const d={template:h,segmentTimeline:a&&Ne(a,"S").map((e=>Fe(e))),list:i&&se(Fe(i),{segmentUrls:s,initialization:Fe(l)}),base:n&&se(Fe(n),{initialization:Fe(l)})};return Object.keys(d).forEach((e=>{d[e]||delete d[e]})),d},He=e=>re(Ne(e.node,"EventStream").map((t=>{const i=Fe(t),s=i.schemeIdUri;return Ne(t,"Event").map((t=>{const n=Fe(t),r=n.presentationTime||0,a=i.timescale||1,o=n.duration||0,l=r/a+e.attributes.start;return{schemeIdUri:s,value:i.value,id:n.id,start:l,end:l+o/a,messageData:Me(t)||n.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),Ve=(e,t)=>(i,s)=>{const n=je(t,Ne(i.node,"BaseURL")),r=se(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(r.periodDuration=i.attributes.duration);const a=Ne(i.node,"AdaptationSet"),o=$e(i.node);return re(a.map(((e,t,i)=>s=>{const n=Fe(s),r=je(t,Ne(s,"BaseURL")),a=Ne(s,"Role")[0],o={role:Fe(a)};let l=se(e,n,o);const h=Ne(s,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(u=Fe(h)).schemeIdUri?("string"!=typeof u.value?[]:u.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===u.schemeIdUri?("string"!=typeof u.value?[]:u.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[i,s=""]=e.split("=");t.channel=i,t.language=e,s.split(",").forEach((e=>{const[i,s]=e.split(":");"lang"===i?t.language=s:"er"===i?t.easyReader=Number(s):"war"===i?t.aspectRatio=Number(s):"3D"===i&&(t["3D"]=Number(s))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;var u;d&&(l=se(l,{captionServices:d}));const c=Ne(s,"Label")[0];if(c&&c.childNodes.length){const e=c.childNodes[0].nodeValue.trim();l=se(l,{label:e})}const p=Ne(s,"ContentProtection").reduce(((e,t)=>{const i=Fe(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const s=qe[i.schemeIdUri];if(s){e[s]={attributes:i};const n=Ne(t,"cenc:pssh")[0];if(n){const t=Me(n);e[s].pssh=t&&E(t)}}return e}),{});Object.keys(p).length&&(l=se(l,{contentProtection:p}));const m=$e(s),g=Ne(s,"Representation"),f=se(i,m);return re(g.map(((e,t,i)=>s=>{const n=Ne(s,"BaseURL"),r=je(t,n),a=se(e,Fe(s)),o=$e(s);return r.map((e=>({segmentInfo:se(i,o),attributes:se(a,e)})))})(l,r,f)))})(r,n,o)))},ze=(e,t)=>{if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;const i=se({serverURL:Me(e[0])},Fe(e[0]));return i.queryBeforeStart="true"===i.queryBeforeStart,i},We=e=>{if(""===e)throw new Error("DASH_EMPTY_MANIFEST");const t=new te.DOMParser;let i,s;try{i=t.parseFromString(e,"application/xml"),s=i&&"MPD"===i.documentElement.tagName?i.documentElement:null}catch(e){}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error("DASH_INVALID_XML");return s};var Ge,Xe=i(962),Ke=i.n(Xe),Ye=K([73,68,51]),Qe=function e(t,i){return void 0===i&&(i=0),(t=K(t)).length-i<10||!ee(t,Ye,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=K(e))[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?s+20:s+10}(t,i),e(t,i))},Je=(new Uint8Array([79,112,117,115,72,101,97,100]),function(e){return"string"==typeof e?Z(e):e}),Ze=function(e){e=K(e);for(var t=[],i=0;e.length>i;){var s=e[i],n=0,r=0,a=e[++r];for(r++;128&a;)n=(127&a)<<7,a=e[r],r++;n+=127&a;for(var o=0;o>>0,o=t.subarray(r+4,r+8);if(0===a)break;var l=r+a;if(l>t.length){if(s)break;l=t.length}var h=t.subarray(r+8,l);ee(o,i[0])&&(1===i.length?n.push(h):n.push.apply(n,e(h,i.slice(1),s))),r=l}return n},tt={EBML:K([26,69,223,163]),DocType:K([66,130]),Segment:K([24,83,128,103]),SegmentInfo:K([21,73,169,102]),Tracks:K([22,84,174,107]),Track:K([174]),TrackNumber:K([215]),DefaultDuration:K([35,227,131]),TrackEntry:K([174]),TrackType:K([131]),FlagDefault:K([136]),CodecID:K([134]),CodecPrivate:K([99,162]),VideoTrack:K([224]),AudioTrack:K([225]),Cluster:K([31,67,182,117]),Timestamp:K([231]),TimestampScale:K([42,215,177]),BlockGroup:K([160]),BlockDuration:K([155]),Block:K([161]),SimpleBlock:K([163])},it=[128,64,32,16,8,4,2,1],st=function(e,t,i,s){void 0===i&&(i=!0),void 0===s&&(s=!1);var n=function(e){for(var t=1,i=0;i=i.length)return i.length;var n=st(i,s,!1);if(ee(t.bytes,n.bytes))return s;var r=st(i,s+n.length);return e(t,i,s+r.length+r.value+n.length)},at=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return nt(e)})):[nt(e)]}(i),t=K(t);var s=[];if(!i.length)return s;for(var n=0;nt.length?t.length:o+a.value,h=t.subarray(o,l);ee(i[0],r.bytes)&&(1===i.length?s.push(h):s=s.concat(e(h,i.slice(1)))),n+=r.length+a.length+h.length}return s},ot=K([0,0,0,1]),lt=K([0,0,1]),ht=K([0,0,3]),dt=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(l)&&(n=r+o),r+=o+("h264"===t?1:2)}else r++}return e.subarray(0,0)},ct={webm:K([119,101,98,109]),matroska:K([109,97,116,114,111,115,107,97]),flac:K([102,76,97,67]),ogg:K([79,103,103,83]),ac3:K([11,119]),riff:K([82,73,70,70]),avi:K([65,86,73]),wav:K([87,65,86,69]),"3gp":K([102,116,121,112,51,103]),mp4:K([102,116,121,112]),fmp4:K([115,116,121,112]),mov:K([102,116,121,112,113,116]),moov:K([109,111,111,118]),moof:K([109,111,111,102])},pt={aac:function(e){var t=Qe(e);return ee(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Qe(e);return ee(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=at(e,[tt.EBML,tt.DocType])[0];return ee(t,ct.webm)},mkv:function(e){var t=at(e,[tt.EBML,tt.DocType])[0];return ee(t,ct.matroska)},mp4:function(e){return!pt["3gp"](e)&&!pt.mov(e)&&(!(!ee(e,ct.mp4,{offset:4})&&!ee(e,ct.fmp4,{offset:4}))||!(!ee(e,ct.moof,{offset:4})&&!ee(e,ct.moov,{offset:4}))||void 0)},mov:function(e){return ee(e,ct.mov,{offset:4})},"3gp":function(e){return ee(e,ct["3gp"],{offset:4})},ac3:function(e){var t=Qe(e);return ee(e,ct.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188(s,n,r)=>{const a=t.levels[n],o=new RegExp(`^(${a})$`);let l=e;if("log"!==s&&r.unshift(s.toUpperCase()+":"),i&&(l=`%c${e}`,r.unshift(i)),r.unshift(l+":"),kt){kt.push([].concat(r));const e=kt.length-1e3;kt.splice(0,e>0?e:0)}if(!p().console)return;let h=p().console[s];h||"debug"!==s||(h=p().console.info||p().console.log),h&&a&&o.test(s)&&h[Array.isArray(r)?"apply":"call"](p().console,r)})(t,a,s),a.createLogger=(n,r,a)=>{const o=void 0!==r?r:i;return e(`${t} ${o} ${n}`,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:r},a.level=e=>{if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);r=e}return r},a.history=()=>kt?[].concat(kt):[],a.history.filter=e=>(kt||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),a.history.clear=()=>{kt&&(kt.length=0)},a.history.disable=()=>{null!==kt&&(kt.length=0,kt=null)},a.history.enable=()=>{null===kt&&(kt=[])},a.error=(...e)=>n("error",r,e),a.warn=(...e)=>n("warn",r,e),a.debug=(...e)=>n("debug",r,e),a}("VIDEOJS"),xt=It.createLogger,At=Object.prototype.toString,Dt=function(e){return Ot(e)?Object.keys(e):[]};function Pt(e,t){Dt(e).forEach((i=>t(e[i],i)))}function Lt(e,t,i=0){return Dt(e).reduce(((i,s)=>t(i,e[s],s)),i)}function Ot(e){return!!e&&"object"==typeof e}function Rt(e){return Ot(e)&&"[object Object]"===At.call(e)&&e.constructor===Object}function Nt(...e){const t={};return e.forEach((e=>{e&&Pt(e,((e,i)=>{Rt(e)?(Rt(t[i])||(t[i]={}),t[i]=Nt(t[i],e)):t[i]=e}))})),t}function Mt(e={}){const t=[];for(const i in e)if(e.hasOwnProperty(i)){const s=e[i];t.push(s)}return t}function Ut(e,t,i,s=!0){const n=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const e=i();return n(e),e}};return s&&(r.set=n),Object.defineProperty(e,t,r)}var Bt=Object.freeze({__proto__:null,each:Pt,reduce:Lt,isObject:Ot,isPlain:Rt,merge:Nt,values:Mt,defineLazyProperty:Ut});let Ft,qt=!1,jt=null,$t=!1,Ht=!1,Vt=!1,zt=!1,Wt=!1,Gt=null,Xt=null;const Kt=Boolean(p().cast&&p().cast.framework&&p().cast.framework.CastReceiverContext);let Yt=null,Qt=!1,Jt=!1,Zt=!1,ei=!1,ti=!1,ii=!1,si=!1;const ni=Boolean(di()&&("ontouchstart"in p()||p().navigator.maxTouchPoints||p().DocumentTouch&&p().document instanceof p().DocumentTouch)),ri=p().navigator&&p().navigator.userAgentData;if(ri&&ri.platform&&ri.brands&&($t="Android"===ri.platform,Vt=Boolean(ri.brands.find((e=>"Microsoft Edge"===e.brand))),zt=Boolean(ri.brands.find((e=>"Chromium"===e.brand))),Wt=!Vt&&zt,Gt=Xt=(ri.brands.find((e=>"Chromium"===e.brand))||{}).version||null,Jt="Windows"===ri.platform),!zt){const e=p().navigator&&p().navigator.userAgent||"";qt=/iPod/i.test(e),jt=function(){const t=e.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),$t=/Android/i.test(e),Ft=function(){const t=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;const i=t[1]&&parseFloat(t[1]),s=t[2]&&parseFloat(t[2]);return i&&s?parseFloat(t[1]+"."+t[2]):i||null}(),Ht=/Firefox/i.test(e),Vt=/Edg/i.test(e),zt=/Chrome/i.test(e)||/CriOS/i.test(e),Wt=!Vt&&zt,Gt=Xt=function(){const t=e.match(/(Chrome|CriOS)\/(\d+)/);return t&&t[2]?parseFloat(t[2]):null}(),Yt=function(){const t=/MSIE\s(\d+)\.\d/.exec(e);let i=t&&parseFloat(t[1]);return!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e)&&(i=11),i}(),ti=/Tizen/i.test(e),ii=/Web0S/i.test(e),si=ti||ii,Qt=/Safari/i.test(e)&&!Wt&&!$t&&!Vt&&!si,Jt=/Windows/i.test(e),Zt=/iPad/i.test(e)||Qt&&ni&&!/iPhone/i.test(e),ei=/iPhone/i.test(e)&&!Zt}const ai=ei||Zt||qt,oi=(Qt||ai)&&!Wt;var li=Object.freeze({__proto__:null,get IS_IPOD(){return qt},get IOS_VERSION(){return jt},get IS_ANDROID(){return $t},get ANDROID_VERSION(){return Ft},get IS_FIREFOX(){return Ht},get IS_EDGE(){return Vt},get IS_CHROMIUM(){return zt},get IS_CHROME(){return Wt},get CHROMIUM_VERSION(){return Gt},get CHROME_VERSION(){return Xt},IS_CHROMECAST_RECEIVER:Kt,get IE_VERSION(){return Yt},get IS_SAFARI(){return Qt},get IS_WINDOWS(){return Jt},get IS_IPAD(){return Zt},get IS_IPHONE(){return ei},get IS_TIZEN(){return ti},get IS_WEBOS(){return ii},get IS_SMART_TV(){return si},TOUCH_ENABLED:ni,IS_IOS:ai,IS_ANY_SAFARI:oi});function hi(e){return"string"==typeof e&&Boolean(e.trim())}function di(){return g()===p().document}function ui(e){return Ot(e)&&1===e.nodeType}function ci(){try{return p().parent!==p().self}catch(e){return!0}}function pi(e){return function(t,i){if(!hi(t))return g()[e](null);hi(i)&&(i=g().querySelector(i));const s=ui(i)?i:g();return s[e]&&s[e](t)}}function mi(e="div",t={},i={},s){const n=g().createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){const i=t[e];"textContent"===e?gi(n,i):n[e]===i&&"tabIndex"!==e||(n[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){n.setAttribute(e,i[e])})),s&&Ri(n,s),n}function gi(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function fi(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function yi(e,t){return function(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(t),e.classList.contains(t)}function _i(e,...t){return e.classList.add(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e}function vi(e,...t){return e?(e.classList.remove(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e):(It.warn("removeClass was called with an element that doesn't exist"),null)}function bi(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 Ti(e,t){Object.getOwnPropertyNames(t).forEach((function(i){const s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)}))}function Si(e){const t={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0){const s=e.attributes;for(let e=s.length-1;e>=0;e--){const n=s[e].name;let r=s[e].value;i.includes(n)&&(r=null!==r),t[n]=r}}return t}function Ei(e,t){return e.getAttribute(t)}function wi(e,t,i){e.setAttribute(t,i)}function Ci(e,t){e.removeAttribute(t)}function ki(){g().body.focus(),g().onselectstart=function(){return!1}}function Ii(){g().onselectstart=function(){return!0}}function xi(e){if(e&&e.getBoundingClientRect&&e.parentNode){const 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(Fi(e,"height"))),i.width||(i.width=parseFloat(Fi(e,"width"))),i}}function Ai(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};const t=e.offsetWidth,i=e.offsetHeight;let s=0,n=0;for(;e.offsetParent&&e!==g()[St.fullscreenElement];)s+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;return{left:s,top:n,width:t,height:i}}function Di(e,t){const i={x:0,y:0};if(ai){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){const e=Fi(t,"transform");if(/^matrix/.test(e)){const t=e.slice(7,-1).split(/,\s/).map(Number);i.x+=t[4],i.y+=t[5]}else if(/^matrix3d/.test(e)){const t=e.slice(9,-1).split(/,\s/).map(Number);i.x+=t[12],i.y+=t[13]}if(t.assignedSlot&&t.assignedSlot.parentElement&&p().WebKitCSSMatrix){const e=p().getComputedStyle(t.assignedSlot.parentElement).transform,s=new(p().WebKitCSSMatrix)(e);i.x+=s.m41,i.y+=s.m42}t=t.parentNode||t.host}}const s={},n=Ai(t.target),r=Ai(e),a=r.width,o=r.height;let l=t.offsetY-(r.top-n.top),h=t.offsetX-(r.left-n.left);return t.changedTouches&&(h=t.changedTouches[0].pageX-r.left,l=t.changedTouches[0].pageY+r.top,ai&&(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 Pi(e){return Ot(e)&&3===e.nodeType}function Li(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Oi(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((e=>("function"==typeof e&&(e=e()),ui(e)||Pi(e)?e:"string"==typeof e&&/\S/.test(e)?g().createTextNode(e):void 0))).filter((e=>e))}function Ri(e,t){return Oi(t).forEach((t=>e.appendChild(t))),e}function Ni(e,t){return Ri(Li(e),t)}function Mi(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}const Ui=pi("querySelector"),Bi=pi("querySelectorAll");function Fi(e,t){if(!e||!t)return"";if("function"==typeof p().getComputedStyle){let i;try{i=p().getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}function qi(e){[...g().styleSheets].forEach((t=>{try{const i=[...t.cssRules].map((e=>e.cssText)).join(""),s=g().createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(i){const s=g().createElement("link");s.rel="stylesheet",s.type=t.type,s.media=t.media.mediaText,s.href=t.href,e.document.head.appendChild(s)}}))}var ji=Object.freeze({__proto__:null,isReal:di,isEl:ui,isInFrame:ci,createEl:mi,textContent:gi,prependTo:fi,hasClass:yi,addClass:_i,removeClass:vi,toggleClass:bi,setAttributes:Ti,getAttributes:Si,getAttribute:Ei,setAttribute:wi,removeAttribute:Ci,blockTextSelection:ki,unblockTextSelection:Ii,getBoundingClientRect:xi,findPosition:Ai,getPointerPosition:Di,isTextNode:Pi,emptyEl:Li,normalizeContent:Oi,appendContent:Ri,insertContent:Ni,isSingleLeftClick:Mi,$:Ui,$$:Bi,computedStyle:Fi,copyStyleSheetsToWindow:qi});let $i,Hi=!1;const Vi=function(){if(!1===$i.options.autoSetup)return;const e=Array.prototype.slice.call(g().getElementsByTagName("video")),t=Array.prototype.slice.call(g().getElementsByTagName("audio")),i=Array.prototype.slice.call(g().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 ns(e,t,i){if(!Ki.has(e))return;const s=Ki.get(e);if(!s.handlers)return;if(Array.isArray(t))return es(ns,e,t,i);const n=function(e,t){s.handlers[t]=[],Zi(e,t)};if(void 0===t){for(const t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&n(e,t);return}const r=s.handlers[t];if(r)if(i){if(i.guid)for(let e=0;e=t&&(e(...s),i=n)}},cs=function(e,t,i,s=p()){let n;const r=function(){const r=this,a=arguments;let o=function(){n=null,o=null,i||e.apply(r,a)};!n&&i&&e.apply(r,a),s.clearTimeout(n),n=s.setTimeout(o,t)};return r.cancel=()=>{s.clearTimeout(n),n=null},r};var ps=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:hs,bind_:ds,throttle:us,debounce:cs});let ms;class gs{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},ss(this,e,t),this.addEventListener=i}off(e,t){ns(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},as(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},os(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;"string"==typeof e&&(e={type:t}),e=ts(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),rs(this,e)}queueTrigger(e){ms||(ms=new Map);const t=e.type||e;let i=ms.get(this);i||(i=new Map,ms.set(this,i));const s=i.get(t);i.delete(t),p().clearTimeout(s);const n=p().setTimeout((()=>{i.delete(t),0===i.size&&(i=null,ms.delete(this)),this.trigger(e)}),0);i.set(t,n)}}gs.prototype.allowedEvents_={},gs.prototype.addEventListener=gs.prototype.on,gs.prototype.removeEventListener=gs.prototype.off,gs.prototype.dispatchEvent=gs.prototype.trigger;const fs=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,ys=e=>e instanceof gs||!!e.eventBusEl_&&["on","one","off","trigger"].every((t=>"function"==typeof e[t])),_s=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,vs=(e,t,i)=>{if(!e||!e.nodeName&&!ys(e))throw new Error(`Invalid target for ${fs(t)}#${i}; must be a DOM node or evented object.`)},bs=(e,t,i)=>{if(!_s(e))throw new Error(`Invalid event type for ${fs(t)}#${i}; must be a non-empty string or array.`)},Ts=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${fs(t)}#${i}; must be a function.`)},Ss=(e,t,i)=>{const s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let n,r,a;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),[r,a]=t):(n=t[0],r=t[1],a=t[2]),vs(n,e,i),bs(r,e,i),Ts(a,e,i),a=ds(e,a),{isTargetingSelf:s,target:n,type:r,listener:a}},Es=(e,t,i,s)=>{vs(e,e,t),e.nodeName?ls[t](e,i,s):e[t](i,s)},ws={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:n}=Ss(this,e,"on");if(Es(i,"on",s,n),!t){const e=()=>this.off(i,s,n);e.guid=n.guid;const t=()=>this.off("dispose",e);t.guid=n.guid,Es(this,"on","dispose",e),Es(i,"on","dispose",t)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:n}=Ss(this,e,"one");if(t)Es(i,"one",s,n);else{const e=(...t)=>{this.off(i,s,e),n.apply(null,t)};e.guid=n.guid,Es(i,"one",s,e)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:n}=Ss(this,e,"any");if(t)Es(i,"any",s,n);else{const e=(...t)=>{this.off(i,s,e),n.apply(null,t)};e.guid=n.guid,Es(i,"any",s,e)}},off(e,t,i){if(!e||_s(e))ns(this.eventBusEl_,e,t);else{const s=e,n=t;vs(s,this,"off"),bs(n,this,"off"),Ts(i,this,"off"),i=ds(this,i),this.off("dispose",i),s.nodeName?(ns(s,n,i),ns(s,"dispose",i)):ys(s)&&(s.off(n,i),s.off("dispose",i))}},trigger(e,t){vs(this.eventBusEl_,this,"trigger");const i=e&&"string"!=typeof e?e.type:e;if(!_s(i))throw new Error(`Invalid event type for ${fs(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return rs(this.eventBusEl_,e,t)}};function Cs(e,t={}){const{eventBusKey:i}=t;if(i){if(!e[i].nodeName)throw new Error(`The eventBusKey "${i}" does not refer to an element.`);e.eventBusEl_=e[i]}else e.eventBusEl_=mi("span",{className:"vjs-event-bus"});return Object.assign(e,ws),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Ki.has(e)&&Ki.delete(e)})),p().setTimeout((()=>{e.eventBusEl_=null}),0)})),e}const ks={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),Pt(e,((e,i)=>{this.state[i]!==e&&(t=t||{},t[i]={from:this.state[i],to:e}),this.state[i]=e})),t&&ys(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Is(e,t){return Object.assign(e,ks),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&ys(e)&&e.on("statechanged",e.handleStateChanged),e}const xs=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))},As=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Ds=function(e,t){return As(e)===As(t)};var Ps=Object.freeze({__proto__:null,toLowerCase:xs,toTitleCase:As,titleCaseEquals:Ds});class Ls{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Nt({},this.options_),t=this.options_=Nt(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${Ji()}`}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&&(Cs(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Is(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 Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=Nt(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return mi(e,t,i)}localize(e,t,i=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),r=n&&n[s],a=s&&s.split("-")[0],o=n&&n[a];let l=i;return r&&r[e]?l=r[e]:o&&o[e]&&(l=o[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){const s=t[i-1];let n=s;return void 0===s&&(n=e),n}))),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_[As(e.name())]=null,this.childNameIndex_[xs(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=e=>{const i=e.name;let s=e.opts;if(void 0!==t[i]&&(s=t[i]),!1===s)return;!0===s&&(s={}),s.playerOptions=this.options_.playerOptions;const n=this.addChild(i,s);n&&(this[i]=n)};let s;const n=Ls.getComponent("Tech");s=Array.isArray(e)?e:Object.keys(e),s.concat(Object.keys(this.options_).filter((function(e){return!s.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((t=>{let i,s;return"string"==typeof t?(i=t,s=e[i]||this.options_[i]||{}):(i=t.name,s=t),{name:i,opts:s}})).filter((e=>{const t=Ls.getComponent(e.opts.componentClass||As(e.name));return t&&!n.isTech(t)})).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)}$(e,t){return Ui(e,t||this.contentEl())}$$(e,t){return Bi(e,t||this.contentEl())}hasClass(e){return yi(this.el_,e)}addClass(...e){_i(this.el_,...e)}removeClass(...e){vi(this.el_,...e)}toggleClass(e,t){bi(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 Ei(this.el_,e)}setAttribute(e,t){wi(this.el_,e,t)}removeAttribute(e){Ci(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)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;const s=this.el_.style[e],n=s.indexOf("px");return-1!==n?parseInt(s.slice(0,n),10):parseInt(this.el_["offset"+As(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=Fi(this.el_,e),t=parseFloat(t),0===t||isNaN(t)){const i=`offset${As(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect();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=p().performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){const s=t.touches[0].pageX-i.pageX,n=t.touches[0].pageY-i.pageY;Math.sqrt(s*s+n*n)>10&&(e=!1)}}));const s=function(){e=!1};this.on("touchleave",s),this.on("touchcancel",s),this.on("touchend",(function(s){i=null,!0===e&&p().performance.now()-t<200&&(s.preventDefault(),this.trigger("tap"))}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=ds(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",(function(){e(),this.clearInterval(t),t=this.setInterval(e,250)}));const i=function(i){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=ds(this,e),this.clearTimersOnDispose_(),i=p().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),p().clearTimeout(e)),e}setInterval(e,t){e=ds(this,e),this.clearTimersOnDispose_();const i=p().setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),p().clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=ds(this,e),t=p().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=ds(this,t);const i=this.requestAnimationFrame((()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}));return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),p().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 Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(e){const t=p().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;const t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(t.x<0)return!1;if(t.x>(g().documentElement.clientWidth||p().innerWidth))return!1;if(t.y<0)return!1;if(t.y>(g().documentElement.clientHeight||p().innerHeight))return!1;let i=g().elementFromPoint(t.x,t.y);for(;i;){if(i===e)return!0;if(!i.parentNode)return!1;i=i.parentNode}}(e)&&(i=e,t(i.parentElement)&&t(i)&&"0"!==i.style.opacity&&"0px"!==p().getComputedStyle(i).height&&"0px"!==p().getComputedStyle(i).width)&&(!e.parentElement||e.tabIndex>=0));var i}static registerComponent(e,t){if("string"!=typeof e||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=Ls.getComponent("Tech"),s=i&&i.isTech(t),n=Ls===t||Ls.prototype.isPrototypeOf(t.prototype);if(s||!n){let t;throw t=s?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${e}"; ${t}.`)}e=As(e),Ls.components_||(Ls.components_={});const r=Ls.getComponent("Player");if("Player"===e&&r&&r.players){const e=r.players,t=Object.keys(e);if(e&&t.length>0&&t.map((t=>e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return Ls.components_[e]=t,Ls.components_[xs(e)]=t,t}static getComponent(e){if(e&&Ls.components_)return Ls.components_[e]}}function Os(e,t,i,s){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,s,i.length-1),i[s][t]}function Rs(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Os.bind(null,"start",0,e),end:Os.bind(null,"end",1,e)},p().Symbol&&p().Symbol.iterator&&(t[p().Symbol.iterator]=()=>(e||[]).values()),t}function Ns(e,t){return Array.isArray(e)?Rs(e):void 0===e||void 0===t?Rs():Rs([[e,t]])}Ls.registerComponent("Component",Ls);const Ms=function(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),n=Math.floor(e/3600);const r=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(n=s=i="-"),n=n>0||a>0?n+":":"",s=((n||r>=10)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,n+s+i};let Us=Ms;function Bs(e){Us=e}function Fs(){Us=Ms}function qs(e,t=e){return Us(e,t)}var js=Object.freeze({__proto__:null,createTimeRanges:Ns,createTimeRange:Ns,setFormatTime:Bs,resetFormatTime:Fs,formatTime:qs});function $s(e,t){let i,s,n=0;if(!t)return 0;e&&e.length||(e=Ns(0,0));for(let r=0;rt&&(s=t),n+=s-i;return n/t}function Hs(e){if(e instanceof Hs)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Ot(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=Hs.defaultMessages[this.code]||"")}function Vs(e){return null!=e&&"function"==typeof e.then}function zs(e){Vs(e)&&e.then(null,(e=>{}))}Hs.prototype.code=0,Hs.prototype.message="",Hs.prototype.status=null,Hs.prototype.metadata=null,Hs.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Hs.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."},Hs.MEDIA_ERR_CUSTOM=0,Hs.prototype.MEDIA_ERR_CUSTOM=0,Hs.MEDIA_ERR_ABORTED=1,Hs.prototype.MEDIA_ERR_ABORTED=1,Hs.MEDIA_ERR_NETWORK=2,Hs.prototype.MEDIA_ERR_NETWORK=2,Hs.MEDIA_ERR_DECODE=3,Hs.prototype.MEDIA_ERR_DECODE=3,Hs.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Hs.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Hs.MEDIA_ERR_ENCRYPTED=5,Hs.prototype.MEDIA_ERR_ENCRYPTED=5;const Ws=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}}))})};const Gs="vjs-modal-dialog";class Xs extends Ls{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_=mi("div",{className:`${Gs}-content`},{role:"document"}),this.descEl_=mi("p",{className:`${Gs}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),gi(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`${Gs} 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_)return void(this.options_.fillAlways&&this.fill());const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if("boolean"==typeof e){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const 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){const t=this.contentEl(),i=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Ni(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);const n=this.getChild("closeButton");n&&i.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Li(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){const e=g().activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())return e.preventDefault(),void this.close();if("Tab"!==e.key)return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let s;for(let e=0;e(e instanceof p().HTMLAnchorElement||e instanceof p().HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof p().HTMLInputElement||e instanceof p().HTMLSelectElement||e instanceof p().HTMLTextAreaElement||e instanceof p().HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof p().HTMLIFrameElement||e instanceof p().HTMLObjectElement||e instanceof p().HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")))}}Xs.prototype.options_={pauseOnOpen:!0,temporary:!0},Ls.registerComponent("ModalDialog",Xs);class Ks extends gs{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})},ys(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;ithis.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 Zs{constructor(e){Zs.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const s=e.length;this.cues_=e,this.length_=e.length;const n=function(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})};if(tt[e],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}const an=function(e){return new URL(e,g().baseURI)},on=function(e){return new URL(e,g().baseURI).href},ln=function(e){if("string"==typeof e){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},hn=function(e,t=p().location){return an(e).origin!==t.origin};var dn=Object.freeze({__proto__:null,parseUrl:an,getAbsoluteURL:on,getFileExtension:ln,isCrossOrigin:hn});const un=function(e,t){const i=new(p().WebVTT.Parser)(p(),p().vttjs,p().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&&(p().console&&p().console.groupCollapsed&&p().console.groupCollapsed(`Text Track parsing errors for ${t.src}`),s.forEach((e=>It.error(e))),p().console&&p().console.groupEnd&&p().console.groupEnd()),i.flush()},cn=function(e,t){const i={uri:e},s=hn(e);s&&(i.cors=s);const n="use-credentials"===t.tech_.crossOrigin();n&&(i.withCredentials=n),y()(i,ds(this,(function(e,i,s){if(e)return It.error(e,i);t.loaded_=!0,"function"!=typeof p().WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return un(s,t);It.error(`vttjs failed to load, stopping trying to process ${t.src}`)})):un(s,t)})))};class pn extends rn{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Nt(e,{kind:sn[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=nn[t.mode]||"disabled";const 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;const n=new Zs(this.cues_),r=new Zs(this.activeCues_);let a=!1;this.timeupdateHandler=ds(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,a&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"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){nn[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||cn(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return r;const 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 gn extends rn{constructor(e={}){const t=Nt(e,{kind:en[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 fn extends gs{constructor(e={}){let t;super();const i=new pn(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=fn.NONE,i.addEventListener("loadeddata",(()=>{t=fn.LOADED,this.trigger({type:"load",target:this})}))}}fn.prototype.allowedEvents_={load:"load"},fn.NONE=0,fn.LOADING=1,fn.LOADED=2,fn.ERROR=3;const yn={audio:{ListClass:class extends Ks{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Ys(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Ys(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Ys(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)}},TrackClass:mn,capitalName:"Audio"},video:{ListClass:class extends Ks{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Qs(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,Qs(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)}},TrackClass:gn,capitalName:"Video"},text:{ListClass:Js,TrackClass:pn,capitalName:"Text"}};Object.keys(yn).forEach((function(e){yn[e].getterName=`${e}Tracks`,yn[e].privateName=`${e}Tracks_`}));const vn={remoteText:{ListClass:Js,TrackClass:pn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;tthis.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})),bn.names.forEach((t=>{const i=bn[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 bn.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(ds(this,(function(){const 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 Ns(0,0)}bufferedPercent(){return $s(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(yn.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach((e=>{const t=this[`${e}Tracks`]()||[];let i=t.length;for(;i--;){const s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}}))}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new Hs(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ns(0,0):Ns()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){yn.names.forEach((e=>{const t=yn[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(!p().WebVTT)if(g().body.contains(this.el())){if(!this.options_["vtt.js"]&&Rt(v())&&Object.keys(v()).length>0)return void this.trigger("vttjsloaded");const e=g().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})),p().WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const 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_();const n=()=>this.trigger("texttrackchange"),r=()=>{n();for(let t=0;tthis.autoRemoteTextTracks_.addTrack(i.track))),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Ji();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 Tn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Tn||e instanceof Tn||e===Tn}static registerTech(e,t){if(Tn.techs_||(Tn.techs_={}),!Tn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Tn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Tn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=As(e),Tn.techs_[e]=t,Tn.techs_[xs(e)]=t,"Tech"!==e&&Tn.defaultTechOrder_.push(e),t}static getTech(e){if(e)return Tn.techs_&&Tn.techs_[e]?Tn.techs_[e]:(e=As(e),p()&&p().videojs&&p().videojs[e]?(It.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),p().videojs[e]):void 0)}}bn.names.forEach((function(e){const t=bn[e];Tn.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Tn.prototype.featuresVolumeControl=!0,Tn.prototype.featuresMuteControl=!0,Tn.prototype.featuresFullscreenResize=!1,Tn.prototype.featuresPlaybackRate=!1,Tn.prototype.featuresProgressEvents=!1,Tn.prototype.featuresSourceset=!1,Tn.prototype.featuresTimeupdateEvents=!1,Tn.prototype.featuresNativeTextTracks=!1,Tn.prototype.featuresVideoFrameCallback=!1,Tn.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){const i=e.sourceHandlers||[];let s;for(let e=0;ePn(t,Sn[t.type],i,e)),1)}function kn(e,t,i,s=null){const n="call"+As(i),r=e.reduce(Dn(n),s),a=r===wn,o=a?null:t[i](r);return function(e,t,i,s){for(let n=e.length-1;n>=0;n--){const r=e[n];r[t]&&r[t](s,i)}}(e,i,o,a),o}const In={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},xn={setCurrentTime:1,setMuted:1,setVolume:1},An={play:1,pause:1};function Dn(e){return(t,i)=>t===wn?wn:i[e]?i[e](t):t}function Pn(e={},t=[],i,s,n=[],r=!1){const[a,...o]=t;if("string"==typeof a)Pn(e,Sn[a],i,s,n,r);else if(a){const t=function(e,t){const i=En[e.id()];let s=null;if(null==i)return s=t(e),En[e.id()]=[[t,s]],s;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){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const e=t.key.substring(5).toLowerCase();this.move(e)}else if(Un.isEventKey(t,"play")||Un.isEventKey(t,"pause")||Un.isEventKey(t,"ff")||Un.isEventKey(t,"rw")){t.preventDefault();const e=Un.getEventName(t);this.performMediaAction_(e)}else Un.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){const t=e.relatedTarget;let i=null;const s=this.getCurrentComponent(e.target);t&&(i=Boolean(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(){const e=this.player_,t=[];function i(e){for(const 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()))return void t.push(e);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_){const 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:()=>{const 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){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),s=this.focusableComponents.filter((s=>s!==t&&this.isInDirection_(i.boundingClientRect,s.getPositions().boundingClientRect,e))),n=this.findBestCandidate_(i.center,s,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let s=1/0,n=null;for(const r of t){const t=r.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&&It.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const s=mi(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(mi("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=mi("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";const i=this.localize(e);this.controlText_=e,gi(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)}}Ls.registerComponent("ClickableComponent",Fn);class qn extends Fn{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 mi("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;null===e||"anonymous"===e||"use-credentials"===e?this.$("img")&&(this.$("img").crossOrigin=e):this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(mi("picture",{className:"vjs-poster",tabIndex:-1},{},mi("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?zs(this.player_.play()):this.player_.pause())}}qn.prototype.crossorigin=qn.prototype.crossOrigin,Ls.registerComponent("PosterImage",qn);const jn="#222",$n="#ccc",Hn={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 Vn(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)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 zn(e,t,i){try{e.style[t]=i}catch(e){return}}function Wn(e){return e?`${e}px`:""}Ls.registerComponent("TextTrackDisplay",class extends Ls{constructor(e,t,i){super(e,t,i);const 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(ds(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)return void this.hide();e.on("fullscreenchange",s),e.on("playerresize",s);const t=p().screen.orientation||p(),i=p().screen.orientation?"change":"orientationchange";t.addEventListener(i,s),e.on("dispose",(()=>t.removeEventListener(i,s)));const n=this.options_.playerOptions.tracks||[];for(let e=0;e0&&t.forEach((e=>{if(e.style.inset){const 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()||!p().CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight();let n=0,r=0;Math.abs(i-s)>.1&&(i>s?n=Math.round((e-t*s)/2):r=Math.round((t-e/s)/2)),zn(this.el_,"insetInline",Wn(n)),zn(this.el_,"insetBlock",Wn(r))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){const e=i[s];if(!e)continue;const n=e.displayState;if(t.color&&(n.firstChild.style.color=t.color),t.textOpacity&&zn(n.firstChild,"color",Vn(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(n.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&zn(n.firstChild,"backgroundColor",Vn(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?zn(n,"backgroundColor",Vn(t.windowColor,t.windowOpacity)):n.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?n.firstChild.style.textShadow=`2px 2px 3px ${jn}, 2px 2px 4px ${jn}, 2px 2px 5px ${jn}`:"raised"===t.edgeStyle?n.firstChild.style.textShadow=`1px 1px ${jn}, 2px 2px ${jn}, 3px 3px ${jn}`:"depressed"===t.edgeStyle?n.firstChild.style.textShadow=`1px 1px ${$n}, 0 1px ${$n}, -1px -1px ${jn}, 0 -1px ${jn}`:"uniform"===t.edgeStyle&&(n.firstChild.style.textShadow=`0 0 4px ${jn}, 0 0 4px ${jn}, 0 0 4px ${jn}, 0 0 4px ${jn}`)),t.fontPercent&&1!==t.fontPercent){const e=p().parseFloat(n.style.fontSize);n.style.fontSize=e*t.fontPercent+"px",n.style.height="auto",n.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?n.firstChild.style.fontVariant="small-caps":n.firstChild.style.fontFamily=Hn[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof p().WebVTT||e.every((e=>!e.activeCues)))return;const t=[];for(let i=0;ithis.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)return zs(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());const i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s)return void this.player_.tech(!0).focus();const n=()=>s.focus();Vs(t)?t.then(n,(()=>{})):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Xn.prototype.controlText_="Play Video",Ls.registerComponent("BigPlayButton",Xn),Ls.registerComponent("CloseButton",class extends Gn{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)}});class Kn extends Gn{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()?zs(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)))}}Kn.prototype.controlText_="Play",Ls.registerComponent("PlayToggle",Kn);class Yn extends Ls{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],(e=>this.update(e))),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=mi("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=mi("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=qs(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,It.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_=g().createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))})))}updateContent(e){}}Yn.prototype.labelText_="Time",Yn.prototype.controlText_="Time",Ls.registerComponent("TimeDisplay",Yn);class Qn extends Yn{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)}}Qn.prototype.labelText_="Current Time",Qn.prototype.controlText_="Current Time",Ls.registerComponent("CurrentTimeDisplay",Qn);class Jn extends Yn{constructor(e,t){super(e,t);const 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){const t=this.player_.duration();this.updateTextNode_(t)}}Jn.prototype.labelText_="Duration",Jn.prototype.controlText_="Duration",Ls.registerComponent("DurationDisplay",Jn),Ls.registerComponent("TimeDivider",class extends Ls{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}});class Zn extends Yn{constructor(e,t){super(e,t),this.on(e,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(mi("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"!=typeof this.player_.duration())return;let t;t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t)}}Zn.prototype.labelText_="Remaining Time",Zn.prototype.controlText_="Remaining Time",Ls.registerComponent("RemainingTimeDisplay",Zn),Ls.registerComponent("LiveDisplay",class extends Ls{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=mi("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(mi("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(g().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()}});class er extends Gn{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(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=mi("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 tr(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}er.prototype.controlText_="Seek to live, currently playing live",Ls.registerComponent("SeekToLive",er);var ir=Object.freeze({__proto__:null,clamp:tr});class sr extends Ls{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;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Wt||e.preventDefault(),ki(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Ii(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",(()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"}))),e}getProgress(){return Number(tr(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Di(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const 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")}}Ls.registerComponent("Slider",sr);const nr=(e,t)=>tr(e/t*100,0,100).toFixed(2)+"%";Ls.registerComponent("LoadProgressBar",class extends Ls{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",(e=>this.update(e)))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=mi("span",{className:"vjs-control-text"}),i=mi("span",{textContent:this.localize("Loaded")}),s=g().createTextNode(": ");return this.percentageEl_=mi("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",(()=>{const e=this.player_.liveTracker,t=this.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),n=this.partEls_,r=nr(s,i);this.percent_!==r&&(this.el_.style.width=r,gi(this.percentageEl_,r),this.percent_=r);for(let e=0;et.length;e--)this.el_.removeChild(n[e-1]);n.length=t.length}))}}),Ls.registerComponent("TimeTooltip",class extends Ls{constructor(e,t){super(e,t),this.update=us(ds(this,this.update),hs)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const s=Ai(this.el_),n=xi(this.player_.el()),r=e.width*t;if(!n||!s)return;let a=e.left-n.left+r,o=e.width-r+(n.right-e.right);o||(o=e.width-r,a=r);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){gi(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let n;const r=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const e=this.player_.liveTracker.liveWindow(),i=e-t*e;n=(i<1?"":"-")+qs(i,e)}else n=qs(i,r);this.update(e,t,n),s&&s()}))}});class rr extends Ls{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=us(ds(this,this.update),hs)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const i=this.getChild("timeTooltip");if(!i)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}rr.prototype.options_={children:[]},ai||$t||rr.prototype.options_.children.push("timeTooltip"),Ls.registerComponent("PlayProgressBar",rr);class ar extends Ls{constructor(e,t){super(e,t),this.update=us(ds(this,this.update),hs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,(()=>{this.el_.style.left=e.width*t+"px"}))}}ar.prototype.options_={children:["timeTooltip"]},Ls.registerComponent("MouseTimeDisplay",ar);class or extends sr{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=ds(this,this.update),this.update=us(this.update_,hs),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 g()&&"visibilityState"in g()&&this.on(g(),"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===g().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,hs))}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"===g().visibilityState)return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{const e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker;let 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}",[qs(e,s),qs(s,s)],"{1} of {2}")),this.currentTime_=e,this.duration_=s),this.bar&&this.bar.update(xi(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(){const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Mi(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Mi(e)||isNaN(this.player_.duration()))return;let i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);const s=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(s>=.99)return void n.seekToLiveEdge();const e=n.seekableStart(),t=n.liveCurrentTime();if(i=e+s*n.liveWindow(),i>=t&&(i=t),i<=e&&(i=e+.1),i===1/0)return}else i=s*this.player_.duration(),i===this.player_.duration()&&(i-=.1);this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?zs(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){const 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();const 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 g()&&"visibilityState"in g()&&this.off(g(),"visibilitychange",this.toggleVisibility_),super.dispose()}}or.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ai||$t||or.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Ls.registerComponent("SeekBar",or);class lr extends Ls{constructor(e,t){super(e,t),this.handleMouseMove=us(ds(this,this.handleMouseMove),hs),this.throttledHandleMouseSeek=us(ds(this,this.handleMouseSeek),hs),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){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;const n=t.el(),r=Ai(n);let a=Di(n,e).x;a=tr(a,0,1),s&&s.update(r,a),i&&i.update(r,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach((e=>e.disable&&e.disable())),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&zs(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(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}lr.prototype.options_={children:["seekBar"]},Ls.registerComponent("ProgressControl",lr);class hr extends Gn{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(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){g().pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in p()?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 g().exitPictureInPicture&&super.show()}}hr.prototype.controlText_="Picture-in-Picture",Ls.registerComponent("PictureInPictureToggle",hr);class dr extends Gn{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===g()[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()}}dr.prototype.controlText_="Fullscreen",Ls.registerComponent("FullscreenToggle",dr),Ls.registerComponent("VolumeLevel",class extends Ls{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}),Ls.registerComponent("VolumeLevelTooltip",class extends Ls{constructor(e,t){super(e,t),this.update=us(ds(this,this.update),hs)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){const i=xi(this.el_),s=xi(this.player_.el()),n=e.width*t;if(!s||!i)return;const r=e.left-s.left+n,a=e.width-n+(s.right-e.right);let o=i.width/2;ri.width&&(o=i.width),this.el_.style.right=`-${o}px`}this.write(`${s}%`)}write(e){gi(this.el_,e)}updateVolume(e,t,i,s,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,i,s.toFixed(0)),n&&n()}))}});class ur extends Ls{constructor(e,t){super(e,t),this.update=us(ds(this,this.update),hs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,(()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}ur.prototype.options_={children:["volumeLevelTooltip"]},Ls.registerComponent("MouseVolumeLevelDisplay",ur);class cr extends sr{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){Mi(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),s=xi(i),n=this.vertical();let r=Di(i,e);r=n?r.y:r.x,r=tr(r,0,1),t.update(s,r,n)}Mi(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}cr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},ai||$t||cr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),cr.prototype.playerEvent="volumechange",Ls.registerComponent("VolumeBar",cr);class pr extends Ls{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||Rt(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),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")}))}(this,e),this.throttledHandleMouseMove=us(ds(this,this.handleMouseMove),hs),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){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}pr.prototype.options_={children:["volumeBar"]},Ls.registerComponent("VolumeControl",pr);class mr extends Gn{constructor(e,t){super(e,t),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")}))}(this,e),this.on(e,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){const e=i<.1?.1:i;this.player_.volume(e),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),ai&&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),vi(this.el_,[0,1,2,3].reduce(((e,t)=>e+`${t?" ":""}vjs-vol-${t}`),"")),_i(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}mr.prototype.controlText_="Mute",Ls.registerComponent("MuteToggle",mr);class gr extends Ls{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||Rt(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"),ss(g(),"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ns(g(),"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}gr.prototype.options_={children:["muteToggle","volumeControl"]},Ls.registerComponent("VolumePanel",gr);class fr extends Gn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()?i.seekableEnd():this.player_.duration();let n;n=t+this.skipTime<=s?t+this.skipTime:s,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}fr.prototype.controlText_="Skip Forward",Ls.registerComponent("SkipForward",fr);class yr extends Gn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,s=i&&i.isLive()&&i.seekableStart();let n;n=s&&t-this.skipTime<=s?s:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}yr.prototype.controlText_="Skip Backward",Ls.registerComponent("SkipBackward",yr);class _r extends Ls{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 Ls&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Ls&&(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){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=mi(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),ss(t,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||g().activeElement;if(!this.children().some((e=>e.el()===t))){const e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter((t=>t.el()===e.target))[0];if(!i)return;"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){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}Ls.registerComponent("Menu",_r);class vr extends Ls{constructor(e,t={}){super(e,t),this.menuButton_=new Gn(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Gn.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const 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(),ss(g(),"keyup",this.handleMenuKeyUp_)})),this.on("mouseleave",(e=>this.handleMouseLeave(e))),this.on("keydown",(e=>this.handleSubmenuKeyDown(e)))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new _r(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=mi("li",{className:"vjs-menu-title",textContent:As(this.options_.title),tabIndex:-1}),i=new Ls(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,e)},r=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],n),s.addEventListener("change",n),s.addEventListener("selectedlanguagechange",r),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],n),s.removeEventListener("change",n),s.removeEventListener("selectedlanguagechange",r)})),void 0===s.onchange){let e;this.on(["tap","click"],(function(){if("object"!=typeof p().Event)try{e=new(p().Event)("change")}catch(e){}e||(e=g().createEvent("Event"),e.initEvent("change",!0,!0)),s.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){const 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){const t=this.player().textTracks();let 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()}}Ls.registerComponent("OffTextTrackMenuItem",Er);class wr extends br{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Sr){let i;this.label_&&(i=`${this.label_} off`),e.push(new Er(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i-1){const i=new t(this.player_,{track:n,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});i.addClass(`vjs-${n.kind}-menu-item`),e.push(i)}}return e}}Ls.registerComponent("TextTrackButton",wr);class Cr extends Tr{constructor(e,t){const i=t.track,s=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=n&&n{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;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const 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";const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(As(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,s=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(As(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 Ar(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Pr),e}}Lr.prototype.kinds_=["captions","subtitles"],Lr.prototype.controlText_="Subtitles",Ls.registerComponent("SubsCapsButton",Lr);class Or extends Tr{constructor(e,t){const 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`);const n=(...e)=>{this.handleTracksChange.apply(this,e)};s.addEventListener("change",n),this.on("dispose",(()=>{s.removeEventListener("change",n)}))}createEl(e,t,i){const s=super.createEl(e,t,i),n=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(mi("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(mi("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const 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)}}Nr.prototype.contentElType="button",Ls.registerComponent("PlaybackRateMenuItem",Nr);class Mr extends vr{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(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=mi("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new Nr(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}Mr.prototype.controlText_="Playback Rate",Ls.registerComponent("PlaybackRateMenuButton",Mr);class Ur extends Ls{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Ls.registerComponent("Spacer",Ur),Ls.registerComponent("CustomControlSpacer",class extends Ur{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class Br extends Ls{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Br.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},Ls.registerComponent("ControlBar",Br);class Fr extends Xs{constructor(e,t){super(e,t),this.on(e,"error",(e=>{this.open(e)}))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Fr.prototype.options_=Object.assign({},Xs.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Ls.registerComponent("ErrorDisplay",Fr);class qr extends Ls{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(),mi("select",{id:this.options_.id},{},this.options_.SelectOptions.map((e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Ji()}`)+"-"+e[1].replace(/\W+/g,""),i=mi("option",{id:t,value:this.localize(e[0]),textContent:e[1]});return i.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),i})))}}Ls.registerComponent("TextTrackSelect",qr);class jr extends Ls{constructor(e,t={}){super(e,t);const i=mi("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const s=this.options_.selects;for(const t of s){const i=this.options_.selectConfigs[t],s=i.className,n=i.id.replace("%s",this.options_.id_);let r=null;const a=`vjs_select_${Ji()}`;if("colors"===this.options_.type){r=mi("span",{className:s});const e=mi("label",{id:n,className:"vjs-label",textContent:i.label});e.setAttribute("for",a),r.appendChild(e)}const o=new qr(e,{SelectOptions:i.options,legendId:this.options_.legendId,id:a,labelId:n});this.addChild(o),"colors"===this.options_.type&&(r.appendChild(o.el()),this.el().appendChild(r))}}createEl(){return mi("fieldset",{className:this.options_.className})}}Ls.registerComponent("TextTrackFieldset",jr);class $r extends Ls{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new jr(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);const n=new jr(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(n);const r=new jr(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(r)}createEl(){return mi("div",{className:"vjs-track-settings-colors"})}}Ls.registerComponent("TextTrackSettingsColors",$r);class Hr extends Ls{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new jr(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);const n=new jr(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(n);const r=new jr(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(r)}createEl(){return mi("div",{className:"vjs-track-settings-font"})}}Ls.registerComponent("TextTrackSettingsFont",Hr);class Vr extends Ls{constructor(e,t={}){super(e,t);const i=this.localize("restore all settings to the default values"),s=new Gn(e,{controlText:i,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const n=new Gn(e,{controlText:i,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Done"),this.addChild(n)}createEl(){return mi("div",{className:"vjs-track-settings-controls"})}}Ls.registerComponent("TrackSettingsControls",Vr);const zr="vjs-text-track-settings",Wr=["#000","Black"],Gr=["#00F","Blue"],Xr=["#0FF","Cyan"],Kr=["#0F0","Green"],Yr=["#F0F","Magenta"],Qr=["#F00","Red"],Jr=["#FFF","White"],Zr=["#FF0","Yellow"],ea=["1","Opaque"],ta=["0.5","Semi-Transparent"],ia=["0","Transparent"],sa={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Wr,Jr,Qr,Kr,Gr,Zr,Yr,Xr],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ea,ta,ia],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Jr,Wr,Qr,Kr,Gr,Zr,Yr,Xr],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:[ea,ta],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:[ia,ta,ea],className:"vjs-window-opacity vjs-opacity"}};function na(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}sa.windowColor.options=sa.backgroundColor.options,Ls.registerComponent("TextTrackSettings",class extends Xs{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=mi("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){const t=new $r(e,{textTrackComponentid:this.id_,selectConfigs:sa,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Hr(e,{textTrackComponentid:this.id_,selectConfigs:sa,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const s=new Vr(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()})),Pt(sa,(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 Lt(sa,((e,t,i)=>{const s=(n=this.$(t.selector),r=t.parser,na(n.options[n.options.selectedIndex].value,r));var n,r;return void 0!==s&&(e[i]=s),e}),{})}setValues(e){Pt(sa,((t,i)=>{!function(e,t,i){if(t)for(let s=0;s{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(p().localStorage.getItem(zr))}catch(e){It.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?p().localStorage.setItem(zr,JSON.stringify(e)):p().localStorage.removeItem(zr)}catch(e){It.warn(e)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}),Ls.registerComponent("ResizeManager",class extends Ls{constructor(e,t){let i=t.ResizeObserver||p().ResizeObserver;null===t.ResizeObserver&&(i=!1),super(e,Nt({createEl:!i,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||p().ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=cs((()=>{this.resizeHandler()}),100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const e=this.debouncedHandler_;let t=this.unloadListener_=function(){ns(this,"resize",e),ns(this,"unload",t),t=null};ss(this.el_.contentWindow,"unload",t),ss(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()}});const ra={trackingThreshold:20,liveTolerance:15};Ls.registerComponent("LiveTracker",class extends Ls{constructor(e,t){super(e,Nt(ra,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_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(p().performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const s=this.liveCurrentTime(),n=this.player_.currentTime();let r=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-n)>this.options_.liveTolerance;this.timeupdateSeen_&&s!==1/0||(r=!1),r!==this.behindLiveEdge_&&(this.behindLiveEdge_=r,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_,hs),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return-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()}}),Ls.registerComponent("TitleBar",class extends Ls{constructor(e,t){super(e,t),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:mi("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Ji()}`}),description:mi("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Ji()}`})},mi("div",{className:"vjs-title-bar"},{},Mt(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{const s=this.state[e],n=this.els[e],r=i[e];Li(n),s&&gi(n,s),t&&(t.removeAttribute(r),s&&t.setAttribute(r,n.id))})),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}});const aa={initialDisplay:4e3,position:[],takeFocus:!1};Ls.registerComponent("TransientButton",class extends Gn{constructor(e,t){super(e,t=Nt(aa,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(){const e=mi("button",{},{type:"button",class:this.buildCSSClass()},mi("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()}});const oa=e=>{const t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;const i=e.$$("source"),s=[];let n="";if(!i.length)return!1;for(let e=0;e{let i={};for(let s=0;sha([e.el(),p().HTMLMediaElement.prototype,p().Element.prototype,la],"innerHTML"))(e),n=i=>(...s)=>{const n=i.apply(t,s);return oa(e),n};["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(i[e]=t[e],t[e]=n(i[e]))})),Object.defineProperty(t,"innerHTML",Nt(s,{set:n(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_)},ua=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?on(p().Element.prototype.getAttribute.call(this,"src")):""},set(e){return p().Element.prototype.setAttribute.call(this,"src",e),e}});class ca extends Tn{constructor(e,t){super(e,t);const i=e.source;let 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()){const e=this.el_.childNodes;let t=e.length;const i=[];for(;t--;){const n=e[t];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),s||this.el_.hasAttribute("crossorigin")||!hn(n.src)||(s=!0)):i.push(n))}for(let e=0;eha([e.el(),p().HTMLMediaElement.prototype,ua],"src"))(e),s=t.setAttribute,n=t.load;Object.defineProperty(t,"src",Nt(i,{set:s=>{const n=i.set.call(t,s);return e.triggerSourceset(t.src),n}})),t.setAttribute=(i,n)=>{const r=s.call(t,i,n);return/src/i.test(i)&&e.triggerSourceset(t.src),r},t.load=()=>{const i=n.call(t);return oa(e)||(e.triggerSourceset(""),da(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):oa(e)||da(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=n,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let i=0;ie.removeEventListener("change",i)));const s=()=>{for(let e=0;e{e.removeEventListener("change",i),e.removeEventListener("change",s),e.addEventListener("change",s)})),this.on("webkitendfullscreen",(()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)}))}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const 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){const t=yn[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:t=>{const i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[vn.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},r=function(){const e=[];for(let t=0;t{const t=n[e];i.addEventListener(e,t),this.on("dispose",(s=>i.removeEventListener(e,t)))})),this.on("loadstart",r),this.on("dispose",(e=>this.off("loadstart",r)))}proxyNativeTracks_(){yn.names.forEach((e=>{this.proxyNativeTracksForType_(e)}))}createEl(){let e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){const t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),ca.disposeMediaElement(e),e=t}else{e=g().createElement("video");const t=Nt({},this.options_.tag&&Si(this.options_.tag));ni&&!0===this.options_.nativeControlsForTouch||delete t.controls,Ti(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&wi(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready((function(){t.forEach((function(e){this.trigger(e)}),this)}))}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&oi?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){It(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&$t&&Wt&&0===this.el_.currentTime){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"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(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)zs(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(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}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 It.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const s=mi("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return It.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return It.warn(`No matching source element found with src: ${e}`),!1}reset(){ca.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=g().createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();const e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),p().performance&&(e.creationTime=p().performance.now()),e}}Ut(ca,"TEST_VID",(function(){if(!di())return;const e=g().createElement("video"),t=g().createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e})),ca.isSupported=function(){try{ca.TEST_VID.volume=.5}catch(e){return!1}return!(!ca.TEST_VID||!ca.TEST_VID.canPlayType)},ca.canPlayType=function(e){return ca.TEST_VID.canPlayType(e)},ca.canPlaySource=function(e,t){return ca.canPlayType(e.type)},ca.canControlVolume=function(){try{const e=ca.TEST_VID.volume;ca.TEST_VID.volume=e/2+.1;const t=e!==ca.TEST_VID.volume;return t&&ai?(p().setTimeout((()=>{ca&&ca.prototype&&(ca.prototype.featuresVolumeControl=e!==ca.TEST_VID.volume)})),!1):t}catch(e){return!1}},ca.canMuteVolume=function(){try{const e=ca.TEST_VID.muted;return ca.TEST_VID.muted=!e,ca.TEST_VID.muted?wi(ca.TEST_VID,"muted","muted"):Ci(ca.TEST_VID,"muted"),e!==ca.TEST_VID.muted}catch(e){return!1}},ca.canControlPlaybackRate=function(){if($t&&Wt&&Xt<58)return!1;try{const e=ca.TEST_VID.playbackRate;return ca.TEST_VID.playbackRate=e/2+.1,e!==ca.TEST_VID.playbackRate}catch(e){return!1}},ca.canOverrideAttributes=function(){try{const e=()=>{};Object.defineProperty(g().createElement("video"),"src",{get:e,set:e}),Object.defineProperty(g().createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(g().createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(g().createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},ca.supportsNativeTextTracks=function(){return oi||ai&&Wt},ca.supportsNativeVideoTracks=function(){return!(!ca.TEST_VID||!ca.TEST_VID.videoTracks)},ca.supportsNativeAudioTracks=function(){return!(!ca.TEST_VID||!ca.TEST_VID.audioTracks)},ca.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]){Ut(ca.prototype,e,(()=>ca[t]()),!0)})),ca.prototype.featuresVolumeControl=ca.canControlVolume(),ca.prototype.movingMediaElementInDOM=!ai,ca.prototype.featuresFullscreenResize=!0,ca.prototype.featuresProgressEvents=!0,ca.prototype.featuresTimeupdateEvents=!0,ca.prototype.featuresVideoFrameCallback=!(!ca.TEST_VID||!ca.TEST_VID.requestVideoFrameCallback),ca.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){}}()}},ca.resetMediaElement=function(e){if(!e)return;const t=e.querySelectorAll("source");let 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){ca.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){ca.prototype["set"+As(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){ca.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){ca.prototype["set"+As(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){ca.prototype[e]=function(){return this.el_[e]()}})),Tn.withSourceHandlers(ca),ca.nativeSourceHandler={},ca.nativeSourceHandler.canPlayType=function(e){try{return ca.TEST_VID.canPlayType(e)}catch(e){return""}},ca.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return ca.nativeSourceHandler.canPlayType(e.type);if(e.src){const t=ln(e.src);return ca.nativeSourceHandler.canPlayType(`video/${t}`)}return""},ca.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},ca.nativeSourceHandler.dispose=function(){},ca.registerSourceHandler(ca.nativeSourceHandler),Tn.registerTech("Html5",ca);const pa=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],ma={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ga=["tiny","xsmall","small","medium","large","xlarge","huge"],fa={};ga.forEach((e=>{const t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;fa[e]=`vjs-layout-${t}`}));const ya={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class _a extends Ls{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Ji()}`,(t=Object.assign(_a.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const 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=xt(this.id_),this.fsApi_=St,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Si(e),this.language(this.options_.language),t.languages){const e={};Object.getOwnPropertyNames(t.languages).forEach((function(i){e[i.toLowerCase()]=t.languages[i]})),this.languages_=e}else this.languages_=_a.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 new Error(`plugin "${e}" does not exist`)})),this.scrubbing_=!1,this.el_=this.createEl(),Cs(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ss(g(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=Nt(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){const e=(new(p().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"))It.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const 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 Bn(this),this.addClass("vjs-spatial-navigation-enabled")),ni&&this.addClass("vjs-touch-enabled"),ai||this.addClass("vjs-workinghover"),_a.players[this.id_]=this;const n=_t.split(".")[0];this.addClass(`vjs-v${n}`),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"),ns(g(),this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ns(g(),"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),_a.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),En.hasOwnProperty(this.id())&&delete En[this.id()],bn.names.forEach((e=>{const t=this[bn[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");const s="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div"));const n=Si(t);if(s){for(e=this.el_=t,t=this.tag=g().createElement("video");e.children.length;)t.appendChild(e.firstChild);yi(e,"video-js")||_i(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"),n.tabindex="-1",Wt&&Jt&&(t.setAttribute("role","application"),n.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in n&&delete n.width,"height"in n&&delete n.height,Object.getOwnPropertyNames(n).forEach((function(i){s&&"class"===i||e.setAttribute(i,n[i]),s&&t.setAttribute(i,n[i])})),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused");const r=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter((e=>li[e])).map((e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-")));if(this.addClass(...r),!0!==p().VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Gi("vjs-styles-dimensions");const e=Ui(".vjs-styles-defaults"),t=Ui("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);const a=t.getElementsByTagName("a");for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},ys(t=this)?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):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 new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===p().VIDEOJS_NO_DYNAMIC_STYLE){const 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();return void(i&&(e>=0&&(i.width=e),t>=0&&(i.height=t)))}let e,t,i,s;i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";const n=i.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,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),Xi(this.styleEl_,`\n .${s} {\n width: ${e}px;\n height: ${t}px;\n }\n\n .${s}.vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ${100*r}%;\n }\n `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=As(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Tn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let n=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(n=!1);const r={source:t,autoplay:n,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};bn.names.forEach((e=>{const t=bn[e];r[t.getterName]=this[t.privateName]})),Object.assign(r,this.options_[i]),Object.assign(r,this.options_[s]),Object.assign(r,this.options_[e.toLowerCase()]),this.tag&&(r.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(r.startTime=this.cache_.currentTime);const a=Tn.getTech(e);if(!a)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);var o,l;this.tech_=new a(r),this.tech_.ready(ds(this,this.handleTechReady_),!0),o=this.textTracksJson_||[],l=this.tech_,o.forEach((function(e){const t=l.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((e=>t.addCue(e)))})),l.textTracks(),pa.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${As(e)}_`](t)))})),Object.keys(ma).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${ma[e]}_`].bind(this),event:t}):this[`handleTech${ma[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||fi(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){bn.names.forEach((e=>{const t=bn[e];this[t.privateName]=this[t.getterName]()})),this.textTracksJson_=function(e){const t=e.$$("track"),i=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){const t=Ws(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(Ws))}(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&&It.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":_t}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||"string"!=typeof e)return;const t=()=>{const e=this.muted();this.muted(!0);const t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);const i=this.play();if(Vs(i))return i.catch((e=>{throw t(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)}))};let i;return"any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():t():(i=this.play(),Vs(i)&&(i=i.catch(t))),Vs(i)?i.then((()=>{this.trigger({type:"autoplay-success",autoplay:e})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:e})})):void 0}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=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;const i=e.cache_.sources.filter((e=>e.src===t));if(i.length)return i[0].type;const s=e.$$("source");for(let e=0;ee.src&&e.src===t)),n=[],r=this.$$("source"),a=[];for(let e=0;ethis.updateSourceCaches_(e);const 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;const 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");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(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()?zs(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()&&!g().pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let s=g()[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_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready((function(){if(e in xn)return function(e,t,i,s){return t[i](e.reduce(Dn(i),s))}(this.middleware_,this.tech_,e,t);if(e in An)return kn(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw It(e),e}}),!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in In)return function(e,t,i){return e.reduceRight(Dn(i),t[i]())}(this.middleware_,this.tech_,e);if(e in An)return kn(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw It(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t;if("TypeError"===t.name)throw It(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t;throw It(t),t}}}play(){return new Promise((e=>{this.play_(e)}))}play_(e=zs){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(oi||ai);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t)return this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!t&&i&&this.load());const s=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===s?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))}runPlayCallbacks_(e){const 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")||Ns(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){return void 0===e?(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime):(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,void(isFinite(e)&&(this.cache_.currentTime=Number(e)))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_)))}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=Ns(0,0)),e}seekable(){let e=this.techGet_("seekable");return e&&e.length||(e=Ns(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 $s(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;return void 0!==e?(t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){const t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise(((i,s)=>{function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),i()}function a(e,t){n(),s(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);const o=t.requestFullscreenHelper_(e);o&&(o.then(n,n),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){const e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise(((t,i)=>{function s(){e.off("fullscreenerror",r),e.off("fullscreenchange",n)}function n(){s(),t()}function r(e,t){s(),i(t)}e.one("fullscreenchange",n),e.one("fullscreenerror",r);const a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))}))}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=g()[this.fsApi_.exitFullscreen]();return e&&zs(e.then((()=>this.isFullscreen(!1)))),e}this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=g().documentElement.style.overflow,ss(g(),"keydown",this.boundFullWindowOnEscKey_),g().documentElement.style.overflow="hidden",_i(g().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,ns(g(),"keydown",this.boundFullWindowOnEscKey_),g().documentElement.style.overflow=this.docOrigOverflow,vi(g().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){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&p().documentPictureInPicture){const e=g().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(mi("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),p().documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then((t=>(qi(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=>{const i=t.target.querySelector(".video-js");e.parentNode.replaceChild(i,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")})),t)))}return"pictureInPictureEnabled"in g()&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return p().documentPictureInPicture&&p().documentPictureInPicture.window?(p().documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in g()?g().exitPictureInPicture():void 0}handleKeyDown(e){const{userActions:t}=this.options_;t&&t.hotkeys&&((e=>{const 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){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=t=>"f"===e.key.toLowerCase(),muteKey:s=t=>"m"===e.key.toLowerCase(),playPauseKey:n=t=>"k"===e.key.toLowerCase()||" "===e.key.toLowerCase()}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const t=Ls.getComponent("FullscreenToggle");!1!==g()[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),Ls.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Ls.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i[e,Tn.getTech(e)])).filter((([e,t])=>t?t.isSupported():(It.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1))),i=function(e,t,i){let s;return e.some((e=>t.some((t=>{if(s=i(e,t),s)return!0})))),s};let s;const n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};var r;return s=this.options_.sourceOrder?i(e,t,(r=n,(e,t)=>r(t,e))):i(t,e,n),s||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Rn(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Cn(this,i[0],((e,s)=>{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());var n,r;n=s,r=this.tech_,n.forEach((e=>e.setTech&&e.setTech(r)))})),i.length>1){const 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)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return!t||(Ds(t.tech,this.techName_)?(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready((()=>{this.changingSrc_=!1})),!1))}addSourceElement(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}removeSourceElement(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():zs(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}),ys(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:n}=i||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),n&&(n.update(),n.loadProgressBar&&n.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const 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){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let 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=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){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):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){const 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(bt("beforeerror").forEach((t=>{const i=t(this,e);Ot(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){const t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=null,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Hs(e),this.addClass("vjs-error"),It.error(`(CODE:${this.error_.code} ${Hs.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),bt("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_)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")}}listenForUserActivity_(){let e,t,i;const s=ds(this,this.reportUserActivity),n=function(t){s(),this.clearInterval(e)};this.on("mousedown",(function(){s(),this.clearInterval(e),e=this.setInterval(s,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,s())})),this.on("mouseup",n),this.on("mouseleave",n);const r=this.getChild("controlBar");let a;!r||ai||$t||(r.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),r.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",s),this.on("keyup",s),this.setInterval((function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);const e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}),250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}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)return!!this.isAudio_;this.isAudio_=!!e}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach((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){const 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(),ys(this)&&this.trigger("languagechange"))}languages(){return Nt(_a.prototype.options_.languages,this.languages_)}toJSON(){const e=Nt(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)})),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:h,description:r||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const 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:On(t.poster)}]),t}return Nt(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Si(e),s=i["data-setup"];if(yi(e,"vjs-fill")&&(i.fill=!0),yi(e,"vjs-fluid")&&(i.fluid=!0),null!==s)try{Object.assign(i,JSON.parse(s||"{}"))}catch(e){It.error("data-setup",e)}if(Object.assign(t,i),e.hasChildNodes()){const i=e.childNodes;for(let e=0,s=i.length;e"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}bn.names.forEach((function(e){const t=bn[e];_a.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),_a.prototype.crossorigin=_a.prototype.crossOrigin,_a.players={};const va=p().navigator;_a.prototype.options_={techOrder:Tn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:va&&(va.languages&&va.languages[0]||va.userLanguage||va.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},pa.forEach((function(e){_a.prototype[`handleTech${As(e)}_`]=function(){return this.trigger(e)}})),Ls.registerComponent("Player",_a);const ba="plugin",Ta="activePlugins_",Sa={},Ea=e=>Sa.hasOwnProperty(e),wa=e=>Ea(e)?Sa[e]:void 0,Ca=(e,t)=>{e[Ta]=e[Ta]||{},e[Ta][t]=!0},ka=(e,t,i)=>{const s=(i?"before":"")+"pluginsetup";e.trigger(s,t),e.trigger(s+":"+t.name,t)},Ia=(e,t)=>(t.prototype.name=e,function(...i){ka(this,{name:e,plugin:t,instance:null},!0);const s=new t(...[this,...i]);return this[e]=()=>s,ka(this,s.getEventHash()),s});class xa{constructor(e){if(this.constructor===xa)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Cs(this),delete this.trigger,Is(this,this.constructor.defaultState),Ca(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 rs(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Ta][e]=!1,this.player=this.state=null,t[e]=Ia(e,Sa[e])}static isBasic(e){const t="string"==typeof e?wa(e):e;return"function"==typeof t&&!xa.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Ea(e))It.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(_a.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Sa[e]=t,e!==ba&&(xa.isBasic(t)?_a.prototype[e]=function(e,t){const i=function(){ka(this,{name:e,plugin:t,instance:null},!0);const i=t.apply(this,arguments);return Ca(this,e),ka(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(e,t):_a.prototype[e]=Ia(e,t)),t}static deregisterPlugin(e){if(e===ba)throw new Error("Cannot de-register base plugin.");Ea(e)&&(delete Sa[e],delete _a.prototype[e])}static getPlugins(e=Object.keys(Sa)){let t;return e.forEach((e=>{const i=wa(e);i&&(t=t||{},t[e]=i)})),t}static getPluginVersion(e){const t=wa(e);return t&&t.VERSION||""}}function Aa(e,t,i,s){return function(e,t){let i=!1;return function(...s){return i||It.warn(e),i=!0,t.apply(this,s)}}(`${t} is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s)}xa.getPlugin=wa,xa.BASE_PLUGIN_NAME=ba,xa.registerPlugin(ba,xa),_a.prototype.usingPlugin=function(e){return!!this[Ta]&&!0===this[Ta][e]},_a.prototype.hasPlugin=function(e){return!!Ea(e)};const Da=e=>0===e.indexOf("#")?e.slice(1):e;function Pa(e,t,i){let s=Pa.getPlayer(e);if(s)return t&&It.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i),s;const n="string"==typeof e?Ui("#"+Da(e)):e;if(!ui(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const r="getRootNode"in n&&n.getRootNode()instanceof p().ShadowRoot?n.getRootNode():n.ownerDocument.body;n.ownerDocument.defaultView&&r.contains(n)||It.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),bt("beforesetup").forEach((e=>{const i=e(n,Nt(t));Ot(i)&&!Array.isArray(i)?t=Nt(t,i):It.error("please return an object in beforesetup hooks")}));const a=Ls.getComponent("Player");return s=new a(n,t,i),bt("setup").forEach((e=>e(s))),s}if(Pa.hooks_=vt,Pa.hooks=bt,Pa.hook=function(e,t){bt(e,t)},Pa.hookOnce=function(e,t){bt(e,[].concat(t).map((t=>{const i=(...s)=>(Tt(e,i),t(...s));return i})))},Pa.removeHook=Tt,!0!==p().VIDEOJS_NO_DYNAMIC_STYLE&&di()){let e=Ui(".vjs-styles-defaults");if(!e){e=Gi("vjs-styles-defaults");const t=Ui("head");t&&t.insertBefore(e,t.firstChild),Xi(e,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}zi(1,Pa),Pa.VERSION=_t,Pa.options=_a.prototype.options_,Pa.getPlayers=()=>_a.players,Pa.getPlayer=e=>{const t=_a.players;let i;if("string"==typeof e){const s=Da(e),n=t[s];if(n)return n;i=Ui("#"+s)}else i=e;if(ui(i)){const{player:e,playerId:s}=i;if(e||t[s])return e||t[s]}},Pa.getAllPlayers=()=>Object.keys(_a.players).map((e=>_a.players[e])).filter(Boolean),Pa.players=_a.players,Pa.getComponent=Ls.getComponent,Pa.registerComponent=(e,t)=>(Tn.isTech(t)&&It.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Ls.registerComponent.call(Ls,e,t)),Pa.getTech=Tn.getTech,Pa.registerTech=Tn.registerTech,Pa.use=function(e,t){Sn[e]=Sn[e]||[],Sn[e].push(t)},Object.defineProperty(Pa,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(Pa.middleware,"TERMINATOR",{value:wn,writeable:!1,enumerable:!0}),Pa.browser=li,Pa.obj=Bt,Pa.mergeOptions=Aa(9,"videojs.mergeOptions","videojs.obj.merge",Nt),Pa.defineLazyProperty=Aa(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Ut),Pa.bind=Aa(9,"videojs.bind","native Function.prototype.bind",ds),Pa.registerPlugin=xa.registerPlugin,Pa.deregisterPlugin=xa.deregisterPlugin,Pa.plugin=(e,t)=>(It.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),xa.registerPlugin(e,t)),Pa.getPlugins=xa.getPlugins,Pa.getPlugin=xa.getPlugin,Pa.getPluginVersion=xa.getPluginVersion,Pa.addLanguage=function(e,t){return e=(""+e).toLowerCase(),Pa.options.languages=Nt(Pa.options.languages,{[e]:t}),Pa.options.languages[e]},Pa.log=It,Pa.createLogger=xt,Pa.time=js,Pa.createTimeRange=Aa(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ns),Pa.createTimeRanges=Aa(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ns),Pa.formatTime=Aa(9,"videojs.formatTime","videojs.time.formatTime",qs),Pa.setFormatTime=Aa(9,"videojs.setFormatTime","videojs.time.setFormatTime",Bs),Pa.resetFormatTime=Aa(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Fs),Pa.parseUrl=Aa(9,"videojs.parseUrl","videojs.url.parseUrl",an),Pa.isCrossOrigin=Aa(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",hn),Pa.EventTarget=gs,Pa.any=os,Pa.on=ss,Pa.one=as,Pa.off=ns,Pa.trigger=rs,Pa.xhr=y(),Pa.TextTrack=pn,Pa.AudioTrack=mn,Pa.VideoTrack=gn,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{Pa[e]=function(){return It.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),ji[e].apply(null,arguments)}})),Pa.computedStyle=Aa(9,"videojs.computedStyle","videojs.dom.computedStyle",Fi),Pa.dom=ji,Pa.fn=ps,Pa.num=ir,Pa.str=Ps,Pa.url=dn,Pa.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 La{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 Oa extends Pa.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;const i=this.levels_.length;return t=new La(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;ti,e.qualityLevels.VERSION=Ra,i}(this,Pa.obj.merge({},e))};Pa.registerPlugin("qualityLevels",Na),Na.VERSION=Ra;const Ma=T,Ua=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Ba=e=>Pa.log.debug?Pa.log.debug.bind(Pa,"VHS:",`${e} >`):function(){};function Fa(...e){const t=Pa.obj||Pa;return(t.merge||t.mergeOptions).apply(t,e)}function qa(...e){const t=Pa.time||Pa;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}const ja=1/30,$a=.1,Ha=function(e,t){const i=[];let s;if(e&&e.length)for(s=0;s=t}))},za=function(e,t){return Ha(e,(function(e){return e-ja>=t}))},Wa=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},Ga=e=>{const t=[];for(let i=0;ir||(i+=t>n&&t<=r?r-t:r-n)}return i},Ya=(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},Qa=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(s,n){e.push({duration:s.duration,segmentIndex:i,partIndex:n,part:s,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),Ja=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},Za=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:i}=e;let s=(i||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return s+=t&&t.length?t.length:0,s},eo=(e,t)=>{if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;const i=Ja(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},to=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),ts&&([i,s]=[s,i]),i<0){for(let t=i;tDate.now()},ao=function(e){return e.excludeUntil&&e.excludeUntil===1/0},oo=function(e){const t=ro(e);return!e.disabled&&!t},lo=function(e,t){return t.attributes&&t.attributes[e]},ho=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!oo(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)),co=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const e in i){for(const n in i[e])if(s=t(i[e][n]),s)break;if(s)break}return!!s},po=e=>{if(!e||!e.playlists||!e.playlists.length)return co(e,(e=>e.playlists&&e.playlists.length||e.uri));for(let t=0;tq(e))))&&!co(e,(e=>uo(i,e))))return!1}return!0};var mo={liveEdgeDelay:eo,duration:io,seekable:function(e,t,i){const s=t||0;let n=no(e,t,!0,i);return null===n?qa():(n0)for(let t=l-1;t>=0;t--){const i=o[t];if(a+=i.duration,r){if(a<0)continue}else if(a+ja<=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:n-so({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,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let t=l;tja;if(0!==a&&!(s&&a+ja>=0)||t===o.length-1){if(r){if(a>0)continue}else if(a-ja>=0)continue;return{partIndex:i.partIndex,segmentIndex:i.segmentIndex,startTime:n+so({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:oo,isDisabled:function(e){return e.disabled},isExcluded:ro,isIncompatible:ao,playlistEnd:no,isAes:function(e){for(let t=0;t`${e}-${t}`,yo=(e,t,i)=>`placeholder-uri-${e}-${t}-${i}`,_o=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const s in e.mediaGroups[i])for(const n in e.mediaGroups[i][s]){const r=e.mediaGroups[i][s][n];t(r,i,s,n)}}))},vo=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},bo=(e,t,i=yo)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(s&&"AUDIO"===n&&!t.uri)for(let t=0;t{let t=e.playlists.length;for(;t--;){const i=e.playlists[t];vo({playlist:i,id:fo(t,i.uri)}),i.resolvedUri=Ma(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||go.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(e),(e=>{_o(e,(t=>{t.uri&&(t.resolvedUri=Ma(e.uri,t.uri))}))})(e)};class To{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(null!==this.offset_)return;if(!e.length)return;const[t]=e;void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce(((e,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[];const e={},t=[];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]){const t=e[i.class].push(i);i.classListIndex=t-1}else e[i.class]=[i],i.classListIndex=0}));for(const i of t){const 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(){const n=t.status<200||t.status>299,r=t.status>=400&&t.status<=499,a={uri:t.uri,requestType:e},o=n&&!r||s;if(i&&r)a.error=b({},i),a.errorType=Pa.Error.NetworkRequestFailed;else if(t.aborted)a.errorType=Pa.Error.NetworkRequestAborted;else if(t.timedout)a.erroType=Pa.Error.NetworkRequestTimeout;else if(o){const e=s?Pa.Error.NetworkBodyParserFailed:Pa.Error.NetworkBadStatus;a.errorType=e,a.status=t.status,a.headers=t.headers}return a},{EventTarget:Eo}=Pa,wo=(e,t)=>{if(!e)return t;const i=Fa(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{!e.resolvedUri&&e.uri&&(e.resolvedUri=Ma(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Ma(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Ma(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Ma(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=Ma(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=Ma(t,e.uri))}))},ko=function(e){const 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,xo=(e,t,i=Io)=>{const s=Fa(e,{}),n=s.playlists[t.id];if(!n)return null;if(i(n,t))return null;t.segments=ko(t);const r=Fa(n,t);if(r.preloadSegment&&!t.preloadSegment&&delete r.preloadSegment,n.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{const s=e.slice(),n=t.slice();i=i||0;const r=[];let a;for(let e=0;e{Co(e,r.resolvedUri)}));for(let e=0;e{if(e.playlists)for(let i=0;i{const i=e.segments||[],s=i[i.length-1],n=s&&s.parts&&s.parts[s.parts.length-1],r=n&&n.duration||s&&s.duration;return t&&r?1e3*r:500*(e.partTargetDuration||e.targetDuration||10)},Do=(e,t,i)=>{if(!e)return;const s=[];return e.forEach((e=>{if(!e.attributes)return;const{BANDWIDTH:t,RESOLUTION:i,CODECS:n}=e.attributes;s.push({id:e.id,bandwidth:t,resolution:i,codecs:n})})),{type:t,isLive:i,renditions:s}};class Po extends Eo{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Ba("PlaylistLoader");const{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new To,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=Ma(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(t.endList||!t.serverControl)return e;const i={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let s=t.mediaSequence+t.segments.length;if(e){const n=e.parts||[],r=Za(t)-1;r>-1&&r!==n.length-1&&(i._HLS_part=r),(r>-1||n.length)&&s--}i._HLS_msn=s}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const t=new(p().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})(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)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,i){const{uri:s,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:So({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return(({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:n=[],llhls:r})=>{const a=new L;e&&a.on("warn",e),t&&a.on("info",t),s.forEach((e=>a.addParser(e))),n.forEach((e=>a.addTagMapper(e))),a.push(i),a.end();const o=a.manifest;if(r||(["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}const l=Ja(o);if(l.length&&!o.partTargetDuration){const t=l.reduce(((e,t)=>Math.max(e,t.duration)),0);e&&(e({message:`manifest has no partTargetDuration defaulting to ${t}`}),go.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})({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:Pa.Error.StreamingHlsPlaylistParserError,error:e}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:n});const r=t||this.parseManifest_({url:i,manifestString:e});r.lastRequest=Date.now(),vo({playlist:r,uri:i,id:s});const a=xo(this.main,r);this.targetDuration=r.partTargetDuration||r.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Ao(this.media(),!!a)),n.parsedPlaylist=Do(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),p().clearTimeout(this.mediaUpdateTimeout),p().clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new To,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(p().clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=p().setTimeout(this.media.bind(this,e,!1),t))}const i=this.state,s=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.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_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Ao(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;const r={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:r}),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=Ua(e.resolvedUri,s),t)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:r}),this.haveMetadata({playlistString:s.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===i?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}pause(){this.mediaUpdateTimeout&&(p().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&&(p().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=p().setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(p().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=p().setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=p().location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},((t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:So({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=Ua(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=Do(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)return this.main=e,bo(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=ko(e),e.segments.forEach((t=>{Co(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||p().location.href;this.main=((e,t)=>{const i=fo(0,t),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:p().location.href,resolvedUri:p().location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return s.playlists[i]=s.playlists[0],s.playlists[t]=s.playlists[0],s})(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,s=e.ID;let n=i.playlists.length;for(;n--;){const r=i.playlists[n];if(r.attributes["PATHWAY-ID"]===s){const a=r.resolvedUri,o=r.id;if(t){const t=this.createCloneURI_(r.resolvedUri,e),a=fo(s,t),o=this.createCloneAttributes_(s,r.attributes),l=this.createClonePlaylist_(r,a,e,o);i.playlists[n]=l,i.playlists[a]=l,i.playlists[t]=l}else i.playlists.splice(n,1);delete i.playlists[o],delete i.playlists[a]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{if(i.mediaGroups[e]&&i.mediaGroups[e][s])for(const t in i.mediaGroups[e])if(t===s){for(const s in i.mediaGroups[e][t])i.mediaGroups[e][t][s].playlists.forEach(((e,t)=>{const s=i.playlists[e.id],n=s.id,r=s.resolvedUri;delete i.playlists[n],delete i.playlists[r]}));delete i.mediaGroups[e][t]}})),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,s=i.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),r=fo(e.ID,n),a=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,r,e,a);i.playlists[s]=o,i.playlists[r]=o,i.playlists[n]=o,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((n=>{if(s.mediaGroups[n]&&!s.mediaGroups[n][t])for(const r in s.mediaGroups[n])if(r===i){s.mediaGroups[n][t]={};for(const i in s.mediaGroups[n][r]){const a=s.mediaGroups[n][r][i];s.mediaGroups[n][t][i]=b({},a);const o=s.mediaGroups[n][t][i],l=this.createCloneURI_(a.resolvedUri,e);o.resolvedUri=l,o.uri=l,o.playlists=[],a.playlists.forEach(((r,a)=>{const l=s.playlists[r.id],h=yo(n,t,i),d=fo(t,h);if(l&&!s.playlists[d]){const t=this.createClonePlaylist_(l,d,e),i=t.resolvedUri;s.playlists[d]=t,s.playlists[i]=t}o.playlists[a]=this.createClonePlaylist_(r,d,e)}))}}}))}createClonePlaylist_(e,t,i,s){const n=this.createCloneURI_(e.resolvedUri,i),r={resolvedUri:n,uri:n,id:t};return e.segments&&(r.segments=[]),s&&(r.attributes=s),Fa(e,r)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const e of Object.keys(s))i.searchParams.set(e,s[e]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s=>{t[s]&&(i[s]=e)})),i}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const s=e.contentProtection[i].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const Lo=function(e,t,i,s){const n="arraybuffer"===e.responseType?e.response:e.responseText;!t&&n&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=n.byteLength||n.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&&(n||e.responseText)))),s(t,e)},Oo=function(){const e=function e(t,i){t=Fa({timeout:45e3},t);const s=e.beforeRequest||Pa.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||Pa.Vhs.xhr._requestCallbackSet||new Set,r=e._responseCallbackSet||Pa.Vhs.xhr._responseCallbackSet;s&&"function"==typeof s&&(Pa.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const a=!0===Pa.Vhs.xhr.original?Pa.xhr:Pa.Vhs.xhr,o=((e,t)=>{if(!e||!e.size)return;let i=t;return e.forEach((e=>{i=e(i)})),i})(n,t);n.delete(s);const l=a(o||t,(function(e,t){return((e,t,i,s)=>{e&&e.size&&e.forEach((e=>{e(t,i,s)}))})(r,l,e,t),Lo(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},Ro=function(e){const t={};return e.byterange&&(t.Range=function(e){let t;const i=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?p().BigInt(e.offset)+p().BigInt(e.length)-p().BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t}(e.byterange)),t},No=function(e,t){return e.start(t)+"-"+e.end(t)},Mo=function(e,t){const i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Uo=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Bo=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];X(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t},Fo=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},qo=function(e){return e.resolvedUri},jo=e=>{const t=Array.prototype.slice.call(e),i=16;let s,n,r="";for(let e=0;ejo(e),textRanges:e=>{let t,i="";for(t=0;t{if(!a)throw new 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&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;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(r.getTime()+1e3*a)?null:(i>new Date(r)&&(s=n),{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:mo.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"})})(e,t);if(!o)return a({message:`${e} was not found in the stream`});const l=o.segment,h=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}const n=i.getTime();return(s.getTime()-n)/1e3})(l.dateTimeObject,e);if("estimate"===o.type)return 0===i?a({message:`${e} is not buffered yet. Try again`}):(s(o.estimatedStart+h),void r.one("seeked",(()=>{Ho({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:n,tech:r,callback:a})})));const d=l.start+h;r.one("seeked",(()=>a(null,r.currentTime()))),n&&r.pause(),s(d)},Vo=(e,t)=>{if(4===e.readyState)return t()},{EventTarget:zo}=Pa,Wo=function(e,t){if(!Io(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(let i=0;i`placeholder-uri-${e}-${t}-${s.attributes.NAME||i}`,Xo=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(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,Ko=(e,t)=>{const i={};for(const s in e){const n=e[s].sidx;if(n){const e=_e(n);if(!t[e])break;const s=t[e].sidxInfo;Xo(s,n)&&(i[e]=t[e])}}return i};class Yo extends zo{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",(()=>{this.refreshXml_()})),this.on("mediaupdatetimeout",(()=>{this.refreshMedia_(this.media().id)})),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Ba("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){const s=e.sidx&&_e(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s])return void(this.mediaRequest_=p().setTimeout((()=>i(!1)),0));const n=Ua(e.sidx.resolvedUri),r=(n,r)=>{if(this.requestErrored_(n,r,t))return;const a=this.mainPlaylistLoader_.sidxMapping_,{requestType:o}=r;let l;try{l=Ke()(K(r.response).subarray(8))}catch(e){return e.metadata=So({requestType:o,request:r,parseFailure:!0}),void this.requestErrored_(e,r,t)}return a[s]={sidxInfo:e.sidx,sidx:l},ce(e,l,e.sidx.resolvedUri),i(!0)};this.request=((e,t,i,s)=>{let n,r=[],a=!1;const o=function(e,t,s,n){return t.abort(),a=!0,i(e,t,s,n)},l=function(e,t){if(a)return;if(e)return e.metadata=So({requestType:s,request:t,error:e}),o(e,t,"",r);const i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=function(){for(var e=arguments.length,t=new Array(e),i=0;io(e,t,"",r)));const l=ft(r);return"ts"===l&&r.length<188||!l&&r.length<376?Vo(t,(()=>o(e,t,"",r))):o(null,t,l,r)},h={uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:i}){return Lo(e,null,{statusCode:e.status},l)}))}},d=t(h,(function(e,t){return Lo(d,e,t,l)}));return d})(n,this.vhs_.xhr,((t,i,s,a)=>{if(t)return r(t,i);if(!s||"mp4"!==s){const t=s||"unknown";return r({status:i.status,message:`Unsupported ${t} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i)}const{offset:o,length:l}=e.sidx.byterange;if(a.length>=l+o)return r(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ro({byterange:e.sidx.byterange})},r)}),"dash-sidx")}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},p().clearTimeout(this.minimumUpdatePeriodTimeout_),p().clearTimeout(this.mediaRequest_),p().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));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(),p().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(p().clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){p().clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=p().setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=p().setTimeout((()=>this.haveMain_()),0)}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},((i,s)=>{if(i){const{requestType:e}=s;i.metadata=So({requestType:e,request:s,error:i})}if(this.requestErrored_(i,s))return void("HAVE_NOTHING"===this.state&&(this.started=!1));this.trigger({type:"manifestrequestcomplete",metadata:t});const n=s.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Ua(this.mainPlaylistLoader_.srcUrl,s),n?(this.handleMain_(),void this.syncClientServerClock_((()=>e(s,n)))):e(s,n)}))}syncClientServerClock_(e){const t=(i=this.mainPlaylistLoader_.mainXml_,(e=>{const t=Ne(e,"UTCTiming")[0];if(!t)return null;const i=Fe(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.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":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return i})(We(i)));var i;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:Ma(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},((i,s)=>{if(!this.request)return;if(i){const{requestType:t}=s;return this.error.metadata=So({requestType:t,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;n="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};let i;this.trigger({type:"manifestparsestart",metadata:t});try{i=(({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:n})=>{const r=((e,t={})=>{const i=((e,t={})=>{const{manifestUri:i="",NOW:s=Date.now(),clientOffset:n=0,eventHandler:r=function(){}}=t,a=Ne(e,"Period");if(!a.length)throw new Error("INVALID_NUMBER_OF_PERIOD");const o=Ne(e,"Location"),l=Fe(e),h=je([{baseUrl:i}],Ne(e,"BaseURL")),d=Ne(e,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=s,l.clientOffset=n,o.length&&(l.locations=o.map(Me));const u=[];return a.forEach(((e,t)=>{const i=Fe(e),s=u[t-1];i.start=(({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0)({attributes:i,priorPeriodAttributes:s?s.attributes:null,mpdType:l.type}),u.push({node:e,attributes:i})})),{locations:l.locations,contentSteeringInfo:ze(d,r),representationInfo:re(u.map(Ve(l,h))),eventStream:re(u.map(He))}})(We(e),t),s=i.representationInfo.map(Re);return Ie({dashPlaylists:s,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:i.eventStream})})(e,{manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:n});return bo(r,t,Go),r})({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(e){this.error=e,this.error.metadata={errorType:Pa.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}e&&(i=((e,t,i)=>{let s=!0,n=Fa(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{if(e.playlists&&e.playlists.length){const a=e.playlists[0].id,o=xo(n,e.playlists[0],Wo);o&&(n=o,r in n.mediaGroups[t][i]||(n.mediaGroups[t][i][r]=e),n.mediaGroups[t][i][r].playlists[0]=n.playlists[a],s=!1)}})),((e,t)=>{_o(e,((i,s,n,r)=>{t.mediaGroups[s][n]&&r in t.mediaGroups[s][n]||delete e.mediaGroups[s][n][r]}))})(n,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(s=!1),s?null:n})(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:e,endList:s}=i,n=[];i.playlists.forEach((e=>{n.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})}));const r={duration:e,isLive:!s,renditions:n};t.parsedManifest=r,this.trigger({type:"manifestparsecomplete",metadata:t})}return Boolean(i)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(p().clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;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`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=p().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_=((e,t)=>{let i=Ko(e.playlists,t);return _o(e,((e,s,n,r)=>{if(e.playlists&&e.playlists.length){const s=e.playlists;i=Fa(i,Ko(s,t))}})),i})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=p().setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),Ao(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const 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){const t=new Set;for(const i in e.contentProtection){const s=e.contentProtection[i].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var Qo={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Jo=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Zo=function(e){return function(){const t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(t){const i=new BlobBuilder;return i.append(e),URL.createObjectURL(i.getBlob())}}(e),i=Jo(new Worker(t));i.objURL=t;const s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),s.call(this)},i}},el=function(e){return`var browserWorkerPolyFill = ${Jo.toString()};\nbrowserWorkerPolyFill(self);\n`+e},tl=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},il=el(tl((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var s;return!!e[t]&&(s=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(s,1),s>-1)},this.trigger=function(t){var i,s,n,r;if(i=e[t])if(2===arguments.length)for(n=i.length,s=0;s>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},y=function(e){return s(w.hdlr,D[e])},f=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),s(w.mdhd,t)},g=function(e){return s(w.mdia,f(e),y(e.type),l(e))},o=function(e){return s(w.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},l=function(e){return s(w.minf,"video"===e.type?s(w.vmhd,P):s(w.smhd,L),n(),v(e))},h=function(e,t){for(var i=[],n=t.length;n--;)i[n]=T(t[n]);return s.apply(null,[w.moof,o(e)].concat(i))},d=function(e){for(var t=e.length,i=[];t--;)i[t]=p(e[t]);return s.apply(null,[w.moov,c(4294967295)].concat(i).concat(u(e)))},u=function(e){for(var t=e.length,i=[];t--;)i[t]=S(e[t]);return s.apply(null,[w.mvex].concat(i))},c=function(e){var t=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 s(w.mvhd,t)},_=function(e){var t,i,n=e.samples||[],r=new Uint8Array(4+n.length);for(i=0;i>>8),a.push(255&n[t].byteLength),a=a.concat(Array.prototype.slice.call(n[t]));for(t=0;t>>8),o.push(255&r[t].byteLength),o=o.concat(Array.prototype.slice.call(r[t]));if(i=[w.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]),s(w.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([n.length],a,[r.length],o))),s(w.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(s(w.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h])))}return s.apply(null,i)},F=function(e){return s(w.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))},m=function(e){var t=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 s(w.tkhd,t)},T=function(e){var t,i,n,r,a,o;return t=s(w.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])),a=Math.floor(e.baseMediaDecodeTime/W),o=Math.floor(e.baseMediaDecodeTime%W),i=s(w.tfdt,new Uint8Array([1,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(n=E(e,92),s(w.traf,t,i,n)):(r=_(e),n=E(e,r.length+92),s(w.traf,t,i,n,r))},p=function(e){return e.duration=e.duration||4294967295,s(w.trak,m(e),g(e))},S=function(e){var t=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&&(t[t.length-1]=0),s(w.trex,t)},$=function(e,t){var i=0,s=0,n=0,r=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(n=4),void 0!==e[0].compositionTimeOffset&&(r=8)),[0,0,i|s|n|r,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]},j=function(e,t){var i,n,r,a,o,l;for(t+=20+16*(a=e.samples||[]).length,r=$(a,t),(n=new Uint8Array(r.length+16*a.length)).set(r),i=r.length,l=0;l>>24,n[i++]=(16711680&o.duration)>>>16,n[i++]=(65280&o.duration)>>>8,n[i++]=255&o.duration,n[i++]=(4278190080&o.size)>>>24,n[i++]=(16711680&o.size)>>>16,n[i++]=(65280&o.size)>>>8,n[i++]=255&o.size,n[i++]=o.flags.isLeading<<2|o.flags.dependsOn,n[i++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,n[i++]=61440&o.flags.degradationPriority,n[i++]=15&o.flags.degradationPriority,n[i++]=(4278190080&o.compositionTimeOffset)>>>24,n[i++]=(16711680&o.compositionTimeOffset)>>>16,n[i++]=(65280&o.compositionTimeOffset)>>>8,n[i++]=255&o.compositionTimeOffset;return s(w.trun,n)},q=function(e,t){var i,n,r,a,o,l;for(t+=20+8*(a=e.samples||[]).length,r=$(a,t),(i=new Uint8Array(r.length+8*a.length)).set(r),n=r.length,l=0;l>>24,i[n++]=(16711680&o.duration)>>>16,i[n++]=(65280&o.duration)>>>8,i[n++]=255&o.duration,i[n++]=(4278190080&o.size)>>>24,i[n++]=(16711680&o.size)>>>16,i[n++]=(65280&o.size)>>>8,i[n++]=255&o.size;return s(w.trun,i)},E=function(e,t){return"audio"===e.type?q(e,t):j(e,t)};var G,X,K,Y,Q,J,Z,ee,te={ftyp:a=function(){return s(w.ftyp,C,k,C,I)},mdat:function(e){return s(w.mdat,e)},moof:h,moov:d,initSegment:function(e){var t,i=a(),s=d(e);return(t=new Uint8Array(i.byteLength+s.byteLength)).set(i),t.set(s,i.byteLength),t}},ie=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},se={groupNalsIntoFrames:function(e){var t,i,s=[],n=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,s.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},generateSampleTable:function(e,t){var i,s,n,r,a,o=t||0,l=[];for(i=0;ihe.ONE_SECOND_IN_TS/2))){for((a=function(){if(!G){var e={96e3:[ne,[227,64],ae(154),[56]],88200:[ne,[231],ae(170),[56]],64e3:[ne,[248,192],ae(240),[56]],48e3:[ne,[255,192],ae(268),[55,148,128],ae(54),[112]],44100:[ne,[255,192],ae(268),[55,163,128],ae(84),[112]],32e3:[ne,[255,192],ae(268),[55,234],ae(226),[112]],24e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,112],ae(126),[224]],16e3:[ne,[255,192],ae(268),[55,255,128],ae(268),[111,255],ae(269),[223,108],ae(195),[1,192]],12e3:[re,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,253,128],ae(259),[56]],11025:[re,ae(268),[3,127,248],ae(268),[6,255,240],ae(268),[13,255,224],ae(268),[27,255,192],ae(268),[55,175,128],ae(108),[112]],8e3:[re,ae(268),[3,121,16],ae(47),[7]]};t=e,G=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return G}()[e.samplerate])||(a=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)})))},generateSampleTable:function(e){var t,i,s=[];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--},ve.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},ve.prototype.addText=function(e){this.rows[this.rowIdx]+=e},ve.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var be=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new ve(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};be.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new ve(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},be.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},be.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 Te=function(e){e=e||{},Te.prototype.init.call(this);var t,i=this,s=e.captionServices||{},n={};Object.keys(s).forEach((e=>{t=s[e],/^SERVICE/.test(e)&&(n[e]=t.encoding)})),this.serviceEncodings=n,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(i.new708Packet(),i.add708Bytes(e)):(null===i.current708Packet&&i.new708Packet(),i.add708Bytes(e))}};Te.prototype=new me,Te.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Te.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,s=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(s)},Te.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,s=null,n=0,r=t[n++];for(e.seq=r>>6,e.sizeCode=63&r;n>5)&&s>0&&(i=r=t[n++]),this.pushServiceBlock(i,n,s),s>0&&(n+=s-1)},Te.prototype.pushServiceBlock=function(e,t,i){var s,n=t,r=this.current708Packet.data,a=this.services[e];for(a||(a=this.initService(e,n));n("0"+(255&e).toString(16)).slice(-2))).join("");s=String.fromCharCode(parseInt(e,16))}else a=ye[r=d|u]||r,s=4096&r&&r===a?"":String.fromCharCode(a);return p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(s),e},Te.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],n=i[e+2];return _e(s)&&_e(n)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Te.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Te.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],n=7&s;t.setCurrentWindow(n);var r=t.currentWindow;return s=i[++e],r.visible=(32&s)>>5,r.rowLock=(16&s)>>4,r.columnLock=(8&s)>>3,r.priority=7&s,s=i[++e],r.relativePositioning=(128&s)>>7,r.anchorVertical=127&s,s=i[++e],r.anchorHorizontal=s,s=i[++e],r.anchorPoint=(240&s)>>4,r.rowCount=15&s,s=i[++e],r.columnCount=63&s,s=i[++e],r.windowStyle=(56&s)>>3,r.penStyle=7&s,r.virtualRowCount=r.rowCount+1,e},Te.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=i[e],n=t.currentWindow.winAttr;return s=i[++e],n.fillOpacity=(192&s)>>6,n.fillRed=(48&s)>>4,n.fillGreen=(12&s)>>2,n.fillBlue=3&s,s=i[++e],n.borderType=(192&s)>>6,n.borderRed=(48&s)>>4,n.borderGreen=(12&s)>>2,n.borderBlue=3&s,s=i[++e],n.borderType+=(128&s)>>5,n.wordWrap=(64&s)>>6,n.printDirection=(48&s)>>4,n.scrollDirection=(12&s)>>2,n.justify=3&s,s=i[++e],n.effectSpeed=(240&s)>>4,n.effectDirection=(12&s)>>2,n.displayEffect=3&s,e},Te.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},Te.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)},Te.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var n=0;n<8;n++)i&1<>4,n.offset=(12&s)>>2,n.penSize=3&s,s=i[++e],n.italics=(128&s)>>7,n.underline=(64&s)>>6,n.edgeType=(56&s)>>3,n.fontStyle=7&s,e},Te.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=i[e],n=t.currentWindow.penColor;return s=i[++e],n.fgOpacity=(192&s)>>6,n.fgRed=(48&s)>>4,n.fgGreen=(12&s)>>2,n.fgBlue=3&s,s=i[++e],n.bgOpacity=(192&s)>>6,n.bgRed=(48&s)>>4,n.bgGreen=(12&s)>>2,n.bgBlue=3&s,s=i[++e],n.edgeRed=(48&s)>>4,n.edgeGreen=(12&s)>>2,n.edgeBlue=3&s,e},Te.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=i[e],n=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,s=i[++e],n.row=15&s,s=i[++e],n.column=63&s,e},Te.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Se={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},Ee=function(e){return null===e?"":(e=Se[e]||e,String.fromCharCode(e))},we=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ce=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},ke=function(e,t){ke.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,n,r;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),s=t>>>8,n=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_=Ce();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ce();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ce()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(s,n))r=Ee((s=(3&s)<<8)|n),this[this.mode_](e.pts,r),this.column_++;else if(this.isExtCharacter(s,n))"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),r=Ee((s=(3&s)<<8)|n),this[this.mode_](e.pts,r),this.column_++;else if(this.isMidRowCode(s,n))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14&~n||this.addFormatting(e.pts,["i"]),1&~n||this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(s,n)){const e=3&n;this.nonDisplayed_[this.row_].offset=e,this.column_+=e}else if(this.isPAC(s,n)){var a=we.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&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),!(16&~t)){const e=(14&t)>>1;this.column_=4*e,this.nonDisplayed_[this.row_].indent+=e}this.isColorPAC(n)&&(14&~n||this.addFormatting(e.pts,["i"]))}else this.isNormalChar(s)&&(0===n&&(n=null),r=Ee(s),r+=Ee(n),this[this.mode_](e.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};ke.prototype=new me,ke.prototype.flushDisplayed=function(e){const 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_})},ke.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ce(),this.nonDisplayed_=Ce(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},ke.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_},ke.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},ke.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},ke.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},ke.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},ke.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},ke.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},ke.prototype.isNormalChar=function(e){return e>=32&&e<=127},ke.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ce(),this.displayed_=Ce()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},ke.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)}},ke.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;i+=t,this.nonDisplayed_[this.row_].text=i},ke.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;i+=t,this.displayed_[this.row_].text=i},ke.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Le=function(e){var t,i;Le.prototype.init.call(this),this.type_=e||De,this.push=function(e){"metadata"!==e.type?this.type_!==De&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Pe(e.dts,i),e.pts=Pe(e.pts,i),t=e.dts,this.trigger("data",e)):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")}};Le.prototype=new Ae;var Oe,Re={TimestampRolloverStream:Le,handleRollover:Pe},Ne=(e,t,i)=>{if(!e)return-1;for(var s=i;s>>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=Ye.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ye.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 Xe,ze.STREAM_TYPES={h264:27,adts:15},We=function(){var e,t=this,i=!1,s={data:[],size:0},n={data:[],size:0},r={data:[],size:0},a=function(e,i,s){var n,r,a=new Uint8Array(e.size),o={type:i},l=0,h=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]))}(a,o),n="video"===i||o.packetLength<=e.size,(s||n)&&(e.size=0,e.data.length=0),n&&t.trigger("data",o)}};We.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ye.H264_STREAM_TYPE:e=s,t="video";break;case Ye.ADTS_STREAM_TYPE:e=n,t="audio";break;case Ye.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&a(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var s={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",s)}})[o.type]()},this.reset=function(){s.size=0,s.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){a(s,"video"),a(n,"audio"),a(r,"timed-metadata")},this.flush=function(){if(!i&&e){var s={type:"metadata",tracks:[]};null!==e.video&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&s.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",s)}i=!1,this.flushStreams_(),this.trigger("done")}},We.prototype=new Xe;var Ze={PAT_PID:0,MP2T_PACKET_LENGTH:Je,TransportPacketStream:Ve,TransportParseStream:ze,ElementaryStream:We,TimestampRolloverStream:Qe,CaptionStream:Ke.CaptionStream,Cea608Stream:Ke.Cea608Stream,Cea708Stream:Ke.Cea708Stream,MetadataStream:Ge};for(var et in Ye)Ye.hasOwnProperty(et)&&(Ze[et]=Ye[et]);var tt,it=Ze,st=le.ONE_SECOND_IN_TS,nt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(tt=function(e){var t,i=0;tt.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(s){var n,r,a,o,l,h=0;if(e||(i=0),"audio"===s.type){var d;for(t&&t.length?(a=t,(t=new Uint8Array(a.byteLength+s.data.byteLength)).set(a),t.set(s.data,a.byteLength)):t=s.data;h+7>5,l=(o=1024*(1+(3&t[h+6])))*st/nt[(60&t[h+2])>>>2],t.byteLength-h>>6&3),channelcount:(1&t[h+2])<<2|(192&t[h+3])>>>6,samplerate:nt[(60&t[h+2])>>>2],samplingfrequencyindex:(60&t[h+2])>>>2,samplesize:16,data:t.subarray(h+7+r,h+n)}),i++,h+=n}else"number"!=typeof d&&(d=h),h++;"number"==typeof d&&(this.skipWarn_(d,h),d=null),t=t.subarray(h)}},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 H;var rt,at,ot,lt=tt,ht=H,dt=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 n=e.byteLength-t,r=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");r.set(e.subarray(n,n+a)),i=new DataView(r.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var n;s>e?(i<<=e,s-=e):(e-=s,e-=8*(n=Math.floor(e/8)),t-=n,this.loadWord(),i<<=e,s-=e)},this.readBits=function(e){var n=Math.min(s,e),r=i>>>32-n;return(s-=n)>0?i<<=n:t>0&&this.loadWord(),(n=e-n)>0?r<>>e)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()};(at=function(){var e,t,i=0;at.prototype.init.call(this),this.push=function(s){var n;t?((n=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),n.set(s.data,t.byteLength),t=n):t=s.data;for(var r=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 ht,ot={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},rt=function(){var e,t,i,s,n,r,a,o=new at;rt.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=n(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=n(a.subarray(1)),o.config=r(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,n=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},gt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=mt(e,t),gt(e,t))},ft=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},yt={isLikelyAacData:function(e){var t=gt(e,0);return e.length>=t+2&&!(255&~e[t])&&!(240&~e[t+1])&&16==(22&e[t+1])},parseId3TagSize:mt,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 e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&!(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,s;t=10,64&e[5]&&(t+=4,t+=ft(e.subarray(10,14)));do{if((i=ft(e.subarray(t+4,t+8)))<1)return null;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 n=0;n>>2;return(o*=4)+(3&a[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&~e[l]||240&~e[l+1])l++;else{if(e.length-l<7)break;if(l+(o=_t.parseAdtsSize(e,l))>e.length)break;r={type:"audio",data:e.subarray(l,l+o),pts:t,dts:t},this.trigger("data",r),l+=o}else{if(e.length-l<10)break;if(l+(o=_t.parseId3TagSize(e,l))>e.length)break;n={type:"timed-metadata",data:e.subarray(l,l+o)},this.trigger("data",n),l+=o}s=e.length-l,e=s>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 H;var vt,bt,Tt,St,Et=H,wt=te,Ct=se,kt=de,It=ce,xt=it,At=le,Dt=lt,Pt=ct.H264Stream,Lt=ut,Ot=yt.isLikelyAacData,Rt=le.ONE_SECOND_IN_TS,Nt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Mt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ut=function(e,t){t.stream=e,this.trigger("log",t)},Bt=function(e,t){for(var i=Object.keys(t),s=0;s=-1e4&&i<=45e3&&(!s||o>i)&&(s=r,o=i));return s?s.gop:null},this.alignGopsAtStart_=function(e){var t,i,s,n,r,o,l,h;for(r=e.byteLength,o=e.nalCount,l=e.duration,t=i=0;ts.pts?t++:(i++,r-=n.byteLength,o-=n.nalCount,l-=n.duration);return 0===i?e:i===e.length?null:((h=e.slice(i)).byteLength=r,h.duration=l,h.nalCount=o,h.pts=h[0].pts,h.dts=h[0].dts,h)},this.alignGopsAtEnd_=function(e){var t,i,s,n,r,o,l;for(t=a.length-1,i=e.length-1,r=null,o=!1;t>=0&&i>=0;){if(s=a[t],n=e[i],s.pts===n.pts){o=!0;break}s.pts>n.pts?t--:(t===a.length-1&&(r=i),i--)}if(!o&&null===r)return null;if(0===(l=o?i:r))return e;var 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}},vt.prototype=new Et,St=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,St.prototype.init.call(this),this.push=function(e){return e.content||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))))}},St.prototype=new Et,St.prototype.flush=function(e){var t,i,s,n,r=0,a={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,Mt.forEach((function(e){a.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Nt.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=wt.initSegment(this.pendingTracks),a.initSegment=new Uint8Array(s.byteLength),a.initSegment.set(s),a.data=new Uint8Array(this.pendingBytes),n=0;n=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},St.prototype.setRemux=function(e){this.remuxTracks=e},(Tt=function(e){var t,i,s=this,n=!0;Tt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="aac",n.metadataStream=new xt.MetadataStream,n.aacStream=new Lt,n.audioTimestampRolloverStream=new xt.TimestampRolloverStream("audio"),n.timedMetadataTimestampRolloverStream=new xt.TimestampRolloverStream("timed-metadata"),n.adtsStream=new Dt,n.coalesceStream=new St(e,n.metadataStream),n.headOfPipeline=n.aacStream,n.aacStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.aacStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.metadataStream.on("timestamp",(function(e){n.aacStream.setTimestamp(e.timeStamp)})),n.aacStream.on("data",(function(r){"timed-metadata"!==r.type&&"audio"!==r.type||n.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new bt(i,e),n.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),n.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("done",this.trigger.bind(this,"done")),Bt(this,n)},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="ts",n.metadataStream=new xt.MetadataStream,n.packetStream=new xt.TransportPacketStream,n.parseStream=new xt.TransportParseStream,n.elementaryStream=new xt.ElementaryStream,n.timestampRolloverStream=new xt.TimestampRolloverStream,n.adtsStream=new Dt,n.h264Stream=new Pt,n.captionStream=new xt.CaptionStream(e),n.coalesceStream=new St(e,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream).pipe(n.timestampRolloverStream),n.timestampRolloverStream.pipe(n.h264Stream),n.timestampRolloverStream.pipe(n.adtsStream),n.timestampRolloverStream.pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on("data",(function(r){var a;if("metadata"===r.type){for(a=r.tracks.length;a--;)t||"video"!==r.tracks[a].type?i||"audio"!==r.tracks[a].type||((i=r.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=r.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new vt(t,e),n.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),n.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,n.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))})),n.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),n.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),n.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),n.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),i&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new bt(i,e),n.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),n.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),n.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("id3Frame",(function(e){e.dispatchType=n.metadataStream.dispatchType,s.trigger("id3Frame",e)})),n.coalesceStream.on("caption",this.trigger.bind(this,"caption")),n.coalesceStream.on("done",this.trigger.bind(this,"done")),Bt(this,n)},this.setBaseMediaDecodeTime=function(s){var n=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,It.clearDtsInfo(i),n.audioTimestampRolloverStream&&n.audioTimestampRolloverStream.discontinuity()),t&&(n.videoSegmentStream&&(n.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,It.clearDtsInfo(t),n.captionStream.reset()),n.timestampRolloverStream&&n.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(n){var t=Ot(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){n=!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 Et;var jt,$t,Ht,Vt,zt={Transmuxer:Tt,VideoSegmentStream:vt,AudioSegmentStream:bt,AUDIO_PROPERTIES:Nt,VIDEO_PROPERTIES:Mt,generateSegmentTimingInfo:qt},Wt=function(e){return e>>>0},Gt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),(t+=String.fromCharCode(e[2]))+String.fromCharCode(e[3])},Xt=Wt,Kt=Gt,Yt=function(e,t){var i,s,n,r,a,o=[];if(!t.length)return null;for(i=0;i1?i+s:e.byteLength,n===t[0]&&(1===t.length?o.push(e.subarray(i+8,r)):(a=Yt(e.subarray(i+8,r),t.slice(1))).length&&(o=o.concat(a))),i=r;return o},Qt=Wt,Jt=z.getUint64,Zt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Jt(e.subarray(4)):t.baseMediaDecodeTime=Qt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},ei=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]}},ti=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),n=1&i.flags[2],r=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(n&&(i.dataOffset=s.getInt32(u),u+=4),r&&d&&(t={flags:ei(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=ei(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},ii=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)},n=1&s.flags[2],r=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,n&&(t+=4,s.baseDataOffset=i.getUint32(12),t+=4),r&&(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),!n&&d&&(s.baseDataOffsetIsMoof=!0),s},si=(jt="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},pe.discardEmulationPreventionBytes),ni=Ie.CaptionStream,ri=Yt,ai=Zt,oi=ti,li=ii,hi=jt,di=function(e,t){for(var i=e,s=0;s0;){var l=t.shift();this.parse(l,r,a)}return o=function(e,t,i){if(null===t)return null;var s=function(e,t){var i=ri(e,["moof","traf"]),s=ri(e,["mdat"]),n={},r=[];return s.forEach((function(e,t){var s=i[t];r.push({mdat:e,traf:s})})),r.forEach((function(e){var i,s,r=e.mdat,a=e.traf,o=ri(a,["tfhd"]),l=li(o[0]),h=l.trackId,d=ri(a,["tfdt"]),u=d.length>0?ai(d[0]).baseMediaDecodeTime:0,c=ri(a,["trun"]);t===h&&c.length>0&&(i=function(e,t,i){var s=t,n=i.defaultSampleDuration||0,r=i.defaultSampleSize||0,a=i.trackId,o=[];return e.forEach((function(e){var t=oi(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=n),void 0===e.size&&(e.size=r),e.trackId=a,e.dts=s,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof s?(e.pts=s+hi.BigInt(e.compositionTimeOffset),s+=hi.BigInt(e.duration)):(e.pts=s+e.compositionTimeOffset,s+=e.duration)})),o=o.concat(t)})),o}(c,u,l),s=function(e,t,i){var s,n,r,a,o=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(n=0;n+41)&&s||n}(h,u)?u:void 0},scaleTime:function(e,t,i,s){return e||0===e?e/t:s+i/t}},fi=Wt,yi=function(e){return("00"+e.toString(16)).slice(-2)},_i=Yt,vi=Gt,bi=gi,Ti=z.getUint64,Si=jt,Ei=je.parseId3Frames;$t=function(e,t){var i=_i(t,["moof","traf"]).reduce((function(t,i){var s,n=_i(i,["tfhd"])[0],r=fi(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),a=e[r]||9e4,o=_i(i,["tfdt"])[0],l=new DataView(o.buffer,o.byteOffset,o.byteLength);let h;return"bigint"==typeof(s=1===o[0]?Ti(o.subarray(4,12)):l.getUint32(4))?h=s/Si.BigInt(a):"number"!=typeof s||isNaN(s)||(h=s/a),h11?(n.codec+=".",n.codec+=yi(d[9]),n.codec+=yi(d[10]),n.codec+=yi(d[11])):n.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(n.codec)?(d=u.subarray(28),"esds"===vi(d.subarray(4,8))&&d.length>20&&0!==d[19]?(n.codec+="."+yi(d[19]),n.codec+="."+yi(d[20]>>>2&63).replace(/^0/,"")):n.codec="mp4a.40.2"):n.codec=n.codec.toLowerCase())}var c=_i(e,["mdia","mdhd"])[0];c&&(n.timescale=Vt(c)),i.push(n)})),i};var wi=$t,Ci=Ht,ki=function(e,t=0){return _i(e,["emsg"]).map((e=>{var i=bi.parseEmsgBox(new Uint8Array(e)),s=Ei(i.message_data);return{cueTime:bi.scaleTime(i.presentation_time,i.timescale,i.presentation_time_delta,t),duration:bi.scaleTime(i.event_duration,i.timescale),frames:s}}))},Ii=xe,xi=function(e){var t=31&e[1];return(t<<=8)|e[2]},Ai=function(e){return!!(64&e[1])},Di=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Pi=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}},Li={parseType:function(e,t){var i=xi(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=Ai(e),i=4+Di(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Ai(e),s=4+Di(e);if(i&&(s+=e[s]+1),1&e[s+5]){var n;n=3+((15&e[s+1])<<8|e[s+2])-4;for(var r=12+((15&e[s+10])<<8|e[s+11]);r=e.byteLength)return null;var i,s=null;return 192&(i=e[t+7])&&((s={}).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,s.pts*=4,s.pts+=(6&e[t+13])>>>1,s.dts=s.pts,64&i&&(s.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,s.dts*=4,s.dts+=(6&e[t+18])>>>1)),s},videoPacketContainsKeyFrame:function(e){for(var t=4+Di(e),i=e.subarray(t),s=0,n=0,r=!1;n3&&"slice_layer_without_partitioning_rbsp_idr"===Pi(31&i[n+3])&&(r=!0),r}},Oi=xe,Ri=Re.handleRollover,Ni={};Ni.ts=Li,Ni.aac=yt;var Mi=le.ONE_SECOND_IN_TS,Ui=188,Bi=71,Fi=function(e,t,i){for(var s,n,r,a,o=0,l=Ui,h=!1;l<=e.byteLength;)if(e[o]!==Bi||e[l]!==Bi&&l!==e.byteLength)o++,l++;else{if(s=e.subarray(o,l),"pes"===Ni.ts.parseType(s,t.pid)&&(n=Ni.ts.parsePesType(s,t.table),r=Ni.ts.parsePayloadUnitStartIndicator(s),"audio"===n&&r&&(a=Ni.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),h=!0)),h)break;o+=Ui,l+=Ui}for(o=(l=e.byteLength)-Ui,h=!1;o>=0;)if(e[o]!==Bi||e[l]!==Bi&&l!==e.byteLength)o--,l--;else{if(s=e.subarray(o,l),"pes"===Ni.ts.parseType(s,t.pid)&&(n=Ni.ts.parsePesType(s,t.table),r=Ni.ts.parsePayloadUnitStartIndicator(s),"audio"===n&&r&&(a=Ni.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),h=!0)),h)break;o-=Ui,l-=Ui}},qi=function(e,t,i){for(var s,n,r,a,o,l,h,d=0,u=Ui,c=!1,p={data:[],size:0};u=0;)if(e[d]!==Bi||e[u]!==Bi)d--,u--;else{if(s=e.subarray(d,u),"pes"===Ni.ts.parseType(s,t.pid)&&(n=Ni.ts.parsePesType(s,t.table),r=Ni.ts.parsePayloadUnitStartIndicator(s),"video"===n&&r&&(a=Ni.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),c=!0)),c)break;d-=Ui,u-=Ui}},ji=function(e,t){var i;return i=Ni.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,s=0,n=null,r=null,a=0,o=0;e.length-o>=3;){switch(Ni.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((a=Ni.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+a),r=Ni.aac.parseAacTimestamp(t)),o+=a;break;case"audio":if(e.length-o<7){i=!0;break}if((a=Ni.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===n&&(t=e.subarray(o,o+a),n=Ni.aac.parseSampleRate(t)),s++,o+=a;break;default:o++}if(i)return null}if(null===n||null===r)return null;var l=Mi/n;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*s*l,pts:r+1024*s*l}]}}(e):function(e){var t={pid:null,table:null},i={};for(var s in function(e,t){for(var i,s=0,n=Ui;n{const{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:n,remux:r,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:h,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y,segment:_,triggerSegmentEventFn:v}=e,b={buffer:[]};let T=y;if(t.onmessage=i=>{t.currentTransmux===e&&("data"===i.data.action&&((e,t,i)=>{const{type:s,initSegment:n,captions:r,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:h}=e.data.segment;t.buffer.push({captions:r,captionStreams:a,metadata:o});const 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(n.data,n.byteOffset,n.byteLength)};void 0!==l&&(u.videoFrameDtsTime=l),void 0!==h&&(u.videoFramePtsTime=h),i(u)})(i,b,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(i,b),"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&&(T=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"===i.data.type&&(T||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:b,callback:m}),rl(t))))},t.onerror=()=>{const e={message:"Received an error message from the transmuxer worker",metadata:{errorType:Pa.Error.StreamingFailedToTransmuxSegment,segmentInfo:Hl({segment:_})}};m(null,e)},s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(n)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),void 0!==r&&t.postMessage({action:"setRemux",remux:r}),i.byteLength){const e=i instanceof ArrayBuffer?i:i.buffer,s=i instanceof ArrayBuffer?0:i.byteOffset;v({type:"segmenttransmuxingstart",segment:_}),t.postMessage({action:"push",data:e,byteOffset:s,byteLength:i.byteLength},[e])}y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},rl=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():nl(e.currentTransmux))},al=(e,t)=>{e.postMessage({action:t}),rl(e)};var ol=e=>{((e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void al(t,e);t.transmuxQueue.push(al.bind(null,t,e))})("reset",e)};const ll=function(e){const t=e.transmuxer,i=e.endAction||e.action,s=e.callback,n=b({},e,{endAction:null,transmuxer:null,callback:null}),r=n=>{n.data.action===i&&(t.removeEventListener("message",r),n.data.data&&(n.data.data=new Uint8Array(n.data.data,e.byteOffset||0,e.byteLength||n.data.data.byteLength),e.data&&(e.data=n.data.data)),s(n.data))};if(t.addEventListener("message",r),e.data){const i=e.data instanceof ArrayBuffer;n.byteOffset=i?0:e.data.byteOffset,n.byteLength=e.data.byteLength;const s=[i?e.data:e.data.buffer];t.postMessage(n,s)}else t.postMessage(n)},hl=-101,dl=-102,ul=e=>{e.forEach((e=>{e.abort()}))},cl=(e,t)=>{const{requestType:i}=t,s=So({requestType:i,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:hl,xhr:t,metadata:s}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:dl,xhr:t,metadata:s}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t,metadata:s}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t,metadata:s}:null},pl=(e,t,i,s)=>(n,r)=>{const a=r.response,o=cl(n,r);if(o)return i(o,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:2,xhr:r},e);const l=new DataView(a),h=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let e=0;e{const i=ft(e.map.bytes);if("mp4"!==i){const s=e.map.resolvedUri||e.map.uri,n=i||"unknown";return t({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${s}`,code:2,metadata:{mediaType:n}})}ll({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))})},gl=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{const m=e.map&&e.map.tracks||{},g=Boolean(m.audio&&m.video);let f=s.bind(null,e,"audio","start");const y=s.bind(null,e,"audio","end");let _=s.bind(null,e,"video","start");const v=s.bind(null,e,"video","end");ll({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data;const m=s.result;m&&(i(e,{hasAudio:m.hasAudio,hasVideo:m.hasVideo,isMuxed:g}),i=null),(e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void nl(e);e.transmuxer.transmuxQueue.push(e)})({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),y&&void 0!==e.end&&y(e.end)},onVideoTimingInfo:e=>{_&&void 0!==e.start&&(_(e.start),_=null),v&&void 0!==e.end&&v(e.end)},onVideoSegmentTimingInfo:t=>{const i={pts:{start:t.start.presentation,end:t.end.presentation},dts:{start:t.start.decode,end:t.end.decode}};p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:i}),n(t)},onAudioSegmentTimingInfo:t=>{const i={pts:{start:t.start.pts,end:t.end.pts},dts:{start:t.start.dts,end:t.end.dts}};p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:i}),r(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})}})},fl=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=new Uint8Array(t);if(function(e){return et(e,["moof"]).length>0}(m)){e.isFmp4=!0;const{tracks:n}=e.map,r={isFmp4:!0,hasVideo:!!n.video,hasAudio:!!n.audio};n.audio&&n.audio.codec&&"enca"!==n.audio.codec&&(r.audioCodec=n.audio.codec),n.video&&n.video.codec&&"encv"!==n.video.codec&&(r.videoCodec=n.video.codec),n.video&&n.audio&&(r.isMuxed=!0),i(e,r);const l=(t,i)=>{d(e,{data:m,type:r.hasAudio&&!r.isMuxed?"audio":"video"}),i&&i.length&&a(e,i),t&&t.length&&o(e,t),u(null,e,{})};ll({action:"probeMp4StartTime",timescales:e.map.timescales,data:m,transmuxer:e.transmuxer,callback:({data:i,startTime:a})=>{t=i.buffer,e.bytes=m=i,r.hasAudio&&!r.isMuxed&&s(e,"audio","start",a),r.hasVideo&&s(e,"video","start",a),ll({action:"probeEmsgID3",data:m,transmuxer:e.transmuxer,offset:a,callback:({emsgData:i,id3Frames:s})=>{t=i.buffer,e.bytes=m=i,n.video&&i.byteLength&&e.transmuxer?ll({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:m,timescales:e.map.timescales,trackIds:[n.video.id],callback:i=>{t=i.data.buffer,e.bytes=m=i.data,i.logs.forEach((function(e){c(Fa(e,{stream:"mp4CaptionParser"}))})),l(i.captions,s)}}):l(void 0,s)}})}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=ft(m)),"ts"!==e.container&&"aac"!==e.container)return i(e,{hasAudio:!1,hasVideo:!1}),void u(null,e,{});gl({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})}else u(null,e,{})},yl=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s,segment:n,doneFn:r},a){const o=t=>{if(t.data.source===e){s.removeEventListener("message",o);const e=t.data.decrypted;a(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let l;s.onerror=()=>{const e="An error occurred in the decryption worker",t=Hl({segment:n}),i={message:e,metadata:{error:new Error(e),errorType:Pa.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};r(i,n)},s.addEventListener("message",o),l=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(Bo({source:e,encrypted:i,key:l,iv:t.iv}),[i.buffer,l.buffer])},_l=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:n,progressFn:r,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y})=>{const _=[],v=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=0,g=!1;return(f,y)=>{if(!g){if(f)return g=!0,ul(e),u(f,y);if(m+=1,m===e.length){const m=function(){if(y.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),yl({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},(e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),fl({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})}))})({decryptionWorker:t,segment:y,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p});fl({segment:y,bytes:y.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})};if(y.endOfAllRequests=Date.now(),y.map&&y.map.encryptedBytes&&!y.map.bytes)return p({type:"segmentdecryptionstart",segment:y}),yl({decryptionWorker:t,id:y.requestId+"-init",encryptedBytes:y.map.encryptedBytes,key:y.map.key,segment:y,doneFn:u},(t=>{y.map.bytes=t,p({type:"segmentdecryptioncomplete",segment:y}),ml(y,(t=>{if(t)return ul(e),u(t,y);m()}))}));m()}}}})({activeXhrs:_,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:y});if(s.key&&!s.key.bytes){const i=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&i.push(s.map.key);const n=Fa(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),r=pl(s,i,v,y);y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.key.resolvedUri}});const a=e(n,r);_.push(a)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){const i=Fa(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),n=pl(s,[s.map.key],v,y);y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.map.key.resolvedUri}});const r=e(i,n);_.push(r)}const i=Fa(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Ro(s.map),requestType:"segment-media-initialization"}),n=(({segment:e,finishProcessingFn:t,triggerSegmentEventFn:i})=>(s,n)=>{const r=cl(s,n);if(r)return t(r,e);const a=new Uint8Array(n.response);if(i({type:"segmentloaded",segment:e}),e.map.key)return e.map.encryptedBytes=a,t(null,e);e.map.bytes=a,ml(e,(function(i){if(i)return i.xhr=n,i.status=n.status,t(i,e);t(null,e)}))})({segment:s,finishProcessingFn:v,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:s});const r=e(i,n);_.push(r)}const b=Fa(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Ro(s),requestType:"segment"}),T=(({segment:e,finishProcessingFn:t,responseType:i,triggerSegmentEventFn:s})=>(n,r)=>{const a=cl(n,r);if(a)return t(a,e);s({type:"segmentloaded",segment:e});const o="arraybuffer"!==i&&r.responseText?(e=>{const t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(r),e.key?e.encryptedBytes=new Uint8Array(o):e.bytes=new Uint8Array(o),t(null,e)})({segment:s,finishProcessingFn:v,responseType:b.responseType,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:s});const S=e(b,T);S.addEventListener("progress",(({segment:e,progressFn:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d})=>i=>{if(!i.target.aborted)return e.stats=Fa(e.stats,(e=>{const 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*8*1e3),i})(i)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(i,e)})({segment:s,progressFn:r,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m})),_.push(S);const E={};return _.forEach((e=>{e.addEventListener("loadend",(({loadendState:e,abortFn:t})=>i=>{i.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)})({loadendState:E,abortFn:n}))})),()=>ul(_)},vl=Ba("CodecUtils"),bl=(e,t)=>{const i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Tl=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push(B(`${i}${s}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return vl(`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},Sl=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},El=function(e,t){const i=t.attributes||{},s=Tl(function(e){const t=e.attributes||{};if(t.CODECS)return F(t.CODECS)}(t)||[]);if(bl(e,t)&&!s.audio&&!((e,t)=>{if(!bl(e,t))return!0;const i=t.attributes||{},s=e.mediaGroups.AUDIO[i.AUDIO];for(const e in s)if(!s[e].uri&&!s[e].playlists)return!0;return!1})(e,t)){const t=Tl(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var s in i){var n=i[s];if(n.default&&n.playlists)return F(n.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);t.audio&&(s.audio=t.audio)}return s},wl=Ba("PlaylistSelector"),Cl=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},kl=function(e,t){if(!e)return"";const i=p().getComputedStyle(e);return i?i[t]:""},Il=function(e,t){const i=e.slice();e.sort((function(e,s){const n=t(e,s);return 0===n?i.indexOf(e)-i.indexOf(s):n}))},xl=function(e,t){let i,s;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||p().Number.MAX_VALUE,t.attributes.BANDWIDTH&&(s=t.attributes.BANDWIDTH),s=s||p().Number.MAX_VALUE,i-s};let Al=function(e,t,i,s,n,r){if(!e)return;const a={bandwidth:t,width:i,height:s,limitRenditionByPlayerDimensions:n};let o=e.playlists;mo.isAudioOnly(e)&&(o=r.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map((e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,s=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||p().Number.MAX_VALUE,{bandwidth:t,width:i,height:s,playlist:e}}));Il(l,((e,t)=>e.bandwidth-t.bandwidth)),l=l.filter((e=>!mo.isIncompatible(e.playlist)));let h=l.filter((e=>mo.isEnabled(e.playlist)));h.length||(h=l.filter((e=>!mo.isDisabled(e.playlist))));const d=h.filter((e=>e.bandwidth*Qo.BANDWIDTH_VARIANCEe.bandwidth===u.bandwidth))[0];if(!1===n){const e=c||h[0]||l[0];if(e&&e.playlist){let t="sortedPlaylistReps";return c&&(t="bandwidthBestRep"),h[0]&&(t="enabledPlaylistReps"),wl(`choosing ${Cl(e)} using ${t} with options`,a),e.playlist}return wl("could not choose a playlist with options",a),null}const m=d.filter((e=>e.width&&e.height));Il(m,((e,t)=>e.width-t.width));const g=m.filter((e=>e.width===i&&e.height===s));u=g[g.length-1];const f=g.filter((e=>e.bandwidth===u.bandwidth))[0];let y,_,v,b;if(f||(y=m.filter((e=>e.width>i||e.height>s)),_=y.filter((e=>e.width===y[0].width&&e.height===y[0].height)),u=_[_.length-1],v=_.filter((e=>e.bandwidth===u.bandwidth))[0]),r.leastPixelDiffSelector){const e=m.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-s),e)));Il(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),b=e[0]}const T=b||v||f||c||h[0]||l[0];if(T&&T.playlist){let e="sortedPlaylistReps";return b?e="leastPixelDiffRep":v?e="resolutionPlusOneRep":f?e="resolutionBestRep":c?e="bandwidthBestRep":h[0]&&(e="enabledPlaylistReps"),wl(`choosing ${Cl(T)} using ${e} with options`,a),T.playlist}return wl("could not choose a playlist with options",a),null};const Dl=function(){let e=this.useDevicePixelRatio&&p().devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),Al(this.playlists.main,this.systemBandwidth,parseInt(kl(this.tech_.el(),"width"),10)*e,parseInt(kl(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)};function Pl(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}const Ll={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"},Ol=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Rl=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Pa.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},Nl=function(e,t,i){let s,n;if(i&&i.cues)for(s=i.cues.length;s--;)n=i.cues[s],n.startTime>=e&&n.endTime<=t&&i.removeCue(n)},Ml=e=>"number"==typeof e&&isFinite(e),Ul=1/60,Bl=e=>{const{startOfSegment:t,duration:i,segment:s,part:n,playlist:{mediaSequence:r,id:a,segments:o=[]},mediaIndex:l,partIndex:h,timeline:d}=e,u=o.length-1;let c="mediaIndex/partIndex increment";e.getMediaInfoForTime?c=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(c="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(c+=` with independent ${e.independent}`);const p="number"==typeof h,m=e.segment.uri?"segment":"pre-segment",g=p?Za({preloadSegment:s})-1:0;return`${m} [${r+l}/${r+u}]`+(p?` part [${h}/${g}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(p?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${c}]`+` playlist [${a}]`},Fl=e=>`${e}TimingInfo`,ql=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:n})=>{if(t===i)return!1;if("audio"===s){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==i}if("main"===s&&n){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==i}return!1},jl=e=>{const t=e.pendingSegment_;if(t&&ql({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:t.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&(e=>{if(!e)return!1;const t=e.pendingTimelineChange({type:"audio"}),i=e.pendingTimelineChange({type:"main"}),s=t&&i,n=s&&t.to!==i.to;return!(!s||-1===t.from||-1===i.from||!n)})(e.timelineChangeController_)){if((e=>{const t=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=e.timelineChangeController_.pendingTimelineChange({type:"main"});return t&&i&&t.to{e&&(e.pause(),e.resetEverything(),e.load())})(e)}},$l=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+ja,Hl=({type:e,segment:t})=>{if(!t)return;const i=Boolean(t.key||t.map&&t.map.ke),s=Boolean(t.map&&!t.map.bytes),n=void 0===t.startOfSegment?t.start:t.startOfSegment;return{type:e||t.type,uri:t.resolvedUri||t.uri,start:n,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class Vl extends Pa.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",(()=>{this.isEndOfStream_()||(this.ended_=!1)})),this.fetchAtBuffer_=!1,this.logger_=Ba(`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_():jl(this)})),this.sourceUpdater_.on("codecschange",(e=>{this.trigger(b({type:"codecschange"},e))})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():jl(this)})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(e=>{this.trigger(b({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():jl(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():jl(this)}))}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return(e=>{const t=new sl;t.currentTransmux=null,t.transmuxQueue=[];const i=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t})({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_&&p().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(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}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,p().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_&&ol(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return qa();if("main"===this.loaderType_){const{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;const i=Fo(e);let 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;const i=qo(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(s||e).resolvedUri};return s&&(n.bytes=s.bytes),n}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){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"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const 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 n=null;if(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:\ncurrentTime: ${this.currentTime_()}\nbufferedEnd: ${Xa(this.buffered_())}\n`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const r=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${r}]`),null!==this.mediaIndex)if(this.mediaIndex-=r,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}s&&(s.mediaIndex-=r,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_&&(p().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_&&ol(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const 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)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let n=1;const r=()=>{n--,0===n&&i()};!s&&this.audioDisabled_||(n++,this.sourceUpdater_.removeAudio(e,t,r)),(s||"main"===this.loaderType_)&&(this.gopBuffer_=((e,t,i,s)=>{const n=Math.ceil((t-s)*yt.ONE_SECOND_IN_TS),r=Math.ceil((i-s)*yt.ONE_SECOND_IN_TS),a=e.slice();let o=e.length;for(;o--&&!(e[o].pts<=r););if(-1===o)return a;let l=o+1;for(;l--&&!(e[l].pts<=n););return l=Math.max(l,0),a.splice(l,o-l+1),a})(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,r));for(const i in this.inbandTextTracks_)Nl(e,t,this.inbandTextTracks_[i]);Nl(e,t,this.segmentMetadataTrack_),r()}monitorBuffer_(){this.checkBufferTimeout_&&p().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=p().setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&p().clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=p().setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Hl({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;const s="number"==typeof e&&t.segments[e],n=e+1===t.segments.length,r=!s||!s.parts||i+1===s.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&n&&r}chooseNextRequest_(){const e=this.buffered_(),t=Xa(e)||0,i=Ka(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,n=i>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||s||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(a.isSyncRequest)a.mediaIndex=function(e,t,i){t=t||[];const s=[];let n=0;for(let r=0;ri))return r}return 0===s.length?0:s[s.length-1]}(this.currentTimeline_,r,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${a.mediaIndex}`);else if(null!==this.mediaIndex){const e=r[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;const n=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:\nFor TargetTime: ${n}.\nCurrentTime: ${this.currentTime_()}\nBufferedEnd: ${t}\nFetch At Buffer: ${this.fetchAtBuffer_}\n`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const t=this.getSyncInfoFromMediaSequenceSync_(n);if(!t){const e="No sync info found while using media sequence sync";return this.error({message:e,metadata:{errorType:Pa.Error.StreamingFailedToSelectNextSegment,error:new Error(e)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${t.start} --\x3e ${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.");const t=mo.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:n,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 ${n}`:`currentTime ${n}`,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} `)}const o=r[a.mediaIndex];let 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]);const 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){const e=r[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");const d=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=r.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;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const 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){const{independent:t,playlist:i,mediaIndex:s,startOfSegment:n,isSyncRequest:r,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:r,startOfSegment:n,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:n,buffered:this.buffered_(),overrideCheck:c});const p=Xa(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(u.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(u.gopsToAlignWith=((e,t,i)=>{if(null==t||!e.length)return[];const s=Math.ceil((t-i+3)*yt.ONE_SECOND_IN_TS);let n;for(n=0;ns);n++);return e.slice(n)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),u}timestampOffsetForSegment_(e){return(({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:n})=>n||e!==t?e!mo.isIncompatible(e)));let d=h.filter(mo.isEnabled);d.length||(d=h.filter((e=>!mo.isDisabled(e))));const u=d.filter(mo.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const t=l.getSyncPoint(e,n,o,i)?1:2;return{playlist:e,rebufferingImpact:mo.estimateSegmentRequestTime(r,s,e)*t-a}})),c=u.filter((e=>e.rebufferingImpact<=0));return Il(c,((e,t)=>xl(t.playlist,e.playlist))),c.length?c[0]:(Il(u,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),u[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!a)return;const o=n-r-a.rebufferingImpact;let l=.5;r<=ja&&(l=1),!a.playlist||a.playlist.uri===this.playlist_.uri||o{s[e.stream]=s[e.stream]||{startTime:1/0,captions:[],endTime:0};const 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=>{const{startTime:t,endTime:n,captions:r}=s[e],a=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${n} for ${e}`),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]);const n=t.textTracks().getTrackById(s);if(n)e[i]=n;else{let n=i,r=i,a=!1;const o=(t.options_.vhs&&t.options_.vhs.captionServices||{})[s];o&&(n=o.label,r=o.language,a=o.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:s,default:a,label:n,language:r},!1).track}}}(a,this.vhs_.tech_,e),Nl(t,n,a[e]),function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(!t)return;const s=p().WebKitDataCue||p().VTTCue;t.forEach((t=>{const n=t.stream;t.content?t.content.forEach((r=>{const a=new s(t.startTime+i,t.endTime+i,r.text);a.line=r.line,a.align="left",a.position=r.position,a.positionAlign="line-left",e[n].addCue(a)})):e[n].addCue(new s(t.startTime+i,t.endTime+i,t.text))}))}({captionArray:r,inbandTextTracks:a,timestampOffset:i})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e=>e())),this.metadataQueue_.caption.forEach((e=>e())),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!(!e||this.getCurrentMediaInfo_()&&ql({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())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:s,isMuxed:n}=t;return!(s&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||ql({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_())return jl(this),void this.callQueue_.push(this.handleData_.bind(this,e,t));const 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[Fl(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let s;t&&(s=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:s,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_});const e=this.chooseNextRequest_();if(e.mediaIndex!==i.mediaIndex||e.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)}}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){const e=Fo(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){const n=this.sourceUpdater_.audioBuffered(),r=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ga(n).join(", ")),r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ga(r).join(", "));const a=n.length?n.start(0):0,o=n.length?n.end(n.length-1):0,l=r.length?r.start(0):0,h=r.length?r.end(r.length-1):0;if(o-a<=1&&h-l<=1)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${Ga(n).join(", ")}, video buffer: ${Ga(r).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:e,type:t,bytes:i}));const d=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${d}`),this.remove(0,d,(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=p().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){s&&(22!==s.code?(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:Pa.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:n}){if(!n){const e=[s];let t=s.byteLength;i&&(e.unshift(i),t+=i.byteLength),n=(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})({bytes:t,segments:e})}const r={segmentInfo:Hl({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:r}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,n=`${e}TimingInfo`;s[n]||(s[n]={}),s[n].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[n].transmuxedPresentationStart=i.start.presentation,s[n].transmuxedDecodeStart=i.start.decode,s[n].transmuxedPresentationEnd=i.end.presentation,s[n].transmuxedDecodeEnd=i.end.decode,s[n].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:s}=t;if(!s||!s.byteLength)return;if("audio"===i&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,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_())return jl(this),void this.loadQueue_.push((()=>{const t=b({},e,{forceTimestampOffset:!0});b(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}));this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=null!==this.mediaIndex,n=e.timeline!==this.currentTimeline_&&e.timeline>0,r=i||s&&n;this.logger_(`Requesting\n${Pl(e.uri)}\n${Bl(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=_l({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: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_(`${Bl(e)} logged from transmuxer stream ${s} as a ${i}: ${t}`)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:n})=>{const r={segmentInfo:Hl({segment:t})};i&&(r.keyInfo=i),s&&(r.trackInfo=s),n&&(r.timingInfo=n),this.trigger({type:e,metadata:r})}})}trimBackBuffer_(e){const t=((e,t,i)=>{let s=t-Qo.BACK_BUFFER_LENGTH;e.length&&(s=Math.max(s,e.start(0)));const n=t-i;return Math.min(n,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,r={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:n},a=e.playlist.segments[e.mediaIndex-1];if(a&&a.timeline===t.timeline&&(a.videoTimingInfo?r.baseStartTime=a.videoTimingInfo.transmuxedDecodeEnd:a.audioTimingInfo&&(r.baseStartTime=a.audioTimingInfo.transmuxedDecodeEnd)),t.key){const i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(t.key),r.key.iv=i}return t.map&&(r.map=this.initSegmentForMap(t.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e{if(!t.length)return e;if(i)return t.slice();const s=t[0].pts;let n=0;for(;n=s);n++);return e.slice(0,n).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:n,useVideoTimingInfo:r,videoTimingInfo:a,audioTimingInfo:o}){if(void 0!==e)return e;if(!r)return o.start;const l=t.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===s+n?a.start:s}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:i,hasVideo:s,isMuxed:n}=t,r="main"===this.loaderType_&&s,a=!this.audioDisabled_&&i&&!n;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);r&&e.waitingOnAppends++,a&&e.waitingOnAppends++,r&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),a&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=((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)(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const 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)}handleAppendsDone_(){if(this.pendingSegment_){const e={segmentInfo:Hl({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:e})}if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=((e,t)=>{if("hls"!==t)return null;const i=(e=>{let t=0;return["video","audio"].forEach((function(i){const s=e[`${i}TimingInfo`];if(!s)return;const{start:n,end:r}=s;let a;"bigint"==typeof n||"bigint"==typeof r?a=p().BigInt(r)-p().BigInt(n):"number"==typeof n&&"number"==typeof r&&(a=r-n),void 0!==a&&a>t&&(t=a)})),"bigint"==typeof t&&t3*e.playlist.targetDuration,r=s&&s.end&&this.currentTime_()-s.end>3*e.playlist.partTargetDuration;if(n||r)return this.logger_(`bad ${n?"segment":"part"} ${Bl(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_()}recordThroughput_(e){if(e.duratione.toUpperCase()))},Gl=["video","audio"],Xl=(e,t)=>{const i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},Kl=(e,t)=>{if(0===t.queue.length)return;let i=0,s=t.queue[i];if("mediaSource"!==s.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Xl(e,t)){if(s.type!==e){if(i=((e,t)=>{for(let i=0;i{const i=t[`${e}Buffer`],s=Wl(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},Ql=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Jl=(e,t,i)=>(s,n)=>{const r=n[`${s}Buffer`];if(Ql(n.mediaSource,r)){n.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{r.appendBuffer(e)}catch(e){n.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${s}Buffer`),n.queuePending[s]=null,i(e)}}},Zl=(e,t)=>(i,s)=>{const n=s[`${i}Buffer`];if(Ql(s.mediaSource,n)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{n.remove(e,t)}catch(n){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},eh=e=>(t,i)=>{const s=i[`${t}Buffer`];Ql(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),s.timestampOffset=e)},th=e=>(t,i)=>{e()},ih=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){Pa.log.warn("Failed to call media source endOfStream",e)}}},sh=e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){Pa.log.warn("Failed to set media source duration",e)}},nh=(e,t)=>i=>{const s=Wl(e),n=j(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const r=i.mediaSource.addSourceBuffer(n);r.addEventListener("updateend",i[`on${s}UpdateEnd_`]),r.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=r},rh=e=>t=>{const i=t[`${e}Buffer`];if(Yl(e,t),Ql(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){Pa.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},ah=e=>(t,i)=>{const s=i[`${t}Buffer`],n=j(e);if(!Ql(i.mediaSource,s))return;const r=e.substring(0,e.indexOf(".")),a=i.codecs[t];if(a.substring(0,a.indexOf("."))===r)return;const 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(n),i.codecs[t]=e}catch(e){o.errorType=Pa.Error.StreamingCodecsChangeError,o.error=e,e.metadata=o,i.error_=e,i.trigger("error"),Pa.log.warn(`Failed to changeType on ${t}Buffer`,e)}},oh=({type:e,sourceUpdater:t,action:i,doneFn:s,name:n})=>{t.queue.push({type:e,action:i,doneFn:s,name:n}),Kl(e,t)},lh=(e,t)=>i=>{const s=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let i=0;iKl("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Ba("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=lh("video",this),this.onAudioUpdateEnd_=lh("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){oh({type:"mediaSource",sourceUpdater:this,action:nh(e,t),name:"addSourceBuffer"})}abort(e){oh({type:e,sourceUpdater:this,action:(e,t)=>{if("open"!==t.mediaSource.readyState)return;const i=t[`${e}Buffer`];if(Ql(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){Pa.log.warn(`Failed to abort on ${e}Buffer`,t)}}},name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?oh({type:"mediaSource",sourceUpdater:this,action:rh(e),name:"removeSourceBuffer"}):Pa.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!Pa.browser.IS_FIREFOX&&p().MediaSource&&p().MediaSource.prototype&&"function"==typeof p().MediaSource.prototype.removeSourceBuffer}static canChangeType(){return p().SourceBuffer&&p().SourceBuffer.prototype&&"function"==typeof p().SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?oh({type:e,sourceUpdater:this,action:ah(t),name:"changeType"}):Pa.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){const{segmentInfo:i,type:s,bytes:n}=e;if(this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${n.length} until video append`);if(oh({type:s,sourceUpdater:this,action:Jl(n,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===s){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const 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 Ql(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:qa()}videoBuffered(){return Ql(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:qa()}buffered(){const e=Ql(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Ql(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,s=null,n=0;const r=[],a=[];if(!(e&&e.length&&t&&t.length))return qa();let o=e.length;for(;o--;)r.push({time:e.start(o),type:"start"}),r.push({time:e.end(o),type:"end"});for(o=t.length;o--;)r.push({time:t.start(o),type:"start"}),r.push({time:t.end(o),type:"end"});for(r.sort((function(e,t){return e.time-t.time})),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>Yl(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const dh=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),uh=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class ch extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class ph extends Vl{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 qa();const e=this.subtitlesTrack_.cues;return qa([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Fo(e);let s=this.initSegments_[i];if(t&&!s&&e.bytes){const t=uh.byteLength+e.bytes.byteLength,n=new Uint8Array(t);n.set(e.bytes),n.set(uh,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:n}}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){Nl(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}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_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===hl&&this.handleTimeout_(),e.code===dl?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const n=s.segment;if(n.map&&(n.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof p().WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));n.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message,metadata:{errorType:Pa.Error.StreamingVttParserError,error:e}})}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)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,s.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new(p().VTTCue)(e.startTime,e.endTime,e.text):e)})),function(e){const t=e.cues;if(!t)return;const i={};for(let s=t.length-1;s>=0;s--){const n=t[s],r=`${n.startTime}-${n.endTime}-${n.text}`;i[r]?e.removeCue(n):i[r]=n}}(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof p().WebVTT)throw new ch;"function"==typeof p().TextDecoder?t=new(p().TextDecoder)("utf8"):(t=p().WebVTT.StringDecoder(),i=!0);const s=new(p().WebVTT.Parser)(p(),p().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=>{Pa.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=dh(t)),s.parse(t)}let n=e.bytes;i&&(n=dh(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,i){const s=e.segment;if(!t)return;if(!e.cues.length)return void(s.empty=!0);const{MPEGTS:n,LOCAL:r}=e.timestampmap,a=n/yt.ONE_SECOND_IN_TS-r+t.mapping;if(e.cues.forEach((e=>{const 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){const t=e.cues[0].startTime,n=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,n-s.duration)}}}handleRollover_(e,t){if(null===t)return e;let i=e*yt.ONE_SECOND_IN_TS;const s=t*yt.ONE_SECOND_IN_TS;let n;for(n=s4294967296;)i+=n;return i/yt.ONE_SECOND_IN_TS}}const mh=function(e,t){const i=e.cues;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null};class gh{constructor({start:e,end:t,segmentIndex:i,partIndex:s=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=s,this.appended_=n}isInRange(e){return e>=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach((e=>e.resetAppendedStatus()))}}class yh{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach((e=>e.resetAppendStatus()))}update(e,t){const{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),this.isReliable_)return this.updateStorage_(s,i,this.calculateBaseTime_(i,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const 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){const s=new Map;let n="\n",r=i,a=t;this.start_=r,e.forEach(((e,t)=>{const i=this.storage_.get(a),o=r,l=o+e.duration,h=Boolean(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),d=new gh({start:o,end:l,appended:h,segmentIndex:t});e.syncInfo=d;let u=r;const c=(e.parts||[]).map(((e,s)=>{const r=u,o=u+e.duration,l=Boolean(i&&i.partsSyncInfo&&i.partsSyncInfo[s]&&i.partsSyncInfo[s].isAppended),h=new gh({start:r,end:o,appended:l,segmentIndex:t,partIndex:s});return u=o,n+=`Media Sequence: ${a}.${s} | Range: ${r} --\x3e ${o} | Appended: ${l}\n`,e.syncInfo=h,h}));s.set(a,new fh(d,c)),n+=`${Pl(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --\x3e ${l} | Appended: ${h}\n`,a++,r=l})),this.end_=r,this.storage_=s,this.diagnostics_=n}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 _h extends yh{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){const t=this.parent_.getSyncInfoForMediaSequence(e);return t?t.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}const vh=[{name:"VOD",run:(e,t,i,s,n)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,s,n,r)=>{const a=e.getMediaSequenceSync(r);if(!a)return null;if(!a.isReliable)return null;const o=a.getSyncInfoForTime(n);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,s,n)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let r=null,a=null;const o=Qa(t);n=n||0;for(let i=0;i{let r=null,a=null;n=n||0;const o=Qa(t);for(let e=0;e=e)&&(a=e,r={time:h,segmentIndex:i.segmentIndex,partIndex:i.partIndex})}}return r}},{name:"Discontinuity",run:(e,t,i,s,n)=>{let r=null;if(n=n||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s=e)&&(i=e,r={time:l.time,segmentIndex:a,partIndex:null})}}}return r}},{name:"Playlist",run:(e,t,i,s,n)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class bh extends Pa.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new yh,i=new _h(t),s=new _h(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Ba("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,n){if(t!==1/0)return vh.find((({name:e})=>"VOD"===e)).run(this,e,t);const r=this.runStrategies_(e,t,i,s,n);if(!r.length)return null;for(const t of r){const{syncPoint:i,strategy:n}=t,{segmentIndex:r,time:a}=i;if(r<0)continue;const o=a,l=o+e.segments[r].duration;if(this.logger_(`Strategy: ${n}. Current time: ${s}. selected segment: ${r}. Time: [${o} -> ${l}]}`),s>=o&&s0&&(s.time*=-1),Math.abs(s.time+so({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s,n){const r=[];for(let a=0;a86400)Pa.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let s=i-1;s>=0;s--){const 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){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const n=s.dateTimeObject;s.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[s.timeline]=-n.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){const s=e.segment,n=e.part;let r,a,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}]`)),r=e.startOfSegment,a=t.end+o.mapping;else{if(!o)return!1;r=t.start+o.mapping,a=t.end+o.mapping}return n&&(n.start=r,n.end=a),(!s.start||ro){let s;s=a<0?i.start-so({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):i.end+so({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[r]={time:s,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class Th extends Pa.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}){if("number"==typeof t&&"number"==typeof i){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const s={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Sh=el(tl((function(){var e=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))^r]=r;for(a=o=0;!s[a];a^=d||1,o=h[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,s[a]=p,n[p]=a,c=l[u=l[d=l[a]]],g=16843009*c^65537*u^257*d^16843008*a,m=257*l[p]^16843008*p,r=0;r<4;r++)t[r][a]=m=m<<24^m>>>8,i[r][p]=g=g<<24^g>>>8;for(r=0;r<5;r++)t[r]=t[r].slice(0),i[r]=i[r].slice(0);return e}()),this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];const r=this._tables[0][4],a=this._tables[1],o=e.length;let l=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");const h=e.slice(0),d=[];for(this._key=[h,d],i=o;i<4*o+28;i++)n=h[i-1],(i%o==0||8===o&&i%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],i%o==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),h[i]=h[i-o]^n;for(s=0;i;s++,i--)n=h[3&s?i:i-4],d[s]=i<=4||s<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}decrypt(e,t,i,s,n,r){const a=this._key[1];let o,l,h,d=e^a[0],u=s^a[1],c=i^a[2],p=t^a[3];const m=a.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],v=y[1],b=y[2],T=y[3],S=y[4];for(g=0;g>>24]^v[u>>16&255]^b[c>>8&255]^T[255&p]^a[f],l=_[u>>>24]^v[c>>16&255]^b[p>>8&255]^T[255&d]^a[f+1],h=_[c>>>24]^v[p>>16&255]^b[d>>8&255]^T[255&u]^a[f+2],p=_[p>>>24]^v[d>>16&255]^b[u>>8&255]^T[255&c]^a[f+3],f+=4,d=o,u=l,c=h;for(g=0;g<4;g++)n[(3&-g)+r]=S[d>>>24]<<24^S[u>>16&255]<<16^S[c>>8&255]<<8^S[255&p]^a[f++],o=d,d=u,u=c,c=p,p=o}}class n extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const r=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24};class a{constructor(e,t,i,s){const o=a.STEP,l=new Int32Array(e.buffer),h=new Uint8Array(e.byteLength);let d=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(l.subarray(d,d+o),t,i,h)),d=o;d>2),a=new s(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),l=new Int32Array(o.buffer);let h,d,u,c,p,m,g,f,y;for(h=i[0],d=i[1],u=i[2],c=i[3],y=0;y{const s=e[i];var n;n=s,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t}({source:t.source,decrypted:i}),[i.buffer])}))}})));var Eh=Zo(Sh);const wh=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Ch=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},kh=(e,t)=>{t.activePlaylistLoader=e,e.load()},Ih={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:i},excludePlaylist:s}=t,n=i.activeTrack(),r=i.activeGroup(),a=(r.filter((e=>e.default))[0]||r[0]).id,o=i.tracks[a];if(n!==o){Pa.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()}else s({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:i}}=t;Pa.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const s=i.activeTrack();s&&(s.mode="disabled"),i.onTrackChanged()}},xh={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:n,segmentLoaders:{[e]:r}}=i;t.on("loadedmetadata",(()=>{const e=t.media();r.playlist(e,n),(!s.paused()||e.endList&&"none"!==s.preload())&&r.load()})),t.on("loadedplaylist",(()=>{r.playlist(t.media(),n),s.paused()||r.load()})),t.on("error",Ih[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:n,segmentLoaders:{[e]:r},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();r.playlist(e,n),r.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&r.load()})),t.on("loadedplaylist",(()=>{r.playlist(t.media(),n),s.paused()||r.load()})),t.on("error",Ih[e](e,i))}},Ah={AUDIO:(e,t)=>{const{vhs:i,sourceType:s,segmentLoaders:{[e]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:h}},mainPlaylistLoader:d}=t,u=po(d.main);a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}},u&&(a[e].main.default.playlists=d.main.playlists));for(const n in a[e]){o[n]||(o[n]=[]);for(const c in a[e][n]){let p,m=a[e][n][c];if(u?(h(`AUDIO group '${n}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new Po(m.playlists[0],i,r):m.resolvedUri?new Po(m.resolvedUri,i,r):m.playlists&&"dash"===s?new Yo(m.playlists[0],i,r,d):null,m=Fa({id:c,playlistLoader:p},m),xh[e](e,m.playlistLoader,t),o[n].push(m),void 0===l[c]){const e=new Pa.AudioTrack({id:c,kind:wh(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}}n.on("error",Ih[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:s,sourceType:n,segmentLoaders:{[e]:r},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:h}},mainPlaylistLoader:d}=t;for(const r in o[e]){l[r]||(l[r]=[]);for(const u in o[e][r]){if(!s.options_.useForcedSubtitles&&o[e][r][u].forced)continue;let c,p=o[e][r][u];if("hls"===n)c=new Po(p.resolvedUri,s,a);else if("dash"===n){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new Yo(p.playlists[0],s,a,d)}else"vhs-json"===n&&(c=new Po(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=Fa({id:u,playlistLoader:c},p),xh[e](e,p.playlistLoader,t),l[r].push(p),void 0===h[u]){const e=i.addRemoteTextTrack({id:u,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:u},!1).track;h[u]=e}}}r.on("error",Ih[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:n,tracks:r}}}=t;for(const t in s[e]){n[t]||(n[t]=[]);for(const a in s[e][t]){const o=s[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const l=i.options_.vhs&&i.options_.vhs.captionServices||{};let h={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[h.instreamId]&&(h=Fa(h,l[h.instreamId])),void 0===h.default&&delete h.default,n[t].push(Fa({id:a},o)),void 0===r[a]){const e=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;r[a]=e}}}}},Dh=(e,t)=>{for(let i=0;i()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}};class Lh{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_=Ma(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 Oh extends Pa.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Lh,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_=Ba("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i)return this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),void this.trigger("error");i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=Ma(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"))}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();const s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},((e,t)=>{if(e){if(410===t.status)return this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i);if(429===t.status){const i=t.responseHeaders["retry-after"];return this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),void this.startTTLTimeout_(parseInt(i,10))}return this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_()}let n;this.trigger({type:"contentsteeringloadcomplete",metadata:s});try{n=JSON.parse(this.request_.responseText)}catch(e){const t={errorType:Pa.Error.StreamingContentSteeringParserError,error:e};this.trigger({type:"error",metadata:t})}this.assignSteeringProperties_(n);const r={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:r}),this.startTTLTimeout_()}))}setProxyServerUrl_(e){const t=new(p().URL)(e),i=new(p().URL)(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(p().atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new(p().URL)(e),i=this.getPathway(),s=this.getBandwidth_();if(i){const e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(s){const e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,s)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),void this.trigger("error");this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(e=>{for(const 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;const t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!t(i))return i}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=1e3*e;this.ttlTimeout_=p().setTimeout((()=>{this.requestSteeringManifest()}),t)}clearTTLTimeout_(){p().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 Lh}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&&(Ma(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let Rh;const Nh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Mh=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class Uh extends Pa.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:s,bandwidth:n,externVhs:r,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:h,cacheEncryptionKeys:d,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:m,experimentalUseMMS:g}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:f}=e;null==f&&(f=1/0),Rh=r,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=h,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=f,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:f,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:zl,activeTrack:zl,getActiveGroup:zl,onGroupChanged:zl,onTrackChanged:zl,lastTrack_:null,logger_:Ba(`MediaGroups[${t}]`)}})),e})(),g&&p().ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new(p().ManagedMediaSource),Pa.log("Using ManagedMediaSource")):p().MediaSource&&(this.mediaSource=new(p().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_=qa(),this.hasPlayed_=!1,this.syncController_=new bh(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Eh,this.sourceUpdater_=new hh(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Th,this.keyStatusMap_=new Map;const y={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,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:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new Yo(t,this.vhs_,Fa(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Po(t,this.vhs_,Fa(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Vl(Fa(y,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Vl(Fa(y,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new ph(Fa(y,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){s.off("vttjserror",n),e()}function n(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",n),s.addWebVttScript_()}))}),e),this.contentSteeringController_=new Oh(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_()))),Nh.forEach((e=>{this[e+"_"]=Mh.bind(this,e)})),this.logger_=Ba("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;const _="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(_,(()=>{const 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_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),n=s&&(s.id||s.uri),r=e&&(e.id||e.uri);if(n&&n!==r){this.logger_(`switch media ${n} -> ${r} from ${t}`);const i={renditionInfo:{id:r,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=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){const 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_=p().setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(p().clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||s.length&&i[s[0]];for(const t in e)if(e[t].default){n={label:t};break}}if(!n)return t;const r=[];for(const t in i)if(i[t][n.label]){const s=i[t][n.label];if(s.playlists&&s.playlists.length)r.push.apply(r,s.playlists);else if(s.uri)r.push(s);else if(e.playlists.length)for(let i=0;i{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ho(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()),(e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{Ah[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:n,segmentLoaders:{AUDIO:r,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=((e,t)=>i=>{const{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:n}}}=t,r=s.media();if(!r)return null;let a=null;r.attributes[e]&&(a=n[r.attributes[e]]);const o=Object.keys(n);if(!a)if("AUDIO"===e&&o.length>1&&po(t.main))for(let e=0;ee.id===i.id))[0]||null})(i,e),t[i].activeTrack=Ph[i](i,e),t[i].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:n}}=t,r=n.activeTrack(),a=n.getActiveGroup(),o=n.activePlaylistLoader,l=n.lastGroup_;a&&l&&a.id===l.id||(n.lastGroup_=a,n.lastTrack_=r,Ch(i,n),a&&!a.isMainPlaylist&&(a.playlistLoader?(i.resyncLoader(),kh(a.playlistLoader,n)):o&&s.resetEverything()))})(i,e),t[i].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()})(i,e),t[i].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:n},mediaTypes:{[e]:r}}=t,a=r.activeTrack(),o=r.getActiveGroup(),l=r.activePlaylistLoader,h=r.lastTrack_;if((!h||!a||h.id!==a.id)&&(r.lastGroup_=o,r.lastTrack_=a,Ch(s,r),o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;return r.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),i.pause(),n.resetEverything(),void e.fastQualityChange_(s)}if("AUDIO"===e){if(!o.playlistLoader)return n.setAudio(!0),void n.resetEverything();s.setAudio(!0),n.setAudio(!1)}l!==o.playlistLoader?(s.track&&s.track(a),s.resetEverything(),kh(o.playlistLoader,r)):kh(o.playlistLoader,r)}})(i,e),t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(i,e)}));const o=t.AUDIO.activeGroup();if(o){const 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),r.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()))}));const l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),n.on("dispose",(()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio");for(const e in t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[e])})({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))return;if(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",(()=>{const 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",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ho(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",(()=>{const 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(b({},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){const i=e.mediaGroups||{};let s=!0;const n=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const 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"}),Rh.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(i.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:o,log:l}){if(!s)return Pa.log.warn("We received no playlist to switch to. Please check your stream."),!1;const 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;const d=Boolean(Va(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);const u=Ka(t,i),c=o?Qo.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Qo.MAX_BUFFER_LOW_WATER_LINE;if(am)&&u>=n){let e=`${h} as forwardBuffer >= bufferLowWaterLine (${u} >= ${n})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${h} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const 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",(()=>{const e=this.audioSegmentLoader_.pendingSegment_;if(!e||!e.segment||!e.segment.syncInfo)return;const 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}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const 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(b({},e))})),this.audioSegmentLoader_.on(e,(e=>{this.player_.trigger(b({},e))})),this.subtitleSegmentLoader_.on(e,(e=>{this.player_.trigger(b({},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()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(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();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime(){}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();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;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=Rh.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),n=this.tech_.buffered();if(!n.length)return i-s<=$a;const r=n.end(n.length-1);return r-s<=$a&&i-r<=$a}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(oo),r=1===n.length&&n[0]===e;if(1===s.length&&i!==1/0)return Pa.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){const t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),void setTimeout((()=>{this.contentSteeringController_.addAvailablePathway(t)}),i)}let t=!1;s.forEach((i=>{if(i===e)return;const s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(Pa.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const l=t.internal?this.logger_:Pa.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"]);const d=o.targetDuration/2*1e3||5e3,u="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",r||u)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);const n=[];(s||"audio"===e)&&n.push("AUDIO"),(s||"subtitle"===e)&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const 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){const t=Va(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Rh.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const s=this.mainPlaylistLoader_.main,n=Rh.Playlist.seekable(t,i,Rh.Playlist.liveEdgeDelay(s,t));if(0===n.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=Rh.Playlist.seekable(t,i,Rh.Playlist.liveEdgeDelay(s,t)),0===e.length)return}let r,a;if(this.seekable_&&this.seekable_.length&&(r=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>n.end(0)||n.start(0)>e.end(0)?this.seekable_=n:this.seekable_=qa([[e.start(0)>n.start(0)?e.start(0):n.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=>{const t=this.mediaTypes_[e].groups;for(const 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_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=El(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||V}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||V,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const r={};let a;if(["video","audio"].forEach((function(t){if(s.hasOwnProperty(t)&&(i=e[t].isFmp4,n=s[t],!(i?$(n):H(n)))){const i=e[t].isFmp4?"browser":"muxer";r[i]=r[i]||[],r[i].push(s[t]),"audio"===t&&(a=i)}var i,n})),n&&a&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${a} does not support codec(s): "${s.audio}"`)}if(!Object.keys(r).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(F(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,n=(F(s[t]||"")[0]||{}).type;i&&n&&i.toLowerCase()!==n.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}{const e=Object.keys(r).reduce(((e,t)=>(e&&(e+=", "),e+`${t} does not support codec(s): "${r[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);const n=El(this.main,s),r=[];!n.audio||H(n.audio)||$(n.audio)||r.push(`audio codec ${n.audio}`),!n.video||H(n.video)||$(n.video)||r.push(`video codec ${n.video}`),n.text&&"stpp.ttml.im1t"===n.text&&r.push(`text codec ${n.text}`),r.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${r.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=Tl(F(e)),n=Sl(s),r=s.video&&F(s.video)[0]||null,a=s.audio&&F(s.audio)[0]||null;Object.keys(i).forEach((e=>{const s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);const o=[],l=El(this.mainPlaylistLoader_.main,s),h=Sl(l);if(l.audio||l.video){if(h!==n&&o.push(`codec count "${h}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const e=l.video&&F(l.video)[0]||null,t=l.audio&&F(l.audio)[0]||null;e&&r&&e.type.toLowerCase()!==r.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${r.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;const i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(!e.segments)return;let s,n=i;for(let i=0;i{const i=e.metadataTrack_;if(!i)return;const s=p().WebKitDataCue||p().VTTCue;t.forEach((e=>{for(const t of Object.keys(e)){if(Ol.has(t))continue;const n=new s(e.startTime,e.endTime,"");n.id=e.id,n.type="com.apple.quicktime.HLS",n.value={key:Ll[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(n.value.data=new Uint8Array(n.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(n)}e.processDateRange()}))})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Rl(this.inbandTextTracks_,e,this.tech_),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(!t)return;const n=p().WebKitDataCue||p().VTTCue,r=e.metadataTrack_;if(!r)return;if(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||p().isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach((e=>{const i=new n(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:()=>(Pa.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(Pa.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(Pa.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})}(i),r.addCue(i)}))})),!r.cues||!r.cues.length)return;const a=r.cues,o=[];for(let e=0;e{const 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)=>{const i=l[e],n=isFinite(s)?s:e,r=Number(h[t+1])||n;i.forEach((e=>{e.endTime=r}))}))})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):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(b({},e))}))})),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",(()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),i=[];for(const s of e.playlists){const e=s.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!(i.length||!t.size)})())&&this.resetContentSteeringController_()}))}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,i=new Set;let s=!1;Object.keys(t).forEach((n=>{const r=t[n],a=this.pathwayAttribute_(r),o=a&&e!==a;r.excludeUntil===1/0&&"content-steering"===r.lastExcludeReason_&&!o&&(delete r.excludeUntil,delete r.lastExcludeReason_,s=!0);const l=!r.excludeUntil&&r.excludeUntil!==1/0;!i.has(r.id)&&o&&l&&(i.add(r.id),r.excludeUntil=1/0,r.lastExcludeReason_="content-steering",this.logger_(`excluding ${r.id} for ${r.lastExcludeReason_}`))})),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach((t=>{const i=this.mediaTypes_[t];if(i.activePlaylistLoader){const t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(s=!0)}})),s&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(const[e,s]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(e));for(const[s,n]of i.entries()){const i=t.get(s);i?this.equalPathwayClones_(i,n)||(this.mainPlaylistLoader_.updateOrDeleteClone(n,!0),this.contentSteeringController_.addAvailablePathway(s)):(e.filter((e=>e.attributes["PATHWAY-ID"]===n["BASE-ID"])).forEach((e=>{this.mainPlaylistLoader_.addClonePathway(n,e)})),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;const i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const e in i)if(i[e]!==s[e])return!1;for(const e in s)if(i[e]!==s[e])return!1;return!0}changeSegmentPathway_(){const 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;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach((i=>{const s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach((s=>{const n="usable",r=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===n,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;r?r&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is ${n}`)):(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 ${n}`)),e++)}))})),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach((e=>{const 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,Pa.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))}))}addKeyStatus_(e,t){const i=("string"==typeof e?e:(e=>{const t=new Uint8Array(e);return Array.from(t).map((e=>e.toString(16).padStart(2,"0"))).join("")})(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_()}}class Bh{constructor(e,t,i){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const 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"]}var r,a,o;this.codecs=El(s.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,a=t.id,o=n,e=>{const t=r.main.playlists[a],i=ao(t),s=oo(t);if(void 0===e)return s;e?delete t.disabled:t.disabled=!0;const n={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===s||i||(o(t),e?r.trigger({type:"renditionenabled",metadata:n}):r.trigger({type:"renditiondisabled",metadata:n})),e})}}const Fh=["seeking","seeked","pause","playing","error"];class qh extends Pa.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_=Ba("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),r=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},r[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),r[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}));const l=e=>{["main","audio"].forEach((t=>{r[`${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(Fh,n),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(Fh,n),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=>{r[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),r[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&p().clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&p().clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=p().setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),n=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i=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(qa([this.lastRecordedTime,e]));const t={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:$a)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Wa(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const s=this.playlistController_.sourceUpdater_,n=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-ja),h=[r,a];for(let e=0;e ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const 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}const 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;const n=za(s,t);return n.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${n.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+$a;const r=!i.endList,a="number"==typeof i.partTargetDuration;return r&&(a||s)&&(n=e.end(e.length-1)+3*i.targetDuration),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:s,end:n}}return null}}const jh={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},$h=function(e,t){let i=0,s=0;const n=Fa(jh,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const r=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*n.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(n.getSource&&"function"==typeof n.getSource)return i=Date.now(),n.getSource.call(e,a);Pa.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function(){e.off("loadedmetadata",r),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),$h(e,t)}};var Hh="3.15.0";const Vh={PlaylistLoader:Po,Playlist:mo,utils:$o,STANDARD_PLAYLIST_SELECTOR:Dl,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(mo.isEnabled);return Il(e,((e,t)=>xl(e,t))),e.filter((e=>!!El(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:Dl,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio&&p().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),Al(this.playlists.main,t,parseInt(kl(this.tech_.el(),"width"),10)*s,parseInt(kl(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:xl,comparePlaylistResolution:function(e,t){let i,s;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||p().Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(s=t.attributes.RESOLUTION.width),s=s||p().Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s},xhr:Oo()};Object.keys(Qo).forEach((e=>{Object.defineProperty(Vh,e,{get:()=>(Pa.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Qo[e]),set(t){Pa.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?Pa.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Qo[e]=t}})}));const zh="videojs-vhs",Wh=function(e,t){const i=t.media();let s=-1;for(let t=0;t{if(!p().localStorage)return null;const e=p().localStorage.getItem(zh);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},Xh=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},Kh=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Yh=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Qh=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};Vh.supportsNativeHls=function(){if(!g()||!g().createElement)return!1;const e=g().createElement("video");return!!Pa.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))}))}(),Vh.supportsNativeDash=!!(g()&&g().createElement&&Pa.getTech("Html5").isSupported())&&/maybe|probably/i.test(g().createElement("video").canPlayType("application/dash+xml")),Vh.supportsTypeNatively=e=>"hls"===e?Vh.supportsNativeHls:"dash"===e&&Vh.supportsNativeDash,Vh.isSupported=function(){return Pa.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Vh.xhr.onRequest=function(e){Xh(Vh.xhr,e)},Vh.xhr.onResponse=function(e){Kh(Vh.xhr,e)},Vh.xhr.offRequest=function(e){Yh(Vh.xhr,e)},Vh.xhr.offResponse=function(e){Qh(Vh.xhr,e)};const Jh=Pa.getComponent("Component");class Zh extends Jh{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Ba("VhsHandler"),t.options_&&t.options_.playerId){const e=Pa.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 new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(g(),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=g().fullscreenElement||g().webkitFullscreenElement||g().mozFullScreenElement||g().msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1: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_=Fa(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){const e=Gh();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=Qo.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Qo.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;const t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;var i;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=Vh,this.options_.sourceType=G(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Uh(this.options_);const s=Fa({liveRangeSafeTimeDelta:$a},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new qh(s),this.attachStreamingEventListeners_(),this.playlistController_.on("error",(()=>{const e=Pa.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const n=this.options_.bufferBasedABR?Vh.movingAverageBandwidthSelector(.55):Vh.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Vh.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;const t=p().navigator.connection||p().navigator.mozConnection||p().navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const s=1e3*t.downlink*1e3;e=s>=i&&e>=i?Math.max(e,s):s}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;return t=this.throughput>0?1/this.throughput:0,Math.floor(1/(e+t))},set(){Pa.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:()=>Ga(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:()=>Ga(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&&(e=>{if(!p().localStorage)return!1;let t=Gh();t=t?Fa(t,e):e;try{p().localStorage.setItem(zh,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const t=e.playlistController_.main(),i=po(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!ao(e))).map(((t,i)=>new Bh(e,t,t.id))):[]}})),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_=p().URL.createObjectURL(this.playlistController_.mediaSource),(Pa.browser.IS_ANY_SAFARI||Pa.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_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),(({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const n=(o=i?s.concat([i]):s,l=Object.keys(t),o.reduce(((e,t)=>{if(!t.contentProtection)return e;const i=l.reduce(((e,i)=>{const s=t.contentProtection[i];return s&&s.pssh&&(e[i]={pssh:s.pssh}),e}),{});return Object.keys(i).length&&e.push(i),e}),[])),r=[],a=[];var o,l;return n.forEach((t=>{a.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),r.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(r),Promise.race(a)])})({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_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=(({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{const n=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Tl(F(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);const n=j(s.video),r=j(s.audio),a={};for(const i in e)a[i]={},r&&(a[i].audioContentType=r),n&&(a[i].videoContentType=n),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 Fa(e,a)})(t,i,s);return!(!n||(e.currentSource().keySystems=n,n&&!e.eme&&(Pa.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1)))})({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});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.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=Pa.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{!function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Wh(e,t.playlists)}(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Wh(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":Hh,"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 hh.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_&&p().URL.revokeObjectURL&&(p().URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return(({playlist:e,time:t,callback:i})=>{if(!i)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===t)return i({message:"getProgramTime: playlist and time must be provided"});const s=((e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,s=0;for(let n=0;ns){if(e>s+.25*n.duration)return null;i=n}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}})(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});const n={mediaSeconds:t},r=((e,t)=>{if(!t.dateTimeObject)return null;const i=t.videoTimingInfo.transmuxerPrependedSeconds,s=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*s)})(t,s.segment);return r&&(n.programDateTime=r.toISOString()),i(null,n)})({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Ho({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=>{Xh(this.xhr,e)},this.xhr.onResponse=e=>{Kh(this.xhr,e)},this.xhr.offRequest=e=>{Yh(this.xhr,e)},this.xhr.offResponse=e=>{Qh(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(b({},e))}))})),["gapjumped","playedrangeschanged"].forEach((e=>{this.playbackWatcher_.on(e,(e=>{this.player_.trigger(b({},e))}))}))}}const ed={name:"videojs-http-streaming",VERSION:Hh,canHandleSource(e,t={}){const i=Fa(Pa.options,t);return!(!i.vhs.experimentalUseMMS&&!$("avc1.4d400d,mp4a.40.2",!1))&&ed.canPlayType(e.type,i)},handleSource(e,t,i={}){const s=Fa(Pa.options,i);return t.vhs=new Zh(e,t,s),t.vhs.xhr=Oo(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=G(e);if(!i)return"";const s=ed.getOverrideNative(t);return!Vh.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(Pa.browser.IS_ANY_SAFARI||Pa.browser.IS_IOS),{overrideNative:s=i}=t;return s}};$("avc1.4d400d,mp4a.40.2",!0)&&Pa.getTech("Html5").registerSourceHandler(ed,0),Pa.VhsHandler=Zh,Pa.VhsSourceHandler=ed,Pa.Vhs=Vh,Pa.use||Pa.registerComponent("Vhs",Vh),Pa.options.vhs=Pa.options.vhs||{},Pa.getPlugin&&Pa.getPlugin("reloadSourceOnError")||Pa.registerPlugin("reloadSourceOnError",(function(e){$h(this,e)}));const td=Pa.getComponent("MenuItem"),id=Pa.dom||Pa;class sd extends td{constructor(e,t={}){const i=t.selected;t.selected=t.active,super(e,t);const s=e.qualityLevels();this.levels_=t.levels,this.selected_=i,this.handleQualityChange=this.handleQualityChange.bind(this),this.controlText(t.controlText),this.on(s,"change",this.handleQualityChange),this.on("dispose",(()=>{this.off(s,"change",this.handleQualityChange)}))}createEl(e,t,i){const s=super.createEl(e,t,i),n=id.createEl("span",{className:"vjs-quality-menu-item-sub-label",innerHTML:this.localize(this.options_.subLabel||"")});return this.subLabel_=n,s&&s.appendChild(n),s}handleClick(){this.updateSiblings_();const e=this.player().qualityLevels(),t=e.selectedIndex;for(let i=0,s=e.length;i-1;this.selected(t)}selected(e){if(this.selectable)if(this.selected_){this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(this.localize("{1}, selected",this.localize(this.options_.controlText)));const t=this.player().controlBar.getChild("QualityMenuButton");e?t.removeClass("vjs-quality-menu-button-waiting"):t.addClass("vjs-quality-menu-button-waiting")}else this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(this.options_.controlText)}updateSiblings_(){const e=this.player().qualityLevels(),t=this.player().controlBar.getChild("QualityMenuButton").items;for(let i=0,s=t.length;i-1;s.selected_=s===this,s.selected(n)}}}const nd=Pa.getComponent("MenuButton"),rd=function(e){return Array.from(e).some((e=>e.height))},ad=function(e){return e>=2160?"4K":e>=720?"HD":""};Pa.registerComponent("QualityMenuButton",class extends nd{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-label",this.localize("Quality Levels")),this.controlText("Quality Levels"),e.options().experimentalSvgIcons||this.$(".vjs-icon-placeholder").classList.add("vjs-icon-cog"),this.setIcon("cog"),this.qualityLevels_=e.qualityLevels(),this.update=this.update.bind(this),this.hide=this.hide.bind(this),this.handleQualityChange_=this.handleQualityChange_.bind(this),this.firstChangeHandler_=this.firstChangeHandler_.bind(this),this.enableDefaultResolution_=this.enableDefaultResolution_.bind(this),this.on(this.qualityLevels_,"addqualitylevel",this.update),this.on(this.qualityLevels_,"removequalitylevel",this.update),this.on(this.qualityLevels_,"change",this.handleQualityChange_),this.one(this.qualityLevels_,"change",this.firstChangeHandler_),e.on("adstart",this.hide),e.on(["adend","adtimeout"],this.update),this.update(),this.on("dispose",(()=>{this.off(this.qualityLevels_,"addqualitylevel",this.update),this.off(this.qualityLevels_,"removequalitylevel",this.update),this.off(this.qualityLevels_,"change",this.handleQualityChange_),this.off(this.qualityLevels_,"change",this.firstChangeHandler_),e.off("adstart",this.hide),e.off(["adend","adtimeout"],this.update),e.off("loadedmetadata",this.enableDefaultResolution_)}))}buildWrapperCSSClass(){return`vjs-quality-menu-wrapper ${super.buildWrapperCSSClass()}`}buildCSSClass(){return`vjs-quality-menu-button ${super.buildCSSClass()}`}createItems(){const e=[];if(!this.qualityLevels_||!this.qualityLevels_.length)return e;let t;if(this.options_.useResolutionLabels&&rd(this.qualityLevels_)?(t=this.groupByResolution_(),this.addClass("vjs-quality-menu-button-use-resolution")):(t=this.groupByBitrate_(),this.removeClass("vjs-quality-menu-button-use-resolution")),t.length<=1)return[];t.forEach((t=>{t.levels.length&&(t.selectable=!0,e.push(new sd(this.player(),t)))}));const i=new sd(this.player(),{levels:Array.prototype.map.call(this.qualityLevels_,((e,t)=>t)),label:"Auto",controlText:"Auto",active:!0,selected:!0,selectable:!0});return this.autoMenuItem_=i,e.push(i),e}groupByResolution_(){const e={},t=[];for(let i=0,s=this.qualityLevels_.length;it.lines-e.lines));const i=[];return t.forEach((t=>{i.push(e[t.label])})),i}groupByBitrate_(){const e=[{levels:[],label:"HD",controlText:"High Definition"},{levels:[],label:"SD",controlText:"Standard Definition"}];for(let t=0,i=this.qualityLevels_.length;t=this.options_.sdBitrateLimit&&(i="HD")),"HD"===i?(this.addClass("vjs-quality-menu-button-HD-flag"),this.removeClass("vjs-quality-menu-button-4K-flag")):"4K"===i?(this.removeClass("vjs-quality-menu-button-HD-flag"),this.addClass("vjs-quality-menu-button-4K-flag")):(this.removeClass("vjs-quality-menu-button-HD-flag"),this.removeClass("vjs-quality-menu-button-4K-flag")),this.autoMenuItem_&&(this.autoMenuItem_.manuallySelected_&&e?this.autoMenuItem_.subLabel_.innerHTML=this.localize(i):this.autoMenuItem_.subLabel_.innerHTML="")}enableDefaultResolution_(){const e=this.options_.defaultResolution;for(let t=0;t{e.addClass("vjs-quality-menu");const i=e.getChild("controlBar"),s=i.addChild("QualityMenuButton",t,i.children_.length-2);return function(){e.removeClass("vjs-quality-menu"),i.removeChild(s),s.dispose()}},dd=function(e){!function(e,t){if(void 0!==e.qualityLevels){e.qualityLevels();let i=()=>{};e.ready((()=>{i=hd(e,t),e.on("loadstart",(()=>{i(),i=hd(e,t)}))})),e.qualityMenu=()=>{},e.qualityMenu.VERSION=od}}(this,Pa.obj.merge(ld,e))};Pa.registerPlugin("qualityMenu",dd),dd.VERSION=od;const ud={name:n.UU,viewportWidth:1200,attributes:{}};(0,s.registerBlockType)(n.UU,{title:n.DD,category:n.L1,icon:n.Kk,description:n.h_,example:ud,edit:function({attributes:e,setAttributes:t}){const{videoId:i,videoUrl:s,videoAlt:n,useCustomSize:d,videoSize:c,videoType:p,videoPosterUrl:m}=e,g=(0,h.useRef)(null),f=(0,h.useRef)(null);(0,h.useEffect)((()=>{if(!s||!g.current||f.current)return;const e=document.createElement("video-js");e.classList.add("vjs-big-play-centered"),g.current.appendChild(e);const t=f.current=Pa(e,{controls:!0,responsive:!d,fluid:!d,poster:m,sources:[{src:s,type:p}],preload:"auto",plugins:{qualityMenu:{}}}),i=c.width&&c.height;return d&&i&&(t.width(c.width),t.height(c.height)),()=>{t&&!t.isDisposed()&&(t.dispose(),f.current=null)}}),[s,m]),(0,h.useEffect)((()=>{if(!f.current)return;const e=c.width&&c.height;d&&e?(f.current.fluid(!1),f.current.responsive(!1),f.current.width(c.width),f.current.height(c.height)):(f.current.fluid(!0),f.current.responsive(!0))}),[d,c]);const y=e=>{t({mediaId:e.id,videoUrl:null,videoAlt:e.alt||e.title,videoSize:{width:e.width,height:e.height},videoType:e.mime,videoPosterUrl:e.thumb?.src||e.image?.src}),(async()=>{try{const i=await u()({path:`/wp/v2/media/${e.id}`});if(i&&i.meta&&i.meta._rt_transcoded_url){const s=i.meta._rt_transcoded_url;t({videoUrl:s,videoType:s.endsWith(".mpd")?"application/dash+xml":e.mime})}else t({videoUrl:e.url})}catch(i){console.error("Error fetching media meta:",i),t({videoUrl:e.url})}})()},_=(e,i)=>{isNaN(parseInt(e))||t({videoSize:{...c,[i]:parseInt(e)}})};return(0,r.createElement)("div",{...(0,o.useBlockProps)()},(0,r.createElement)(o.InspectorControls,null,(0,r.createElement)(l.PanelBody,{title:"Video Settings"},(0,r.createElement)("p",null,(0,r.createElement)("strong",null,"Video")),(0,r.createElement)(l.PanelRow,null,(0,r.createElement)(o.MediaUploadCheck,null,(0,r.createElement)(o.MediaUpload,{title:"Select Video",onSelect:y,allowedTypes:["video"],accept:"video/*",value:i,render:({open:e})=>(0,r.createElement)("div",{className:"upload-controls"},(0,r.createElement)(l.Button,{onClick:e,variant:"primary"},s?(0,a.__)("Replace Video"):(0,a.__)("Select Video")),s&&(0,r.createElement)(l.Button,{onClick:()=>t({videoUrl:null,videoPosterUrl:null}),variant:"link",isDestructive:!0},(0,a.__)("Remove Video")))}))),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,"Thumbnail Image")),(0,r.createElement)(l.PanelRow,null,(0,r.createElement)(o.MediaUploadCheck,null,(0,r.createElement)(o.MediaUpload,{title:"Select Thumbnail Image",onSelect:e=>{t({videoPosterUrl:e.url})},allowedTypes:["image"],accept:"image/*",render:({open:e})=>(0,r.createElement)("div",{className:"upload-controls"},(0,r.createElement)(l.Button,{onClick:e,variant:"primary"},m?(0,a.__)("Replace Thumbnail Image"):(0,a.__)("Select Thumbnail Image")),m&&(0,r.createElement)(l.Button,{onClick:()=>t({videoPosterUrl:null}),variant:"link",isDestructive:!0},(0,a.__)("Remove Thumbnail Image")))}))),(0,r.createElement)(l.TextControl,{label:"Alt Text",value:n,onChange:e=>t({videoAlt:e}),help:"Descriptive text for screen readers and SEO."}),(0,r.createElement)(l.ToggleControl,{label:"Use Custom Size",checked:d,onChange:e=>t({useCustomSize:e})}),d&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l.TextControl,{label:"Width",value:c.width,onChange:e=>_(e,"width")}),(0,r.createElement)(l.TextControl,{label:"Height",value:c.height,onChange:e=>_(e,"height")})))),s?(0,r.createElement)("div",{"data-vjs-player":!0},(0,r.createElement)("div",{ref:g})):(0,r.createElement)(l.Placeholder,{icon:"format-video",label:"RT Player Block",instructions:"Select a video from your media library or upload a new one."},(0,r.createElement)(o.MediaUploadCheck,null,(0,r.createElement)(o.MediaUpload,{onSelect:y,allowedTypes:["video"],render:({open:e})=>(0,r.createElement)(l.Button,{onClick:e,variant:"primary"},"Select Video")}))))},save:function({attributes:e}){const{videoUrl:t,videoAlt:i,videoSize:s,videoType:n,videoPosterUrl:a,useCustomSize:l}=e,h={controls:!0,autoplay:!1,preload:"auto",fluid:!l,responsive:!l};return(0,r.createElement)("div",{...o.useBlockProps.save()},t&&(0,r.createElement)("div",{"data-vjs-player":!0},(0,r.createElement)("video",{className:"video-js vjs-big-play-centered",alt:i,poster:a,"data-attributes":JSON.stringify(h),width:l?s.width:"100%",height:l?s.height:"auto"},(0,r.createElement)("source",{src:t,type:n}))))}})},697:(e,t,i)=>{var s,n=void 0!==i.g?i.g:"undefined"!=typeof window?window:{},r=i(542);"undefined"!=typeof document?s=document:(s=n["__GLOBAL_DOCUMENT_CACHE@4"])||(s=n["__GLOBAL_DOCUMENT_CACHE@4"]=r),e.exports=s},840:(e,t,i)=>{var s;s="undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{},e.exports=s},56:e=>{e.exports=function(e){if(!e)return!1;var i=t.call(e);return"[object Function]"===i||"function"==typeof e&&"[object RegExp]"!==i||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},962:(e,t,i)=>{var s=i(626).getUint64;e.exports=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=s(e.subarray(n)),i.firstOffset=s(e.subarray(n+8)),n+=16),n+=2;var r=t.getUint16(n);for(n+=2;r>0;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}},622:e=>{var t,i,s,n,r,a,o,l=9e4;t=function(e){return e*l},i=function(e,t){return e*t},s=function(e){return e/l},n=function(e,t){return e/t},r=function(e,i){return t(n(e,i))},a=function(e,t){return i(s(e),t)},o=function(e,t,i){return s(i?e:e-t)},e.exports={ONE_SECOND_IN_TS:l,secondsToVideoTs:t,secondsToAudioTs:i,videoTsToSeconds:s,audioTsToSeconds:n,audioTsToVideoTs:r,videoTsToAudioTs:a,metadataTsToSeconds:o}},626:e=>{var t=Math.pow(2,32);e.exports={getUint64:function(e){var i,s=new DataView(e.buffer,e.byteOffset,e.byteLength);return s.getBigUint64?(i=s.getBigUint64(0)){var s=i(840),n=e.exports={WebVTT:i(311),VTTCue:i(184),VTTRegion:i(891)};s.vttjs=n,s.WebVTT=n.WebVTT;var r=n.VTTCue,a=n.VTTRegion,o=s.VTTCue,l=s.VTTRegion;n.shim=function(){s.VTTCue=r,s.VTTRegion=a},n.restore=function(){s.VTTCue=o,s.VTTRegion=l},s.VTTCue||n.shim()},311:(e,t,i)=>{var s=i(697),n=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function r(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function a(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+(0|s)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function o(){this.values=n(null)}function l(e,t,i,s){var n=s?e.split(s):[e];for(var r in n)if("string"==typeof n[r]){var a=n[r].split(i);2===a.length&&t(a[0].trim(),a[1].trim())}}function h(e,t,i){var s=e;function n(){var t=a(e);if(null===t)throw new r(r.Errors.BadTimeStamp,"Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function h(){e=e.replace(/^\s+/,"")}if(h(),t.startTime=n(),h(),"--\x3e"!==e.substr(0,3))throw new r(r.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.substr(3),h(),t.endTime=n(),h(),function(e,t){var s=new o;l(e,(function(e,t){switch(e){case"region":for(var n=i.length-1;n>=0;n--)if(i[n].id===t){s.set(e,i[n].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":var r=t.split(","),a=r[0];s.integer(e,a),s.percent(e,a)&&s.set("snapToLines",!1),s.alt(e,a,["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start","center","end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start","center","end"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");try{t.line=s.get("line","auto")}catch(e){}t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100);try{t.align=s.get("align","center")}catch(e){t.align=s.get("align","middle")}try{t.position=s.get("position","auto")}catch(e){t.position=s.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=s.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}r.prototype=n(Error.prototype),r.prototype.constructor=r,r.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},o.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s=0&&t<=100)&&(this.set(e,t),!0)}};var d=s.createElement&&s.createElement("textarea"),u={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},c={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"},m={rt:"ruby"};function g(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function s(e,t){return!m[t.localName]||m[t.localName]===e.localName}function n(t,i){var s=u[t];if(!s)return null;var n=e.document.createElement(s),r=p[t];return r&&i&&(n[r]=i.trim()),n}for(var r,o,l=e.document.createElement("div"),h=l,g=[];null!==(r=i());)if("<"!==r[0])h.appendChild(e.document.createTextNode((o=r,d.innerHTML=o,o=d.textContent,d.textContent="",o)));else{if("/"===r[1]){g.length&&g[g.length-1]===r.substr(2).replace(">","")&&(g.pop(),h=h.parentNode);continue}var f,y=a(r.substr(1,r.length-2));if(y){f=e.document.createProcessingInstruction("timestamp",y),h.appendChild(f);continue}var _=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!_)continue;if(!(f=n(_[1],_[3])))continue;if(!s(h,f))continue;if(_[2]){var v=_[2].split(".");v.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(c.hasOwnProperty(i)){var s=t?"background-color":"color",n=c[i];f.style[s]=n}})),f.className=v.join(" ")}g.push(_[1]),h.appendChild(f),h=f}return l}var f=[[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 y(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function _(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function s(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function n(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var r=i.match(/^.*(\n|\r)/);return r?(e.length=0,r[0]):i}return"ruby"===t.tagName?n(e):t.childNodes?(s(e,t),n(e)):void 0}for(s(t,e);i=n(t);)for(var r=0;r=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,n=0;nu&&(d=d<0?-1:1,d*=Math.ceil(u/h)*h),a<0&&(d+=""===r.vertical?i.height:i.width,o=o.reverse()),n.move(c,d)}else{var p=n.lineHeight/i.height*100;switch(r.lineAlign){case"center":a-=p/2;break;case"end":a-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(a,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(a,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(a,"%")})}o=["+y","-x","+x","-y"],n=new T(t)}var m=function(e,t){for(var n,r=new T(e),a=1,o=0;ol&&(n=new T(e),a=l),e=new T(r)}return n||r}(n,o);t.move(m.toCSSCompatValues(i))}function E(){}v.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},v.prototype.formatStyle=function(e,t){return 0===e?0:e+t},b.prototype=n(v.prototype),b.prototype.constructor=b,T.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},T.prototype.overlaps=function(e){return this.lefte.left&&this.tope.top},T.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},T.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},T.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},T.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},T.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},E.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},E.convertCueToDOMTree=function(e,t){return e&&t?g(e,t):null},E.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;t{var t={"":1,lr:1,rl:1},i={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function s(e){return"string"==typeof e&&!!i[e.toLowerCase()]&&e.toLowerCase()}function n(e,i,n){this.hasBeenReset=!1;var r="",a=!1,o=e,l=i,h=n,d=null,u="",c=!0,p="auto",m="start",g="auto",f="auto",y=100,_="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return a},set:function(e){a=!!e}},startTime:{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");l=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return d},set:function(e){d=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var i=function(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===i)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=i,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return p},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");p=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return m},set:function(e){var t=s(e);t?(m=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");g=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=s(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return y},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");y=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return _},set:function(e){var t=s(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");_=t,this.hasBeenReset=!0}}}),this.displayState=void 0}n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},e.exports=n},891:e=>{var t={"":!0,up:!0};function i(e){return"number"==typeof e&&e>=0&&e<=100}e.exports=function(){var e=100,s=3,n=0,r=100,a=0,o=100,l="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!i(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");s=e}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(e){if(!i(e))throw new Error("RegionAnchorX must be between 0 and 100.");r=e}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!i(e))throw new Error("RegionAnchorY must be between 0 and 100.");n=e}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(e){if(!i(e))throw new Error("ViewportAnchorY must be between 0 and 100.");o=e}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!i(e))throw new Error("ViewportAnchorX must be between 0 and 100.");a=e}},scroll:{enumerable:!0,get:function(){return l},set:function(e){var i=function(e){return"string"==typeof e&&!!t[e.toLowerCase()]&&e.toLowerCase()}(e);!1===i?console.warn("Scroll: an invalid or illegal string was specified."):l=i}}})}},542:()=>{},634:e=>{function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(!i){var a=1/0;for(d=0;d=r)&&Object.keys(s.O).every((e=>s.O[e](i[l])))?i.splice(l--,1):(o=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[i,n,r]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={664:0,936:0};s.O.j=t=>0===e[t];var t=(t,i)=>{var n,r,a=i[0],o=i[1],l=i[2],h=0;if(a.some((t=>0!==e[t]))){for(n in o)s.o(o,n)&&(s.m[n]=o[n]);if(l)var d=l(s)}for(t&&t(i);hs(673)));n=s.O(n)})(); \ No newline at end of file diff --git a/assets/build/blocks/rt-player/style-index-rtl.css b/assets/build/blocks/rt-player/style-index-rtl.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/assets/build/blocks/rt-player/style-index-rtl.css @@ -0,0 +1 @@ + diff --git a/assets/build/blocks/rt-player/style-index.css b/assets/build/blocks/rt-player/style-index.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/assets/build/blocks/rt-player/style-index.css @@ -0,0 +1 @@ + diff --git a/assets/src/blocks/easydam-player/VideoJS.js b/assets/src/blocks/easydam-player/VideoJS.js new file mode 100644 index 0000000..e620598 --- /dev/null +++ b/assets/src/blocks/easydam-player/VideoJS.js @@ -0,0 +1,76 @@ +import React from 'react'; +import videojs from 'video.js'; +import 'video.js/dist/video-js.css'; + +import { useRef, useEffect } from '@wordpress/element'; +import { video } from '@wordpress/icons'; + +export const VideoJS = (props) => { + const videoRef = useRef(null); + const playerRef = useRef(null); + const { options, onReady } = props; + + console.log(options); + + useEffect(() => { + // Make sure Video.js player is only initialized once + if (!playerRef.current) { + // The Video.js player needs to be _inside_ the component el for React 18 Strict Mode. + const videoElement = document.createElement("video-js"); + + videoElement.classList.add("vjs-big-play-centered"); + videoElement.classList.add("vjs-styles-dimensions"); + videoRef.current.appendChild(videoElement); + + const player = (playerRef.current = videojs(videoElement, options), () => { + onReady && onReady(player); + }); + + + // You could update an existing player in the `else` block here + // on prop change, for example: + } else { + const player = playerRef.current; + + player.autoplay(options.autoplay); + player.poster(options.poster || ''); + player.controls(options.controls); + player.loop(options.loop); + player.muted(options.muted); + player.preload(options.preload || ''); + player.playsinline(options.playsinline); + player.src(options.sources); + } + }, [options, videoRef]); + + // Dispose the Video.js player when the functional component unmounts + useEffect(() => { + const player = playerRef.current; + + if ( playerRef.current ) { + + const playerEl = playerRef.current.el_; + let video = playerEl.querySelector('video'); + + video.addEventListener("loadedmetadata", () => { + console.log(`${(video.videoHeight / video.videoWidth) * 100}%`); + playerEl.style.paddingTop = `${(video.videoHeight / video.videoWidth) * 100}%`; + }); + } + + return () => { + if (player && !player.isDisposed()) { + player.dispose(); + playerRef.current = null; + } + }; + }, [playerRef]); + + return ( +
+
+
+ ); +}; + +export default VideoJS; diff --git a/assets/src/blocks/easydam-player/block.json b/assets/src/blocks/easydam-player/block.json new file mode 100644 index 0000000..e1edc83 --- /dev/null +++ b/assets/src/blocks/easydam-player/block.json @@ -0,0 +1,82 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "easydam/video", + "title": "EasyDAM Video", + "category": "media", + "description": "Embed a video from your media library or upload a new one.", + "keywords": [ "movie", "video", "player" ], + "textdomain": "transcoder", + "attributes": { + "autoplay": { + "type": "boolean", + "attribute": "autoplay" + }, + "controls": { + "type": "boolean", + "default": true + }, + "id": { + "type": "number", + "role": "content" + }, + "loop": { + "type": "boolean" + }, + "muted": { + "type": "boolean" + }, + "poster": { + "type": "string" + }, + "preload": { + "type": "string", + "default": "metadata" + }, + "blob": { + "type": "string", + "role": "local" + }, + "src": { + "type": "string", + "role": "content" + }, + "sources": { + "type": "array", + "items": { + "type": "object" + }, + "default": [] + }, + "playsInline": { + "type": "boolean" + }, + "tracks": { + "role": "content", + "type": "array", + "items": { + "type": "object" + }, + "default": [] + } + }, + "supports": { + "anchor": true, + "align": true, + "spacing": { + "margin": true, + "padding": true, + "__experimentalDefaultControls": { + "margin": false, + "padding": false + } + }, + "interactivity": { + "clientNavigation": true + } + }, + "editorStyle": ["file:./index.css", "file:./frontend.css"], + "style": ["file:./style-index.css", "file:./frontend.css"], + "editorScript": ["file:./index.js"], + "viewScript": "file:./frontend.js" +} diff --git a/assets/src/blocks/easydam-player/edit-common-settings.js b/assets/src/blocks/easydam-player/edit-common-settings.js new file mode 100644 index 0000000..9394bfa --- /dev/null +++ b/assets/src/blocks/easydam-player/edit-common-settings.js @@ -0,0 +1,98 @@ +/** + * WordPress dependencies + */ +import { __, _x } from '@wordpress/i18n'; +import { ToggleControl, SelectControl } from '@wordpress/components'; +import { useMemo, useCallback, Platform } from '@wordpress/element'; + +const options = [ + { value: 'auto', label: __( 'Auto' ) }, + { value: 'metadata', label: __( 'Metadata' ) }, + { value: 'none', label: _x( 'None', 'Preload value' ) }, +]; + +const VideoSettings = ( { setAttributes, attributes } ) => { + const { autoplay, controls, loop, muted, playsInline, preload } = + attributes; + + const autoPlayHelpText = __( + 'Autoplay may cause usability issues for some users.' + ); + const getAutoplayHelp = Platform.select( { + web: useCallback( ( checked ) => { + return checked ? autoPlayHelpText : null; + }, [] ), + native: autoPlayHelpText, + } ); + + const toggleFactory = useMemo( () => { + const toggleAttribute = ( attribute ) => { + return ( newValue ) => { + setAttributes( { [ attribute ]: newValue } ); + }; + }; + + return { + autoplay: toggleAttribute( 'autoplay' ), + loop: toggleAttribute( 'loop' ), + muted: toggleAttribute( 'muted' ), + controls: toggleAttribute( 'controls' ), + playsInline: toggleAttribute( 'playsInline' ), + }; + }, [] ); + + const onChangePreload = useCallback( ( value ) => { + setAttributes( { preload: value } ); + }, [] ); + + return ( + <> + + + + + + + + ); +}; + +export default VideoSettings; diff --git a/assets/src/blocks/easydam-player/edit.js b/assets/src/blocks/easydam-player/edit.js new file mode 100644 index 0000000..af0dfee --- /dev/null +++ b/assets/src/blocks/easydam-player/edit.js @@ -0,0 +1,320 @@ +/** + * External dependencies + */ +import clsx from 'clsx'; + +/** + * WordPress dependencies + */ +import { isBlobURL } from '@wordpress/blob'; +import { + BaseControl, + Button, + Disabled, + PanelBody, + Spinner, + Placeholder, +} from '@wordpress/components'; +import { + BlockControls, + BlockIcon, + InspectorControls, + MediaPlaceholder, + MediaUpload, + MediaUploadCheck, + MediaReplaceFlow, + useBlockProps, + RichText +} from '@wordpress/block-editor'; +import { useRef, useEffect, useState } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; +import { __, sprintf } from '@wordpress/i18n'; +import { useInstanceId } from '@wordpress/compose'; +import { useDispatch } from '@wordpress/data'; +import { media as icon } from '@wordpress/icons'; +import { store as noticesStore } from '@wordpress/notices'; + +/** + * Internal dependencies + */ +import VideoCommonSettings from './edit-common-settings'; +import Tracks from './tracks'; +import Video from './VideoJS'; + +const ALLOWED_MEDIA_TYPES = [ 'video' ]; +const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ]; + +function VideoEdit( { + isSelected: isSingleSelected, + attributes, + className, + setAttributes, + insertBlocksAfter, + onReplace, +} ) { + const instanceId = useInstanceId( VideoEdit ); + const videoPlayer = useRef(); + const posterImageButton = useRef(); + const { id, controls, autoplay, poster, src, tracks, sources, muted, loop, playsInline, preload } = attributes; + const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob ); + + console.log(attributes); + + + useEffect( () => { + // Placeholder may be rendered. + if ( videoPlayer.current ) { + videoPlayer.current.load(); + } + }, [ poster ] ); + + function onSelectVideo( media ) { + if ( ! media || ! media.url ) { + // In this case there was an error + // previous attributes should be removed + // because they may be temporary blob urls. + setAttributes( { + src: undefined, + id: undefined, + poster: undefined, + caption: undefined, + blob: undefined, + } ); + setTemporaryURL(); + return; + } + + if ( isBlobURL( media.url ) ) { + setTemporaryURL( media.url ); + return; + } + + // Sets the block's attribute and updates the edit component from the + // selected media. + setAttributes( { + blob: undefined, + src: media.url, + id: media.id, + poster: + media.image?.src !== media.icon ? media.image?.src : undefined, + caption: media.caption, + } ); + + + // Fetch transcoded URL from media meta. + (async () => { + try { + const response = await apiFetch( { path: `/wp/v2/media/${ media.id }` } ); + if ( response && response.meta && response.meta._rt_transcoded_url ) { + const transcodedUrl = response.meta._rt_transcoded_url; + + setAttributes({ + sources: [ + { + src: transcodedUrl, + type: transcodedUrl.endsWith('.mpd') ? 'application/dash+xml' : media.mime + }, + { + src: media.url, + type: media.mime + } + ] + }); + } else { + // If meta not present, use media url. + setAttributes({ + sources: [ + { + src: media.url, + type: media.mime + } + ] + }); + } + } catch ( error ) { + console.error( 'Error fetching media meta:', error ); + // On error, use media url. + setAttributes({ + sources: [ + { + src: media.url, + type: media.mime + } + ] + }); + } + })(); + + setTemporaryURL(); + } + + function onSelectURL( newSrc ) { + if ( newSrc !== src ) { + setAttributes( { + blob: undefined, + src: newSrc, + id: undefined, + poster: undefined, + } ); + setTemporaryURL(); + } + } + + const { createErrorNotice } = useDispatch( noticesStore ); + function onUploadError( message ) { + createErrorNotice( message, { type: 'snackbar' } ); + } + + const classes = clsx( className, { + 'easydam-video-block': true, + 'is-transient': !! temporaryURL, + } ); + + const blockProps = useBlockProps( { + className: classes, + } ); + + if ( ! src && ! temporaryURL ) { + return ( +
+ + ( + + ) } + /> + +
+ ); + } + + function onSelectPoster( image ) { + setAttributes( { poster: image.url } ); + } + + function onRemovePoster() { + setAttributes( { poster: undefined } ); + + // Move focus back to the Media Upload button. + posterImageButton.current.focus(); + } + + const videoPosterDescription = `video-block__poster-image-description-${ instanceId }`; + + return ( + <> + { isSingleSelected && ( + <> + + onSelectVideo( undefined ) } + /> + + + ) } + + + + +
+ + { __( 'Poster image' ) } + + ( + + ) } + /> + + { !! poster && ( + + ) } +
+
+
+
+
+ { /* + Disable the video tag if the block is not selected + so the user clicking on it won't play the + video when the controls are enabled. + */ } + + + { !! temporaryURL && } +
+ + ); +} + +export default VideoEdit; diff --git a/assets/src/blocks/easydam-player/editor.scss b/assets/src/blocks/easydam-player/editor.scss new file mode 100644 index 0000000..66ebb4a --- /dev/null +++ b/assets/src/blocks/easydam-player/editor.scss @@ -0,0 +1 @@ +@import url('https://vjs.zencdn.net/8.3.0/video-js.css'); \ No newline at end of file diff --git a/assets/src/blocks/easydam-player/frontend.js b/assets/src/blocks/easydam-player/frontend.js new file mode 100644 index 0000000..4013e6c --- /dev/null +++ b/assets/src/blocks/easydam-player/frontend.js @@ -0,0 +1,37 @@ +import videojs from "video.js"; +import "video.js/dist/video-js.css"; +// import 'videojs-contrib-quality-levels'; +import 'videojs-hls-quality-selector'; + +// Adding an event listener for the 'DOMContentLoaded' event to ensure the script runs after the complete page is loaded. +document.addEventListener( 'DOMContentLoaded', () => easyDAMPlayer() ); + +/** + * RT Player + * + */ +function easyDAMPlayer() { + + const videos = document.querySelectorAll(".easydam-player.video-js"); + + videos.forEach(video => { + // read the data-setup attribute + const videoSetupOptions = video.dataset.setup ? JSON.parse(video.dataset.setup) : { + controls: true, + autoplay: false, + preload: 'auto', + fluid: true + }; + + console.log('videoOptions', videoSetupOptions); + + + const player = videojs(video, videoSetupOptions); + + const qualityLevels = player.qualityLevels(); + + player.hlsQualitySelector({ + vjsIconClass:'vjs-icon-cog', + }); + }); +} diff --git a/assets/src/blocks/easydam-player/index.js b/assets/src/blocks/easydam-player/index.js new file mode 100644 index 0000000..dd6cd84 --- /dev/null +++ b/assets/src/blocks/easydam-player/index.js @@ -0,0 +1,45 @@ +/** + * WordPress dependencies + */ +/** + * Registers a new block provided a unique name and an object defining its behavior. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ + */ +import { registerBlockType } from '@wordpress/blocks'; +import { video as icon } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +/** + * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. + * All files containing `style` keyword are bundled together. The code used + * gets applied both to the front of your site and to the editor. + * + * @see https://www.npmjs.com/package/@wordpress/scripts#using-css + */ +import './style.scss'; + +/** + * Internal dependencies + */ +import Edit from './edit'; +import save from './save'; + +/** + * Every block starts by registering a new block type definition. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ + */ +registerBlockType( 'easydam/video', { + icon, + /** + * @see ./edit.js + */ + edit: Edit, + /** + * @see ./save.js + */ + save, +} ); diff --git a/assets/src/blocks/easydam-player/index.php b/assets/src/blocks/easydam-player/index.php new file mode 100644 index 0000000..e69de29 diff --git a/assets/src/blocks/easydam-player/save.js b/assets/src/blocks/easydam-player/save.js new file mode 100644 index 0000000..018727d --- /dev/null +++ b/assets/src/blocks/easydam-player/save.js @@ -0,0 +1,53 @@ +/** + * WordPress dependencies + */ +import { + RichText, + useBlockProps, + __experimentalGetElementClassName, +} from '@wordpress/block-editor'; + +/** + * Internal dependencies + */ +import Tracks from './tracks'; + +export default function save( { attributes } ) { + const { + autoplay, + caption, + controls, + loop, + muted, + poster, + preload, + src, + sources, + playsInline, + tracks, + } = attributes; + + const videoSetupOptions = { + controls, + autoplay, + loop, + muted, + preload, + poster, + fluid: true, + sources, + }; + + return ( +
+ { src && ( + + ) } +
+ ); +} diff --git a/assets/src/blocks/easydam-player/style.scss b/assets/src/blocks/easydam-player/style.scss new file mode 100644 index 0000000..006884c --- /dev/null +++ b/assets/src/blocks/easydam-player/style.scss @@ -0,0 +1,25 @@ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ + + + .wp-block-trascoder-rt-player { + // Add your styles here. +} + +.easydam-video-block { + video { + width: 100%; + height: auto; + } +} + +.wp-block-easydam-video { + video { + width: 100%; + height: auto; + } +} diff --git a/assets/src/blocks/easydam-player/tracks.js b/assets/src/blocks/easydam-player/tracks.js new file mode 100644 index 0000000..372ea8c --- /dev/null +++ b/assets/src/blocks/easydam-player/tracks.js @@ -0,0 +1,5 @@ +export default function Tracks( { tracks = [] } ) { + return tracks.map( ( track ) => { + return ; + } ); +} diff --git a/assets/src/blocks/rt-player/block.json b/assets/src/blocks/rt-player/block.json new file mode 100644 index 0000000..4d9882c --- /dev/null +++ b/assets/src/blocks/rt-player/block.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "transcoder/rt-player", + "version": "1.0.0", + "title": "RT Player", + "category": "media", + "icon": "video-alt3", + "description": "A block for embedding videos with a custom player.", + "supports": { + "html": false + }, + "attributes": { + "videoId": { + "type": "string" + }, + "videoUrl": { + "type": "string" + }, + "videoAlt": { + "type": "string" + }, + "useCustomSize": { + "type": "boolean", + "default": false + }, + "videoSize": { + "type": "object", + "default": {} + }, + "videoType": { + "type": "string" + }, + "videoPosterUrl": { + "type": "string" + } + }, + "textdomain": "transcoder", + "editorScript": "file:./index.js", + "editorStyle": "file:./index.css", + "viewScript": "file:./frontend.js" +} diff --git a/assets/src/blocks/rt-player/edit.js b/assets/src/blocks/rt-player/edit.js new file mode 100644 index 0000000..4b9f87f --- /dev/null +++ b/assets/src/blocks/rt-player/edit.js @@ -0,0 +1,286 @@ +/** + * React hook that is used to mark the block wrapper element. + * It provides all the necessary props like the class name. + * + * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps + */ + +/** + * Retrieves the translation of text. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ + */ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * WordPress dependencies + */ +import { useBlockProps, InspectorControls, MediaUpload, MediaUploadCheck } from '@wordpress/block-editor'; +import { Button, PanelBody, PanelRow, TextControl, ToggleControl, Placeholder } from '@wordpress/components'; +import { useEffect, useRef } from '@wordpress/element'; +import apiFetch from '@wordpress/api-fetch'; // **Import apiFetch** + +/** + * External dependencies + */ +import videojs from 'video.js'; +import 'videojs-contrib-quality-menu'; +import 'video.js/dist/video-js.css'; +import 'videojs-contrib-quality-menu/dist/videojs-contrib-quality-menu.css'; + +/** + * Internal dependencies + */ +/** + * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. + * Those files can contain any CSS code that gets applied to the editor. + * + * @see https://www.npmjs.com/package/@wordpress/scripts#using-css + */ +import './editor.scss'; + +/** + * External dependencies + */ + +/** + * The edit function describes the structure of your block in the context of the + * editor. This represents what the editor will render when the block is used. + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * @param {Object} props.setAttributes Function to set block's attributes. + * + * @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit + * + * @return {HTMLElement} Element to render. + */ +export default function Edit( { attributes, setAttributes } ) { + const { videoId, videoUrl, videoAlt, useCustomSize, videoSize, videoType, videoPosterUrl } = attributes; + const videoRef = useRef( null ); + const playerInstance = useRef( null ); + + useEffect( () => { + if ( ! videoUrl || ! videoRef.current || playerInstance.current ) { + return; + } + + // Create a new video element. + const videoElement = document.createElement( 'video-js' ); + videoElement.classList.add( 'vjs-big-play-centered' ); + videoRef.current.appendChild( videoElement ); + + // Initialize the player. + const player = playerInstance.current = videojs( videoElement, { + controls: true, + responsive: ! useCustomSize, + fluid: ! useCustomSize, + poster: videoPosterUrl, + sources: [ { + src: videoUrl, + type: videoType, + } ], + preload: 'auto', + plugins: { + qualityMenu: {} + } + } ); + + const isCustomSizeDefined = videoSize.width && videoSize.height; + + // Set initial dimensions if defined. + if ( useCustomSize && isCustomSizeDefined ) { + player.width( videoSize.width ); + player.height( videoSize.height ); + } + + return () => { + if ( player && ! player.isDisposed() ) { + player.dispose(); + playerInstance.current = null; + } + }; + }, [ videoUrl, videoPosterUrl ] ); + + useEffect( () => { + if ( ! playerInstance.current ) { + return; + } + + const isCustomSizeDefined = videoSize.width && videoSize.height; + + if ( useCustomSize && isCustomSizeDefined ) { + // Disable responsive and fluid mode. + playerInstance.current.fluid( false ); + playerInstance.current.responsive( false ); + + // Set custom size. + playerInstance.current.width( videoSize.width ); + playerInstance.current.height( videoSize.height ); + } else { + // Enable responsive and fluid mode. + playerInstance.current.fluid( true ); + playerInstance.current.responsive( true ); + } + }, [ useCustomSize, videoSize ] ); + + const onSelectVideo = ( media ) => { + setAttributes( { + mediaId: media.id, + videoUrl: null, + videoAlt: media.alt || media.title, + videoSize: { + width: media.width, + height: media.height, + }, + videoType: media.mime, + videoPosterUrl: media.thumb?.src || media.image?.src, + } ); + + // Fetch transcoded URL from media meta. + const fetchTranscodedUrl = async () => { + try { + const response = await apiFetch( { path: `/wp/v2/media/${ media.id }` } ); + if ( response && response.meta && response.meta._rt_transcoded_url ) { + const transcodedUrl = response.meta._rt_transcoded_url; + setAttributes( { videoUrl: transcodedUrl, videoType: transcodedUrl.endsWith('.mpd') ? 'application/dash+xml' : media.mime } ); + } else { + // If meta not present, use media url. + setAttributes( { videoUrl: media.url } ); + } + } catch ( error ) { + console.error( 'Error fetching media meta:', error ); + // On error, use media url. + setAttributes( { videoUrl: media.url } ); + } + }; + + fetchTranscodedUrl(); + }; + + const onSelectPoster = ( media ) => { + setAttributes( { + videoPosterUrl: media.url, + } ); + }; + + const onSizeChange = ( value, key ) => { + if ( isNaN( parseInt( value ) ) ) { + return; + } + + setAttributes( { + videoSize: { + ...videoSize, + [ key ]: parseInt( value ), + }, + } ); + }; + + return ( +
+ + +

Video

+ + + ( +
+ + { videoUrl && ( + + ) } +
+ ) } + /> +
+
+

Thumbnail Image

+ + + ( +
+ + { videoPosterUrl && ( + + ) } +
+ ) } + /> +
+
+ setAttributes( { videoAlt: value } ) } + help="Descriptive text for screen readers and SEO." + /> + setAttributes( { useCustomSize: value } ) } + /> + { useCustomSize && ( + <> + onSizeChange( value, 'width' ) } + /> + onSizeChange( value, 'height' ) } + /> + + ) } +
+
+ { videoUrl ? ( +
+
+
+ ) : ( + + + ( + + ) } + /> + + + ) } +
+ ); +} diff --git a/assets/src/blocks/rt-player/editor.scss b/assets/src/blocks/rt-player/editor.scss new file mode 100644 index 0000000..59e0c99 --- /dev/null +++ b/assets/src/blocks/rt-player/editor.scss @@ -0,0 +1,22 @@ +/** + * The following styles get applied inside the editor only. + * + * Replace them with your own styles or remove the file completely. + */ + +.block-editor-block-inspector { + + .components-panel__row { + margin-bottom: 1em; + + .upload-controls { + display: flex; + flex-direction: column; + gap: 1em; + } + } +} + +.wp-block-trascoder-rt-player { + // Add editor styles here. +} diff --git a/assets/src/blocks/rt-player/example.js b/assets/src/blocks/rt-player/example.js new file mode 100644 index 0000000..00898ae --- /dev/null +++ b/assets/src/blocks/rt-player/example.js @@ -0,0 +1,15 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import metadata from './block.json'; + +export default { + name: metadata.name, + viewportWidth: 1200, + attributes: {}, +}; diff --git a/assets/src/blocks/rt-player/frontend.js b/assets/src/blocks/rt-player/frontend.js new file mode 100644 index 0000000..bac5ceb --- /dev/null +++ b/assets/src/blocks/rt-player/frontend.js @@ -0,0 +1,22 @@ +/* global videojs */ + +// Adding an event listener for the 'DOMContentLoaded' event to ensure the script runs after the complete page is loaded. +document.addEventListener( 'DOMContentLoaded', () => rtPlayerFn() ); + +/** + * RT Player + * + */ +function rtPlayerFn() { + const players = document.querySelectorAll( '.video-js' ); + players.forEach( ( playerEl ) => { + const videoSetupOptions = JSON.parse( playerEl.getAttribute( 'data-attributes' ) ); + + const player = videojs( playerEl, { + ...videoSetupOptions, + plugins: { + qualityMenu: {} + } + }); + } ); +} diff --git a/assets/src/blocks/rt-player/index.js b/assets/src/blocks/rt-player/index.js new file mode 100644 index 0000000..708d368 --- /dev/null +++ b/assets/src/blocks/rt-player/index.js @@ -0,0 +1,56 @@ +/** + * WordPress dependencies + */ +/** + * Registers a new block provided a unique name and an object defining its behavior. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ + */ +import { registerBlockType } from '@wordpress/blocks'; + +/** + * Internal dependencies + */ +/** + * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files. + * All files containing `style` keyword are bundled together. The code used + * gets applied both to the front of your site and to the editor. + * + * @see https://www.npmjs.com/package/@wordpress/scripts#using-css + */ +import './style.scss'; + +/** + * Internal dependencies + */ +import metadata from './block.json'; +import Edit from './edit'; +import save from './save'; +import example from './example'; + +/** + * Every block starts by registering a new block type definition. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ + */ +registerBlockType( metadata.name, { + title: metadata.title, + category: metadata.category, + icon: metadata.icon, + description: metadata.description, + + /** + * Block Example. + * + * @type {Object} + */ + example, + /** + * @see ./edit.js + */ + edit: Edit, + /** + * @see ./save.js + */ + save, +} ); diff --git a/assets/src/blocks/rt-player/index.php b/assets/src/blocks/rt-player/index.php new file mode 100644 index 0000000..a299063 --- /dev/null +++ b/assets/src/blocks/rt-player/index.php @@ -0,0 +1,105 @@ +setup_hooks(); + } + + /** + * Setup action/filter hooks. + * + * @return void + */ + protected function setup_hooks() { + add_action( 'init', array( $this, 'register_block' ) ); + add_action( 'wp_enqueue_scripts', array( $this, 'assets_handler' ) ); + } + + /** + * Enqueue scripts and styles for the block. + * + * @return void + */ + public function assets_handler() { + // Only enqueue assets if the block is present on the page. + if ( has_block( 'transcoder/' . self::SLUG ) ) { + // Define the base path for local library assets. + $lib_path = plugin_dir_url( __FILE__ ) . 'lib'; + + // Enqueue Video.js CSS. + wp_enqueue_style( + 'videojs-css', + $lib_path . '/css/video-js.min.css', + array(), + '8.19.1' + ); + + wp_enqueue_style( + 'videojs-quality-menu-css', + $lib_path . '/css/videojs-contrib-quality-menu.min.css', + array(), + '1.0.3', + ); + + // Enqueue Video.js core script. + wp_enqueue_script( + 'videojs', + $lib_path . '/js/video.min.js', + array(), + '8.19.1', + true + ); + + // Enqueue Quality Menu plugin. + wp_enqueue_script( + 'videojs-quality-menu', + $lib_path . '/js/videojs-contrib-quality-menu.min.js', + array( 'videojs' ), + '1.0.3', + true + ); + } + } + + /** + * Register block. + * + * @return void + */ + public function register_block() { + Assets::get_instance()->register_style( + self::SLUG . '-style', + 'assets/build/blocks/' . self::SLUG . '/style-index.css' + ); + + register_block_type( + TRANSCODER_BLOCK_BUILD . '/' . self::SLUG + ); + } +} + +RT_Player::get_instance(); diff --git a/assets/src/blocks/rt-player/lib/css/video-js.min.css b/assets/src/blocks/rt-player/lib/css/video-js.min.css new file mode 100644 index 0000000..1b81144 --- /dev/null +++ b/assets/src/blocks/rt-player/lib/css/video-js.min.css @@ -0,0 +1 @@ +.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{outline:.0625em solid #fff;box-shadow:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset:10px){.video-js .vjs-text-track-display>div{top:0;right:0;bottom:0;left:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}.video-js .vjs-transient-button{position:absolute;height:3em;display:flex;align-items:center;justify-content:center;background-color:rgba(50,50,50,.5);cursor:pointer;opacity:1;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:rgba(50,50,50,.9)}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file diff --git a/assets/src/blocks/rt-player/lib/css/videojs-contrib-quality-menu.min.css b/assets/src/blocks/rt-player/lib/css/videojs-contrib-quality-menu.min.css new file mode 100644 index 0000000..d480ce5 --- /dev/null +++ b/assets/src/blocks/rt-player/lib/css/videojs-contrib-quality-menu.min.css @@ -0,0 +1 @@ +.video-js.vjs-quality-menu{display:block}.video-js.vjs-quality-menu .vjs-quality-menu-button{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-button li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-button.vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em;width:10em;left:0}.video-js.vjs-quality-menu .vjs-menu-item .vjs-control-text{position:absolute}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper{position:relative}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper li{text-transform:none}.video-js.vjs-quality-menu .vjs-quality-menu-wrapper.vjs-menu-wrapper-popup .vjs-menu .vjs-menu-content{max-height:25em;width:10em;left:0}.video-js.vjs-quality-menu .vjs-quality-menu-item-sub-label{font-size:75%;font-weight:bold;position:absolute;right:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-use-resolution .vjs-quality-menu-item-sub-label{position:absolute;right:0;text-align:center;width:4em}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after,.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{background-color:#2b333f;color:inherit;content:"";font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:.7em;font-weight:300;height:2.2em;line-height:2.2em;padding:0;position:absolute;right:0;text-align:center;top:.5em;width:2.2em;border-radius:2em;letter-spacing:.1em}.video-js.vjs-quality-menu .vjs-quality-menu-button-HD-flag:after{content:"HD"}.video-js.vjs-quality-menu .vjs-quality-menu-button-4K-flag:after{content:"4K"}.video-js.vjs-quality-menu .vjs-quality-menu-button-waiting:before{-webkit-animation:vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite;animation:vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite}/*# sourceMappingURL=videojs-contrib-quality-menu.css.map */ diff --git a/assets/src/blocks/rt-player/lib/js/video.min.js b/assets/src/blocks/rt-player/lib/js/video.min.js new file mode 100644 index 0000000..c34398f --- /dev/null +++ b/assets/src/blocks/rt-player/lib/js/video.min.js @@ -0,0 +1,53 @@ +/** + * @license + * Video.js 8.19.1 + * Copyright Brightcove, Inc. + * Available under Apache License Version 2.0 + * + * + * Includes vtt.js + * Available under Apache License Version 2.0 + * + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){var M="8.19.1";let U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}let q={prefixed:!0};var j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=j[0];let V;for(let e=0;e{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),z&&(z.push([].concat(s)),e=z.length-1e3,z.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},(o.history=()=>z?[].concat(z):[]).filter=t=>(z||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{z&&(z.length=0)},o.history.disable=()=>{null!==z&&(z.length=0,z=null)},o.history.enable=()=>{null===z&&(z=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),W=o.createLogger,G=Object.prototype.toString;function X(t,i){$(t).forEach(e=>i(t[e],e))}function K(i,s,e=0){return $(i).reduce((e,t)=>s(e,i[t],t),e)}function Y(e){return!!e&&"object"==typeof e}function Q(e){return Y(e)&&"[object Object]"===G.call(e)&&e.constructor===Object}function d(...e){let i={};return e.forEach(e=>{e&&X(e,(e,t)=>{Q(e)?(Q(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function J(e={}){var t,i,s=[];for(t in e)e.hasOwnProperty(t)&&(i=e[t],s.push(i));return s}function Z(t,i,s,e=!0){let r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}let ee=Object.freeze({__proto__:null,each:X,reduce:K,isObject:Y,isPlain:Q,merge:d,values:J,defineLazyProperty:Z}),te=!1,ie=null,se=!1,re,ne=!1,ae=!1,oe=!1,le=!1,de=null,he=null;var e=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let ue=null,ce=!1,pe=!1,me=!1,ge=!1,fe=!1,ye=!1,_e=!1,ve=Boolean(Ee()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var be,t=window.navigator&&window.navigator.userAgentData;if(t&&t.platform&&t.brands&&(se="Android"===t.platform,ae=Boolean(t.brands.find(e=>"Microsoft Edge"===e.brand)),oe=Boolean(t.brands.find(e=>"Chromium"===e.brand)),le=!ae&&oe,de=he=(t.brands.find(e=>"Chromium"===e.brand)||{}).version||null,pe="Windows"===t.platform),!oe){let i=window.navigator&&window.navigator.userAgent||"";te=/iPod/i.test(i),ie=(t=i.match(/OS (\d+)_/i))&&t[1]?t[1]:null,se=/Android/i.test(i),re=(t=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(vi=t[1]&&parseFloat(t[1]),be=t[2]&&parseFloat(t[2]),vi&&be?parseFloat(t[1]+"."+t[2]):vi||null):null,ne=/Firefox/i.test(i),ae=/Edg/i.test(i),oe=/Chrome/i.test(i)||/CriOS/i.test(i),le=!ae&&oe,de=he=(be=i.match(/(Chrome|CriOS)\/(\d+)/))&&be[2]?parseFloat(be[2]):null,ue=function(){var e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)?11:t}(),fe=/Tizen/i.test(i),ye=/Web0S/i.test(i),_e=fe||ye,ce=/Safari/i.test(i)&&!le&&!se&&!ae&&!_e,pe=/Windows/i.test(i),me=/iPad/i.test(i)||ce&&ve&&!/iPhone/i.test(i),ge=/iPhone/i.test(i)&&!me}let u=ge||me||te,Te=(ce||u)&&!le;var Se=Object.freeze({__proto__:null,get IS_IPOD(){return te},get IOS_VERSION(){return ie},get IS_ANDROID(){return se},get ANDROID_VERSION(){return re},get IS_FIREFOX(){return ne},get IS_EDGE(){return ae},get IS_CHROMIUM(){return oe},get IS_CHROME(){return le},get CHROMIUM_VERSION(){return de},get CHROME_VERSION(){return he},IS_CHROMECAST_RECEIVER:e,get IE_VERSION(){return ue},get IS_SAFARI(){return ce},get IS_WINDOWS(){return pe},get IS_IPAD(){return me},get IS_IPHONE(){return ge},get IS_TIZEN(){return fe},get IS_WEBOS(){return ye},get IS_SMART_TV(){return _e},TOUCH_ENABLED:ve,IS_IOS:u,IS_ANY_SAFARI:Te});function we(e){return"string"==typeof e&&Boolean(e.trim())}function Ee(){return document===window.document}function Ce(e){return Y(e)&&1===e.nodeType}function ke(){try{return window.parent!==window.self}catch(e){return!0}}function Ie(i){return function(e,t){return we(e)?(t=Ce(t=we(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function l(e="div",i={},t={},s){let r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?xe(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&Ge(r,s),r}function xe(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ae(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function De(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Pe(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function Le(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(o.warn("removeClass was called with an element that doesn't exist"),null)}function Oe(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Re(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function Ne(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Je(e,"height"))),i.width||(i.width=parseFloat(Je(e,"width"))),i}}function He(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[q.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Ve(t,e){var i={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Je(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e.assignedSlot&&e.assignedSlot.parentElement&&window.WebKitCSSMatrix&&(r=window.getComputedStyle(e.assignedSlot.parentElement).transform,r=new window.WebKitCSSMatrix(r),i.x+=r.m41,i.y+=r.m42),e=e.parentNode||e.host}}var n={},a=He(e.target),t=He(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,u)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function ze(e){return Y(e)&&3===e.nodeType}function $e(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function We(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>Ce(e="function"==typeof e?e():e)||ze(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function Ge(t,e){return We(e).forEach(e=>t.appendChild(e)),t}function Xe(e,t){return Ge($e(e),t)}function Ke(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 Ye=Ie("querySelector"),Qe=Ie("querySelectorAll");function Je(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Ze(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var et=Object.freeze({__proto__:null,isReal:Ee,isEl:Ce,isInFrame:ke,createEl:l,textContent:xe,prependTo:Ae,hasClass:De,addClass:Pe,removeClass:Le,toggleClass:Oe,setAttributes:Re,getAttributes:Ne,getAttribute:Me,setAttribute:Ue,removeAttribute:Be,blockTextSelection:Fe,unblockTextSelection:qe,getBoundingClientRect:je,findPosition:He,getPointerPosition:Ve,isTextNode:ze,emptyEl:$e,normalizeContent:We,appendContent:Ge,insertContent:Xe,isSingleLeftClick:Ke,$:Ye,$$:Qe,computedStyle:Je,copyStyleSheetsToWindow:Ze});function tt(){if(!1!==st.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function bt(s,r,n,a=window){let o;function e(){let e=this,t=arguments,i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}let Tt=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:p,throttle:vt,debounce:bt}),St;class wt{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},mt(this,e,t),this.addEventListener=i}off(e,t){c(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ft(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},yt(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=ut(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),gt(this,e)}queueTrigger(e){St=St||new Map;let t=e.type||e,i=St.get(this);i||(i=new Map,St.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,St.delete(this)),this.trigger(e)},0));i.set(t,s)}}wt.prototype.allowedEvents_={},wt.prototype.addEventListener=wt.prototype.on,wt.prototype.removeEventListener=wt.prototype.off,wt.prototype.dispatchEvent=wt.prototype.trigger;let Et=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),Ct=t=>t instanceof wt||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),kt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,It=(e,t,i)=>{if(!e||!e.nodeName&&!Ct(e))throw new Error(`Invalid target for ${Et(t)}#${i}; must be a DOM node or evented object.`)},xt=(e,t,i)=>{if(!kt(e))throw new Error(`Invalid event type for ${Et(t)}#${i}; must be a non-empty string or array.`)},At=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${Et(t)}#${i}; must be a function.`)},Dt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):(r=t[0],n=t[1],a=t[2]),It(r,e,i),xt(n,e,i),At(a,e,i),a=p(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Pt=(e,t,i,s)=>{It(e,e,t),e.nodeName?_t[t](e,i,s):e[t](i,s)},Lt={on(...t){let{isTargetingSelf:e,target:i,type:s,listener:r}=Dt(this,t,"on");if(Pt(i,"on",s,r),!e){let e=()=>this.off(i,s,r);e.guid=r.guid;t=()=>this.off("dispose",e);t.guid=r.guid,Pt(this,"on","dispose",e),Pt(i,"on","dispose",t)}},one(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=Dt(this,e,"one");if(t)Pt(i,"one",s,r);else{let t=(...e)=>{this.off(i,s,t),r.apply(null,e)};t.guid=r.guid,Pt(i,"one",s,t)}},any(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=Dt(this,e,"any");if(t)Pt(i,"any",s,r);else{let t=(...e)=>{this.off(i,s,t),r.apply(null,e)};t.guid=r.guid,Pt(i,"any",s,t)}},off(e,t,i){!e||kt(e)?c(this.eventBusEl_,e,t):(e=e,t=t,It(e,this,"off"),xt(t,this,"off"),At(i,this,"off"),i=p(this,i),this.off("dispose",i),e.nodeName?(c(e,t,i),c(e,"dispose",i)):Ct(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){It(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(kt(i))return gt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${Et(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function Ot(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=l("span",{className:"vjs-event-bus"});Object.assign(e,Lt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}let Rt={state:{},setState(e){"function"==typeof e&&(e=e());let i;return X(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&Ct(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Nt(e,t){Object.assign(e,Rt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&Ct(e)&&e.on("statechanged",e.handleStateChanged)}function Mt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function m(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Ut(e,t){return m(e)===m(t)}let Bt=Object.freeze({__proto__:null,toLowerCase:Mt,toTitleCase:m,titleCaseEquals:Ut});class g{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+lt++),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&&(Ot(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Nt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&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;0<=e;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 Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return l(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}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(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,r[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=g.getComponent(e.opts.componentClass||m(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==s[t]?s[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{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),window.clearTimeout(e)),e}setInterval(e,t){e=p(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=p(this,e),t=window.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=p(this,t);var 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),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return 0<=(e||this.el_).tabIndex&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(e){var e=window.getComputedStyle(e,null),t=e.getPropertyValue("visibility");return"none"!==e.getPropertyValue("display")&&!["hidden","collapse"].includes(t)}var i;return!(!function(t){if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width!==0){var i={x:t.getBoundingClientRect().left+t.offsetWidth/2,y:t.getBoundingClientRect().top+t.offsetHeight/2};if(!(i.x<0||i.x>(document.documentElement.clientWidth||window.innerWidth)||i.y<0||i.y>(document.documentElement.clientHeight||window.innerHeight))){let e=document.elementFromPoint(i.x,i.y);for(;e;){if(e===t)return 1;if(!e.parentNode)return;e=e.parentNode}}}}(e=e||this.el())||!t((i=e).parentElement)||!t(i)||"0"===i.style.opacity||"0px"===window.getComputedStyle(i).height||"0px"===window.getComputedStyle(i).width||e.parentElement&&!(0<=e.tabIndex))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=g.getComponent("Tech"),i=i&&i.isTech(e),s=g===e||g.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=m(t),g.components_||(g.components_={});s=g.getComponent("Player");if("Player"===t&&s&&s.players){let t=s.players;i=Object.keys(t);if(t&&0t[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return g.components_[t]=e,g.components_[Mt(t)]=e}static getComponent(e){if(e&&g.components_)return g.components_[e]}}function Ft(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function jt(e,t){return Array.isArray(e)?qt(e):void 0===e||void 0===t?qt():qt([[e,t]])}g.registerComponent("Component",g);function Ht(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Y(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}function Xt(e){return null!=e&&"function"==typeof e.then}function Kt(e){Xt(e)&&e.then(null,e=>{})}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.prototype.metadata=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.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."},i.MEDIA_ERR_CUSTOM=0,i.prototype.MEDIA_ERR_CUSTOM=0,i.MEDIA_ERR_ABORTED=1,i.prototype.MEDIA_ERR_ABORTED=1,i.MEDIA_ERR_NETWORK=2,i.prototype.MEDIA_ERR_NETWORK=2,i.MEDIA_ERR_DECODE=3,i.prototype.MEDIA_ERR_DECODE=3,i.MEDIA_ERR_SRC_NOT_SUPPORTED=4,i.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,i.MEDIA_ERR_ENCRYPTED=5,i.prototype.MEDIA_ERR_ENCRYPTED=5;function Yt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Qt,Jt=function(e){var t=e.$$("track");let i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Yt(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(Yt))},Zt=function(e,i){return e.forEach(function(e){let t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Yt;let ei="vjs-modal-dialog";class ti extends g{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_=l("div",{className:ei+"-content"},{role:"document"}),this.descEl_=l("p",{className:ei+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),xe(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 ei+" 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(){var e;this.opened_?this.options_.fillAlways&&this.fill():(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(){var e;this.opened_&&(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(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Xe(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),$e(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())e.preventDefault(),this.close();else if("Tab"===e.key){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}ti.prototype.options_={pauseOnOpen:!0,temporary:!0},g.registerComponent("ModalDialog",ti);class ii extends wt{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},Ct(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;e{this.changing_||(this.changing_=!0,si(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)}}function ni(t,i){for(let e=0;e{this.changing_||(this.changing_=!0,ni(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 oi extends ii{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 li{constructor(e){li.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(t=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);io.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Ui(e,s){var t={uri:e};(e=fi(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),Di(t,p(this,function(e,t,i){if(e)return o.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Mi(i,s);o.error("vttjs failed to load, stopping trying to process "+s.src)}):Mi(i,s)}))}class Bi extends pi{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:ui[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=ci[e.mode]||"disabled",i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new li(this.cues_)),n=new li(this.activeCues_),a=!1;this.timeupdateHandler=p(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(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"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){ci[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Ui(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e{t=ji.LOADED,this.trigger({type:"load",target:this})})}}ji.prototype.allowedEvents_={load:"load"},ji.NONE=0,ji.LOADING=1,ji.LOADED=2,ji.ERROR=3;let Hi={audio:{ListClass:ri,TrackClass:Fi,capitalName:"Audio"},video:{ListClass:ai,TrackClass:qi,capitalName:"Video"},text:{ListClass:oi,TrackClass:Bi,capitalName:"Text"}},Vi=(Object.keys(Hi).forEach(function(e){Hi[e].getterName=e+"Tracks",Hi[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:oi,TrackClass:Bi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=Xi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,a=Ji[r],i=a?(a=e.document.createElement(a),(r=es[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,ts[(n=i).localName]&&ts[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;Zi.hasOwnProperty(e)&&(e=Zi[e],i.style[t?"background-color":"color"]=e)}),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,Qi.innerHTML=n,n=Qi.textContent,Qi.textContent="",n)));return l}var ss=[[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 rs(e){var t=[],i="";if(e&&e.childNodes)for(n(t,e);i=function e(t){var i,s,r;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(r=s.match(/^.*(\n|\r)/))?r[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0:null}(t);)for(var s=0;s=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function ns(){}function as(e,t,i){ns.call(this),this.cue=t,this.cueDiv=is(e,t.text);this.applyStyles({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:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},this.cueDiv),this.div=e.document.createElement("div"),e={direction:rs(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(e),this.div.appendChild(this.cueDiv);var s=0;switch(t.positionAlign){case"start":case"line-left":s=t.position;break;case"center":s=t.position-t.size/2;break;case"end":case"line-right":s=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(s,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function os(e,t,o,l){var i,s=new _(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;ru&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),n<0&&(h+=""===r.vertical?o.height:o.width,a=a.reverse()),s.move(c,h)}else{var p=s.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new _(t)}u=function(e,t){for(var i,s=new _(e),r=1,n=0;ne.left&&this.tope.top},_.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},_.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},ls.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},ls.convertCueToDOMTree=function(e,t){return e&&t?is(e,t):null};ls.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;tthis.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}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.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(p(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return jt(0,0)}bufferedPercent(){return Gt(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(Hi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?jt(0,0):jt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Hi.names.forEach(e=>{var t=Hi[e];let 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(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Q(_s)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){let i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var 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=lt++;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 v.canPlayType(e.type)}static isTech(e){return e.prototype instanceof v||e instanceof v||e===v}static registerTech(e,t){if(v.techs_||(v.techs_={}),!v.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!v.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(v.canPlaySource)return e=m(e),v.techs_[e]=t,v.techs_[Mt(e)]=t,"Tech"!==e&&v.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return v.techs_&&v.techs_[e]?v.techs_[e]:(e=m(e),window&&window.videojs&&window.videojs[e]?(o.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){let t=a[e];v.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),v.prototype.featuresVolumeControl=!0,v.prototype.featuresMuteControl=!0,v.prototype.featuresFullscreenResize=!1,v.prototype.featuresPlaybackRate=!1,v.prototype.featuresProgressEvents=!1,v.prototype.featuresSourceset=!1,v.prototype.featuresTimeupdateEvents=!1,v.prototype.featuresNativeTextTracks=!1,v.prototype.featuresVideoFrameCallback=!1,v.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction s(r={},e=[],n,a,o=[],l=!1){let[t,...d]=e;if("string"==typeof t)s(r,vs[t],n,a,o,l);else if(t){let i=xs(a,t);if(!i.setSource)return o.push(i),s(r,d,n,a,o,l);i.setSource(Object.assign({},r),function(e,t){if(e)return s(r,d,n,a,o,l);o.push(i),s(t,r.type===t.type?d:vs[t.type],n,a,o,l)})}else d.length?s(r,d,n,a,o,l):l?n(r,o):s(r,vs["*"],n,a,o,!0)}(t,vs[t.type],i,e),1)}function ws(e,t,i,s=null){var r="call"+m(i),r=e.reduce(Is(r),s),s=r===Ts,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}let Es={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Cs={setCurrentTime:1,setMuted:1,setVolume:1},ks={play:1,pause:1};function Is(i){return(e,t)=>e===Ts?Ts:t[i]?t[i](e):e}function xs(e,t){var i=bs[e.id()];let s=null;if(null==i)s=t(e),bs[e.id()]=[[t,s]];else{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&&(1{if(e.hasOwnProperty("el_")){if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))return void i.push(e);e.hasOwnProperty("children_")&&0{i.push({name:()=>"ModalButton"+(e+1),el:()=>t,getPositions:()=>{var e=t.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}}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:e=>!0,focus:()=>t.focus()})})}),this.focusableComponents=i,this.focusableComponents}findSuitableDOMChild(e){return e.el()?function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let e=0;ee!==s&&this.isInDirection_(t.boundingClientRect,e.getPositions().boundingClientRect,i)),e=this.findBestCandidate_(t.center,e,i);e?this.focus(e):this.trigger({type:"endOfFocusableComponents",direction:i,focusedComponent:s})}}findBestCandidate_(e,t,i){let s=1/0,r=null;for(var n of t){var a=n.getPositions().center,a=this.calculateDistance_(e,a,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&&o.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;e=l(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=l("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";var i=this.localize(e);this.controlText_=e,xe(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"),"undefined"!=typeof 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"),"undefined"!=typeof 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)}}g.registerComponent("ClickableComponent",Ms);class Us extends Ms{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 l("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof 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;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(l("picture",{className:"vjs-poster",tabIndex:-1},{},l("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Kt(this.player_.play()):this.player_.pause())}}Us.prototype.crossorigin=Us.prototype.crossOrigin,g.registerComponent("PosterImage",Us);let Bs={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 Fs(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)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 qs(e,t,i){try{e.style[t]=i}catch(e){}}function js(e){return e?e+"px":""}class Hs extends g{constructor(s,e,t){super(s,e,t);let r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(p(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);let e=window.screen.orientation||window,t=window.screen.orientation?"change":"orientationchange";e.addEventListener(t,r),s.on("dispose",()=>e.removeEventListener(t,r));var i=this.options_.playerOptions.tracks||[];for(let e=0;e{var t;e.style.inset&&3===(t=e.style.inset.split(" ")).length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}))}}updateDisplayOverlay(){if(this.player_.videoHeight()&&window.CSS.supports("inset-inline: 10px")){var i=this.player_.currentWidth(),s=this.player_.currentHeight(),r=i/s,n=this.player_.videoWidth()/this.player_.videoHeight();let e=0,t=0;.1!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(t){var i=this.player_.play();if(this.mouseused_&&"clientX"in t&&"clientY"in t)Kt(i),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var t=this.player_.getChild("controlBar");let e=t&&t.getChild("playToggle");e?(t=()=>e.focus(),Xt(i)?i.then(t,()=>{}):this.setTimeout(t,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}zs.prototype.controlText_="Play Video",g.registerComponent("BigPlayButton",zs);class $s extends s{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)}}g.registerComponent("CloseButton",$s);class Ws extends s{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()?Kt(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))}}Ws.prototype.controlText_="Play",g.registerComponent("PlayToggle",Ws);class Gs extends g{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],e=>this.update(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=l("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=l("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=Wt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,o.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_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Gs.prototype.labelText_="Time",Gs.prototype.controlText_="Time",g.registerComponent("TimeDisplay",Gs);class Xs extends Gs{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)}}Xs.prototype.labelText_="Current Time",Xs.prototype.controlText_="Current Time",g.registerComponent("CurrentTimeDisplay",Xs);class Ks extends Gs{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Ks.prototype.labelText_="Duration",Ks.prototype.controlText_="Duration",g.registerComponent("DurationDisplay",Ks);class Ys extends g{createEl(){var 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}}g.registerComponent("TimeDivider",Ys);class Qs extends Gs{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(l("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}Qs.prototype.labelText_="Remaining Time",Qs.prototype.controlText_="Remaining Time",g.registerComponent("RemainingTimeDisplay",Qs);class Js extends g{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=l("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(l("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.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()}}g.registerComponent("LiveDisplay",Js);class Zs extends s{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(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=l("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 er(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}Zs.prototype.controlText_="Seek to live, currently playing live",g.registerComponent("SeekToLive",Zs);zi=Object.freeze({__proto__:null,clamp:er});class tr extends g{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(){var e;this.enabled()&&(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){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||le||e.preventDefault(),Fe(),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){var t=this.bar.el_.ownerDocument;qe(),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){let t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(er(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Ve(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){var t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,t=t&&t.horizontalSeek;i?t&&"ArrowLeft"===e.key||!t&&"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):t&&"ArrowRight"===e.key||!t&&"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")}}g.registerComponent("Slider",tr);let ir=(e,t)=>er(e/t*100,0,100).toFixed(2)+"%";class sr extends g{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=l("span",{className:"vjs-control-text"}),i=l("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=l("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",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=ir(s,e);this.percent_!==e&&(this.el_.style.width=e,xe(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}g.registerComponent("LoadProgressBar",sr);class rr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(s,r,n){var a=He(this.el_),o=je(this.player_.el()),r=s.width*r;if(o&&a){let e=s.left-o.left+r,t=s.width-r+(o.right-s.right),i=(t||(t=s.width-r,e=r),a.width/2);ea.width&&(i=a.width),i=Math.round(i),this.el_.style.right=`-${i}px`,this.write(n)}}write(e){xe(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Wt(i,t):Wt(a,s),this.update(r,n,e),o&&o()})}}g.registerComponent("TimeTooltip",rr);class nr extends g{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}nr.prototype.options_={children:[]},u||se||nr.prototype.options_.children.push("timeTooltip"),g.registerComponent("PlayProgressBar",nr);class ar extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}ar.prototype.options_={children:["timeTooltip"]},g.registerComponent("MouseTimeDisplay",ar);class or extends tr{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=p(this,this.update),this.update=vt(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 document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.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"!==document.visibilityState){let s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Wt(e,i),Wt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(je(this.el()),this.getProgress())}),s}}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(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Ke(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(Ke(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e),this.player_.options_.enableSmoothSeeking&&this.update()}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var 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?Kt(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){var t,i=this.player_.liveTracker;" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):"Home"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):"End"===e.key?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(e.key)?(e.preventDefault(),e.stopPropagation(),t=.1*parseInt(e.key,10),i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):"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 document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}or.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||se||or.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),g.registerComponent("SeekBar",or);class lr extends g{constructor(e,t){super(e,t),this.handleMouseMove=vt(p(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=vt(p(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){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=He(r=n.el()),r=er(r=Ve(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;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())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Kt(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(){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_)}handleMouseDown(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_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}lr.prototype.options_={children:["seekBar"]},g.registerComponent("ProgressControl",lr);class dr extends s{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(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?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 document.exitPictureInPicture&&super.show()}}dr.prototype.controlText_="Picture-in-Picture",g.registerComponent("PictureInPictureToggle",dr);class hr extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[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()}}hr.prototype.controlText_="Fullscreen",g.registerComponent("FullscreenToggle",hr);class ur extends g{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}g.registerComponent("VolumeLevel",ur);class cr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=je(this.el_),r=je(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){xe(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}g.registerComponent("VolumeLevelTooltip",cr);class pr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}pr.prototype.options_={children:["volumeLevelTooltip"]},g.registerComponent("MouseVolumeLevelDisplay",pr);class mr extends tr{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){Ke(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=je(s=this.el()),i=this.vertical(),s=Ve(s,e),s=er(s=i?s.y:s.x,0,1),r.update(t,s,i)),Ke(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){var 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)})}}mr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||se||mr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),mr.prototype.playerEvent="volumechange",g.registerComponent("VolumeBar",mr);class gr extends g{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Q(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=vt(p(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){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_)}handleMouseUp(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_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gr.prototype.options_={children:["volumeBar"]},g.registerComponent("VolumeControl",gr);class fr extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var 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_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&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),Le(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Pe(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}fr.prototype.controlText_="Mute",g.registerComponent("MuteToggle",fr);class yr extends g{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Q(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"),mt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),c(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}yr.prototype.options_={children:["muteToggle","volumeControl"]},g.registerComponent("VolumePanel",yr);class _r extends s{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(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}_r.prototype.controlText_="Skip Forward",g.registerComponent("SkipForward",_r);class vr extends s{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(){var 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){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}vr.prototype.controlText_="Skip Backward",g.registerComponent("SkipBackward",vr);class br extends g{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 g&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof g&&(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){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=l(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),mt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.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){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),mt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){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"))}createMenu(){var e,t=new br(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=l("li",{className:"vjs-menu-title",textContent:m(this.options_.title),tabIndex:-1}),e=new g(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;e{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 window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{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){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(m(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","descriptions"].indexOf(this.options_.track.kind)&&(t.appendChild(l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(l("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Ur.prototype.contentElType="button",g.registerComponent("PlaybackRateMenuItem",Ur);class Br extends Tr{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(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=l("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(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new Ur(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0{this.open(e)})}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}Hr.prototype.options_=Object.assign({},ti.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),g.registerComponent("ErrorDisplay",Hr);class Vr extends g{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(),l("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{var t=(this.options_.labelId||"vjs-track-option-"+lt++)+"-"+e[1].replace(/\W+/g,""),e=l("option",{id:t,value:this.localize(e[0]),textContent:e[1]});return e.setAttribute("aria-labelledby",this.selectLabelledbyIds+" "+t),e}))}}g.registerComponent("TextTrackSelect",Vr);class zr extends g{constructor(t,e={}){super(t,e);var i,e=l("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId}),e=(this.el().appendChild(e),this.options_.selects);for(i of e){var s=this.options_.selectConfigs[i],r=s.className,n=s.id.replace("%s",this.options_.id_);let e=null;var a="vjs_select_"+lt++,r=("colors"===this.options_.type&&(e=l("span",{className:r}),(r=l("label",{id:n,className:"vjs-label",textContent:s.label})).setAttribute("for",a),e.appendChild(r)),new Vr(t,{SelectOptions:s.options,legendId:this.options_.legendId,id:a,labelId:n}));this.addChild(r),"colors"===this.options_.type&&(e.appendChild(r.el()),this.el().appendChild(e))}}createEl(){return l("fieldset",{className:this.options_.className})}}g.registerComponent("TextTrackFieldset",zr);class $r extends g{constructor(e,t={}){super(e,t);var t=this.options_.textTrackComponentid,i=new zr(e,{id_:t,legendId:"captions-text-legend-"+t,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"}),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-background-"+t,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"})),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-window-"+t,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(i)}createEl(){return l("div",{className:"vjs-track-settings-colors"})}}g.registerComponent("TextTrackSettingsColors",$r);class Wr extends g{constructor(e,t={}){super(e,t);var t=this.options_.textTrackComponentid,i=new zr(e,{id_:t,legendId:"captions-font-size-"+t,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"}),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-edge-style-"+t,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"})),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-font-family-"+t,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(i)}createEl(){return l("div",{className:"vjs-track-settings-font"})}}g.registerComponent("TextTrackSettingsFont",Wr);class Gr extends g{constructor(e,t={}){super(e,t);var t=this.localize("restore all settings to the default values"),i=new s(e,{controlText:t,className:"vjs-default-button"}),i=(i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i),new s(e,{controlText:t,className:"vjs-done-button"}));i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return l("div",{className:"vjs-track-settings-controls"})}}g.registerComponent("TrackSettingsControls",Gr);let Xr="vjs-text-track-settings";var e=["#000","Black"],Ii=["#00F","Blue"],Kr=["#0FF","Cyan"],Yr=["#0F0","Green"],r=["#F0F","Magenta"],Qr=["#F00","Red"],Jr=["#FFF","White"],n=["#FF0","Yellow"],Zr=["1","Opaque"],en=["0.5","Semi-Transparent"],tn=["0","Transparent"];let sn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[e,Jr,Qr,Yr,Ii,n,r,Kr],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Zr,en,tn],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Jr,e,Qr,Yr,Ii,n,r,Kr],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:[Zr,en],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:[tn,en,Zr],className:"vjs-window-opacity vjs-opacity"}};function rn(e,t){if((e=t?t(e):e)&&"none"!==e)return e}sn.windowColor.options=sn.backgroundColor.options;class nn extends ti{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=l("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){var t=new $r(e,{textTrackComponentid:this.id_,selectConfigs:sn,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]}),t=(this.addChild(t),new Wr(e,{textTrackComponentid:this.id_,selectConfigs:sn,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]})),t=(this.addChild(t),new Gr(e));this.addChild(t)}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()}),X(sn,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 K(sn,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=rn(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){X(sn,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Xr))}catch(e){o.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Xr,JSON.stringify(e)):window.localStorage.removeItem(Xr)}catch(e){o.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}g.registerComponent("TextTrackSettings",nn);class an extends g{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=bt(()=>{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){let e=this.debouncedHandler_,t=this.unloadListener_=function(){c(this,"resize",e),c(this,"unload",t),t=null};mt(this.el_.contentWindow,"unload",t),mt(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()}}g.registerComponent("ResizeManager",an);let on={trackingThreshold:20,liveTolerance:15};class ln extends g{constructor(e,t){super(e,d(on,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_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,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(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:l("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+lt++}),description:l("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+lt++})},l("div",{className:"vjs-title-bar"},{},J(this.els))}updateDom_(){var e=this.player_.tech_;let s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];$e(i),t&&xe(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}g.registerComponent("TitleBar",dn);let hn={initialDisplay:4e3,position:[],takeFocus:!1};class un extends s{constructor(e,t){super(e,t=d(hn,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(){var e=l("button",{},{type:"button",class:this.buildCSSClass()},l("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()}}g.registerComponent("TransientButton",un);function cn(s){let r=s.el();if(!r.resetSourceWatch_){let t={},e=yn(s),i=t=>(...e)=>{e=t.apply(r,e);return mn(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{r[e]&&(t[e]=r[e],r[e]=i(t[e]))}),Object.defineProperty(r,"innerHTML",d(e,{set:i(e.set)})),r.resetSourceWatch_=()=>{r.resetSourceWatch_=null,Object.keys(t).forEach(e=>{r[e]=t[e]}),Object.defineProperty(r,"innerHTML",e)},s.one("sourceset",r.resetSourceWatch_)}}function pn(n){if(n.featuresSourceset){let r=n.el();if(!r.resetSourceset_){e=n;let t=fn([e.el(),window.HTMLMediaElement.prototype,_n],"src");var e;let i=r.setAttribute,s=r.load;Object.defineProperty(r,"src",d(t,{set:e=>{e=t.set.call(r,e);return n.triggerSourceset(r.src),e}})),r.setAttribute=(e,t)=>{t=i.call(r,e,t);return/src/i.test(e)&&n.triggerSourceset(r.src),t},r.load=()=>{var e=s.call(r);return mn(n)||(n.triggerSourceset(""),cn(n)),e},r.currentSrc?n.triggerSourceset(r.currentSrc):mn(n)||cn(n),r.resetSourceset_=()=>{r.resetSourceset_=null,r.load=s,r.setAttribute=i,Object.defineProperty(r,"src",t),r.resetSourceWatch_&&r.resetSourceWatch_()}}}}let mn=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;efn([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,gn],"innerHTML"),_n=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?gi(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class b extends v{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!fi(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,i){if(i===this[`featuresNative${e}Tracks`]){let t=e.toLowerCase();this[t+"TracksListeners_"]&&Object.keys(this[t+"TracksListeners_"]).forEach(e=>{this.el()[t+"Tracks"].removeEventListener(e,this[t+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!i,this[t+"TracksListeners_"]=null,this.proxyNativeTracksForType_(t)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var s=Hi[i];let r=this.el()[s.getterName],n=this[s.getterName]();if(this[`featuresNative${s.capitalName}Tracks`]&&r&&r.addEventListener){let e={change:e=>{var t={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(t),"text"===i&&this[Vi.remoteText.getterName]().trigger(t)},addtrack(e){n.addTrack(e.track)},removetrack(e){n.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{let i=e[t];r.addEventListener(t,i),this.on("dispose",e=>r.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Hi.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),b.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&Ne(this.options_.tag)),ve&&!0===this.options_.nativeControlsForTouch||delete e.controls,Re(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Ue(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{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)Kt(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(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}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){return e?(e={src:e},t&&(e.type=t),t=l("source",{},e),this.el_.appendChild(t),!0):(o.error("Invalid source URL."),!1)}removeSourceElement(e){if(e){var t;for(t of this.el_.querySelectorAll("source"))if(t.src===e)return this.el_.removeChild(t),!0;o.warn("No matching source element found with src: "+e)}else o.error("Source URL is required to remove the source element.");return!1}reset(){b.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){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),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):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Z(b,"TEST_VID",function(){var e,t;if(Ee())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),b.isSupported=function(){try{b.TEST_VID.volume=.5}catch(e){return!1}return!(!b.TEST_VID||!b.TEST_VID.canPlayType)},b.canPlayType=function(e){return b.TEST_VID.canPlayType(e)},b.canPlaySource=function(e,t){return b.canPlayType(e.type)},b.canControlVolume=function(){try{let e=b.TEST_VID.volume;b.TEST_VID.volume=e/2+.1;var t=e!==b.TEST_VID.volume;return t&&u?(window.setTimeout(()=>{b&&b.prototype&&(b.prototype.featuresVolumeControl=e!==b.TEST_VID.volume)}),!1):t}catch(e){return!1}},b.canMuteVolume=function(){try{var e=b.TEST_VID.muted;return b.TEST_VID.muted=!e,b.TEST_VID.muted?Ue(b.TEST_VID,"muted","muted"):Be(b.TEST_VID,"muted"),e!==b.TEST_VID.muted}catch(e){return!1}},b.canControlPlaybackRate=function(){if(se&&le&&he<58)return!1;try{var e=b.TEST_VID.playbackRate;return b.TEST_VID.playbackRate=e/2+.1,e!==b.TEST_VID.playbackRate}catch(e){return!1}},b.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},b.supportsNativeTextTracks=function(){return Te||u&&le},b.supportsNativeVideoTracks=function(){return!(!b.TEST_VID||!b.TEST_VID.videoTracks)},b.supportsNativeAudioTracks=function(){return!(!b.TEST_VID||!b.TEST_VID.audioTracks)},b.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]){Z(b.prototype,e,()=>b[t](),!0)}),b.prototype.featuresVolumeControl=b.canControlVolume(),b.prototype.movingMediaElementInDOM=!u,b.prototype.featuresFullscreenResize=!0,b.prototype.featuresProgressEvents=!0,b.prototype.featuresTimeupdateEvents=!0,b.prototype.featuresVideoFrameCallback=!(!b.TEST_VID||!b.TEST_VID.requestVideoFrameCallback),b.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},b.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){b.prototype["set"+m(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){b.prototype["set"+m(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]()}}),v.withSourceHandlers(b),b.nativeSourceHandler={},b.nativeSourceHandler.canPlayType=function(e){try{return b.TEST_VID.canPlayType(e)}catch(e){return""}},b.nativeSourceHandler.canHandleSource=function(e,t){return e.type?b.nativeSourceHandler.canPlayType(e.type):e.src?(e=yi(e.src),b.nativeSourceHandler.canPlayType("video/"+e)):""},b.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},b.nativeSourceHandler.dispose=function(){},b.registerSourceHandler(b.nativeSourceHandler),v.registerTech("Html5",b);let vn=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],bn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Tn=["tiny","xsmall","small","medium","large","xlarge","huge"],Sn={},wn=(Tn.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Sn[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class T extends g{constructor(e,i,t){if(e.id=e.id||i.id||"vjs_video_"+lt++,(i=Object.assign(T.getTagSettings(e),i)).initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,i.language||(s=e.closest("[lang]"))&&(i.language=s.getAttribute("lang")),super(null,i,t),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=W(this.id_),this.fsApi_=q,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Ne(e),this.language(this.options_.language),i.languages){let t={};Object.getOwnPropertyNames(i.languages).forEach(function(e){t[e.toLowerCase()]=i.languages[e]}),this.languages_=t}else this.languages_=T.prototype.options_.languages;this.resetCache_(),this.poster_=i.poster||"",this.controls_=!!i.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),i.plugins&&Object.keys(i.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Ot(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(mt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),t=(i.plugins&&Object.keys(i.plugins).forEach(e=>{this[e](i.plugins[e])}),i.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(i.playbackRates),i.experimentalSvgIcons&&((t=(new window.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")).querySelector("parsererror")?(o.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=t.documentElement).style.display="none",this.el_.appendChild(s),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"),i.spatialNavigation&&i.spatialNavigation.enabled&&(this.spatialNavigation=new Rs(this),this.addClass("vjs-spatial-navigation-enabled")),ve&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),T.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+t),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(){var e;this.trigger("dispose"),this.off("dispose"),c(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),c(document,"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),e=this,bs.hasOwnProperty(e.id())&&delete bs[e.id()],a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),Ne(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);De(i,"video-js")||Pe(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",le&&pe&&(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(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused");var n,a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(e=>Se[e]).map(e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-")),o=(this.addClass(...a),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=at("vjs-styles-dimensions"),a=Ye(".vjs-styles-defaults"),(n=Ye("head")).insertBefore(this.styleEl_,a?a.nextSibling:n.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),t.getElementsByTagName("a"));for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},Ct(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):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 new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.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;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=a[e];n[e.getterName]=this[e.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&&0{this.on(this.tech_,t,e=>this[`handleTech${m(t)}_`](e))}),Object.keys(bn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${bn[t]}_`].bind(this),event:e}):this[`handleTech${bn[t]}_`](e)})}),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||Ae(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Jt(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&&o.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":M}}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_(t){if(this.tech_&&"string"==typeof t){var i=()=>{let e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Xt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Xt(e=this.play())&&(e=e.catch(i)),Xt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}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=((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(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.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_(){0e.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()?Kt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.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,t):this.isInPictureInPicture()&&!document.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_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}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_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Kt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(Te||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||jt(0,0)}scrubbing(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")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=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&&e.length?e:jt(0,0)}seekable(){let e=this.techGet_("seekable");return e=e&&e.length?e:jt(0,0)}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Gt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){let a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Kt(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=document.documentElement.style.overflow,mt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Pe(document.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,c(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Le(document.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)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){let t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(l("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Ze(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:e}),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_.userActions;s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(t){var{fullscreenKey:e=e=>"f"===t.key.toLowerCase(),muteKey:i=e=>"m"===t.key.toLowerCase(),playPauseKey:s=e=>"k"===t.key.toLowerCase()||" "===t.key.toLowerCase()}=this.options_.userActions?this.options_.userActions.hotkeys:{};e.call(this,t)?(t.preventDefault(),t.stopPropagation(),e=g.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&e.prototype.handleClick.call(this,t)):i.call(this,t)?(t.preventDefault(),t.stopPropagation(),g.getComponent("MuteToggle").prototype.handleClick.call(this,t)):s.call(this,t)&&(t.preventDefault(),t.stopPropagation(),g.getComponent("PlayToggle").prototype.handleClick.call(this,t))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,v.getTech(e)]).filter(([e,t])=>t?t.isSupported():(o.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let r=As(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),Ss(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.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)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Ut(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(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Kt(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}),Ct(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{}).seekBar;e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var 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)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let 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)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!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_;this.usingNativeControls_!==(e=!!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(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);Y(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){let e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),o.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),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")))}listenForUserActivity_(){let t,i,s,r=p(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||se||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}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)return!!this.isAudio_;this.isAudio_=!!e}updatePlayerHeightOnAudioOnlyMode_(){var 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");var e=this.children();let t=this.getChild("ControlBar");var 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){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],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_())):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)?(this.audioOnlyMode()?this.audioOnlyMode(!1):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 t=e.track;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(),Ct(this))&&this.trigger("languagechange")}languages(){return d(T.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(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}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ps(t.poster)}]),t)}static getTagSettings(e){var i={sources:[],tracks:[]},t=Ne(e),s=t["data-setup"];if(De(e,"vjs-fill")&&(t.fill=!0),De(e,"vjs-fluid")&&(t.fluid=!0),null!==s)try{Object.assign(t,JSON.parse(s||"{}"))}catch(e){o.error("data-setup",e)}if(Object.assign(i,t),e.hasChildNodes()){var r=e.childNodes;for(let e=0,t=r.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){let t=a[e];T.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),T.prototype.crossorigin=T.prototype.crossOrigin,T.players={};Jr=window.navigator;T.prototype.options_={techOrder:v.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Jr&&(Jr.languages&&Jr.languages[0]||Jr.userLanguage||Jr.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},vn.forEach(function(e){T.prototype[`handleTech${m(e)}_`]=function(){return this.trigger(e)}}),g.registerComponent("Player",T);function En(t,i){function s(){Pn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return Dn(this,t),Pn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}let Cn="plugin",kn="activePlugins_",In={},xn=e=>In.hasOwnProperty(e),An=e=>xn(e)?In[e]:void 0,Dn=(e,t)=>{e[kn]=e[kn]||{},e[kn][t]=!0},Pn=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},Ln=(i,s)=>(s.prototype.name=i,function(...e){Pn(this,{name:i,plugin:s,instance:null},!0);let t=new s(this,...e);return this[i]=()=>t,Pn(this,t.getEventHash()),t});class On{constructor(e){if(this.constructor===On)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ot(this),delete this.trigger,Nt(this,this.constructor.defaultState),Dn(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 gt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[kn][e]=!1,this.player=this.state=null,t[e]=Ln(e,In[e])}static isBasic(e){e="string"==typeof e?An(e):e;return"function"==typeof e&&!On.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(xn(e))o.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(T.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return In[e]=t,e!==Cn&&(On.isBasic(t)?T.prototype[e]=En(e,t):T.prototype[e]=Ln(e,t)),t}static deregisterPlugin(e){if(e===Cn)throw new Error("Cannot de-register base plugin.");xn(e)&&(delete In[e],delete T.prototype[e])}static getPlugins(e=Object.keys(In)){let i;return e.forEach(e=>{var t=An(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=An(e);return e&&e.VERSION||""}}function Rn(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||o.warn(n),t=!0,a.apply(this,e)}}}On.getPlugin=An,On.BASE_PLUGIN_NAME=Cn,On.registerPlugin(Cn,On),T.prototype.usingPlugin=function(e){return!!this[kn]&&!0===this[kn][e]},T.prototype.hasPlugin=function(e){return!!xn(e)};let Nn=e=>0===e.indexOf("#")?e.slice(1):e;function E(e,i,s){let r=E.getPlayer(e);if(r)i&&o.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&r.ready(s);else{let t="string"==typeof e?Ye("#"+Nn(e)):e;if(!Ce(t))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in t&&t.getRootNode()instanceof window.ShadowRoot?t.getRootNode():t.ownerDocument.body,e=(t.ownerDocument.defaultView&&e.contains(t)||o.warn("The element supplied is not included in the DOM"),!0===(i=i||{}).restoreEl&&(i.restoreEl=(t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player")?t.parentNode:t).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(t,d(i));!Y(e)||Array.isArray(e)?o.error("please return an object in beforesetup hooks"):i=d(i,e)}),g.getComponent("Player"));r=new e(t,i,s),B("setup").forEach(e=>e(r))}return r}E.hooks_=U,E.hooks=B,E.hook=function(e,t){B(e,t)},E.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{let i=(...e)=>(F(s,i),t(...e));return i}))},E.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&Ee()&&!(e=Ye(".vjs-styles-defaults"))&&(e=at("vjs-styles-defaults"),(Qr=Ye("head"))&&Qr.insertBefore(e,Qr.firstChild),ot(e,` + .video-js { + width: 300px; + height: 150px; + } + + .vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: 56.25% + } + `)),rt(1,E),E.VERSION=M,E.options=T.prototype.options_,E.getPlayers=()=>T.players,E.getPlayer=e=>{var t=T.players;let i;if("string"==typeof e){var s=Nn(e),r=t[s];if(r)return r;i=Ye("#"+s)}else i=e;if(Ce(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},E.getAllPlayers=()=>Object.keys(T.players).map(e=>T.players[e]).filter(Boolean),E.players=T.players,E.getComponent=g.getComponent,E.registerComponent=(e,t)=>(v.isTech(t)&&o.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),g.registerComponent.call(g,e,t)),E.getTech=v.getTech,E.registerTech=v.registerTech,E.use=function(e,t){vs[e]=vs[e]||[],vs[e].push(t)},Object.defineProperty(E,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(E.middleware,"TERMINATOR",{value:Ts,writeable:!1,enumerable:!0}),E.browser=Se,E.obj=ee,E.mergeOptions=Rn(9,"videojs.mergeOptions","videojs.obj.merge",d),E.defineLazyProperty=Rn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Z),E.bind=Rn(9,"videojs.bind","native Function.prototype.bind",p),E.registerPlugin=On.registerPlugin,E.deregisterPlugin=On.deregisterPlugin,E.plugin=(e,t)=>(o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),On.registerPlugin(e,t)),E.getPlugins=On.getPlugins,E.getPlugin=On.getPlugin,E.getPluginVersion=On.getPluginVersion,E.addLanguage=function(e,t){return e=(""+e).toLowerCase(),E.options.languages=d(E.options.languages,{[e]:t}),E.options.languages[e]},E.log=o,E.createLogger=W,E.time=t,E.createTimeRange=Rn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",jt),E.createTimeRanges=Rn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",jt),E.formatTime=Rn(9,"videojs.formatTime","videojs.time.formatTime",Wt),E.setFormatTime=Rn(9,"videojs.setFormatTime","videojs.time.setFormatTime",zt),E.resetFormatTime=Rn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",$t),E.parseUrl=Rn(9,"videojs.parseUrl","videojs.url.parseUrl",mi),E.isCrossOrigin=Rn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",fi),E.EventTarget=wt,E.any=yt,E.on=mt,E.one=ft,E.off=c,E.trigger=gt,E.xhr=Di,E.TextTrack=Bi,E.AudioTrack=Fi,E.VideoTrack=qi,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{E[e]=function(){return o.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),et[e].apply(null,arguments)}}),E.computedStyle=Rn(9,"videojs.computedStyle","videojs.dom.computedStyle",Je),E.dom=et,E.fn=Tt,E.num=zi,E.str=Bt,E.url=_i,E.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"},bi(function(e,t){ +/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */ +e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=t(e);class s{constructor(e){let t=this;t.id=e.id;t.label=t.id;t.width=e.width;t.height=e.height;t.bitrate=e.bandwidth;t.frameRate=e.frameRate;t.enabled_=e.enabled;Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(e){t.enabled_(e)}});return t}}class n extends i["default"].EventTarget{constructor(){super();let e=this;e.levels_=[];e.selectedIndex_=-1;Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}});Object.defineProperty(e,"length",{get(){return e.levels_.length}});e[Symbol.iterator]=()=>e.levels_.values();return e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;t=new s(e);if(!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});this.levels_.push(t);this.trigger({qualityLevel:t,type:"addqualitylevel"});return t}removeQualityLevel(i){let s=null;for(let e=0,t=this.length;ee)this.selectedIndex_--;break}if(s)this.trigger({qualityLevel:i,type:"removequalitylevel"});return s}getQualityLevelById(i){for(let e=0,t=this.length;es;e.qualityLevels.VERSION=a;return s},o=function(e){return r(this,i["default"].obj.merge({},e))};return i["default"].registerPlugin("qualityLevels",o),o.VERSION=a,o}(E)});function Mn(e){return window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")}var Un="https://example.com",Bn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i=/^\/\//.test(e),s=!window.location&&!/\/\//i.test(e),t=(e=new window.URL(e,window.location||Un),new URL(t,e));return s?t.href.slice(Un.length):i?t.href.slice(t.protocol.length):t.href},Yr=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){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1{var e=e.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class zn extends Yr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let a,o;0!==(i=i.trim()).length&&("#"!==i[0]?this.trigger("data",{type:"uri",uri:i}):this.tagMappers.reduce((e,t)=>{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;ee),this.customParsers.push(e=>{if(t.exec(e))return this.trigger("data",{type:"custom",data:s(e),customType:i,segment:r}),!0})}addTagMapper({expression:t,map:i}){this.tagMappers.push(e=>t.test(e)?i(e):e)}}function $n(t){let i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=t[e]}),i}function Wn(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&l&&(o.map=l),!o.key&&d&&(o.key=d),o.timeline||"number"!=typeof c||(o.timeline=c),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(n){let t,i;if(r.manifest.definitions)for(var e in r.manifest.definitions)if(n.uri&&(n.uri=n.uri.replace(`{$${e}}`,r.manifest.definitions[e])),n.attributes)for(var s in n.attributes)"string"==typeof n.attributes[s]&&(n.attributes[s]=n.attributes[s].replace(`{$${e}}`,r.manifest.definitions[e]));({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in n&&((o.byterange=e).length=n.length,"offset"in n||(n.offset=p)),"offset"in n&&((o.byterange=e).offset=n.offset),p=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"})),n.title&&(o.title=n.title),0(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,Wn.call(this,this.manifest))},start(){!n.attributes||isNaN(n.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out"(){o.cueOut=n.data},"cue-out-cont"(){o.cueOutCont=n.data},"cue-in"(){o.cueIn=n.data},skip(){this.manifest.skip=$n(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;var e=this.manifest.segments.length,t=$n(n.attributes),t=(o.parts=o.parts||[],o.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=m),m=t.byterange.offset+t.byterange.length),o.parts.length-1);this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){var e=this.manifest.serverControl=$n(n.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wn.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"(){var t=this.manifest.segments.length,i=$n(n.attributes),e=i.type&&"PART"===i.type,s=(o.preloadHints=o.preloadHints||[],o.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e?m:0,e&&(m=i.byterange.offset+i.byterange.length)),o.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #`+t,n.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===t.id);this.manifest.dateRanges[e]=f(this.manifest.dateRanges[e],t),g[t.id]=f(g[t.id],t),this.manifest.dateRanges.pop()}else g[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=$n(n.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",n.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};var e,t=(e,t)=>{e in this.manifest.definitions?this.trigger("error",{message:"EXT-X-DEFINE: Duplicate name "+e}):this.manifest.definitions[e]=t};return"QUERYPARAM"in n.attributes?"NAME"in n.attributes||"IMPORT"in n.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):(e=this.params.get(n.attributes.QUERYPARAM))?void t(n.attributes.QUERYPARAM,decodeURIComponent(e)):void this.trigger("error",{message:"EXT-X-DEFINE: No query param "+n.attributes.QUERYPARAM}):"NAME"in n.attributes?"IMPORT"in n.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in n.attributes&&"string"==typeof n.attributes.VALUE?void t(n.attributes.NAME,n.attributes.VALUE):void this.trigger("error",{message:"EXT-X-DEFINE: No value for "+n.attributes.NAME}):"IMPORT"in n.attributes?this.mainDefinitions[n.attributes.IMPORT]?void t(n.attributes.IMPORT,this.mainDefinitions[n.attributes.IMPORT]):void this.trigger("error",{message:`EXT-X-DEFINE: No value ${n.attributes.IMPORT} to import, or IMPORT used on main playlist`}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:n.attributes,uri:n.uri,timeline:c}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",n.attributes,["BANDWIDTH","URI"])}}[n.tagType]||function(){}).call(r)},uri(){o.uri=n.uri,a.push(o),!this.manifest.targetDuration||"duration"in o||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),d&&(o.key=d),o.timeline=c,l&&(o.map=l),m=0,null!==this.lastProgramDateTime&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*o.duration),o={}},comment(){},custom(){n.segment?(o.custom=o.custom||{},o.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(r)})}requiredCompatibilityversion(e,t){(e=e.length&&t.call(e,function(e,t){return e===(n[t]?n[t]&i[r+t]:i[r+t])})},fa=function(r,e,n){e.forEach(function(e){for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var s=r.mediaGroups[e][t][i];n(s,e,t,i)}})};function ya(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var _a=ya({HTML:"text/html",isHTML:function(e){return e===_a.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),va=ya({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===va.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),ba={assign:function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},find:function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function Fa(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(Fa(e,t))return 1}while(e=e.nextSibling)}function qa(){this.ownerDocument=this}function ja(e,t,i){e&&e._inc++,i.namespaceURI===Sa.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Ha(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function Va(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ha(e.ownerDocument,e),t}function za(e){return e&&e.nodeType===A.DOCUMENT_TYPE_NODE}function $a(e){return e&&e.nodeType===A.ELEMENT_NODE}function Wa(e){return e&&e.nodeType===A.TEXT_NODE}function Ga(e,t){var i,e=e.childNodes||[];if(!Ta(e,$a)&&!za(t))return i=Ta(e,za),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Xa(e,t){var i,e=e.childNodes||[];if(!Ta(e,function(e){return $a(e)&&e!==t}))return i=Ta(e,za),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Ka(e,t,i){if(!(s=e)||s.nodeType!==A.DOCUMENT_NODE&&s.nodeType!==A.DOCUMENT_FRAGMENT_NODE&&s.nodeType!==A.ELEMENT_NODE)throw new x(xa,"Unexpected parent node type "+e.nodeType);var s;if(i&&i.parentNode!==e)throw new x(Aa,"child not in parent");if(!(s=t)||!($a(s)||Wa(s)||za(s)||s.nodeType===A.DOCUMENT_FRAGMENT_NODE||s.nodeType===A.COMMENT_NODE||s.nodeType===A.PROCESSING_INSTRUCTION_NODE)||za(t)&&e.nodeType!==A.DOCUMENT_NODE)throw new x(xa,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Ya(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===A.DOCUMENT_FRAGMENT_NODE){var n=r.filter($a);if(1"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):fo(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)fo(o,t,i,s,r.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case 9:case 11:for(o=e.firstChild;o;)fo(o,t,i,s,r.slice()),o=o.nextSibling;return;case 2:return go(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,Ba));case 4:return t.push("");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function yo(e,t,i){e[t]=i}r.INVALID_STATE_ERR=(I[11]="Invalid state",11),r.SYNTAX_ERR=(I[12]="Syntax error",12),r.INVALID_MODIFICATION_ERR=(I[13]="Invalid modification",13),r.NAMESPACE_ERR=(I[14]="Invalid namespace",14),r.INVALID_ACCESS_ERR=(I[15]="Invalid access",15),x.prototype=Error.prototype,ka(r,x),Da.prototype={length:0,item:function(e){return 0<=e&&e",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES}),vo=(_o.XML_ENTITIES,ba.NAMESPACE),tn=/[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]/,en=new RegExp("[\\-\\.0-9"+tn.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),bo=new RegExp("^"+tn.source+en.source+"*(?::"+tn.source+en.source+"*)?$"),To=0,So=1,wo=2,Eo=3,Co=4,ko=5,Io=6,xo=7;function Ao(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ao)}function Do(){}function Po(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Lo(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value,o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&"");a.localName=u,!1!==o&&(null==r&&(r={},Oo(i,i={})),i[o]=r[o]=l,a.uri=vo.XMLNS,t.startPrefixMapping(o,l))}for(var d,n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=vo.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function Oo(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Ro(){this.attributeNames={}}(Ao.prototype=new Error).name=Ao.name,Do.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Oo(t,t={}),function(i,e,s,r,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(s,t)?s[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function t(e){var t;m",y+3),v=i.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=i.substring(y+2).replace(/[\s<].*/,""),n.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s",t);if(s){e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e)return e[0].length,i.processingInstruction(e[1],e[2]),s+2}return-1}(i,y,r);break;case"!":u&&o(y),_=function(e,t,i,s){{if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4),t",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),n=s.length;if(1":switch(d){case To:s.setTagName(e.slice(t,l));case ko:case Io:case xo:break;case Co:case So:"/"===(u=e.slice(t,l)).slice(-1)&&(s.closed=!0,u=u.slice(0,-1));case wo:d===wo&&(u=o),d==Co?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(vo.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case Eo:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(d){case To:s.setTagName(e.slice(t,l)),d=Io;break;case So:o=e.slice(t,l),d=wo;break;case Co:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case ko:d=Io}else switch(d){case wo:s.tagName,vo.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=So;break;case ko:n.warning('attribute space is required"'+o+'"!!');case Io:d=So,t=l;break;case Eo:d=Co,t=l;break;case xo:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(i,y,E,C,a,n),k=E.length;if(!E.closed&&function(e,t,i,s){var r=s[i];null==r&&((r=e.lastIndexOf(""))",t),e=e.substring(t+1,n);if(/[&<]/.test(e))return/^script$/i.test(i)?r.characters(e,0,e.length):(e=e.replace(/&#?\w+;/g,s),r.characters(e,0,e.length)),n}return t+1}(i,_,E.tagName,a,r):_++}}catch(e){if(e instanceof Ao)throw e;n.error("element parse error: "+e),_=-1}m<_?m=_:t(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},Ro.prototype={setTagName:function(e){if(!bo.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!bo.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Zr={XMLReader:Do,ParseError:Ao},No=Kr.DOMImplementation,Mo=ba.NAMESPACE,Uo=Zr.ParseError,Bo=Zr.XMLReader;function Fo(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function qo(e){this.options=e||{locator:{}}}function jo(){this.cdata=!1}function Ho(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Vo(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function zo(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function $o(e,t){(e.currentElement||e.doc).appendChild(t)}qo.prototype.parseFromString=function(e,t){var i=this.options,s=new Bo,r=i.domBuilder||new jo,n=i.errorHandler,a=i.locator,o=i.xmlns||{},t=/\/x?html?$/.test(t),l=t?_o.HTML_ENTITIES:_o.XML_ENTITIES,n=(a&&r.setDocumentLocator(a),s.errorHandler=function(s,e,r){if(!s){if(e instanceof jo)return e;s=e}var n={},a=s instanceof Function;function t(t){var i=s[t];!i&&a&&(i=2==s.length?function(e){s(t,e)}:s),n[t]=i?function(e){i("[xmldom "+t+"]\t"+e+Vo(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),n}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=Mo.HTML),o.xml=o.xml||Mo.XML,i.normalizeLineEndings||Fo);return e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},jo.prototype={startDocument:function(){this.doc=(new No).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;$o(this,n),this.currentElement=n,this.locator&&Ho(this.locator,n);for(var o=0;o!!e&&"object"==typeof e,D=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):Go(t[e])&&Go(i[e])?t[e]=D(t[e],i[e]):t[e]=i[e]}),t),{}),Xo=t=>Object.keys(t).map(e=>t[e]),Ko=(t,i)=>{var s=[];for(let e=t;ee.reduce((e,t)=>e.concat(t),[]),Qo=t=>{if(!t.length)return[];var i=[];for(let e=0;ee.reduce((e,t,i)=>(t[s]&&e.push(i),e),[]),Zo=(e,i)=>Xo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{}));var el={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};let tl=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:Bn(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t},sl=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),rl={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=sl(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=sl(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},nl=n=>e=>{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}},al=e=>{var{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=rl[t](e),a=Ko(a,o).map(nl(e));return"static"===t&&(a[o=a.length-1].duration=("number"==typeof r?r:n)-i/s*o),a},ol=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=tl({baseUrl:t,source:i.sourceURL,range:i.range}),(t=tl({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=al(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(el.NO_BASE_URL)},ll=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;tZo(e,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),cl=(t,i)=>{for(let e=0;e{let r=[];return fa(e,dl,(e,t,i,s)=>{r=r.concat(e.playlists||[])}),r},ml=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},gl=({oldPlaylists:t,newPlaylists:e,timelineStarts:r})=>{e.forEach(i=>{i.discontinuitySequence=r.findIndex(function({timeline:e}){return e===i.timeline});var e=cl(t,i.attributes.NAME);if(e&&!i.sidx){let t=i.segments[0];var s=e.segments.findIndex(function(e){return Math.abs(e.presentationTime-t.presentationTime)e.timeline||e.segments.length&&i.timeline>e.segments[e.segments.length-1].timeline)&&i.discontinuitySequence--):(e.segments[s].discontinuity&&!t.discontinuity&&(t.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),ml({playlist:i,mediaSequence:e.segments[s].number}))}})},fl=({oldManifest:e,newManifest:t})=>{var i=e.playlists.concat(pl(e)),s=t.playlists.concat(pl(t));return t.timelineStarts=ul([e.timelineStarts,t.timelineStarts]),gl({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t},yl=e=>e&&e.uri+"-"+il(e.byterange),_l=e=>{e=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{});let t=[];return Object.values(e).forEach(e=>{e=Xo(e.reduce((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));t=t.concat(e)}),t.map(e=>(e.discontinuityStarts=Jo(e.segments||[],"discontinuity"),e))},vl=(e,t)=>{var i=yl(e.sidx),t=i&&t[i]&&t[i].sidx;return t&&ll(e,t,e.sidx.resolvedUri),e},bl=(e,t={})=>{if(Object.keys(t).length)for(var i in e)e[i]=vl(e[i],t);return e},Tl=({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r},Sl=({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{"undefined"==typeof t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);var n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},n=(e.codecs&&(n.CODECS=e.codecs),{attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t});return e.serviceLocation&&(n.attributes.serviceLocation=e.serviceLocation),n},wl=(e,n={},a=!1)=>{let o;e=e.reduce((e,t)=>{var i=t.attributes.role&&t.attributes.role.value||"",s=t.attributes.lang||"";let r=t.attributes.label||"main";e[r=s&&!t.attributes.label?t.attributes.lang+(i?` (${i})`:""):r]||(e[r]={language:s,autoselect:!0,default:"main"===i,playlists:[],uri:""});s=vl(Tl(t,a),n);return e[r].playlists.push(s),"undefined"==typeof o&&"main"===i&&((o=t).default=!0),e},{});return o||(e[Object.keys(e)[0]].default=!0),e},El=(e,r={})=>e.reduce((e,t)=>{var i=t.attributes.label||t.attributes.lang||"text",s=t.attributes.lang||"und";return e[i]||(e[i]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(vl(Sl(t),r)),e},{}),Cl=e=>e.reduce((s,e)=>(e&&e.forEach(e=>{var{channel:t,language:i}=e;s[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(s[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(s[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(s[i]["3D"]=e["3D"])}),s),{}),kl=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},Il=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,xl=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Al=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,Dl=(e,i)=>{e.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=i.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((e,t)=>{e.number=t})})},Pl=i=>i?Object.keys(i).reduce((e,t)=>{t=i[t];return e.concat(t.playlists)},[]):[],Ll=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a,o,l,d,h,u,c;return e.length?({sourceDuration:d,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=e[0].attributes,a=_l(e.filter(Il)).map(kl),o=_l(e.filter(xl)),l=_l(e.filter(Al)),e=e.map(e=>e.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:d,playlists:bl(a,s)},0<=h&&(d.minimumUpdatePeriod=1e3*h),t&&(d.locations=t),i&&(d.contentSteering=i),"dynamic"===u&&(d.suggestedPresentationDelay=c),n&&0e),d.timelineStarts=ul(c),Dl(u,d.timelineStarts),t&&(d.mediaGroups.AUDIO.audio=t),i&&(d.mediaGroups.SUBTITLES.subs=i),e.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=Cl(e)),r?fl({oldManifest:r,newManifest:d}):d):{}},Ol=(e,t,i)=>{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)},Rl=(s,r)=>{var{type:n,minimumUpdatePeriod:a=0,media:o="",sourceDuration:l,timescale:d=1,startNumber:h=1,periodStart:u}=s,c=[];let p=-1;for(let i=0;ip&&(p=m);let e;e=f<0?(m=i+1)===r.length?"dynamic"===n&&0(e,t,i,s)=>{return"$$"===e?"$":"undefined"==typeof r[t]?e:(e=""+r[t],"RepresentationID"===t||(s=i?parseInt(s,10):1)<=e.length?e:new Array(s-e.length+1).join("0")+e)},Ul=(e,t)=>e.replace(Nl,Ml(t)),Bl=(e,t)=>e.duration||t?e.duration?al(e):Rl(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}],Fl=(s,e)=>{let r={RepresentationID:s.id,Bandwidth:s.bandwidth||0};var{initialization:t={sourceURL:"",range:""}}=s;let n=tl({baseUrl:s.baseUrl,source:Ul(t.sourceURL,r),range:t.range});return Bl(s,e).map(e=>{r.Number=e.number,r.Time=e.time;var t=Ul(s.media||"",r),i=s.timescale||1,i=s.periodStart+(e.time-(s.presentationTimeOffset||0))/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:Bn(s.baseUrl||"",t),map:n,number:e.number,presentationTime:i}})},ql=(e,t)=>{var{baseUrl:e,initialization:i={}}=e,i=tl({baseUrl:e,source:i.sourceURL,range:i.range}),e=tl({baseUrl:e,source:t.media,range:t.mediaRange});return e.map=i,e},jl=(r,e)=>{let{duration:t,segmentUrls:i=[],periodStart:n}=r;if(!t&&!e||t&&e)throw new Error(el.SEGMENT_TIME_UNSPECIFIED);let a=i.map(e=>ql(r,e)),s;return t&&(s=al(r)),(s=e?Rl(r,e):s).map((e,t)=>{var i,s;if(a[t])return t=a[t],i=r.timescale||1,s=r.presentationTimeOffset||0,t.timeline=e.timeline,t.duration=e.duration,t.number=e.number,t.presentationTime=n+(e.time-s)/i,t}).filter(e=>e)},Hl=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Fl,i=D(e,t.template)):t.base?(s=ol,i=D(e,t.base)):t.list&&(s=jl,i=D(e,t.list));var r,n,a,e={attributes:e};return s&&(r=s(i,t.segmentTimeline),i.duration?({duration:n,timescale:a=1}=i,i.duration=n/a):r.length?i.duration=r.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},Vl=e=>e.map(Hl),P=(e,t)=>Qo(e.childNodes).filter(({tagName:e})=>e===t),zl=e=>e.textContent.trim(),$l=e=>{var t,i,s,r,n,e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);return e?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},Wl={mediaPresentationDuration(e){return $l(e)},availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod(e){return $l(e)},suggestedPresentationDelay(e){return $l(e)},type(e){return e},timeShiftBufferDepth(e){return $l(e)},start(e){return $l(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return parseFloat(e.split("/").reduce((e,t)=>e/t))},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){var t=parseInt(e,10);return isNaN(t)?$l(e):t},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},DEFAULT(e){return e}},L=e=>e&&e.attributes?Qo(e.attributes).reduce((e,t)=>{var i=Wl[t.name]||Wl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},Gl={"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"},Xl=(e,t)=>t.length?Yo(e.map(function(s){return t.map(function(e){var t=zl(e),i=Bn(s.baseUrl,t),e=D(L(e),{baseUrl:i});return i!==t&&!e.serviceLocation&&s.serviceLocation&&(e.serviceLocation=s.serviceLocation),e})})):e,Kl=e=>{var t=P(e,"SegmentTemplate")[0],i=P(e,"SegmentList")[0],s=i&&P(i,"SegmentURL").map(e=>D({tag:"SegmentURL"},L(e))),e=P(e,"SegmentBase")[0],r=i||t,r=r&&P(r,"SegmentTimeline")[0],n=i||e||t,n=n&&P(n,"Initialization")[0],t=t&&L(t);t&&n?t.initialization=n&&L(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});let a={template:t,segmentTimeline:r&&P(r,"S").map(e=>L(e)),list:i&&D(L(i),{segmentUrls:s,initialization:L(n)}),base:e&&D(L(e),{initialization:L(n)})};return Object.keys(a).forEach(e=>{a[e]||delete a[e]}),a},Yl=(r,n,a)=>e=>{var t=P(e,"BaseURL"),t=Xl(n,t);let i=D(r,L(e)),s=Kl(e);return t.map(e=>({segmentInfo:D(a,s),attributes:D(i,e)}))},Ql=e=>e.reduce((e,t)=>{var i=L(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),Gl[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=P(t,"cenc:pssh")[0])&&(t=zl(i),e[s].pssh=t&&Fn(t)),e},{}),Jl=e=>{return"urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var t,s;return/=/.test(e)?([t,s=""]=e.split("="),i.channel=t,i.language=e,s.split(",").forEach(e=>{var[e,t]=e.split(":");"lang"===e?i.language=t:"er"===e?i.easyReader=Number(t):"war"===e?i.aspectRatio=Number(t):"3D"===e&&(i["3D"]=Number(t))})):i.language=e,i.channel&&(i.channel="SERVICE"+i.channel),i}):void 0},Zl=o=>Yo(P(o.node,"EventStream").map(e=>{let n=L(e),a=n.schemeIdUri;return P(e,"Event").map(e=>{var t=L(e),i=t.presentationTime||0,s=n.timescale||1,r=t.duration||0,i=i/s+o.attributes.start;return{schemeIdUri:a,value:n.value,id:t.id,start:i,end:i+r/s,messageData:zl(e)||t.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})})),ed=(n,a,o)=>e=>{var t=L(e),i=Xl(a,P(e,"BaseURL")),s=P(e,"Role")[0],s={role:L(s)};let r=D(n,t,s);t=P(e,"Accessibility")[0],s=Jl(L(t)),s&&(r=D(r,{captionServices:s})),t=P(e,"Label")[0],t&&t.childNodes.length&&(s=t.childNodes[0].nodeValue.trim(),r=D(r,{label:s})),t=Ql(P(e,"ContentProtection")),Object.keys(t).length&&(r=D(r,{contentProtection:t})),s=Kl(e),t=P(e,"Representation"),e=D(o,s);return Yo(t.map(Yl(r,i,e)))},td=(n,a)=>(e,t)=>{var i=Xl(a,P(e.node,"BaseURL")),s=D(n,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration),P(e.node,"AdaptationSet")),e=Kl(e.node);return Yo(r.map(ed(s,i,e)))},id=(e,t)=>{return 1"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0,rd=(e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=t,n=P(e,"Period");if(!n.length)throw new Error(el.INVALID_NUMBER_OF_PERIOD);var a=P(e,"Location");let o=L(e);t=Xl([{baseUrl:t}],P(e,"BaseURL")),e=P(e,"ContentSteering");o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,a.length&&(o.locations=a.map(zl));let l=[];return n.forEach((e,t)=>{var i=L(e),t=l[t-1];i.start=sd({attributes:i,priorPeriodAttributes:t?t.attributes:null,mpdType:o.type}),l.push({node:e,attributes:i})}),{locations:o.locations,contentSteeringInfo:id(e,r),representationInfo:Yo(l.map(td(o,t))),eventStream:Yo(l.map(Zl))}},nd=e=>{if(""===e)throw new Error(el.DASH_EMPTY_MANIFEST);var t,i=new Wo;let s;try{t=i.parseFromString(e,"application/xml"),s=t&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0(e=>{e=P(e,"UTCTiming")[0];if(!e)return null;var t=L(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(el.UNSUPPORTED_UTC_TIMING_SCHEME)}return t})(nd(e));function od(e,t){var i,s,r;return void 0===t&&(t=0),(e=w(e)).length-t<10||!k(e,md,{offset:t})?t:(t+=(void 0===(s=t)&&(s=0),r=(i=w(i=e))[s+5],i=i[s+6]<<21|i[s+7]<<14|i[s+8]<<7|i[s+9],(16&r)>>4?20+i:10+i),od(e,t))}function ld(e,t,i){var s;return i>=t.length?t.length:(s=Td(t,i,!1),k(e.bytes,s.bytes)?i:ld(e,t,i+(e=Td(t,i+s.length)).length+e.value+s.length))}function dd(e,t){i=t,t=Array.isArray(i)?i.map(function(e){return Sd(e)}):[Sd(i)],e=w(e);var i,s=[];if(t.length)for(var r=0;re.length?e.length:o+a.value),o=e.subarray(o,l);k(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(dd(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function hd(e,t,i,s){void 0===s&&(s=1/0),e=w(e),i=[].concat(i);for(var r,n=0,a=0;n>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}var ud=Math.pow(2,32),cd=function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i},md=w([73,68,51]),gd=function(e){return"string"==typeof e?ga(e):e},fd=function(e){return Array.isArray(e)?e.map(function(e){return gd(e)}):[gd(e)]},yd=function e(t,i,s){void 0===s&&(s=!1),i=fd(i),t=w(t);var r=[];if(i.length)for(var n=0;n>>0,o=t.subarray(n+4,n+8);if(0==a)break;a=n+a;if(a>t.length){if(s)break;a=t.length}var l=t.subarray(n+8,a);k(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),s))),n=a}return r},_d={EBML:w([26,69,223,163]),DocType:w([66,130]),Segment:w([24,83,128,103]),SegmentInfo:w([21,73,169,102]),Tracks:w([22,84,174,107]),Track:w([174]),TrackNumber:w([215]),DefaultDuration:w([35,227,131]),TrackEntry:w([174]),TrackType:w([131]),FlagDefault:w([136]),CodecID:w([134]),CodecPrivate:w([99,162]),VideoTrack:w([224]),AudioTrack:w([225]),Cluster:w([31,67,182,117]),Timestamp:w([231]),TimestampScale:w([42,215,177]),BlockGroup:w([160]),BlockDuration:w([155]),Block:w([161]),SimpleBlock:w([163])},vd=[128,64,32,16,8,4,2,1],bd=function(e){for(var t=1,i=0;it&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Md=e=>E.log.debug?E.log.debug.bind(E,"VHS:",e+" >"):function(){};function O(...e){var t=E.obj||E;return(t.merge||t.mergeOptions).apply(t,e)}function Ud(...e){var t=E.time||E;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function Bd(e,i){return Wd(e,function(e,t){return e-$d<=i&&t+$d>=i})}function Fd(e,t){return Wd(e,function(e){return e-zd>=t})}function qd(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function jd(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},Xd=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Yd=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Qd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},Jd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},Zd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function nh(e){return e.excludeUntil&&e.excludeUntil===1/0}function ah(e){var t=rh(e);return!e.disabled&&!t}function oh(e,t){return t.attributes&&t.attributes[e]}function lh(e,t){var i,s=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let r=!1;for(i in s){for(var n in s[i])if(r=t(s[i][n]))break;if(r)break}return!!r}let dh=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!ah(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)),uh=i=>{if(!i||!i.playlists||!i.playlists.length)return lh(i,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;eXn(e))){s=lh(i,e=>hh(t,e));if(!s)return!1}}return!0};var ch={liveEdgeDelay:Zd,duration:sh,seekable:function(e,t,i){var s=t||0;let r=Vd(e,t,!0,i);return null===r?Ud():Ud(s,r=rzd),m=0===o,p=p&&0<=o+zd;if(!m&&!p||e===l.length-1){if(a){if(0e+"-"+t,gh=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i,fh=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var s=r.mediaGroups[e][t][i];n(s,e,t,i)}})},yh=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},_h=(o,e,l=gh)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{let t=e.playlists.length;for(;t--;){var i=e.playlists[t];yh({playlist:i,id:mh(t,i.uri)}),i.resolvedUri=Rd(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||ph.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(o),s=o,fh(s,e=>{e.uri&&(e.resolvedUri=Rd(s.uri,e.uri))})};class vh{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,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 i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(var e of s){var t=i[e.class]||[];e.endDate?e.endTime=e.endDate.getTime()/1e3-this.offset_:e.endOnNext&&t[e.classListIndex+1]?e.endTime=t[e.classListIndex+1].startTime:e.duration?e.endTime=e.startTime+e.duration:e.plannedDuration?e.endTime=e.startTime+e.plannedDuration:e.endTime=e.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){var r=t.status<200||299{if(!t)return i;var s=O(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=Rd(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Rd(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Rd(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Rd(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rd(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rd(t,e.uri))})},Eh=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ch=(e,r,t=Eh)=>{var i=O(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=Th(r);let n=O(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{wh(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)},Ih=(e,t,i)=>{if(e){let r=[];return e.forEach(e=>{var t,i,s;e.attributes&&({BANDWIDTH:t,RESOLUTION:i,CODECS:s}=e.attributes,r.push({id:e.id,bandwidth:t,resolution:i,codecs:s}))}),{type:t,isLive:i,renditions:r}}};class xh extends Jr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Md("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new vh,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=Rd(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){let i={};if(t.serverControl.canBlockReload){var s,r=t.preloadSegment;let e=t.mediaSequence+t.segments.length;r&&(r=r.parts||[],-1<(s=Jd(t)-1)&&s!=r.length-1&&(i._HLS_part=s),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2,metadata:bh({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:t,manifestString:e}){try{return(({onwarn:t,oninfo:e,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{let a=new Gn,o=(t&&a.on("warn",t),e&&a.on("info",e),s.forEach(e=>a.addParser(e)),r.forEach(e=>a.addTagMapper(e)),a.push(i),a.end(),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(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!o.targetDuration){let e=10;o.segments&&o.segments.length&&(e=o.segments.reduce((e,t)=>Math.max(e,t.duration),0)),t&&t({message:"manifest has no targetDuration defaulting to "+e}),o.targetDuration=e}e=Qd(o);return e.length&&!o.partTargetDuration&&(s=e.reduce((e,t)=>Math.max(e,t.duration),0),t&&(t({message:"manifest has no partTargetDuration defaulting to "+s}),ph.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=s),o})({onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:e,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(e){this.error=e,this.error.metadata={errorType:E.Error.StreamingHlsPlaylistParserError,error:e}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";var r={playlistInfo:{type:"media",uri:i}},t=(this.trigger({type:"playlistparsestart",metadata:r}),t||this.parseManifest_({url:i,manifestString:e})),e=(t.lastRequest=Date.now(),yh({playlist:t,uri:i,id:s}),Ch(this.main,t));this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(kh(this.media(),!!e)),r.parsedPlaylist=Ih(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new vh,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(r,e){if(!r)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof r){if(!this.main.playlists[r])throw new Error("Unknown playlist URI: "+r);r=this.main.playlists[r]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(r.partTargetDuration||r.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,r,!1),e);else{let s=this.state;var e=!this.media_||r.id!==this.media_.id,t=this.main.playlists[r.id];if(t&&t.endList||r.endList&&r.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=r,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(kh(r,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(r.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging");let i={playlistInfo:{type:"media",uri:(this.pendingMedia_=r).uri}};this.trigger({type:"playlistrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:r.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(r.lastRequest=Date.now(),r.resolvedUri=Nd(r.resolvedUri,t),e)return this.playlistRequestError(this.request,r,s);this.trigger({type:"playlistrequestcomplete",metadata:i}),this.haveMetadata({playlistString:t.responseText,url:r.uri,id:r.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.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&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.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=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);else{let i={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2,metadata:bh({requestType:t.requestType,request:t,error:e})},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:i}),this.src=Nd(this.src,t),this.trigger({type:"playlistparsestart",metadata:i});e=this.parseManifest_({manifestString:t.responseText,url:this.src});i.parsedPlaylist=Ih(e.playlists,i.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:i}),this.setupInitialPlaylist(e)}})}}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,_h(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=Th(t),t.segments.forEach(e=>{wh(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=mh(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}updateOrDeleteClone(e,t){var i=this.main,s=e.ID;let r=i.playlists.length;for(;r--;){var n,a,o,l,d,h=i.playlists[r];h.attributes["PATHWAY-ID"]===s&&(n=h.resolvedUri,a=h.id,t?(o=this.createCloneURI_(h.resolvedUri,e),l=mh(s,o),d=this.createCloneAttributes_(s,h.attributes),h=this.createClonePlaylist_(h,l,e,d),i.playlists[r]=h,i.playlists[l]=h,i.playlists[o]=h):i.playlists.splice(r,1),delete i.playlists[a],delete i.playlists[n])}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let s=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{if(s.mediaGroups[e]&&s.mediaGroups[e][r])for(var t in s.mediaGroups[e])if(t===r){for(var i in s.mediaGroups[e][t])s.mediaGroups[e][t][i].playlists.forEach((e,t)=>{var e=s.playlists[e.id],i=e.id,e=e.resolvedUri;delete s.playlists[i],delete s.playlists[e]});delete s.mediaGroups[e][t]}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){var i=this.main,s=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),n=mh(e.ID,r),a=this.createCloneAttributes_(e.ID,t.attributes),t=this.createClonePlaylist_(t,n,e,a);i.playlists[s]=t,i.playlists[n]=t,i.playlists[r]=t,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(l){let d=l.ID,s=l["BASE-ID"],h=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{if(h.mediaGroups[o]&&!h.mediaGroups[o][d])for(var e in h.mediaGroups[o])if(e===s){h.mediaGroups[o][d]={};for(let a in h.mediaGroups[o][e]){var t=h.mediaGroups[o][e][a];h.mediaGroups[o][d][a]=f({},t);let n=h.mediaGroups[o][d][a];var i=this.createCloneURI_(t.resolvedUri,l);n.resolvedUri=i,n.uri=i,n.playlists=[],t.playlists.forEach((e,t)=>{var i,s=h.playlists[e.id],r=gh(o,d,a),r=mh(d,r);s&&!h.playlists[r]&&(i=(s=this.createClonePlaylist_(s,r,l)).resolvedUri,h.playlists[r]=s,h.playlists[i]=s),n.playlists[t]=this.createClonePlaylist_(e,r,l)})}}})}createClonePlaylist_(e,t,i,s){i=this.createCloneURI_(e.resolvedUri,i),i={resolvedUri:i,uri:i,id:t};return e.segments&&(i.segments=[]),s&&(i.attributes=s),O(e,i)}createCloneURI_(e,t){var i,s=new URL(e),r=(s.hostname=t["URI-REPLACEMENT"].HOST,t["URI-REPLACEMENT"].PARAMS);for(i of Object.keys(r))s.searchParams.set(i,r[i]);return s.href}createCloneAttributes_(t,i){let s={"PATHWAY-ID":t};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]&&(s[e]=t)}),s}getKeyIdSet(e){if(e.contentProtection){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes.keyId;s&&i.add(s.toLowerCase())}return i}}}function Ah(e,t,i,s){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),s(t=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))),e)}function Dh(){function d(e,a){e=O({timeout:45e3},e);var t=d.beforeRequest||E.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||E.Vhs.xhr._requestCallbackSet||new Set;let o=d._responseCallbackSet||E.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(E.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=(!0===E.Vhs.xhr.original?E:E.Vhs).xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);let l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),Ah(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestType=e.requestType,l.requestTime=Date.now(),l}return d.original=!0,d}function Ph(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Lh(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Oh(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Rh(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Nh(e){return e.resolvedUri}let Mh=function(i){let s={};return Object.keys(i).forEach(e=>{var t=i[e];ua(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s},Uh=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;eUh(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,qh=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*Bh)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},jh=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{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(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:ch.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{jh({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},Hh=(e,t)=>{if(4===e.readyState)return t()},Vh=(e,t,r,s)=>{function n(e,t,i,s){return t.abort(),l=!0,r(e,t,i,s)}function i(e,t){var i;if(!l)return e?(e.metadata=bh({requestType:s,request:t,error:e}),n(e,t,"",a)):(i=t.responseText.substring(a&&a.byteLength||0,t.responseText.length),a=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;nn(e,t,"",a)):n(null,t,i,a))}let a=[],o,l=!1;let d=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return Ah(e,null,{statusCode:e.status},i)})}},function(e,t){return Ah(d,e,t,i)});return d};e=E.EventTarget;function zh(t,i){if(!Eh(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Wh=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=rd(nd(e),i),s=Vl(e.representationInfo);r=Ll({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return _h(r,t,$h),r},Gh=(e,t,i)=>{let a=!0,o=O(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=Ch(o,e.playlists[0],zh))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,fh(n,(e,t,i,s)=>{l.mediaGroups[t][i]&&s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Xh=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(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},Kh=(e,t)=>{var i,s={};for(i in e){var r=e[i].sidx;if(r){var n=yl(r);if(!t[n])break;var a=t[n].sidxInfo;Xh(a,r)&&(s[n]=t[n])}}return s};class Yh extends e{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Md("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_(l,r,n){let d=l.sidx&&yl(l.sidx);if(l.sidx&&d&&!this.mainPlaylistLoader_.sidxMapping_[d]){let a=Nd(l.sidx.resolvedUri),o=(t,i)=>{if(!this.requestErrored_(t,i,r)){var t=this.mainPlaylistLoader_.sidxMapping_,s=i.requestType;let e;try{e=pd(w(i.response).subarray(8))}catch(e){return e.metadata=bh({requestType:s,request:i,parseFailure:!0}),void this.requestErrored_(e,i,r)}return t[d]={sidxInfo:l.sidx,sidx:e},ll(l,e,l.sidx.resolvedUri),n(!0)}};this.request=Vh(a,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?o(e,t):i&&"mp4"===i?({offset:r,length:n}=l.sidx.byterange,s.length>=n+r?o(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ph({byterange:l.sidx.byterange})},o))):(e=i||"unknown",o({status:t.status,message:`Unsupported ${e} container type for sidx segment at URL: `+a,response:"",playlist:l,internal:!0,playlistExclusionDuration:1/0,code:2},t))},"dash-sidx")}else this.mediaRequest_=window.setTimeout(()=>n(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.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(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);let i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}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(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){let r={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:r}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(e,t)=>{var i;if(e&&(i=t.requestType,e.metadata=bh({requestType:i,request:t,error:e})),this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{this.trigger({type:"manifestrequestcomplete",metadata:r});let e=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Nd(this.mainPlaylistLoader_.srcUrl,t),!e)return s(t,e);this.handleMain_(),this.syncClientServerClock_(()=>s(t,e))}})}syncClientServerClock_(r){let n=ad(this.mainPlaylistLoader_.mainXml_);return null===n?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),r()):"DIRECT"===n.method?(this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),r()):void(this.request=this.vhs_.xhr({uri:Rd(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(t,i)=>{if(this.request){var s;if(t)return s=i.requestType,this.error.metadata=bh({requestType:s,request:i,error:t}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),r();let e;e="HEAD"===n.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),r()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let s;try{s=Wh({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(e){this.error=e,this.error.metadata={errorType:E.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}e&&(s=Gh(e,s,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=s||e;var r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||s&&s.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(s),s){var{duration:r,endList:e}=s;let t=[];s.playlists.forEach(e=>{t.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})});r={duration:r,isLive:!e,renditions:t};i.parsedManifest=r,this.trigger({type:"manifestparsecomplete",metadata:i})}return Boolean(s)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;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`):this.createMUPTimeout_(t)}createMUPTimeout_(e){let t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.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_=((e,r)=>{let n=Kh(e.playlists,r);return fh(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=O(n,Kh(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;let 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=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),e()},kh(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(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){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes["cenc:default_KID"];s&&i.add(s.replace(/-/g,"").toLowerCase())}return i}}}var R={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};function Qh(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}let Jh=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=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),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),q(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},q=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=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 l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.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]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},pe=function(e){return l(d.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]),U(e))},$=function(e){e=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 l(d.tkhd,e)},J=function(e){var t,i=l(d.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/be),r=Math.floor(e.baseMediaDecodeTime%be),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=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&&(t[t.length-1]=0),l(d.trex,t)},me=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,(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]},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=me(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},fe=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=me(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?fe:ge)(e,t)};function Te(e,t){var i=Ae();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}function s(e){for(var t=[];e--;)t.push(0);return t}function r(e){e=e||{},r.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new p(0,0),new p(0,1),new p(1,0),new p(1,1)],this.parse708captions_&&(this.cc708Stream_=new c({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function Se(e){return 32<=e&&e<=127||160<=e&&e<=255}function n(e){this.windowNum=e,this.reset()}function we(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new n(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Ee(e){return null===e?"":(e=je[e]||e,String.fromCharCode(e))}function a(){for(var e=[],t=He+1;t--;)e.push({text:"",indent:0,offset:0});return e}function Ce(e,t){var i=1;for(tGe;)e+=i*We;return e}function ke(e){var t,i;ke.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"metadata"===e.type?this.trigger("data",e):"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Ce(e.dts,i),e.pts=Ce(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(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var Ie,xe={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:j=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=j(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},Ae=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},De={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tUe.ONE_SECOND_IN_TS/2))){for(a=(a=Me()[e.samplerate])||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)}))},generateSampleTable:function(e){for(var t=[],i=0;i=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},n.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},n.prototype.addText=function(e){this.rows[this.rowIdx]+=e},n.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},we.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new n(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},we.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},we.prototype.createTextDecoder=function(t){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(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},c.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||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),je=(c.prototype=new u,c.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},c.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},c.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0("0"+(255&e).toString(16)).slice(-2)).join(""),String.fromCharCode(parseInt(n,16))):(t=qe[r=a|o]||r,4096&r&&r===t?"":String.fromCharCode(t)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(i),e},c.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1];return e=Se(s)&&Se(i[e+2])?this.handleText(++e,t,{isMultiByte:!0}):e},c.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},c.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],t=(t.setCurrentWindow(7&s),t.currentWindow),s=i[++e];return t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},c.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},c.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},c.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)},c.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,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},c.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},c.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},c.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{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}),He=14,Ve=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],p=function(e,t){p.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===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):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=a()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=a():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=a()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Ee((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("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),s=Ee((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=Ve.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&0<=r&&r<=14&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Ee(t),s+=Ee(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},u=(p.prototype=new u,p.prototype.flushDisplayed=function(e){let i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},p.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=a(),this.nonDisplayed_=a(),this.lastControlCode_=null,this.column_=0,this.row_=He,this.rollUpRows_=2,this.formatting_=[]},p.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_},p.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},p.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},p.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},p.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},p.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},p.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},p.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},p.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},p.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,o.timeStamp=a=(a*=4)+(3&n[7]),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=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=T.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=T.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 b,Ke.STREAM_TYPES={h264:27,adts:15},(Ye=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>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]))};Ye.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case T.H264_STREAM_TYPE:e=n,t="video";break;case T.ADTS_STREAM_TYPE:e=a,t="audio";break;case T.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new b,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:nt,TransportParseStream:Ke,ElementaryStream:Ye,TimestampRolloverStream:$e,CaptionStream:rt.CaptionStream,Cea608Stream:rt.Cea608Stream,Cea708Stream:rt.Cea708Stream,MetadataStream:_});for(Qe in T)T.hasOwnProperty(Qe)&&(at[Qe]=T[Qe]);var ot,lt,b=at,$e=t,dt=h.ONE_SECOND_IN_TS,ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ut=function(l){var d,h=0;ut.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*dt/ht[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:ht[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},rt=(ut.prototype=new $e,ut),_=t,ct=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=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()},pt=function(){var s,r,n=0;pt.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},yt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=ft(e,t),yt(e,t))},_t=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:ft,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5;return 6144&e[t+3]|e[t+4]<<3|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=10;64&e[5]&&(i=(i+=4)+mt(e.subarray(10,14)));do{if((t=mt(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=vt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;n=0=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Rt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Ot.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=E.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},w.prototype.setRemux=function(e){this.remuxTracks=e},(Ct=function(s){var r,n,a=this,i=!0;Ct.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new I.MetadataStream,t.aacStream=new Dt,t.audioTimestampRolloverStream=new I.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new I.TimestampRolloverStream("timed-metadata"),t.adtsStream=new xt,t.coalesceStream=new w(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Mt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),Tt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new I.MetadataStream,i.packetStream=new I.TransportPacketStream,i.parseStream=new I.TransportParseStream,i.elementaryStream=new I.ElementaryStream,i.timestampRolloverStream=new I.TimestampRolloverStream,i.adtsStream=new xt,i.h264Stream=new At,i.captionStream=new I.CaptionStream(s),i.coalesceStream=new w(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new Et(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Mt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),Tt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,k.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,k.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=Pt(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!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 S;function Ut(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Bt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function $t(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}}var Wt=Ct,t=function(e){return e>>>0},Le=function(e){return("00"+e.toString(16)).slice(-2)},Gt=t,Xt=Ut,Kt=t,Yt=ve.getUint64,Qt=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]}},Oe="undefined"!=typeof window?window:"undefined"!=typeof ye?ye:"undefined"!=typeof self?self:{},b=Oe,Jt=Ne.discardEmulationPreventionBytes,Zt=u.CaptionStream,x=Bt,ei=Ft,ti=qt,ii=jt,si=b,ri=function(e,t){for(var i=e,s=0;s>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),D(e,["mdia","mdhd"])[0]);s&&(i.timescale=_i(s)),n.push(i)}),n},Ti=function(e,i=0){return D(e,["emsg"]).map(e=>{var e=mi.parseEmsgBox(new Uint8Array(e)),t=yi(e.message_data);return{cueTime:mi.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:mi.scaleTime(e.event_duration,e.timescale),frames:t}})},Si=ze,wi=ze,P=Je,L={},O=(L.ts={parseType:function(e,t){e=Ht(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=Vt(e),i=4+zt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Vt(e),s=4+zt(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).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,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.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,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+zt(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=L.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=L.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=L.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=O/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in Ei(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case wi.H264_STREAM_TYPE:s.video=[],ki(e,i,s),0===s.video.length&&delete s.video;break;case wi.ADTS_STREAM_TYPE:s.audio=[],Ci(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=P(e.dts,s),e.pts=P(e.pts,s),e.dtsTime=e.dts/O,e.ptsTime=e.pts/O})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=P(e.dts,r),e.pts=P(e.pts,r),e.dtsTime=e.dts/O,e.ptsTime=e.pts/O}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=P(t.dts,r),t.pts=P(t.pts,r),t.dtsTime=t.dts/O,t.ptsTime=t.pts/O),e):null};class xi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Wt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:h.videoTsToSeconds(e.start.dts),presentation:h.videoTsToSeconds(e.start.pts)},end:{decode:h.videoTsToSeconds(e.end.dts),presentation:h.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:h.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=h.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:h.videoTsToSeconds(e.start.dts),presentation:h.videoTsToSeconds(e.start.pts)},end:{decode:h.videoTsToSeconds(e.end.dts),presentation:h.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:h.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=h.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:h.videoTsToSeconds(e.start),end:h.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:h.videoTsToSeconds(e.start),end:h.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new li,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=vi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=bi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=Ti(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*h.ONE_SECOND_IN_TS,t=Ii(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(h.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(h.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){"init"===e.data.action&&e.data.options?this.messageHandlers=new xi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new xi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));let su=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},ru=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},nu=(e,t)=>{t.gopInfo=e.data.gopInfo},au=t=>{let{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y,segment:_,triggerSegmentEventFn:v}=t,b={buffer:[]},T=y;var S,w;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&su(e,b,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&nu(e,b),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(T=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||T||(i.onmessage=null,ru({transmuxedData:b,callback:m}),ou(i))},i.onerror=()=>{var e={message:"Received an error message from the transmuxer worker",metadata:{errorType:E.Error.StreamingFailedToTransmuxSegment,segmentInfo:Qu({segment:_})}};m(null,e)},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(S=e instanceof ArrayBuffer?e:e.buffer,w=e instanceof ArrayBuffer?0:e.byteOffset,v({type:"segmenttransmuxingstart",segment:_}),i.postMessage({action:"push",data:S,byteOffset:w,byteLength:e.byteLength},[S])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},ou=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():au(e.currentTransmux))},lu=(e,t)=>{e.postMessage({action:t}),ou(e)},du=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(lu.bind(null,t,e)):(t.currentTransmux=e,lu(t,e))};let hu=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,au(e))};var uu=e=>{du("reset",e)},cu=(hu,e=>{let t=new iu,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function pu(e){let t=0;return e.audio&&t++,e.video&&t++,t}function mu(e,t){var i=t.attributes||{},s=Lu(function(e){e=e.attributes||{};if(e.CODECS)return ra(e.CODECS)}(t)||[]);return!Pu(e,t)||s.audio||((e,t)=>{if(!Pu(e,t))return!0;var i,t=t.attributes||{},s=e.mediaGroups.AUDIO[t.AUDIO];for(i in s)if(!s[i].uri&&!s[i].playlists)return!0;return!1})(e,t)||(t=Lu(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return ra(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function gu(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function fu(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}let yu=function(t){let i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=f({},t,{endAction:null,transmuxer:null,callback:null});let a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)},_u={FAILURE:2,TIMEOUT:-101,ABORTED:-102},vu=e=>{e.forEach(e=>{e.abort()})},bu=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),Tu=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Su=(e,t)=>{var i=t.requestType,i=bh({requestType:i,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:_u.TIMEOUT,xhr:t,metadata:i}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:_u.ABORTED,xhr:t,metadata:i}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:_u.FAILURE,xhr:t,metadata:i}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:_u.FAILURE,xhr:t,metadata:i}:null},wu=(r,n,a,o)=>(e,t)=>{var i=t.response,e=Su(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:_u.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=Pd(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t=t||"unknown"} container for initialization segment at URL: `+e,code:_u.FAILURE,metadata:{mediaType:t}});yu({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},Cu=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{var m=i.map&&i.map.tracks||{};let g=Boolean(m.audio&&m.video),f=e.bind(null,i,"audio","start"),y=e.bind(null,i,"audio","end"),_=e.bind(null,i,"video","start"),v=e.bind(null,i,"video","end");yu({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:g}),s=null),hu({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:g,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(g&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{f&&"undefined"!=typeof e.start&&(f(e.start),f=null),y&&"undefined"!=typeof e.end&&y(e.end)},onVideoTimingInfo:e=>{_&&"undefined"!=typeof e.start&&(_(e.start),_=null),v&&"undefined"!=typeof e.end&&v(e.end)},onVideoSegmentTimingInfo:e=>{var t={pts:{start:e.start.presentation,end:e.end.presentation},dts:{start:e.start.decode,end:e.end.decode}};p({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:t}),r(e)},onAudioSegmentTimingInfo:e=>{var t={pts:{start:e.start.pts,end:e.end.pts},dts:{start:e.start.dts,end:e.end.dts}};p({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:t}),n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:(e,t)=>{u&&(e.type="combined"===e.type?"video":e.type,p({type:"segmenttransmuxingcomplete",segment:i}),u(t,i,e))},segment:i,triggerSegmentEventFn:p})}})},ku=({segment:n,bytes:a,trackInfoFn:e,timingInfoFn:o,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:i,id3Fn:l,captionsFn:d,isEndOfTimeline:s,endedTimelineFn:r,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=new Uint8Array(a);if(Ld(m)){n.isFmp4=!0;let i=n.map.tracks,s={isFmp4:!0,hasVideo:!!i.video,hasAudio:!!i.audio},r=(i.audio&&i.audio.codec&&"enca"!==i.audio.codec&&(s.audioCodec=i.audio.codec),i.video&&i.video.codec&&"encv"!==i.video.codec&&(s.videoCodec=i.video.codec),i.video&&i.audio&&(s.isMuxed=!0),e(n,s),(e,t)=>{h(n,{data:m,type:s.hasAudio&&!s.isMuxed?"audio":"video"}),t&&t.length&&l(n,t),e&&e.length&&d(n,e),u(null,n,{})});void yu({action:"probeMp4StartTime",timescales:n.map.timescales,data:m,transmuxer:n.transmuxer,callback:({data:e,startTime:t})=>{a=e.buffer,n.bytes=m=e,s.hasAudio&&!s.isMuxed&&o(n,"audio","start",t),s.hasVideo&&o(n,"video","start",t),yu({action:"probeEmsgID3",data:m,transmuxer:n.transmuxer,offset:t,callback:({emsgData:e,id3Frames:t})=>{a=e.buffer,n.bytes=m=e,i.video&&e.byteLength&&n.transmuxer?yu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:m,timescales:n.map.timescales,trackIds:[i.video.id],callback:e=>{a=e.data.buffer,n.bytes=m=e.data,e.logs.forEach(function(e){c(O(e,{stream:"mp4CaptionParser"}))}),r(e.captions,t)}}):r(void 0,t)}})}})}else n.transmuxer?("undefined"==typeof n.container&&(n.container=Pd(m)),"ts"!==n.container&&"aac"!==n.container?(e(n,{hasAudio:!1,hasVideo:!1}),u(null,n,{})):Cu({segment:n,bytes:a,trackInfoFn:e,timingInfoFn:o,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:i,id3Fn:l,captionsFn:d,isEndOfTimeline:s,endedTimelineFn:r,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})):u(null,n,{})},Iu=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s,segment:r,doneFn:n},a){let o=e=>{e.data.source===t&&(s.removeEventListener("message",o),e=e.data.decrypted,a(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.onerror=()=>{var e="An error occurred in the decryption worker",t=Qu({segment:r}),e={message:e,metadata:{error:new Error(e),errorType:E.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};n(e,r)},s.addEventListener("message",o);let l;l=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(Mh({source:t,encrypted:i,key:l,iv:e.iv}),[i.buffer,l.buffer])},xu=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),Iu({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),ku({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})})},Au=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y})=>{let _=[];var v,b,T,S,w,E,C,k,I,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f})=>{let t=0,y=!1;return(e,i)=>{if(!y){if(e)return y=!0,vu(s),m(e,i);if((t+=1)===s.length){let t=function(){if(i.encryptedBytes)return xu({decryptionWorker:r,segment:i,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f});ku({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f})};if(i.endOfAllRequests=Date.now(),i.map&&i.map.encryptedBytes&&!i.map.bytes)return f({type:"segmentdecryptionstart",segment:i}),Iu({decryptionWorker:r,id:i.requestId+"-init",encryptedBytes:i.map.encryptedBytes,key:i.map.key,segment:i,doneFn:m},e=>{i.map.bytes=e,f({type:"segmentdecryptioncomplete",segment:i}),Eu(i,e=>{if(e)return vu(s),m(e,i);t()})});t()}}}})({activeXhrs:_,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y}),f=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=O(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),l=wu(s,a,i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.key.resolvedUri}}),d=e(o,l),_.push(d)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(h=O(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),u=wu(s,[s.map.key],i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.map.key.resolvedUri}}),c=e(h,u),_.push(c)),p=O(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Ph(s.map),requestType:"segment-media-initialization"}),{segment:v,finishProcessingFn:b,triggerSegmentEventFn:T}=[{segment:s,finishProcessingFn:i,triggerSegmentEventFn:y}][0],m=(e,t)=>{var e=Su(e,t);return e?b(e,v):(e=new Uint8Array(t.response),T({type:"segmentloaded",segment:v}),v.map.key?(v.map.encryptedBytes=e,b(null,v)):(v.map.bytes=e,void Eu(v,function(e){if(e)return e.xhr=t,e.status=t.status,b(e,v);b(null,v)})))},y({type:"segmentloadstart",segment:s}),g=e(p,m),_.push(g)),O(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Ph(s),requestType:"segment"})),a=({segment:S,finishProcessingFn:w,responseType:E,triggerSegmentEventFn:C}=[{segment:s,finishProcessingFn:i,responseType:f.responseType,triggerSegmentEventFn:y}][0],(e,t)=>{e=Su(e,t);if(e)return w(e,S);C({type:"segmentloaded",segment:S});e="arraybuffer"!==E&&t.responseText?Jh(t.responseText.substring(S.lastReachedChar||0)):t.response;return S.stats=bu(t),S.key?S.encryptedBytes=new Uint8Array(e):S.bytes=new Uint8Array(e),w(null,S)}),o=(y({type:"segmentloadstart",segment:s}),e(f,a));o.addEventListener("progress",({segment:k,progressFn:I}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return k.stats=O(k.stats,Tu(e)),!k.stats.firstBytesReceivedAt&&k.stats.bytesReceived&&(k.stats.firstBytesReceivedAt=Date.now()),I(e,k)})),_.push(o);let x={};return _.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:x,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>vu(_)},Du=Md("CodecUtils"),Pu=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},Lu=function(e){let s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(sa(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),a=(Nu(n,(e,t)=>e.bandwidth-t.bandwidth),(n=n.filter(e=>!ch.isIncompatible(e.playlist))).filter(e=>ch.isEnabled(e.playlist)));l=(a=a.length?a:n.filter(e=>!ch.isDisabled(e.playlist))).filter(e=>e.bandwidth*R.BANDWIDTH_VARIANCEe.bandwidth===o.bandwidth)[0];if(!1===u){let t=m||a[0]||n[0];if(t&&t.playlist){let e=m?"bandwidthBestRep":"sortedPlaylistReps";return a[0]&&(e="enabledPlaylistReps"),Ou(`choosing ${Ru(t)} using ${e} with options`,p),t.playlist}}else{var g,u=l.filter(e=>e.width&&e.height),l=(Nu(u,(e,t)=>e.width-t.width),u.filter(e=>e.width===d&&e.height===h)),l=(o=l[l.length-1],l.filter(e=>e.bandwidth===o.bandwidth)[0]);let t,i;l||(g=(t=u.filter(e=>e.width>d||he.width===t[0].width&&e.height===t[0].height),o=g[g.length-1],i=g.filter(e=>e.bandwidth===o.bandwidth)[0]);let s,r=(c.leastPixelDiffSelector&&(g=u.map(e=>(e.pixelDiff=Math.abs(e.width-d)+Math.abs(e.height-h),e)),Nu(g,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=g[0]),s||i||l||m||a[0]||n[0]);if(r&&r.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":l?e="resolutionBestRep":m?e="bandwidthBestRep":a[0]&&(e="enabledPlaylistReps"),Ou(`choosing ${Ru(r)} using ${e} with options`,p),r.playlist}}return Ou("could not choose a playlist with options",p),null}}function Uu(){let e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),Mu(this.playlists.main,this.systemBandwidth,parseInt(gu(this.tech_.el(),"width"),10)*e,parseInt(gu(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Bu(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}function Fu(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}let qu=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:o})=>{if(t){let r=window.WebKitDataCue||window.VTTCue,a=e.metadataTrack_;if(a&&(t.forEach(e=>{let s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new r(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return E.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return E.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return E.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),a.addCue(i)})}),a.cues)&&a.cues.length){var s=a.cues,l=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),n=Object.keys(r).sort((e,t)=>Number(e)-Number(t));n.forEach((e,t)=>{var i=r[e],e=isFinite(o)?o:e;let s=Number(n[t+1])||e;i.forEach(e=>{e.endTime=s})})}}},ju={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"},Hu=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Vu=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,E.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},zu=e=>"number"==typeof e&&isFinite(e),$u=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?Jd({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Wu=e=>e+"TimingInfo",Gu=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Xu=e=>{var t,i,s,r=e.pendingSegment_;r&&Gu({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:r.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&!!((r=e.timelineChangeController_)&&(t=r.pendingTimelineChange({type:"audio"}),r=r.pendingTimelineChange({type:"main"}),s=(i=t&&r)&&t.to!==r.to,i)&&-1!==t.from&&-1!==r.from&&s)&&(t=(i=e).timelineChangeController_.pendingTimelineChange({type:"audio"}),i=i.timelineChangeController_.pendingTimelineChange({type:"main"}),t&&i&&t.to!!e&&Math.round(e)>t+zd,Yu=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&s{var i,s,r;if(t)return i=Boolean(t.key||t.map&&t.map.ke),s=Boolean(t.map&&!t.map.bytes),r=void 0===t.startOfSegment?t.start:t.startOfSegment,{type:e||t.type,uri:t.resolvedUri||t.uri,start:r,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class Ju extends E.EventTarget{constructor(e,t=0){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Md(`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_():Xu(this)}),this.sourceUpdater_.on("codecschange",e=>{this.trigger(f({type:"codecschange"},e))}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Xu(this)}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",e=>{this.trigger(f({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Xu(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Xu(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return cu({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_&&window.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(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(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,window.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"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&uu(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ud();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Rh(e);let 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;var i=Nh(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){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"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(t,this.currentTime_()),this.logger_(`Playlist update: +currentTime: ${this.currentTime_()} +bufferedEnd: ${qd(this.buffered_())} +`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.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_&&uu(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var 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(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n,a=()=>{0===--e&&s()};for(n in!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,a)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Od),n=Math.ceil((e-s)*Od),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,a)),this.inbandTextTracks_)Fu(t,i,this.inbandTextTracks_[n]);Fu(t,i,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e,t;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&(t={segmentInfo:Qu({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){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),s=qd(e)||0,e=jd(e,this.currentTime_()),r=!this.hasPlayed_()&&1<=e,n=e>=this.goalBufferLength_(),t=this.playlist_.segments;if(!t.length||r||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);r={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(r.isSyncRequest)r.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,t,s),this.logger_("choose next request. Can not find sync point. Fallback to media Index: "+r.mediaIndex);else if(null!==this.mediaIndex){var n=t[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1;r.startOfSegment=n.end||s,n.parts&&n.parts[a+1]?(r.mediaIndex=this.mediaIndex,r.partIndex=a+1):r.mediaIndex=this.mediaIndex+1}else{let e,t,i;n=this.fetchAtBuffer_?s:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: +For TargetTime: ${n}. +CurrentTime: ${this.currentTime_()} +BufferedEnd: ${s} +Fetch At Buffer: ${this.fetchAtBuffer_} +`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){a=this.getSyncInfoFromMediaSequenceSync_(n);if(!a)return this.error({message:s="No sync info found while using media sequence sync",metadata:{errorType:E.Error.StreamingFailedToSelectNextSegment,error:new Error(s)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${a.start} --> ${a.end})`),e=a.segmentIndex,t=a.partIndex,i=a.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");s=ch.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:n,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=s.segmentIndex,t=s.partIndex,i=s.startTime}r.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+n:"currentTime "+n,r.mediaIndex=e,r.startOfSegment=i,r.partIndex=t,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${r.mediaIndex} `)}a=t[r.mediaIndex];let i=a&&"number"==typeof r.partIndex&&a.parts&&a.parts[r.partIndex];if(!a||"number"==typeof r.partIndex&&!i)return null;"number"!=typeof r.partIndex&&a.parts&&(r.partIndex=0,i=a.parts[0]);s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e||!i||s||i.independent||(0===r.partIndex?(e=(n=t[r.mediaIndex-1]).parts&&n.parts.length&&n.parts[n.parts.length-1])&&e.independent&&(--r.mediaIndex,r.partIndex=n.parts.length-1,r.independent="previous segment"):a.parts[r.partIndex-1].independent&&(--r.partIndex,r.independent="previous part")),s=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return r.mediaIndex>=t.length-1&&s&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,r.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(r))}getSyncInfoFromMediaSequenceSync_(e){var t;return this.mediaSequenceSync_&&(e!==(t=Math.max(e,this.mediaSequenceSync_.start))&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to `+t),e=this.mediaSequenceSync_.getSyncInfoForTime(t))?e.isAppended?(t=this.mediaSequenceSync_.getSyncInfoForTime(e.end))?(t.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),t):null:e:null}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:n}),qd(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Od);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r}=[e][0],r||e!==t?!(e!ch.isIncompatible(e));let d=e.filter(ch.isEnabled);var e=(d=d.length?d:e.filter(e=>!ch.isDisabled(e))).filter(ch.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:ch.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return Nu(h,(e,t)=>fu(t.playlist,e.playlist)),h.length?h[0]:(Nu(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=zd&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{a[e.stream]=a[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=a[e.stream];t.startTime=Math.min(t.startTime,e.startTime+n),t.endTime=Math.max(t.endTime,e.endTime+n),t.captions.push(e)}),Object.keys(a).forEach(e=>{var{startTime:t,endTime:i,captions:s}=a[e],r=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${i} for `+e),function(r,n,a){if(!r[a]){n.trigger({type:"usage",name:"vhs-608"});let s=a;/^cc708_/.test(a)&&(s="SERVICE"+a.split("_")[1]);var o=n.textTracks().getTrackById(s);if(o)r[a]=o;else{let e=a,t=a,i=!1;o=(n.options_.vhs&&n.options_.vhs.captionServices||{})[s];o&&(e=o.label,t=o.language,i=o.default),r[a]=n.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}}(r,this.vhs_.tech_,e),Fu(t,i,r[e]),function({inbandTextTracks:n,captionArray:e,timestampOffset:a}){if(e){let r=window.WebKitDataCue||window.VTTCue;e.forEach(i=>{let s=i.stream;i.content?i.content.forEach(e=>{var t=new r(i.startTime+a,i.endTime+a,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",n[s].addCue(t)}):n[s].addCue(new r(i.startTime+a,i.endTime+a,i.text))})}}({captionArray:s,inbandTextTracks:r,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&Gu({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_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Gu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())Xu(this),this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Wu(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.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,e)}}}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){var r=Rh(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}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){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.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){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(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:E.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}s={segmentInfo:Qu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:s}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):(Xu(this),this.loadQueue_.push(()=>{var e=f({},t,{forceTimestampOffset:!0});f(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)}))}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_($u(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{t={segmentInfo:Qu({segment:t})};i&&(t.keyInfo=i),s&&(t.trackInfo=s),r&&(t.timingInfo=r),this.trigger({type:e,metadata:t})}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-R.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.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&&e.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;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&(e={segmentInfo:Qu({type:this.loaderType_,segment:this.pendingSegment_})},this.trigger({type:"appendsdone",metadata:e})),this.pendingSegment_?((e=this.pendingSegment_).part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=Yu(e,this.sourceType_))&&("warn"===t.severity?E.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+$u(e)):(this.logger_("Appended "+$u(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"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+$u(e)),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_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,zu(t))&&zu(i)&&(Fu(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}}function Zu(){}function ec(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}let tc=["video","audio"],ic=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},sc=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),sc("audio",s),sc("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!ic(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=ec(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},nc=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),ac={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(nc(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(nc(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];nc(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){E.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){E.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(nc(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){E.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=ec(s),i=na(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(rc(i,e),nc(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){E.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:o=>(t,i)=>{var e=i[t+"Buffer"],s=na(o);if(nc(i.mediaSource,e)){var r=o.substring(0,o.indexOf(".")),n=i.codecs[t],a=n.substring(0,n.indexOf("."));if(a!==r){a={codecsChangeInfo:{from:n,to:o}};i.trigger({type:"codecschange",metadata:a}),i.logger_(`changing ${t}Buffer codec from ${n} to `+o);try{e.changeType(s),i.codecs[t]=o}catch(e){a.errorType=E.Error.StreamingCodecsChangeError,(a.error=e).metadata=a,i.error_=e,i.trigger("error"),E.log.warn(`Failed to changeType on ${t}Buffer`,e)}}}}},oc=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),sc(e,t)},lc=(i,s)=>e=>{var t=function(t){if(0===t.length)return"Buffered Ranges are empty";let i="Buffered Ranges: \n";for(let e=0;e ${r}. Duration (${r-s}) +`}return i}(s[i+"Buffered"]());s.logger_(`received "updateend" event for ${i} Source Buffer: `,t),s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),sc(i,s)};class dc extends E.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>sc("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Md("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=lc("video",this),this.onAudioUpdateEnd_=lc("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){oc({type:"mediaSource",sourceUpdater:this,action:ac.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){oc({type:e,sourceUpdater:this,action:ac.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?oc({type:"mediaSource",sourceUpdater:this,action:ac.removeSourceBuffer(e),name:"removeSourceBuffer"}):E.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!E.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?oc({type:e,sourceUpdater:this,action:ac.changeType(t),name:"changeType"}):E.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;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`)):(e=t,oc({type:s,sourceUpdater:this,action:ac.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return nc(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Ud()}videoBuffered(){return nc(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Ud()}buffered(){var e=nc(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=nc(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,s=null,r=0;var n=[],a=[];if(!(e&&e.length&&t&&t.length))return Ud();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort(function(e,t){return e.time-t.time}),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"](()=>rc(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}let hc=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),uc=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class cc extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class pc extends Ju{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_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?Ud([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):Ud()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Rh(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=uc.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(uc,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return"undefined"!=typeof e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){Fu(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE"):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_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===_u.TIMEOUT&&this.handleTimeout_(),e.code===_u.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof window.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"}));else{r.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message,metadata:{errorType:E.Error.StreamingVttParserError,error:e}})}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"):(s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)}),function(t){var i=t.cues;if(i){var s={};for(let e=i.length-1;0<=e;e--){var r=i[e],n=r.startTime+`-${r.endTime}-`+r.text;s[n]?t.removeCue(r):s[n]=r}}}(this.subtitlesTrack_),this.handleAppendsDone_())}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(t){let e,i=!1;if("function"!=typeof window.WebVTT)throw new cc;"function"==typeof window.TextDecoder?e=new window.TextDecoder("utf8"):(e=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,e);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=t.cues.push.bind(t.cues),s.ontimestampmap=e=>{t.timestampmap=e},s.onparsingerror=e=>{E.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){let e=t.segment.map.bytes;i&&(e=hc(e)),s.parse(e)}let r=t.bytes;i&&(r=hc(r)),s.parse(r),s.flush()}updateTimeMapping_(e,r,t){var i=e.segment;if(r)if(e.cues.length){var{MPEGTS:n,LOCAL:a}=e.timestampmap;let s=n/Od-a+r.mapping;e.cues.forEach(e=>{var t=e.endTime-e.startTime,i=this.handleRollover_(e.startTime+s,r.time);e.startTime=Math.max(i,0),e.endTime=Math.max(i+t,0)}),t.syncInfo||(n=e.cues[0].startTime,a=e.cues[e.cues.length-1].startTime,t.syncInfo={mediaSequence:t.mediaSequence+e.mediaIndex,time:Math.min(n,a-i.duration)})}else i.empty=!0}handleRollover_(e,t){if(null===t)return e;let i=e*Od;var s=t*Od;let r;for(r=s=this.start&&ee.resetAppendedStatus())}}class fc{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){var{mediaSequence:e,segments:i}=e;if(this.isReliable_=this.isReliablePlaylist_(e,i),this.isReliable_)return this.updateStorage_(i,e,this.calculateBaseTime_(e,t))}getSyncInfoForTime(e){for(var{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(var s of i)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let d=new Map,h="\n",u=i,c=t;this.start_=u,e.forEach((e,a)=>{let o=this.storage_.get(c);var t=u,i=t+e.duration,s=Boolean(o&&o.segmentSyncInfo&&o.segmentSyncInfo.isAppended),r=new mc({start:t,end:i,appended:s,segmentIndex:a});e.syncInfo=r;let l=u;var n=(e.parts||[]).map((e,t)=>{var i=l,s=l+e.duration,r=Boolean(o&&o.partsSyncInfo&&o.partsSyncInfo[t]&&o.partsSyncInfo[t].isAppended),n=new mc({start:i,end:s,appended:r,segmentIndex:a,partIndex:t});return l=s,h+=`Media Sequence: ${c}.${t} | Range: ${i} --> ${s} | Appended: ${r} +`,e.syncInfo=n});d.set(c,new gc(r,n)),h+=`${Bu(e.resolvedUri)} | Media Sequence: ${c} | Range: ${t} --> ${i} | Appended: ${s}\n`,c++,u=i}),this.end_=u,this.storage_=d,this.diagnostics_=h}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 yc extends fc{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){return this.storage_.size?super.calculateBaseTime_(e,t):(t=this.parent_.getSyncInfoForMediaSequence(e))?t.segmentSyncInfo.start:0}}let _c=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"MediaSequence",run:(e,t,i,s,r,n)=>{e=e.getMediaSequenceSync(n);return e&&e.isReliable&&(n=e.getSyncInfoForTime(r))?{time:n.start,partIndex:n.partIndex,segmentIndex:n.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Yd(i);r=r||0;for(let e=0;e{let n=null,a=null;r=r||0;var o=Yd(t);for(let e=0;e=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class vc extends E.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};var t=new fc,i=new yc(t),s=new yc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Md("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(t!==1/0)return _c.find(({name:e})=>"VOD"===e).run(this,e,t);var n,t=this.runStrategies_(e,t,i,s,r);if(!t.length)return null;for(n of t){var{syncPoint:a,strategy:o}=n,{segmentIndex:l,time:d}=a;if(!(l<0)){var h=d+e.segments[l].duration;if(this.logger_(`Strategy: ${o}. Current time: ${s}. selected segment: ${l}. Time: [${d} -> ${h}]}`),d<=s&&so){let e;e=a<0?s.start-Hd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+Hd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class bc extends E.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 Tc=Zh(eu(tu(function(){var e=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){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),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))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);let a=new Uint8Array(e.byteLength),o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){let i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));let Sc=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},wc=(e,t)=>{(t.activePlaylistLoader=e).load()},Ec={AUDIO:(a,o)=>()=>{var{mediaTypes:{[a]:e},excludePlaylist:t}=o,i=e.activeTrack(),s=e.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=e.tracks[s];if(i===r)t({error:{message:"Problem encountered loading the default audio track."}});else{for(var n in E.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),e.tracks)e.tracks[n].enabled=e.tracks[n]===r;e.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{[i]:e}=s.mediaTypes,t=(E.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),e.activeTrack());t&&(t.mode="disabled"),e.onTrackChanged()}},Cc={AUDIO:(e,t,i)=>{if(!t)return;let{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var 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",Ec[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var 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",Ec[e](e,i))}},kc={AUDIO:(i,s)=>{var r,n,{vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u,logger_:c}},mainPlaylistLoader:p}=s,m=uh(p.main);for(r in d[i]&&0!==Object.keys(d[i]).length||(d[i]={main:{default:{default:!0}}},m&&(d[i].main.default.playlists=p.main.playlists)),d[i])for(var g in h[r]||(h[r]=[]),d[i][r]){let e=d[i][r][g],t;t=m?(c(`AUDIO group '${r}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===o&&e.playlists?new xh(e.playlists[0],a,l):e.resolvedUri?new xh(e.resolvedUri,a,l):e.playlists&&"dash"===o?new Yh(e.playlists[0],a,l,p):null,e=O({id:g,playlistLoader:t},e),Cc[i](i,e.playlistLoader,s),h[r].push(e),"undefined"==typeof u[g]&&(n=new E.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),u[g]=n)}e.on("error",Ec[i](i,s))},SUBTITLES:(i,s)=>{var r,n,{tech:a,vhs:o,sourceType:l,segmentLoaders:{[i]:e},requestOptions:d,main:{mediaGroups:h},mediaTypes:{[i]:{groups:u,tracks:c}},mainPlaylistLoader:p}=s;for(r in h[i])for(var m in u[r]||(u[r]=[]),h[i][r])if(o.options_.useForcedSubtitles||!h[i][r][m].forced){let e=h[i][r][m],t;if("hls"===l)t=new xh(e.resolvedUri,o,d);else if("dash"===l){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new Yh(e.playlists[0],o,d,p)}else"vhs-json"===l&&(t=new xh(e.playlists?e.playlists[0]:e.resolvedUri,o,d));e=O({id:m,playlistLoader:t},e),Cc[i](i,e.playlistLoader,s),u[r].push(e),"undefined"==typeof c[m]&&(n=a.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,c[m]=n)}e.on("error",Ec[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var i,{tech:s,main:{mediaGroups:r},mediaTypes:{[e]:{groups:n,tracks:a}}}=t;for(i in r[e])for(var o in n[i]||(n[i]=[]),r[e][i]){var l=r[e][i][o];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var d=s.options_.vhs&&s.options_.vhs.captionServices||{};let e={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};void 0===(e=d[e.instreamId]?O(e,d[e.instreamId]):e).default&&delete e.default,n[i].push(O({id:o},l)),"undefined"==typeof a[o]&&(d=s.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,a[o]=d)}}}},Ic=(t,i)=>{for(let e=0;e()=>{var e,{[i]:{tracks:t}}=s.mediaTypes;for(e in t)if(t[e].enabled)return t[e];return null},SUBTITLES:(i,s)=>()=>{var e,{[i]:{tracks:t}}=s.mediaTypes;for(e in t)if("showing"===t[e].mode||"hidden"===t[e].mode)return t[e];return null}},Ac=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{kc[e](e,n)});let{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=xc[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,Sc(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),wc(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Sc(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),wc(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n.mediaTypes],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o,l=a.AUDIO.activeGroup();l&&(l=(l.filter(e=>e.default)[0]||l[0]).id,a.AUDIO.tracks[l].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});let d=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};for(o in t.audioTracks().addEventListener("change",d),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",d),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio"),a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[o])};class Dc{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_=Rd(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 Pc extends E.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Dc,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_=Md("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var i=t.serverUri||t.serverURL;i?i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=Rd(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")):(this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error"))}requestSteeringManifest(e){var t=this.steeringManifest.reloadUri;if(t){let r=e?t:this.getRequestURI(t);if(r){let s={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(e,t)=>{if(e)return 410===t.status?(this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),void this.excludedSteeringManifestURLs.add(r)):429===t.status?(t=t.responseHeaders["retry-after"],this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${t} seconds.`),void this.startTTLTimeout_(parseInt(t,10))):(this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_());this.trigger({type:"contentsteeringloadcomplete",metadata:s});let i;try{i=JSON.parse(this.request_.responseText)}catch(e){t={errorType:E.Error.StreamingContentSteeringParserError,error:e};this.trigger({type:"error",metadata:t})}this.assignSteeringProperties_(i);e={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:e}),this.startTTLTimeout_()})}else this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose()}}setProxyServerUrl_(e){var e=new window.URL(e),t=new window.URL(this.proxyServerUrl_);return t.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(t.toString())}decodeDataUriManifest_(e){e=JSON.parse(window.atob(e));this.assignSteeringProperties_(e)}setSteeringParams_(e){var t,e=new window.URL(e),i=this.getPathway(),s=this.getBandwidth_();return i&&(t=`_${this.manifestType_}_pathway`,e.searchParams.set(t,i)),s&&(t=`_${this.manifestType_}_throughput`,e.searchParams.set(t,s)),e.toString()}assignSteeringProperties_(e){var t;this.steeringManifest.version=e.VERSION,this.steeringManifest.version?(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()),t=(e=>{for(var 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"))):(this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;var t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!t(i))return i}i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=window.setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){window.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 Dc}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&&(Rd(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let Lc,Oc=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Rc extends E.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p,experimentalUseMMS:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let g=e.maxPlaylistRetries;null!==g&&"undefined"!=typeof g||(g=1/0),Lc=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{let t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Zu,activeTrack:Zu,getActiveGroup:Zu,onGroupChanged:Zu,onTrackChanged:Zu,lastTrack_:null,logger_:Md(`MediaGroups[${e}]`)}}),t})(),m&&window.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new window.ManagedMediaSource,E.log("Using ManagedMediaSource")):window.MediaSource&&(this.mediaSource=new window.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_=Ud(),this.hasPlayed_=!1,this.syncController_=new vc(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Tc,this.sourceUpdater_=new dc(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new bc,this.keyStatusMap_=new Map;var f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},f=(this.mainPlaylistLoader_="dash"===this.sourceType_?new Yh(t,this.vhs_,O(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new xh(t,this.vhs_,O(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ju(O(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ju(O(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new pc(O(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new Pc(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_())),Oc.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=Md("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,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(f,()=>{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_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e&&(e.id||e.uri);s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),s={renditionInfo:{id:r,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t},this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{var t=this.mediaTypes_[e],t=t?t.activeGroup():null;let i=this.contentSteeringController_.getPathway();t&&i&&(t=(t.length?t[0]:t).playlists.filter(e=>e.attributes.serviceLocation===i)).length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n,a=i.main||s.length&&i[s[0]];for(n in a)if(a[n].default){r={label:n};break}}if(!r)return e;var o,l=[];for(o in i)if(i[o][r.label]){var d=i[o][r.label];if(d.playlists&&d.playlists.length)l.push.apply(l,d.playlists);else if(d.uri)l.push(d);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;dh(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()),Ac({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 t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var 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",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;dh(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",()=>{var 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(f({},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){var i=e.mediaGroups||{};let s=!0;var r,e=Object.keys(i.AUDIO);for(r in i.AUDIO)for(var n in i.AUDIO[r])i.AUDIO[r][n].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"}),Lc.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!e)return l(d+" as current playlist is not set"),!0;if(s.id!==e.id){var h=Boolean(Bd(t,i).length);if(!e.endList)return h||"number"!=typeof e.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=jd(t,i),t=o?R.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:R.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${i} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else E.log.warn("We received no playlist to switch to. Please check your stream.");return!1}({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",()=>{var 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",()=>{var e=this.audioSegmentLoader_.pendingSegment_;e&&e.segment&&e.segment.syncInfo&&(e=e.segment.syncInfo.end+.01,this.tech_.setCurrentTime(e))}),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}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var 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(f({},e))}),this.audioSegmentLoader_.on(e,e=>{this.player_.trigger(f({},e))}),this.subtitleSegmentLoader_.on(e,e=>{this.player_.trigger(f({},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()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.mainSegmentLoader_.load()})}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(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_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=Lc.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=$d&&e-i<=$d:e-t<=$d)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(ah),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return E.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){let e=this.pathwayAttribute_(s);var a=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(e),this.excludeThenChangePathway_(),void setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(e)},a)}let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(E.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});a=this.selectPlaylist();if(a)return(t.internal?this.logger_:E.log.warn)(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+(t.message?" "+t.message:"")+` Switching to playlist ${a.id}.`),a.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),a.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),r=a.targetDuration/2*1e3||5e3,i="number"==typeof a.lastRequest&&Date.now()-a.lastRequest<=r,this.switchMedia_(a,"exclude",n||i);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){let s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=Bd(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:Lc.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=Lc.Playlist.seekable(s,r,Lc.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=Lc.Playlist.seekable(s,r,Lc.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=Ud([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t,i=this.mediaTypes_[e].groups;for(t in i)i[t].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_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){let n={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();n.video=n.main;var e=mu(this.main(),i);let a={};var t=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(n.main.hasVideo&&(a.video=e.video||n.main.videoCodec||"avc1.4d400d"),n.main.isMuxed&&(a.video+=","+(e.audio||n.main.audioCodec||aa)),(n.main.hasAudio&&!n.main.isMuxed||n.audio.hasAudio||t)&&(a.audio=e.audio||n.main.audioCodec||n.audio.audioCodec||aa,n.audio.isFmp4=(n.main.hasAudio&&!n.main.isMuxed?n.main:n.audio).isFmp4),a.audio||a.video){let s={},r;if(["video","audio"].forEach(function(e){var t,i;a.hasOwnProperty(e)&&(t=n[e].isFmp4,i=a[e],!(t?Yn:Qn)(i))&&(t=n[e].isFmp4?"browser":"muxer",s[t]=s[t]||[],s[t].push(a[e]),"audio"===e&&(r=t))}),t&&r&&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 ${r} does not support codec(s): "${a.audio}"`)}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let s=[];if(["video","audio"].forEach(e=>{var t=(ra(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(ra(a[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&s.push(`"${this.sourceUpdater_.codecs[e]}" -> "${a[e]}"`)}),s.length)return void this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${s.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return a}e=Object.keys(s).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${s[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){let s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=mu(this.main,e)).audio||Qn(t.audio)||Yn(t.audio)||i.push("audio codec "+t.audio),!t.video||Qn(t.video)||Yn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){let r=[],n=this.main().playlists;e=Lu(ra(e));let a=pu(e),o=e.video&&ra(e.video)[0]||null,l=e.audio&&ra(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=mu(this.mainPlaylistLoader_.main,e),i=pu(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&ra(s.video)[0]||null,s=s.audio&&ra(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var i=this.seekable();i.length&&(t=i.start(0)),function(s,r,e=0){if(s.segments){let t=e,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(r,t+o.duration/2)){if("cueIn"in o){i.endTime=t,i.adEndTime=t,t+=o.duration,i=null;continue}if(t{let r=e.metadataTrack_;if(r){let s=window.WebKitDataCue||window.VTTCue;t.forEach(e=>{for(var t of Object.keys(e)){var i;Hu.has(t)||((i=new s(e.startTime,e.endTime,"")).id=e.id,i.type="com.apple.quicktime.HLS",i.value={key:ju[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(i.value.data=new Uint8Array(i.value.data.match(/[\da-f]{2}/gi)).buffer),r.addCue(i))}e.processDateRange()})}})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Vu(this.inbandTextTracks_,e,this.tech_),qu({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){var e=this.main();if(e.contentSteering){for(var t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):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(f({},e))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let r=this.main();(this.contentSteeringController_.didDASHTagChange(r.uri,r.contentSteering)||(()=>{var e,t=this.contentSteeringController_.getAvailablePathways(),i=[];for(e of r.playlists){var s=e.attributes.serviceLocation;if(s&&(i.push(s),!t.has(s)))return!0}return!(i.length||!t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let a=this.contentSteeringController_.getPathway();if(a){this.handlePathwayClones_();let s=this.main().playlists,r=new Set,n=!1;Object.keys(s).forEach(e=>{var e=s[e],t=this.pathwayAttribute_(e),t=t&&a!==t,i=(e.excludeUntil===1/0&&"content-steering"===e.lastExcludeReason_&&!t&&(delete e.excludeUntil,delete e.lastExcludeReason_,n=!0),!e.excludeUntil&&e.excludeUntil!==1/0);!r.has(e.id)&&t&&i&&(r.add(e.id),e.excludeUntil=1/0,e.lastExcludeReason_="content-steering",this.logger_(`excluding ${e.id} for `+e.lastExcludeReason_))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(e=>{var e=this.mediaTypes_[e];e.activePlaylistLoader&&(e=e.activePlaylistLoader.media_)&&e.attributes.serviceLocation!==a&&(n=!0)}),n&&this.changeSegmentPathway_()}}handlePathwayClones_(){var i=this.main().playlists,s=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(s&&s.size||r&&r.size){for(var[e,t]of s.entries())r.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(t),this.contentSteeringController_.excludePathway(e));for(let[e,t]of r.entries()){var n=s.get(e);n?this.equalPathwayClones_(n,t)||(this.mainPlaylistLoader_.updateOrDeleteClone(t,!0),this.contentSteeringController_.addAvailablePathway(e)):(i.filter(e=>e.attributes["PATHWAY-ID"]===t["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(t,e)}),this.contentSteeringController_.addAvailablePathway(e))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;var i,s,r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(i in r)if(r[i]!==n[i])return!1;for(s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.main){let r=0,n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(s=>{var e=this.mainPlaylistLoader_.getKeyIdSet(s);e&&e.size&&e.forEach(e=>{var t="usable",t=this.keyStatusMap_.has(e)&&this.keyStatusMap_.get(e)===t,i=s.lastExcludeReason_===n&&s.excludeUntil===1/0;t?i&&(delete s.excludeUntil,delete s.lastExcludeReason_,this.logger_(`enabling playlist ${s.id} because key ID ${e} is usable`)):(s.excludeUntil!==1/0&&s.lastExcludeReason_!==n&&(s.excludeUntil=1/0,s.lastExcludeReason_=n,this.logger_(`excluding playlist ${s.id} because the key ID ${e} doesn't exist in the keyStatusMap or is not usable`)),r++)})}),r>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{var t=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,i=e.excludeUntil===1/0&&e.lastExcludeReason_===n;t&&i&&(delete e.excludeUntil,E.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${n} key IDs`))})}}addKeyStatus_(e,t){e=("string"==typeof e?e:(e=>{e=new Uint8Array(e);return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")})(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${e} added to the keyStatusMap`),this.keyStatusMap_.set(e,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_()}}class Nc{constructor(e,t,i){var s,n,a,o,r=e.playlistController_,l=r.fastQualityChange_.bind(r);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=mu(r.main(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,a=t.id,o=l,e=>{var t=n.main.playlists[a],i=nh(t),s=ah(t);if("undefined"==typeof e)return s;e?delete t.disabled:t.disabled=!0;var r={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===s||i||(o(t),e?n.trigger({type:"renditionenabled",metadata:r}):n.trigger({type:"renditiondisabled",metadata:r})),e})}}let Mc=["seeking","seeked","pause","playing","error"];class Uc extends E.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_=Md("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={},l=(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)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("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(Mc,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(Mc,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_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.playedRanges_.push(Ud([this.lastRecordedTime,e])),t={playedRanges:this.playedRanges_},this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:$d)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${Gd(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-zd),o=[r,s];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"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=Fd(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+$d;var n=!i.endList;return t>(r=n&&("number"==typeof i.partTargetDuration||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){a&&t.currentTime(a)});t.on("error",s),t.on("dispose",r),t.reloadSourceOnError=function(e){r(),Fc(t,e)}};function qc(t,e){var i=e.media();let s=-1;for(let e=0;efu(e,t)),e.filter(e=>!!mu(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:Uu,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return E.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),R[t]},set(e){E.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?E.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):R[t]=e}})}),"videojs-vhs"),Hc=(N.canPlaySource=function(){return E.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));let n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),Vc=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Lu(ra(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r,n=na(s.video),a=na(s.audio),o={};for(r in e)o[r]={},a&&(o[r].audioContentType=a),n&&(o[r].videoContentType=n),t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(o[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(o[r].url=e[r]);return O(e,o)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(E.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},zc=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(jc);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},$c=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},Wc=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Gc=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Xc=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;let t=document.createElement("video");return!!E.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&E.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return E.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){$c(N.xhr,e)},N.xhr.onResponse=function(e){Wc(N.xhr,e)},N.xhr.offRequest=function(e){Gc(N.xhr,e)},N.xhr.offResponse=function(e){Xc(N.xhr,e)};t=E.getComponent("Component");class Kc extends t{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Md("VhsHandler"),t.options_&&t.options_.playerId&&(i=E.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1: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={}){this.options_=O(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="undefined"!=typeof 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&&((e=zc())&&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=R.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===R.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;e=this.options_.customPixelRatio;"number"==typeof e&&0<=e&&(this.customPixelRatio=e)}setOptions(e={}){this.setOptions_(e)}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=Jn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Rc(this.options_),e=O({liveRangeSafeTimeDelta:$d},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new Uc(e),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{var e=E.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.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;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.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:()=>Xd(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:()=>Xd(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",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=zc())?O(t,e):e;try{window.localStorage.setItem(jc,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=uh(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!nh(e)).map((e,t)=>new Nc(i,e,e.id)):[]}}),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_=window.URL.createObjectURL(this.playlistController_.mediaSource),(E.browser.IS_ANY_SAFARI||E.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_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Hc({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_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=Vc({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});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_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=E.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),qc(t,e.playlists)}),this.playlists.on("mediachange",()=>{qc(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.15.0","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 dc.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_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return qh({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return jh({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=>{$c(this.xhr,e)},this.xhr.onResponse=e=>{Wc(this.xhr,e)},this.xhr.offRequest=e=>{Gc(this.xhr,e)},this.xhr.offResponse=e=>{Xc(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(f({},e))})}),["gapjumped","playedrangeschanged"].forEach(e=>{this.playbackWatcher_.on(e,e=>{this.player_.trigger(f({},e))})})}}let Yc={name:"videojs-http-streaming",VERSION:"3.15.0",canHandleSource(e,t={}){t=O(E.options,t);return!(!t.vhs.experimentalUseMMS&&!Yn("avc1.4d400d,mp4a.40.2",!1))&&Yc.canPlayType(e.type,t)},handleSource(e,t,i={}){i=O(E.options,i);return t.vhs=new Kc(e,t,i),t.vhs.xhr=Dh(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=Jn(e);return e&&(t=Yc.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(E.browser.IS_ANY_SAFARI||E.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return Yn("avc1.4d400d,mp4a.40.2",!0)&&E.getTech("Html5").registerSourceHandler(Yc,0),E.VhsHandler=Kc,E.VhsSourceHandler=Yc,E.Vhs=N,E.use||E.registerComponent("Vhs",N),E.options.vhs=E.options.vhs||{},E.getPlugin&&E.getPlugin("reloadSourceOnError")||E.registerPlugin("reloadSourceOnError",function(e){Fc(this,e)}),E}); diff --git a/assets/src/blocks/rt-player/lib/js/videojs-contrib-quality-menu.min.js b/assets/src/blocks/rt-player/lib/js/videojs-contrib-quality-menu.min.js new file mode 100644 index 0000000..f995bc4 --- /dev/null +++ b/assets/src/blocks/rt-player/lib/js/videojs-contrib-quality-menu.min.js @@ -0,0 +1,2 @@ +/*! @name videojs-contrib-quality-menu @version 1.0.3 @license Apache-2.0 */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsContribQualityMenu=t(e.videojs)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=t(e);const l=s.default.getComponent("MenuItem"),i=s.default.dom||s.default;class a extends l{constructor(e,t={}){const s=t.selected;t.selected=t.active,super(e,t);const l=e.qualityLevels();this.levels_=t.levels,this.selected_=s,this.handleQualityChange=this.handleQualityChange.bind(this),this.controlText(t.controlText),this.on(l,"change",this.handleQualityChange),this.on("dispose",(()=>{this.off(l,"change",this.handleQualityChange)}))}createEl(e,t,s){const l=super.createEl(e,t,s),a=i.createEl("span",{className:"vjs-quality-menu-item-sub-label",innerHTML:this.localize(this.options_.subLabel||"")});return this.subLabel_=a,l&&l.appendChild(a),l}handleClick(){this.updateSiblings_();const e=this.player().qualityLevels(),t=e.selectedIndex;for(let s=0,l=e.length;s-1;this.selected(t)}selected(e){if(this.selectable)if(this.selected_){this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(this.localize("{1}, selected",this.localize(this.options_.controlText)));const t=this.player().controlBar.getChild("QualityMenuButton");e?t.removeClass("vjs-quality-menu-button-waiting"):t.addClass("vjs-quality-menu-button-waiting")}else this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(this.options_.controlText)}updateSiblings_(){const e=this.player().qualityLevels(),t=this.player().controlBar.getChild("QualityMenuButton").items;for(let s=0,l=t.length;s-1;l.selected_=l===this,l.selected(i)}}}const n=s.default.getComponent("MenuButton"),o=function(e){return Array.from(e).some((e=>e.height))},u=function(e){return e>=2160?"4K":e>=720?"HD":""};s.default.registerComponent("QualityMenuButton",class extends n{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-label",this.localize("Quality Levels")),this.controlText("Quality Levels"),e.options().experimentalSvgIcons||this.$(".vjs-icon-placeholder").classList.add("vjs-icon-cog"),this.setIcon("cog"),this.qualityLevels_=e.qualityLevels(),this.update=this.update.bind(this),this.hide=this.hide.bind(this),this.handleQualityChange_=this.handleQualityChange_.bind(this),this.firstChangeHandler_=this.firstChangeHandler_.bind(this),this.enableDefaultResolution_=this.enableDefaultResolution_.bind(this),this.on(this.qualityLevels_,"addqualitylevel",this.update),this.on(this.qualityLevels_,"removequalitylevel",this.update),this.on(this.qualityLevels_,"change",this.handleQualityChange_),this.one(this.qualityLevels_,"change",this.firstChangeHandler_),e.on("adstart",this.hide),e.on(["adend","adtimeout"],this.update),this.update(),this.on("dispose",(()=>{this.off(this.qualityLevels_,"addqualitylevel",this.update),this.off(this.qualityLevels_,"removequalitylevel",this.update),this.off(this.qualityLevels_,"change",this.handleQualityChange_),this.off(this.qualityLevels_,"change",this.firstChangeHandler_),e.off("adstart",this.hide),e.off(["adend","adtimeout"],this.update),e.off("loadedmetadata",this.enableDefaultResolution_)}))}buildWrapperCSSClass(){return`vjs-quality-menu-wrapper ${super.buildWrapperCSSClass()}`}buildCSSClass(){return`vjs-quality-menu-button ${super.buildCSSClass()}`}createItems(){const e=[];if(!this.qualityLevels_||!this.qualityLevels_.length)return e;let t;if(this.options_.useResolutionLabels&&o(this.qualityLevels_)?(t=this.groupByResolution_(),this.addClass("vjs-quality-menu-button-use-resolution")):(t=this.groupByBitrate_(),this.removeClass("vjs-quality-menu-button-use-resolution")),t.length<=1)return[];t.forEach((t=>{t.levels.length&&(t.selectable=!0,e.push(new a(this.player(),t)))}));const s=new a(this.player(),{levels:Array.prototype.map.call(this.qualityLevels_,((e,t)=>t)),label:"Auto",controlText:"Auto",active:!0,selected:!0,selectable:!0});return this.autoMenuItem_=s,e.push(s),e}groupByResolution_(){const e={},t=[];for(let s=0,l=this.qualityLevels_.length;st.lines-e.lines));const s=[];return t.forEach((t=>{s.push(e[t.label])})),s}groupByBitrate_(){const e=[{levels:[],label:"HD",controlText:"High Definition"},{levels:[],label:"SD",controlText:"Standard Definition"}];for(let t=0,s=this.qualityLevels_.length;t=this.options_.sdBitrateLimit&&(s="HD")),"HD"===s?(this.addClass("vjs-quality-menu-button-HD-flag"),this.removeClass("vjs-quality-menu-button-4K-flag")):"4K"===s?(this.removeClass("vjs-quality-menu-button-HD-flag"),this.addClass("vjs-quality-menu-button-4K-flag")):(this.removeClass("vjs-quality-menu-button-HD-flag"),this.removeClass("vjs-quality-menu-button-4K-flag")),this.autoMenuItem_&&(this.autoMenuItem_.manuallySelected_&&e?this.autoMenuItem_.subLabel_.innerHTML=this.localize(s):this.autoMenuItem_.subLabel_.innerHTML="")}enableDefaultResolution_(){const e=this.options_.defaultResolution;for(let t=0;t{e.addClass("vjs-quality-menu");const s=e.getChild("controlBar"),l=s.addChild("QualityMenuButton",t,s.children_.length-2);return function(){e.removeClass("vjs-quality-menu"),s.removeChild(l),l.dispose()}},c=function(e){!function(e,t){if(void 0!==e.qualityLevels){e.qualityLevels();let s=()=>{};e.ready((()=>{s=r(e,t),e.on("loadstart",(()=>{s(),s=r(e,t)}))})),e.qualityMenu=()=>{},e.qualityMenu.VERSION=h}}(this,s.default.obj.merge(d,e))};return s.default.registerPlugin("qualityMenu",c),c.VERSION=h,c})); diff --git a/assets/src/blocks/rt-player/save.js b/assets/src/blocks/rt-player/save.js new file mode 100644 index 0000000..2646236 --- /dev/null +++ b/assets/src/blocks/rt-player/save.js @@ -0,0 +1,53 @@ +/** + * React hook that is used to mark the block wrapper element. + * It provides all the necessary props like the class name. + * + * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps + */ +/** + * WordPress dependencies + */ +import { useBlockProps } from '@wordpress/block-editor'; + +/** + * The save function defines the way in which the different attributes should + * be combined into the final markup, which is then serialized by the block + * editor into `post_content`. + * + * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#save + * + * @param {Object} props Block props. + * @param {Object} props.attributes Block's attributes. + * + * @return {HTMLElement} Element to render. + */ +export default function save( { attributes } ) { + const { videoUrl, videoAlt, videoSize, videoType, videoPosterUrl, useCustomSize } = attributes; + + const videoSetupOptions = { + controls: true, + autoplay: false, + preload: 'auto', + fluid: ! useCustomSize, + responsive: ! useCustomSize, + }; + + return ( +
+ { videoUrl && ( +
+ +
+ ) } +
+ ); +} diff --git a/assets/src/blocks/rt-player/style.scss b/assets/src/blocks/rt-player/style.scss new file mode 100644 index 0000000..f28dc73 --- /dev/null +++ b/assets/src/blocks/rt-player/style.scss @@ -0,0 +1,11 @@ +/** + * The following styles get applied both on the front of your site + * and in the editor. + * + * Replace them with your own styles or remove the file completely. + */ + + +.wp-block-trascoder-rt-player { + // Add your styles here. +} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..3f842b9 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,23 @@ +/** + * WordPress dependencies + */ +const defaultConfig = require( '@wordpress/babel-preset-default' ); + +module.exports = function( api ) { + const config = defaultConfig( api ); + + return { + ...config, + plugins: [ + ...config.plugins + ], + sourceMaps: true, + env: { + production: { + plugins: [ + ...config.plugins + ] + } + } + }; +}; diff --git a/inc/classes/class-assets.php b/inc/classes/class-assets.php new file mode 100644 index 0000000..4aebcbe --- /dev/null +++ b/inc/classes/class-assets.php @@ -0,0 +1,99 @@ + instead of in the . + * Default 'false'. + * @return bool Whether the script has been registered. True on success, false on failure. + */ + public function register_script( $handle, $file, $deps = array(), $ver = false, $in_footer = true ) { + + $src = sprintf( RT_TRANSCODER_URL . '/%s', $file ); + $asset_meta = $this->get_asset_meta( $file, $deps ); + + return wp_register_script( $handle, $src, $asset_meta['dependencies'], $asset_meta['version'], $in_footer ); + } + + /** + * Register a CSS stylesheet. + * + * @param string $handle Name of the stylesheet. Should be unique. + * @param string|bool $file Style file, path of the script relative to the assets/build/ directory. + * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array. + * @param string|bool|null $ver Optional. String specifying script version number, if not set, filetime will be used as version number. + * @param string $media Optional. The media for which this stylesheet has been defined. + * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like + * '(orientation: portrait)' and '(max-width: 640px)'. + * + * @return bool Whether the style has been registered. True on success, false on failure. + */ + public function register_style( $handle, $file, $deps = array(), $ver = false, $media = 'all' ) { + + $src = sprintf( RT_TRANSCODER_URL . '/%s', $file ); + $asset_meta = $this->get_asset_meta( $file, $deps ); + + return wp_register_style( $handle, $src, $asset_meta['dependencies'], $asset_meta['version'], $media ); + } + + /** + * Get asset dependencies and version info from {handle}.asset.php if exists. + * + * @param string $file File name. + * @param array $deps Script dependencies to merge with. + * @param string $ver Asset version string. + * + * @return array + */ + public function get_asset_meta( $file, $deps = array(), $ver = false ) { + $asset_meta_file = sprintf( '%s/%s.asset.php', untrailingslashit( RT_TRANSCODER_PATH ), basename( $file, '.' . pathinfo( $file )['extension'] ) ); + $asset_meta = is_readable( $asset_meta_file ) + ? require $asset_meta_file + : array( + 'dependencies' => array(), + 'version' => $this->get_file_version( $file, $ver ), + ); + + $asset_meta['dependencies'] = array_merge( $deps, $asset_meta['dependencies'] ); + + return $asset_meta; + } + + /** + * Get file version. + * + * @param string $file File path. + * @param int|string|boolean $ver File version. + * + * @return bool|false|int + */ + public function get_file_version( $file, $ver = false ) { + if ( ! empty( $ver ) ) { + return $ver; + } + + $file_path = sprintf( '%s/%s', RT_TRANSCODER_PATH, $file ); + + return file_exists( $file_path ) ? filemtime( $file_path ) : false; + } +} diff --git a/inc/classes/class-blocks.php b/inc/classes/class-blocks.php new file mode 100644 index 0000000..6223651 --- /dev/null +++ b/inc/classes/class-blocks.php @@ -0,0 +1,49 @@ +setup_hooks(); + } + + /** + * Setup hooks. + * + * @return void + */ + public function setup_hooks() { + add_action( 'init', array( $this, 'register_blocks' ) ); + } + + /** + * Register all custom gutenberg blocks. + * + * @return void + */ + public function register_blocks() { + + // Register example-block Block. + register_block_type( + RT_TRANSCODER_PATH . '/assets/build/blocks/easydam-player/' + ); + + } +} diff --git a/inc/classes/class-filesystem.php b/inc/classes/class-filesystem.php index 31275a0..9291472 100644 --- a/inc/classes/class-filesystem.php +++ b/inc/classes/class-filesystem.php @@ -22,7 +22,6 @@ class FileSystem { protected function __construct() { $this->init_file_system(); - } /** @@ -76,7 +75,5 @@ public static function delete_file( $file ) { global $wp_filesystem; return $wp_filesystem->delete( $file ); - } - } diff --git a/inc/helpers/autoloader.php b/inc/helpers/autoloader.php index b9e353e..ad3e638 100644 --- a/inc/helpers/autoloader.php +++ b/inc/helpers/autoloader.php @@ -79,7 +79,6 @@ function autoloader( $resource = '' ) { // We already making sure that file is exists and valid. require_once $resource_path; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable } - } spl_autoload_register( __NAMESPACE__ . '\autoloader' ); diff --git a/inc/traits/trait-singleton.php b/inc/traits/trait-singleton.php index c4d6f8b..e39d1d2 100644 --- a/inc/traits/trait-singleton.php +++ b/inc/traits/trait-singleton.php @@ -83,7 +83,5 @@ final public static function get_instance() { } return $instance[ $called_class ]; - } - } // End trait diff --git a/package.json b/package.json index 53ae851..2e5fa6e 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,43 @@ { "name": "transcoder", "scripts": { - "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack --mode production --progress", - "dev-test": "cross-env BABEL_ENV=default NODE_ENV=development webpack", - "dev": "cross-env BABEL_ENV=default webpack --watch --mode development --progress" - }, - "devDependencies": { - "babel-core": "^6.26.3", - "babel-eslint": "^10.0.1", - "babel-loader": "^7.1.1", - "babel-plugin-lodash": "3.2.11", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-transform-react-jsx": "^6.24.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "1.7.0", - "classnames": "2.2.5", - "cross-env": "^5.0.1", - "diff": "4.0.1", - "eslint": "4.18.2", - "eslint-config-wordpress": "2.0.0", - "eslint-plugin-jest": "21.5.0", - "eslint-plugin-jsx-a11y": "6.0.3", - "eslint-plugin-react": "7.5.1", - "eslint-plugin-wordpress": "git+https://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git", - "glob": "^7.1.2", - "grunt": "^1.0.1", - "grunt-autoprefixer": "^3.0.4", - "grunt-checktextdomain": "^1.0.1", - "grunt-contrib-cssmin": "3.0.0", - "grunt-contrib-uglify": "^2.0.0", - "grunt-contrib-watch": "^1.0.0", - "grunt-wp-i18n": "1.0.3", - "jest": "25.5.2", - "load-grunt-tasks": "5.1.0", - "serialize-javascript": "2.1.2", - "uglifyjs-webpack-plugin": "1.1.6", - "webpack": "4.41.2", - "webpack-cli": "3.3.11" + "build": "webpack --config webpack.config.js --mode production && npm run build:blocks", + "build:assets": "webpack --config webpack.config.js --mode production", + "start": "npm-run-all --parallel start:*", + "create:block": "./bin/block-scaffold/block.js", + "start:blocks": "wp-scripts start --config ./node_modules/@wordpress/scripts/config/webpack.config.js --webpack-src-dir=./assets/src/blocks/ --output-path=./assets/build/blocks/", + "build:blocks": "wp-scripts build --config ./node_modules/@wordpress/scripts/config/webpack.config.js --webpack-src-dir=./assets/src/blocks/ --output-path=./assets/build/blocks/ --mode production", + "test": "npm-run-all --parallel test:*", + "test:js": "wp-scripts test-unit-js --config=tests/js/jest.config.js --passWithNoTests", + "test:js:watch": "npm run test:js -- --watch", + "lint": "npm-run-all --parallel lint:*", + "lint:js": "wp-scripts lint-js ./assets/src", + "lint:js:fix": "npm run lint:js -- --fix ./assets/src" }, "dependencies": { - "@wordpress/api-fetch": "3.6.0" + "@wordpress/api-fetch": "^7.7.0", + "@wordpress/icons": "10.13.0", + "clsx": "2.1.1", + "video.js": "^8.19.1", + "videojs-contrib-dash": "^5.1.1", + "videojs-contrib-quality-levels": "4.1.0", + "videojs-contrib-quality-menu": "^1.0.3", + "videojs-hls-quality-selector": "2.0.0" + }, + "devDependencies": { + "@babel/core": "^7.24.5", + "@babel/preset-env": "^7.24.5", + "@wordpress/babel-preset-default": "^7.41.0", + "@wordpress/scripts": "^27.8.0", + "ajv": "6.12.6", + "cross-env": "^7.0.3", + "eslint": "^8.57.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jest": "^28.5.0", + "jest": "^29.0.0", + "npm-run-all": "^4.1.5", + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-remove-empty-scripts": "^1.0.4" } } diff --git a/phpcs.xml b/phpcs.xml index 617e6d7..31cda1c 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -38,7 +38,7 @@ as set in the "Requires at least" tag in the readme.txt file. --> - + @@ -48,5 +48,6 @@ */vendor/* .github/ */index.php + */build/* diff --git a/public-assets/js/build/transcoder.min.asset.php b/public-assets/js/build/transcoder.min.asset.php new file mode 100644 index 0000000..a5dccba --- /dev/null +++ b/public-assets/js/build/transcoder.min.asset.php @@ -0,0 +1 @@ + array(), 'version' => 'fd0a9a7cdb2f028af078'); diff --git a/public-assets/js/build/transcoder.min.js b/public-assets/js/build/transcoder.min.js index 929ac14..f8466ff 100644 --- a/public-assets/js/build/transcoder.min.js +++ b/public-assets/js/build/transcoder.min.js @@ -1 +1 @@ -!function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){const r={};let i=!1,o=!1;!function(e){e(document).ready(()=>{e(document).ajaxComplete((r,i,o)=>{"undefined"!=typeof bp_template_pack&&"legacy"!==bp_template_pack&&bp_template_pack&&"function"==typeof get_parameter&&"activity_filter"===get_parameter("action",o.data)&&setTimeout(()=>{e("#activity-stream > .activity-list > li .media-type-video > .rtmedia-item-thumbnail video").each((r,i)=>{if(void 0!==(i=e(i)).attr("poster")&&i.attr("poster").length>0||void 0===i.attr("id")||!i.attr("id").length)return;const o=parseInt(i.attr("id").replace(/^\D+/g,""));t(o)}),d()},1e3)}),e(".rtmedia-container ul.rtmedia-list.rtmedia-list-media.rtm-gallery-list > li.rtmedia-list-item").each((r,i)=>{const o=(i=e(i)).find("a.rtmedia-list-item-a > .rtmedia-item-thumbnail > img");o.length&&void 0!==o.attr("src")&&-1!==o.attr("src").search("video_thumb.png")&&t(parseInt(i.attr("id")))}),d(),"undefined"!=typeof rtMediaHook&&(rtMediaHook.register("rtmedia_js_file_added",e=>void 0===e||void 0===e[2]||-1===e[2].search("#rtmedia_uploader_filelist-activity-")||(i=!0,!0)),rtMediaHook.register("rtmedia_js_after_file_upload",e=>{if(void 0===e||void 0===e[1]||void 0===e[2])return!0;if("video"!==e[1].type.split("/")[0])return!0;const r=JSON.parse(e[2]);return!0===Array.isArray(r)&&void 0!==r[0]?(t(r[0]),!0===i&&(n(),i=!1),!0):void 0===r.media_id||(t(r.media_id),!0)}),rtMediaHook.register("rtmedia_js_after_files_uploaded",()=>(d(),!0)),rtMediaHook.register("rtmedia_js_after_activity_added",()=>(d(),!0)))});const t=e=>{void 0===r[e]&&(r[e]={})},n=()=>{if(!Object.entries(r).length)return;let t=[];for(const[e,i]of Object.entries(r))void 0!==e&&void 0!==i&&!1===l(i)&&t.push(e);t.length&&(t=t.join(),e.get(rtTranscoder.restURLPrefix+"/transcoder/v1/amp-rtmedia?media_ids="+t,e=>{a(e)}))},a=(e=!1)=>{if("object"==typeof e)for(const[t,i]of Object.entries(e)){if(void 0===t||void 0===i)continue;const e=parseInt(t);"invalid"!==i?!1!==l(i)&&(r[e]=i,s(e)):void 0!==r[e]&&delete r[e]}d()},d=()=>{!0!==o&&(o=!0,setTimeout(()=>{n(),o=!1},5e3))},s=t=>{if(void 0===r[t]||!l(r[t]))return;const i=e("li#"+t);if(i.length>0){const e=i.find("div.rtmedia-item-thumbnail > img");if(!e.length)return;return void e.attr("src",r[t].poster)}const o=e("video#rt_media_video_"+t);if(o.length>0)return void o.attr("poster",r[t].poster);const n=e("video#rt_media_video_"+t+"_from_mejs");n.length>0&&n.attr("poster",r[t].poster)},l=e=>void 0!==e.poster}(jQuery)}]); \ No newline at end of file +(()=>{const t={};let e=!1,i=!1;!function(r){r(document).ready((()=>{r(document).ajaxComplete(((t,e,i)=>{"undefined"!=typeof bp_template_pack&&"legacy"!==bp_template_pack&&bp_template_pack&&"function"==typeof get_parameter&&"activity_filter"===get_parameter("action",i.data)&&setTimeout((()=>{r("#activity-stream > .activity-list > li .media-type-video > .rtmedia-item-thumbnail video").each(((t,e)=>{if(void 0!==(e=r(e)).attr("poster")&&e.attr("poster").length>0||void 0===e.attr("id")||!e.attr("id").length)return;const i=parseInt(e.attr("id").replace(/^\D+/g,""));a(i)})),n()}),1e3)})),r(".rtmedia-container ul.rtmedia-list.rtmedia-list-media.rtm-gallery-list > li.rtmedia-list-item").each(((t,e)=>{const i=(e=r(e)).find("a.rtmedia-list-item-a > .rtmedia-item-thumbnail > img");i.length&&void 0!==i.attr("src")&&-1!==i.attr("src").search("video_thumb.png")&&a(parseInt(e.attr("id")))})),n(),"undefined"!=typeof rtMediaHook&&(rtMediaHook.register("rtmedia_js_file_added",(t=>(void 0===t||void 0===t[2]||-1===t[2].search("#rtmedia_uploader_filelist-activity-")||(e=!0),!0))),rtMediaHook.register("rtmedia_js_after_file_upload",(t=>{if(void 0===t||void 0===t[1]||void 0===t[2])return!0;if("video"!==t[1].type.split("/")[0])return!0;const i=JSON.parse(t[2]);return!0===Array.isArray(i)&&void 0!==i[0]?(a(i[0]),!0===e&&(d(),e=!1),!0):void 0===i.media_id||(a(i.media_id),!0)})),rtMediaHook.register("rtmedia_js_after_files_uploaded",(()=>(n(),!0))),rtMediaHook.register("rtmedia_js_after_activity_added",(()=>(n(),!0))))}));const a=e=>{void 0===t[e]&&(t[e]={})},d=()=>{if(!Object.entries(t).length)return;let e=[];for(const[i,r]of Object.entries(t))void 0!==i&&void 0!==r&&!1===m(r)&&e.push(i);e.length&&(e=e.join(),r.get(rtTranscoder.restURLPrefix+"/transcoder/v1/amp-rtmedia?media_ids="+e,(t=>{o(t)})))},o=(e=!1)=>{if("object"==typeof e)for(const[i,r]of Object.entries(e)){if(void 0===i||void 0===r)continue;const e=parseInt(i);"invalid"!==r?!1!==m(r)&&(t[e]=r,s(e)):void 0!==t[e]&&delete t[e]}n()},n=()=>{!0!==i&&(i=!0,setTimeout((()=>{d(),i=!1}),5e3))},s=e=>{if(void 0===t[e]||!m(t[e]))return;const i=r("li#"+e);if(i.length>0){const r=i.find("div.rtmedia-item-thumbnail > img");if(!r.length)return;return void r.attr("src",t[e].poster)}const a=r("video#rt_media_video_"+e);if(a.length>0)return void a.attr("poster",t[e].poster);const d=r("video#rt_media_video_"+e+"_from_mejs");d.length>0&&d.attr("poster",t[e].poster)},m=t=>void 0!==t.poster}(jQuery)})(); \ No newline at end of file diff --git a/rt-transcoder.php b/rt-transcoder.php index a0618d4..57a8bd4 100644 --- a/rt-transcoder.php +++ b/rt-transcoder.php @@ -46,6 +46,27 @@ define( 'RT_TRANSCODER_NO_MAIL', true ); } +if ( ! defined( 'TRANSCODER_ASSETS_BUILD' ) ) { + /** + * The build directory for assets + */ + define( 'TRANSCODER_ASSETS_BUILD', RT_TRANSCODER_PATH . 'assets/build' ); +} + +if ( ! defined( 'TRANSCODER_BLOCK_SRC' ) ) { + /** + * The source directory for blocks + */ + define( 'TRANSCODER_BLOCK_SRC', RT_TRANSCODER_PATH . 'assets/src/blocks' ); +} + +if ( ! defined( 'TRANSCODER_BLOCK_BUILD' ) ) { + /** + * The build directory for blocks + */ + define( 'TRANSCODER_BLOCK_BUILD', RT_TRANSCODER_PATH . 'assets/build/blocks' ); +} + require_once RT_TRANSCODER_PATH . 'inc/helpers/autoloader.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant require_once RT_TRANSCODER_PATH . 'inc/helpers/custom-functions.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant require_once RT_TRANSCODER_PATH . 'admin/rt-transcoder-functions.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant @@ -58,6 +79,11 @@ */ \Transcoder\Inc\FileSystem::get_instance(); +/** + * Initiate blocks. + */ +\Transcoder\Inc\Blocks::get_instance(); + $rt_transcoder_admin = new RT_Transcoder_Admin(); /** diff --git a/webpack.config.js b/webpack.config.js index 76f9518..0b7154f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,81 +1,132 @@ /** - * Webpack configuration file. - * - * @package transcoder + * External dependencies */ +const path = require('path'); +const glob = require('glob'); +const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); -/* global process */ +/** + * WordPress dependencies + */ +const defaultConfig = require('@wordpress/scripts/config/webpack.config'); + +// Extend the default config. +const sharedConfig = { + ...defaultConfig, + devtool: false, + plugins: [ + ...defaultConfig.plugins.map((plugin) => { + if (plugin.constructor.name === 'MiniCssExtractPlugin') { + return new MiniCssExtractPlugin({ + filename: '[name].min.css', + }); + } + return plugin; + }), + new RemoveEmptyScriptsPlugin(), + ], + optimization: { + ...defaultConfig.optimization, + minimizer: [ + '...', + new CssMinimizerPlugin(), + ], + splitChunks: { + ...defaultConfig.optimization.splitChunks, + }, + }, +}; -const webpack = require( 'webpack' ); -const glob = require( 'glob' ); -const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' ); +// Configuration for the block editor support script. +const blockEditorSupport = { + ...sharedConfig, + entry: { + blocks: path.resolve( + process.cwd(), + 'admin', + 'js', + 'rt-transcoder-block-editor-support.js' + ), + }, + output: { + filename: 'rt-transcoder-block-editor-support.build.js', + path: path.resolve(__dirname, 'admin', 'js', 'build'), + }, + externals: { + react: 'React', + 'react-dom': 'ReactDOM', + 'react-dom/server': 'ReactDOMServer', + tinymce: 'tinymce', + moment: 'moment', + jquery: 'jQuery', + '@wordpress/components': 'wp.components', + }, +}; -const externals = { - react: 'React', - 'react-dom': 'ReactDOM', - 'react-dom/server': 'ReactDOMServer', - tinymce: 'tinymce', - moment: 'moment', - jquery: 'jQuery', - '@wordpress/components': 'wp.components' // Not really a package. +// Configuration for the public-facing transcoder script. +const transcoderJS = { + ...sharedConfig, + entry: { + 'transcoder.min': path.resolve( + process.cwd(), + 'public-assets', + 'js', + 'transcoder.js' + ), + }, + output: { + filename: '[name].js', + path: path.resolve(__dirname, 'public-assets', 'js', 'build'), + }, }; -module.exports = [ - { - entry: { - blocks: glob.sync( './admin/js/rt-transcoder-block-editor-support.js' ) - }, - output: { - filename: './admin/js/build/rt-transcoder-block-editor-support.build.js', - path: __dirname - }, - externals, - resolve: { - modules: [ - __dirname, - 'node_modules' - ] - }, - module: { - rules: [ - { - test: /.js?$/, - loader: 'babel-loader', - exclude: /node_modules/ - } - ] - }, - plugins: [ - new webpack.DefinePlugin( { - 'process.env.NODE_ENV': JSON.stringify( process.env.NODE_ENV || 'development' ) - } ) - ] - }, - { - entry: './public-assets/js/transcoder.js', - output: { - filename: './public-assets/js/build/transcoder.min.js', - path: __dirname - } - } +// Configuration for processing all admin JS and CSS files. +const jsFiles = glob.sync('./admin/js/**/!(*.min).js', { + ignore: [ + './admin/js/build/**/*.js', + ], +}); + +const cssFiles = glob.sync('./admin/css/**/!(*.min).css'); + +const files = [...jsFiles, ...cssFiles]; + +// Create an entries object mapping names to file paths. +const entries = {}; +const skipFiles = [ + 'jquery-ui-1.7.2.custom.css', + 'rt-transcoder-block-editor-support.js', ]; -if ( process.env.NODE_ENV === 'production' ) { - for ( var moduleConfig of module.exports ) { - moduleConfig.plugins = ( - moduleConfig.plugins || [] - ).concat( - [ - new UglifyJsPlugin( { - sourceMap: true, - uglifyOptions: { - ecma: 8, - compress: { - warnings: false - } - } - } ) - ] - ); - } -} +files.forEach((file) => { + if (skipFiles.some((skipFile) => file.includes(skipFile))) { + return; + } + const extname = path.extname(file); + const relativePath = path + .relative(path.resolve(__dirname, 'admin'), file) + .replace(extname, '') + .replace(/\\/g, '/'); + entries[relativePath] = path.resolve(__dirname, file); +}); + +// Configuration for processing all admin JS and CSS files. +const adminAssetsConfig = { + ...sharedConfig, + entry: entries, + output: { + filename: '[name].min.js', + path: path.resolve(__dirname, 'admin'), + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].min.css', + }), + new RemoveEmptyScriptsPlugin(), + ], +}; + +// Export the configurations. +module.exports = [blockEditorSupport, transcoderJS, adminAssetsConfig];