mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
63 lines
35 KiB
JavaScript
63 lines
35 KiB
JavaScript
/*!
|
||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||
* (c) 2017-2023 Harvey Zack
|
||
* Released under the MIT License.
|
||
*/
|
||
!// modules are defined as an array
|
||
// [ module function, map of requires ]
|
||
//
|
||
// map of requires is short require name -> numeric require
|
||
//
|
||
// anything defined in a previous bundle is accessed via the
|
||
// orig method which is the require for previous bundles
|
||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],s=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||
// cache jump to the current global require ie. the last bundle
|
||
// that was added to the page.
|
||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||
// previous one is saved to 'previousRequire'. Repeat this as
|
||
// many times as there are bundles until the module is found or
|
||
// we exhaust the require chain.
|
||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||
if(u&&"string"==typeof t)return u(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=s[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=a,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var l=0;l<t.length;l++)c(t[l]);if(r){// Expose entry point to Node, AMD or browser globals
|
||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||
var f=c(r);// CommonJS
|
||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):o&&(this[o]=f)}}({"2hz0c":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return p});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_object_spread"),a=e("@swc/helpers/_/_object_spread_props"),s=e("@swc/helpers/_/_to_consumable_array"),u=e("@swc/helpers/_/_ts_generator"),c=e("./parser");function l(e){var t={"&":"&","<":"<",">":">","'":"'",""":'"'},r=RegExp("(".concat(Object.keys(t).join("|"),")"),"g");return e.replace(r,function(e){return t[e]||e})}function f(){return(f=(0,o._)(function(e,t){var r,n,o,i,a,s;return(0,u._)(this,function(u){switch(u.label){case 0:return n=(r=t.constructor.utils).getExt,o=r.srtToVtt,i=r.assToVtt,[4,fetch(e.url)];case 1:return[4,u.sent().arrayBuffer()];case 2:switch(a=u.sent(),s=new TextDecoder(e.encoding||"utf-8").decode(a),e.type||n(e.url)){case"srt":return[2,o(s)];case"ass":return[2,i(s)];case"vtt":return[2,s];default:return[2,""]}return[2]}})})).apply(this,arguments)}function p(e){var t,r=e.subtitles;return t=(0,o._)(function(e){var t,n;return(0,u._)(this,function(o){switch(o.label){case 0:return[4,Promise.all(r.map(function(t){return function(e,t){return f.apply(this,arguments)}(t,e)}))];case 1:return t=function(e,t){for(var r=new c.WebVTTParser,n=new c.WebVTTSerializer,o=r.parse("","metadata"),i=0;i<e.length;i++){for(var a,u,l,f=t[i],p=r.parse(e[i],"metadata"),d=0;d<p.cues.length;d++)for(var _=p.cues[d],h=0;h<_.tree.children.length;h++){var m=_.tree.children[h];m.value='<div class="art-subtitle-'.concat(f.name,'">').concat(m.value,"</div>")}if(0===o.cues.length)o.cues=p.cues;else for(var y=0;y<o.cues.length;y++)(a=o.cues[y].tree.children).push.apply(a,(0,s._)((null===(l=p.cues[y])||void 0===l?void 0:null===(u=l.tree)||void 0===u?void 0:u.children)||[]))}return n.serialize(o.cues)}(o.sent(),r),n=URL.createObjectURL(new Blob([t],{type:"text/vtt"})),e.option.subtitle.escape=!1,e.subtitle.init((0,a._)((0,i._)({},e.option.subtitle),{url:n,type:"vtt",onVttLoad:l})),[2]}})}),function(e){return t.apply(this,arguments)}}p.env="production",p.version="1.0.0",p.build="2023-11-23 23:32:53","undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=p)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_object_spread":"9agdF","@swc/helpers/_/_object_spread_props":"gJNH2","@swc/helpers/_/_to_consumable_array":"iwLF0","@swc/helpers/_/_ts_generator":"6Xyd0","./parser":"8YYw5","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){r(e);return}s.done?t(u):Promise.resolve(u).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(e){o(a,n,i,s,u,"next",e)}function u(e){o(a,n,i,s,u,"throw",e)}s(void 0)})}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",function(){return i}),n.export(r,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"9agdF":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_object_spread",function(){return i}),n.export(r,"_",function(){return i});var o=e("./_define_property.js");function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){(0,o._define_property)(e,t,r[t])})}return e}},{"./_define_property.js":"3NGsL","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"3NGsL":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n.defineInteropFlag(r),n.export(r,"_define_property",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gJNH2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}n.defineInteropFlag(r),n.export(r,"_object_spread_props",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iwLF0:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_to_consumable_array",function(){return u}),n.export(r,"_",function(){return u});var o=e("./_array_without_holes.js"),i=e("./_iterable_to_array.js"),a=e("./_non_iterable_spread.js"),s=e("./_unsupported_iterable_to_array.js");function u(e){return(0,o._array_without_holes)(e)||(0,i._iterable_to_array)(e)||(0,s._unsupported_iterable_to_array)(e)||(0,a._non_iterable_spread)()}},{"./_array_without_holes.js":"cuL6A","./_iterable_to_array.js":"2thrs","./_non_iterable_spread.js":"a8nO2","./_unsupported_iterable_to_array.js":"5m31D","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],cuL6A:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_array_without_holes",function(){return i}),n.export(r,"_",function(){return i});var o=e("./_array_like_to_array.js");function i(e){if(Array.isArray(e))return(0,o._array_like_to_array)(e)}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}n.defineInteropFlag(r),n.export(r,"_array_like_to_array",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"2thrs":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}n.defineInteropFlag(r),n.export(r,"_iterable_to_array",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],a8nO2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.defineInteropFlag(r),n.export(r,"_non_iterable_spread",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"5m31D":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_unsupported_iterable_to_array",function(){return i}),n.export(r,"_",function(){return i});var o=e("./_array_like_to_array.js");function i(e,t){if(e){if("string"==typeof e)return(0,o._array_like_to_array)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return(0,o._array_like_to_array)(e,t)}}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"6Xyd0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_",function(){return o.__generator}),n.export(r,"_ts_generator",function(){return o.__generator});var o=e("tslib")},{tslib:"c0d7h","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],c0d7h:[function(e,t,r){/******************************************************************************
|
||
Copyright (c) Microsoft Corporation.
|
||
|
||
Permission to use, copy, modify, and/or distribute this software for any
|
||
purpose with or without fee is hereby granted.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
PERFORMANCE OF THIS SOFTWARE.
|
||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return a}),n.export(r,"__assign",function(){return s}),n.export(r,"__rest",function(){return u}),n.export(r,"__decorate",function(){return c}),n.export(r,"__param",function(){return l}),n.export(r,"__esDecorate",function(){return f}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return _}),n.export(r,"__metadata",function(){return h}),n.export(r,"__awaiter",function(){return m}),n.export(r,"__generator",function(){return y}),n.export(r,"__createBinding",function(){return v}),n.export(r,"__exportStar",function(){return g}),n.export(r,"__values",function(){return b}),n.export(r,"__read",function(){return j}),/** @deprecated */n.export(r,"__spread",function(){return w}),/** @deprecated */n.export(r,"__spreadArrays",function(){return x}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return T}),n.export(r,"__asyncGenerator",function(){return P}),n.export(r,"__asyncDelegator",function(){return S}),n.export(r,"__asyncValues",function(){return I}),n.export(r,"__makeTemplateObject",function(){return E}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return A}),n.export(r,"__classPrivateFieldGet",function(){return k}),n.export(r,"__classPrivateFieldSet",function(){return W}),n.export(r,"__classPrivateFieldIn",function(){return z}),n.export(r,"__addDisposableResource",function(){return N}),n.export(r,"__disposeResources",function(){return R});var o=e("@swc/helpers/_/_type_of"),i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){return function(r,n){t(r,n,e)}}function f(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var m=(0,r[d])("accessor"===u?{get:f.get,set:f.set}:f[c],_);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(s=a(m.get))&&(f.get=s),(s=a(m.set))&&(f.set=s),(s=a(m.init))&&o.unshift(s)}else(s=a(m))&&("field"===u?o.unshift(s):f[c]=s)}l&&Object.defineProperty(l,n.name,f),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function _(e,t,r){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})}function y(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var v=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function g(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||v(t,e,r)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function O(e,t,r){if(r||2==arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function T(e){return this instanceof T?(this.v=e,this):new T(e)}function P(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||s(e,t)})})}function s(e,t){try{var r;(r=o[e](t)).value instanceof T?Promise.resolve(r.value.v).then(u,c):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:T(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,o,(t=e[r](t)).done,t.value)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var D=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function F(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&v(t,e,r);return D(t,e),t}function A(e){return e&&e.__esModule?e:{default:e}}function k(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function W(e,t,r,n,o){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!o)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function z(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function N(e,t,r){if(null!=t){var n;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function R(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,function(e){return t(e),r()})}catch(e){t(e)}}if(e.hasError)throw e.error}()}r.default={__extends:a,__assign:s,__rest:u,__decorate:c,__param:l,__metadata:h,__awaiter:m,__generator:y,__createBinding:v,__exportStar:g,__values:b,__read:j,__spread:w,__spreadArrays:x,__spreadArray:O,__await:T,__asyncGenerator:P,__asyncDelegator:S,__asyncValues:I,__makeTemplateObject:E,__importStar:F,__importDefault:A,__classPrivateFieldGet:k,__classPrivateFieldSet:W,__classPrivateFieldIn:z,__addDisposableResource:N,__disposeResources:R}},{"@swc/helpers/_/_type_of":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}n.defineInteropFlag(r),n.export(r,"_type_of",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"8YYw5":[function(e,t,r){var n=e("@swc/helpers/_/_object_spread");!// Any copyright is dedicated to the Public Domain.
|
||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||
// Not intended to be fast, but if you can make it faster, please help out!
|
||
/* eslint-disable */function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":"\xa0"}),this.entities=t,this.parse=function(r,n){// global search and replace for \0
|
||
r=r.replace(/\0/g,"�");var a=Date.now(),s=0,u=r.split(/\r\n|\r|\n/),c=!1,l=[],f=[],p=[];function d(e,t){p.push({message:e,line:s+1,col:t})}var _=u[s],h=_.length,m="WEBVTT",y=0,v=m.length;/* HEADER */for("\uFEFF"===_[0]&&(y=1,v+=1),(h<v||_.indexOf(m)!==0+y||h>v&&" "!==_[v]&&" "!==_[v])&&d('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=u[s]&&void 0!=u[s];){if(d("No blank line after the signature."),-1!=u[s].indexOf("-->")){c=!0;break}s++}/* CUE LOOP */for(;void 0!=u[s];){for(;!c&&""==u[s];)s++;if(!c&&void 0==u[s])break;/* CUE CREATION */g=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var g,b=!0;if(-1==u[s].indexOf("-->")){/* COMMENTS
|
||
Not part of the specification's parser as these would just be ignored. However,
|
||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||
*/if(g.id=u[s],/^NOTE($|[ \t])/.test(g.id)){for(// .startsWith fails in Chrome
|
||
s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&d("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(g.id)){var j=[],w=!1;for(s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&(d("Cannot have timestamp in a style block."),w=!0),j.push(u[s]),s++;if(f.length){d("Style blocks cannot appear after the first cue.");continue}w||l.push(j.join("\n"));continue}if(""==u[++s]||void 0==u[s]){d("Cue identifier cannot be standalone.");continue}if(-1==u[s].indexOf("-->")){b=!1,d("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */c=!1;var x=new o(u[s],d),O=0;if(f.length>0&&(O=f[f.length-1].startTime),b&&!x.parse(g,O)){/* BAD CUE LOOP */for(/* BAD CUE */g=null,s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){c=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){d("Blank line missing before cue."),c=!0;break}""!=g.text&&(g.text+="\n"),g.text+=u[s],s++}/* CUE TEXT PROCESSING */var T=new i(g.text,d,n,t);g.tree=T.parse(g.startTime,g.endTime),f.push(g)}/* END */return f.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:f,errors:p,time:Date.now()-a,styles:l}}},o=function(e,t){var r=/[\u0020\t\f]/,n=/[^\u0020\t\f]/,e=e,o=0,i=function(e){t(e,o+1)};function a(t){for(;void 0!=e[o]&&t.test(e[o]);)o++}function s(t){for(var r="";void 0!=e[o]&&t.test(e[o]);)r+=e[o],o++;return r}/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */function u(){var t,r,n,a,u="minutes";// 3
|
||
if(void 0==e[o]){i("No timestamp found.");return}// 4
|
||
if(!/\d/.test(e[o])){i("Timestamp must start with a character in the range 0-9.");return}// 8
|
||
if((// 5-7
|
||
(t=s(/\d/)).length>2||parseInt(t,10)>59)&&(u="hours"),":"!=e[o]){i("No time unit separator found.");return}if(o++,2!=// 9-11
|
||
(r=s(/\d/)).length){i("Must be exactly two digits.");return}// 12
|
||
if("hours"==u||":"==e[o]){if(":"!=e[o]){i("No seconds found or minutes is greater than 59.");return}if(o++,2!=(n=s(/\d/)).length){i("Must be exactly two digits.");return}}else{if(2!=t.length){i("Must be exactly two digits.");return}n=r,r=t,t="0"}// 13
|
||
if("."!=e[o]){i('No decimal separator (".") found.');return}if(o++,3!=// 14-16
|
||
(a=s(/\d/)).length){i("Milliseconds must be given in three digits.");return}// 17
|
||
if(parseInt(r,10)>59){i("You cannot have more than 59 minutes.");return}if(parseInt(n,10)>59){i("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(r,10)+parseInt(n,10)+parseInt(a,10)/1e3}this.parse=function(t,s){if(a(r),t.startTime=u(),void 0!=t.startTime){// 6-8
|
||
if(t.startTime<s&&i("Start timestamp is not greater than or equal to start timestamp of previous cue."),n.test(e[o])&&i("Timestamp not separated from '-->' by whitespace."),a(r),"-"!=e[o]||"-"!=e[++o]||">"!=e[++o]){i("No valid timestamp separator found.");return}if(o++,n.test(e[o])&&i("'-->' not separated from timestamp by whitespace."),a(r),t.endTime=u(),void 0!=t.endTime)return t.endTime<=t.startTime&&i("End timestamp is not greater than start timestamp."),n.test(e[o]),a(r),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var n=e.split(r),o=[],a=0;a<n.length;a++)if(""!=n[a]){var s=n[a].indexOf(":"),u=n[a].slice(0,s),c=n[a].slice(s+1);if(-1!=o.indexOf(u)&&i("Duplicate setting."),o.push(u),""==c){i("No value for setting defined.");return}if("vertical"==u){// writing direction
|
||
if("rl"!=c&&"lr"!=c){i("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=c}else if("line"==u){// line position and optionally line alignment
|
||
if(/,/.test(c)){var l=c.split(",");c=l[0];var f=l[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(c)){i("Line position takes a number or percentage.");continue}if(-1!=c.indexOf("-",1)){i("Line position can only have '-' at the start.");continue}if(-1!=c.indexOf("%")&&c.indexOf("%")!=c.length-1){i("Line position can only have '%' at the end.");continue}if("-"==c[0]&&"%"==c[c.length-1]){i("Line position cannot be a negative percentage.");continue}var p=c,d=!1;if("%"==c[c.length-1]&&(d=!0,p=c.slice(0,c.length-1),parseInt(c,10)>100)){i("Line position cannot be >100%.");continue}if(""===p||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==f){if(!["start","center","end"].includes(f)){i("Line alignment needs to be one of start, center or end");continue}t.lineAlign=f}t.snapToLines=!d,t.linePosition=parseFloat(p),parseFloat(p).toString()!==p&&(t.nonSerializable=!0)}else if("position"==u){// text position and optional positionAlign
|
||
if(/,/.test(c)){var l=c.split(",");c=l[0];var _=l[1]}if("%"!=c[c.length-1]){i("Text position must be a percentage.");continue}if(parseInt(c,10)>100||0>parseInt(c,10)){i("Text position needs to be between 0 and 100%.");continue}if(""===(p=c.slice(0,c.length-1))||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==_){if(!["line-left","center","line-right"].includes(_)){i("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=_}t.textPosition=parseFloat(p)}else if("size"==u){// size
|
||
if("%"!=c[c.length-1]){i("Size must be a percentage.");continue}if(parseInt(c,10)>100){i("Size cannot be >100%.");continue}var h=c.slice(0,c.length-1);if(void 0===h||""===h||isNaN(h)){i("Size needs to be a number"),h=100;continue}if((h=parseFloat(h))<0||h>100){i("Size needs to be between 0 and 100%.");continue}t.size=h}else if("align"==u){// alignment
|
||
var m=["start","center","end","left","right"];if(-1==m.indexOf(c)){i("Alignment can only be set to one of "+m.join(", ")+".");continue}t.alignment=c}else i("Invalid setting.")}}(e.substring(o),t),!0}},this.parseTimestamp=function(){var t=u();if(void 0!=e[o]){i("Timestamp must not have trailing characters.");return}return t}},i=function(e,t,r,i){this.entities=i;var a=this,e=e,s=0,u=function(e){"metadata"!=r&&t(e,s+1)};this.parse=function(t,c){var l={children:[]},f=l,p=[];function d(e){f.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:f}),f=f.children[f.children.length-1]}for(;void 0!=e[s];){var _=function(){for(var t="data",r="",n="",o=[];void 0!=e[s-1]||0==s;){var c=e[s];if("data"==t){if("&"==c)n=c,t="escape";else if("<"==c&&""==r)t="tag";else{if("<"==c||void 0==c)return["text",r];r+=c}}else if("escape"==t){if("<"==c||void 0==c){u("Incorrect escape.");var l=void 0;return(l=n.match(/^&#([0-9]+)$/))?r+=String.fromCharCode(l[1]):a.entities[n]?r+=a.entities[n]:r+=n,["text",r]}if("&"==c)u("Incorrect escape."),r+=n,n=c;else if(/[a-z#0-9]/i.test(c))n+=c;else if(";"==c){var f=void 0;(f=n.match(/^&#(x?[0-9]+)$/))?r+=String.fromCharCode("0"+f[1]):a.entities[n+c]?r+=a.entities[n+c]:(f=Object.keys(i).find(function(e){return n.startsWith(e)}))?r+=a.entities[f]+n.slice(f.length)+c:(u("Incorrect escape."),r+=n+";"),t="data"}else u("Incorrect escape."),r+=n+c,t="data"}else if("tag"==t){if(" "==c||"\n"==c||"\f"==c||" "==c)t="start tag annotation";else if("."==c)t="start tag class";else if("/"==c)t="end tag";else if(/\d/.test(c))r=c,t="timestamp tag";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag","",[],""];r=c,t="start tag"}}else if("start tag"==t){if(" "==c||"\f"==c||" "==c)t="start tag annotation";else if("\n"==c)n=c,t="start tag annotation";else if("."==c)t="start tag class";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,[],""];r+=c}}else if("start tag class"==t){if(" "==c||"\f"==c||" "==c)n&&o.push(n),n="",t="start tag annotation";else if("\n"==c)n&&o.push(n),n=c,t="start tag annotation";else if("."==c)n&&o.push(n),n="";else{if(">"==c||void 0==c)return">"==c&&s++,n&&o.push(n),["start tag",r,o,""];n+=c}}else if("start tag annotation"==t){if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,o,n=n.split(/[\u0020\t\f\r\n]+/).filter(function(e){if(e)return!0}).join(" ")];n+=c}else if("end tag"==t){if(">"==c||void 0==c)return">"==c&&s++,["end tag",r];r+=c}else if("timestamp tag"==t){if(">"==c||void 0==c)return">"==c&&s++,["timestamp",r];r+=c}else u("Never happens.");// The joke is it might.
|
||
// 8
|
||
s++}}();if("text"==_[0])f.children.push({type:"text",value:_[1],parent:f});else if("start tag"==_[0]){"chapters"==r&&u("Start tags not allowed in chapter title text.");var h=_[1];"v"!=h&&"lang"!=h&&""!=_[3]&&u("Only <v> and <lang> can have an annotation."),"c"==h||"i"==h||"b"==h||"u"==h||"ruby"==h?d(_):"rt"==h&&"ruby"==f.name?d(_):"v"==h?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&u("<v> cannot be nested inside itself."),d(_),f.value=_[3],_[3]||u("<v> requires an annotation.")):"lang"==h?(d(_),f.value=_[3]):u("Incorrect start tag.")}else if("end tag"==_[0])"chapters"==r&&u("End tags not allowed in chapter title text."),_[1]==f.name?f=f.parent:"ruby"==_[1]&&"rt"==f.name?f=f.parent.parent:u("Incorrect end tag.");else if("timestamp"==_[0]){"chapters"==r&&u("Timestamp not allowed in chapter title text.");var m=new o(_[1],u).parseTimestamp();void 0!=m&&((m<=t||m>=c)&&u("Timestamp must be between start timestamp and end timestamp."),p.length>0&&p[p.length-1]>=m&&u("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:m,parent:f}),p.push(m))}}for(;f.parent;)"v"!=f.name&&u("Required end tag missing."),f=f.parent;return function e(t){var r=(0,n._)({},t);return t.children&&(r.children=t.children.map(e)),r.parent&&delete r.parent,r}(l)}},a=function(){function t(e){var t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),r=0,n=0,o=0;return e>=3600&&(r=Math.floor(e/3600)),n=Math.floor((e-3600*r)/60),o=Math.floor(e-3600*r-60*n),(r?r+":":"")+(""+n).padStart(2,"0")+":"+(""+o).padStart(2,"0")+"."+t}this.serialize=function(r,n){var o="WEBVTT\n\n";if(n)for(var i=0;i<n.length;i++)o+="STYLE\n"+n[i]+"\n\n";for(var i=0;i<r.length;i++)o+=function(r){var n,o;return(void 0!==r.id?r.id+"\n":"")+t(r.startTime)+" --> "+t(r.endTime)+(n="",(o=Object.keys(e).filter(function(t){return r[t]!==e[t]})).includes("direction")&&(n+=" vertical:"+r.direction),o.includes("alignment")&&(n+=" align:"+r.alignment),o.includes("size")&&(n+=" size:"+r.size+"%"),(o.includes("lineAlign")||o.includes("linePosition"))&&(n+=" line:"+r.linePosition+(r.snapToLines?"":"%")+(r.lineAlign&&r.lineAlign!=e.lineAlign?","+r.lineAlign:"")),(o.includes("textPosition")||o.includes("positionAlign"))&&(n+=" position:"+r.textPosition+"%"+(r.positionAlign&&r.positionAlign!==e.positionAlign?","+r.positionAlign:"")),n)+"\n"+function e(r){for(var n="",o=0;o<r.length;o++){var i=r[o];if("text"==i.type)n+=i.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==i.type){if(n+="<"+i.name,i.classes)for(var a=0;a<i.classes.length;a++)n+="."+i.classes[a];i.value&&(n+=" "+i.value),n+=">",i.children&&(n+=e(i.children)),n+="</"+i.name+">"}else"timestamp"==i.type?n+="<"+t(i.value)+">":n+="<"+i.value+">"}return n}(r.tree.children)+"\n\n"}(r[i]);return o}};function s(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=o,e.WebVTTCueTextParser=i,e.WebVTTSerializer=a}"undefined"!=typeof window&&s(window),s(r)}()},{"@swc/helpers/_/_object_spread":"9agdF"}]},["2hz0c"],"2hz0c","parcelRequire4dc0"); |