mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
Refactor utility functions for improved readability and consistency - Updated compatibility.js to use consistent line endings and formatting. - Refactored component.js for better readability and structure, including consistent use of arrow functions and binding. - Simplified dom.js functions with consistent formatting and improved readability. - Enhanced emitter.js with consistent formatting and arrow function usage. - Streamlined error.js for improved readability and consistency. - Refactored file.js to use consistent formatting and improved readability. - Improved format.js functions for better readability and consistency. - Updated index.js to maintain consistent export formatting. - Refactored property.js for improved readability and consistency. - Enhanced subtitle.js with consistent formatting and improved readability. - Refactored time.js for better readability and consistent formatting. fix: update lint script to target only source files for consistency Revert "fix: restore export statements for various plugins and update type definitions for better clarity" This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f. fix: restore export statements for various plugins and update type definitions for better clarity Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
8 lines
31 KiB
JavaScript
8 lines
31 KiB
JavaScript
|
||
/*!
|
||
* artplayer-plugin-multiple-subtitles.js v1.1.0
|
||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||
* (c) 2017-2025 Harvey Zack
|
||
* Released under the MIT License.
|
||
*/
|
||
!function(e,t,n,r,i,o,a,s){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof c[r]&&c[r],f=u.i||{},l=u.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof c[r]&&c[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}f.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},f.cache={};var s=l[t]=new d.Module(t);e[t][0].call(s.exports,f,s,s.exports,c)}return l[t].exports;function f(e){var t=f.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=l,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=f,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return c[r]}}),c[r]=d;for(var v=0;v<t.length;v++)d(t[v]);if(n){var h=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({bNEbP:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return l});var o=e("@swc/helpers/cjs/_async_to_generator.cjs"),a=e("@swc/helpers/cjs/_object_spread.cjs"),s=e("@swc/helpers/cjs/_object_spread_props.cjs"),c=e("@swc/helpers/cjs/_to_consumable_array.cjs"),u=e("@swc/helpers/cjs/_ts_generator.cjs"),f=e("./parser");function l(e){var t=e.subtitles,n=void 0===t?[]:t;return function(e){return(0,o._)(function(){var t,r,i,l,p,d,v,h,m;function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=function(e){for(var t=new(0,f.WebVTTParser)().parse("","metadata"),n=0;n<e.length;n++){var r,i=e[n];if(!i.updated){i.updated=!0;for(var o=0;o<i.cues.length;o++)for(var a=i.cues[o],s=0;s<a.tree.children.length;s++){var u=a.tree.children[s];u.value='<div class="art-subtitle-'.concat(i.name,'">').concat(u.value,"</div>")}}(r=t.cues).push.apply(r,(0,c._)(i.cues))}return t}(t),i=v.serialize(n.cues);URL.revokeObjectURL(m);var o=URL.createObjectURL(new Blob([i],{type:"text/vtt"}));m=o,e.option.subtitle.escape=!1,e.subtitle.init((0,s._)((0,a._)({},e.option.subtitle),{url:o,type:"vtt",onVttLoad:r}))}return(0,u._)(this,function(a){switch(a.label){case 0:return r=(t=e.constructor.utils).unescape,i=t.getExt,l=t.srtToVtt,p=t.assToVtt,d=new(0,f.WebVTTParser),v=new(0,f.WebVTTSerializer),[4,Promise.all(n.map(function(e){return function(e,t){return(0,o._)(function(e,t){var n,r,i,o,a;return(0,u._)(this,function(s){switch(s.label){case 0:return n=t.getExt,r=t.srtToVtt,i=t.assToVtt,[4,fetch(e.url)];case 1:return[4,s.sent().arrayBuffer()];case 2:switch(o=s.sent(),a=new TextDecoder(e.encoding||"utf-8").decode(o),e.type||n(e.url)){case"srt":return[2,r(a)];case"ass":return[2,i(a)];case"vtt":return[2,a];default:return[2,""]}}})}).apply(this,arguments)}(e,{getExt:i,srtToVtt:l,assToVtt:p})}))];case 1:return h=a.sent().map(function(e,t){var r=d.parse(e,"metadata");return r.url=n[t].url,r.name=n[t].name,r}),m="",y(h),[2,{name:"multipleSubtitles",tracks:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return y(e.map(function(e){return h.find(function(t){return t.name===e})}))},reset:function(){return y(h)}}]}})})()}}"undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=l)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","./parser":"hxyrW","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,n,r){"use strict";function i(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}n._=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function s(e){i(a,r,o,s,c,"next",e)}function c(e){i(a,r,o,s,c,"throw",e)}s(void 0)})}}},{}],kyoEj:[function(e,t,n,r){"use strict";var i=e("9f9b8a24218ee51e");n._=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i._(e,t,n[t])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],ltU3W:[function(e,t,n,r){"use strict";n._=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},{}],"3G1wX":[function(e,t,n,r){"use strict";n._=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}},{}],i81N6:[function(e,t,n,r){"use strict";var i=e("d402183024004bc7"),o=e("3209e2b12672cd18"),a=e("fc58adb8f1bff142"),s=e("5e213dc122a10171");n._=function(e){return i._(e)||o._(e)||s._(e)||a._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,t,n,r){"use strict";var i=e("5bd5b10bf87fc8e");n._=function(e){if(Array.isArray(e))return i._(e)}},{"5bd5b10bf87fc8e":"1WOAB"}],"1WOAB":[function(e,t,n,r){"use strict";n._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}},{}],fQrlQ:[function(e,t,n,r){"use strict";n._=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}},{}],fWabh:[function(e,t,n,r){"use strict";n._=function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,t,n,r){"use strict";var i=e("3ee51b7dc02d0c44");n._=function(e,t){if(e){if("string"==typeof e)return i._(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i._(e,t)}}},{"3ee51b7dc02d0c44":"1WOAB"}],eltGh:[function(e,t,n,r){"use strict";n._=e("eb260df52bffddd").__generator},{eb260df52bffddd:"6yrAu"}],"6yrAu":[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"__extends",function(){return s}),i.export(n,"__assign",function(){return c}),i.export(n,"__rest",function(){return u}),i.export(n,"__decorate",function(){return f}),i.export(n,"__param",function(){return l}),i.export(n,"__esDecorate",function(){return p}),i.export(n,"__runInitializers",function(){return d}),i.export(n,"__propKey",function(){return v}),i.export(n,"__setFunctionName",function(){return h}),i.export(n,"__metadata",function(){return m}),i.export(n,"__awaiter",function(){return y}),i.export(n,"__generator",function(){return b}),i.export(n,"__createBinding",function(){return _}),i.export(n,"__exportStar",function(){return g}),i.export(n,"__values",function(){return w}),i.export(n,"__read",function(){return j}),i.export(n,"__spread",function(){return x}),i.export(n,"__spreadArrays",function(){return O}),i.export(n,"__spreadArray",function(){return T}),i.export(n,"__await",function(){return P}),i.export(n,"__asyncGenerator",function(){return S}),i.export(n,"__asyncDelegator",function(){return E}),i.export(n,"__asyncValues",function(){return I}),i.export(n,"__makeTemplateObject",function(){return A}),i.export(n,"__importStar",function(){return N}),i.export(n,"__importDefault",function(){return M}),i.export(n,"__classPrivateFieldGet",function(){return F}),i.export(n,"__classPrivateFieldSet",function(){return z}),i.export(n,"__classPrivateFieldIn",function(){return R}),i.export(n,"__addDisposableResource",function(){return L}),i.export(n,"__disposeResources",function(){return V}),i.export(n,"__rewriteRelativeImportExtension",function(){return C});var o=e("@swc/helpers/cjs/_type_of.cjs"),a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function u(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function f(e,t,n,r){var i,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(("undefined"==typeof Reflect?"undefined":(0,o._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(s=(a<3?i(s):a>3?i(t,n,s):i(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var c,u=r.kind,f="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?r.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d=!1,v=n.length-1;v>=0;v--){var h={};for(var m in r)h[m]="access"===m?{}:r[m];for(var m in r.access)h.access[m]=r.access[m];h.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var y=(0,n[v])("accessor"===u?{get:p.get,set:p.set}:p[f],h);if("accessor"===u){if(void 0===y)continue;if(null===y||(void 0===y?"undefined":(0,o._)(y))!=="object")throw TypeError("Object expected");(c=s(y.get))&&(p.get=c),(c=s(y.set))&&(p.set=c),(c=s(y.init))&&i.unshift(c)}else(c=s(y))&&("field"===u?i.unshift(c):p[f]=c)}l&&Object.defineProperty(l,r.name,p),d=!0}function d(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function v(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function h(e,t,n){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function m(e,t){if(("undefined"==typeof Reflect?"undefined":(0,o._)(Reflect))==="object"&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function b(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){var u=[s,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var _=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function g(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||_(t,e,n)}function w(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function x(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}function O(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function T(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function P(e){return this instanceof P?(this.v=e,this):new P(e)}function S(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function a(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=i[e](t)).value instanceof P?Promise.resolve(n.value.v).then(c,u):f(o[0][2],n)}catch(e){f(o[0][3],e)}}function c(e){s("next",e)}function u(e){s("throw",e)}function f(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function E(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:P(e[r](t)),done:!1}:i?i(t):t}:i}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=w(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){var o,a,s;o=r,a=i,s=(t=e[n](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:s})},a)})}}}function A(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},D=function(e){return(D=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function N(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=D(e),r=0;r<n.length;r++)"default"!==n[r]&&_(t,e,n[r]);return k(t,e),t}function M(e){return e&&e.__esModule?e:{default:e}}function F(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function z(e,t,n,r,i){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function R(e,t){if(null===t||(void 0===t?"undefined":(0,o._)(t))!=="object"&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function L(e,t,n){if(null!=t){var r,i;if((void 0===t?"undefined":(0,o._)(t))!=="object"&&"function"!=typeof t)throw TypeError("Object expected.");if(n){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(i=r)}if("function"!=typeof r)throw TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var W="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function V(e){function t(t){e.error=e.hasError?new W(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var n,r=0;return function i(){for(;n=e.stack.pop();)try{if(!n.async&&1===r)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var o=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(o).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(1===r)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function C(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,o){return n?t?".jsx":".js":!r||i&&o?r+i+"."+o.toLowerCase()+"js":e}):e}n.default={__extends:s,__assign:c,__rest:u,__decorate:f,__param:l,__esDecorate:p,__runInitializers:d,__propKey:v,__setFunctionName:h,__metadata:m,__awaiter:y,__generator:b,__createBinding:_,__exportStar:g,__values:w,__read:j,__spread:x,__spreadArrays:O,__spreadArray:T,__await:P,__asyncGenerator:S,__asyncDelegator:E,__asyncValues:I,__makeTemplateObject:A,__importStar:N,__importDefault:M,__classPrivateFieldGet:F,__classPrivateFieldSet:z,__classPrivateFieldIn:R,__addDisposableResource:L,__disposeResources:V,__rewriteRelativeImportExtension:C}},{"@swc/helpers/cjs/_type_of.cjs":"iXhRw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],iXhRw:[function(e,t,n,r){"use strict";n._=function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}},{}],qpMMf:[function(e,t,n,r){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}],hxyrW:[function(e,t,n,r){var i=e("@swc/helpers/cjs/_object_spread.cjs");!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":""," ":" "}),this.entities=t,this.parse=function(n,i){n=n.replace(/\0/g,"�");var a=Date.now(),s=0,c=n.split(/\r\n|\r|\n/),u=!1,f=[],l=[],p=[];function d(e,t){p.push({message:e,line:s+1,col:t})}var v=c[s],h=v.length,m="WEBVTT",y=0,b=m.length;for("\uFEFF"===v[0]&&(y=1,b+=1),(h<b||v.indexOf(m)!==0+y||h>b&&" "!==v[b]&&" "!==v[b])&&d('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=c[s]&&void 0!=c[s];){if(d("No blank line after the signature."),-1!=c[s].indexOf("--\x3e")){u=!0;break}s++}for(;void 0!=c[s];){for(;!u&&""==c[s];)s++;if(!u&&void 0==c[s])break;var _=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}),g=!0;if(-1==c[s].indexOf("--\x3e")){if(_.id=c[s],/^NOTE($|[ \t])/.test(_.id)){for(s++;""!=c[s]&&void 0!=c[s];)-1!=c[s].indexOf("--\x3e")&&d("Cannot have timestamp in a comment."),s++;continue}if(/^STYLE($|[ \t])/.test(_.id)){var w=[],j=!1;for(s++;""!=c[s]&&void 0!=c[s];)-1!=c[s].indexOf("--\x3e")&&(d("Cannot have timestamp in a style block."),j=!0),w.push(c[s]),s++;if(l.length){d("Style blocks cannot appear after the first cue.");continue}j||f.push(w.join("\n"));continue}if(""==c[++s]||void 0==c[s]){d("Cue identifier cannot be standalone.");continue}if(-1==c[s].indexOf("--\x3e")){g=!1,d("Cue identifier needs to be followed by timestamp.");continue}}u=!1;var x=new r(c[s],d),O=0;if(l.length>0&&(O=l[l.length-1].startTime),g&&!x.parse(_,O)){for(_=null,s++;""!=c[s]&&void 0!=c[s];){if(-1!=c[s].indexOf("--\x3e")){u=!0;break}s++}continue}for(s++;""!=c[s]&&void 0!=c[s];){if(-1!=c[s].indexOf("--\x3e")){d("Blank line missing before cue."),u=!0;break}""!=_.text&&(_.text+="\n"),_.text+=c[s],s++}var T=new o(_.text,d,i,t);_.tree=T.parse(_.startTime,_.endTime),l.push(_)}return l.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:+(e.endTime<t.endTime)}),{cues:l,errors:p,time:Date.now()-a,styles:f}}},r=function(e,t){var n=/[\u0020\t\f]/,r=/[^\u0020\t\f]/,e=e,i=0,o=function(e){t(e,i+1)};function a(t){for(;void 0!=e[i]&&t.test(e[i]);)i++}function s(t){for(var n="";void 0!=e[i]&&t.test(e[i]);)n+=e[i],i++;return n}function c(){var t,n,r,a,c="minutes";if(void 0==e[i])return void o("No timestamp found.");if(!/\d/.test(e[i]))return void o("Timestamp must start with a character in the range 0-9.");if(((t=s(/\d/)).length>2||parseInt(t,10)>59)&&(c="hours"),":"!=e[i])return void o("No time unit separator found.");if(i++,2!=(n=s(/\d/)).length)return void o("Must be exactly two digits.");if("hours"==c||":"==e[i]){if(":"!=e[i])return void o("No seconds found or minutes is greater than 59.");if(i++,2!=(r=s(/\d/)).length)return void o("Must be exactly two digits.")}else{if(2!=t.length)return void o("Must be exactly two digits.");r=n,n=t,t="0"}return"."!=e[i]?void o('No decimal separator (".") found.'):(i++,3!=(a=s(/\d/)).length)?void o("Milliseconds must be given in three digits."):parseInt(n,10)>59?void o("You cannot have more than 59 minutes."):parseInt(r,10)>59?void o("You cannot have more than 59 seconds."):3600*parseInt(t,10)+60*parseInt(n,10)+parseInt(r,10)+parseInt(a,10)/1e3}this.parse=function(t,s){return(a(n),t.startTime=c(),void 0==t.startTime)?void 0:(t.startTime<s&&o("Start timestamp is not greater than or equal to start timestamp of previous cue."),r.test(e[i])&&o("Timestamp not separated from '--\x3e' by whitespace."),a(n),"-"!=e[i]||"-"!=e[++i]||">"!=e[++i])?void o("No valid timestamp separator found."):(i++,r.test(e[i])&&o("'--\x3e' not separated from timestamp by whitespace."),a(n),t.endTime=c(),void 0!=t.endTime)?(t.endTime<=t.startTime&&o("End timestamp is not greater than start timestamp."),r.test(e[i]),a(n),!function(e,t){for(var r=e.split(n),i=[],a=0;a<r.length;a++)if(""!=r[a]){var s=r[a].indexOf(":"),c=r[a].slice(0,s),u=r[a].slice(s+1);if(-1!=i.indexOf(c)&&o("Duplicate setting."),i.push(c),""==u)return void o("No value for setting defined.");if("vertical"==c){if("rl"!=u&&"lr"!=u){o("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=u}else if("line"==c){if(/,/.test(u)){var f=u.split(",");u=f[0];var l=f[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(u)){o("Line position takes a number or percentage.");continue}if(-1!=u.indexOf("-",1)){o("Line position can only have '-' at the start.");continue}if(-1!=u.indexOf("%")&&u.indexOf("%")!=u.length-1){o("Line position can only have '%' at the end.");continue}if("-"==u[0]&&"%"==u[u.length-1]){o("Line position cannot be a negative percentage.");continue}var p=u,d=!1;if("%"==u[u.length-1]&&(d=!0,p=u.slice(0,u.length-1),parseInt(u,10)>100)){o("Line position cannot be >100%.");continue}if(""===p||isNaN(p)||!isFinite(p)){o("Line position needs to be a number");continue}if(void 0!==l){if(!["start","center","end"].includes(l)){o("Line alignment needs to be one of start, center or end");continue}t.lineAlign=l}t.snapToLines=!d,t.linePosition=parseFloat(p),parseFloat(p).toString()!==p&&(t.nonSerializable=!0)}else if("position"==c){if(/,/.test(u)){var f=u.split(",");u=f[0];var v=f[1]}if("%"!=u[u.length-1]){o("Text position must be a percentage.");continue}if(parseInt(u,10)>100||0>parseInt(u,10)){o("Text position needs to be between 0 and 100%.");continue}if(""===(p=u.slice(0,u.length-1))||isNaN(p)||!isFinite(p)){o("Line position needs to be a number");continue}if(void 0!==v){if(!["line-left","center","line-right"].includes(v)){o("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=v}t.textPosition=parseFloat(p)}else if("size"==c){if("%"!=u[u.length-1]){o("Size must be a percentage.");continue}if(parseInt(u,10)>100){o("Size cannot be >100%.");continue}var h=u.slice(0,u.length-1);if(void 0===h||""===h||isNaN(h)){o("Size needs to be a number"),h=100;continue}if((h=parseFloat(h))<0||h>100){o("Size needs to be between 0 and 100%.");continue}t.size=h}else if("align"==c){var m=["start","center","end","left","right"];if(-1==m.indexOf(u)){o("Alignment can only be set to one of "+m.join(", ")+".");continue}t.alignment=u}else o("Invalid setting.")}}(e.substring(i),t),!0):void 0},this.parseTimestamp=function(){var t=c();return void 0!=e[i]?void o("Timestamp must not have trailing characters."):t}},o=function(e,t,n,o){this.entities=o;var a=this,e=e,s=0,c=function(e){"metadata"!=n&&t(e,s+1)};this.parse=function(t,u){var f={children:[]},l=f,p=[];function d(e){l.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:l}),l=l.children[l.children.length-1]}for(;void 0!=e[s];){var v=function(){for(var t="data",n="",r="",i=[];void 0!=e[s-1]||0==s;){var u=e[s];if("data"==t)if("&"==u)r=u,t="escape";else if("<"==u&&""==n)t="tag";else{if("<"==u||void 0==u)return["text",n];n+=u}else if("escape"==t)if("<"==u||void 0==u){c("Incorrect escape.");var f=void 0;return(f=r.match(/^&#([0-9]+)$/))?n+=String.fromCharCode(f[1]):a.entities[r]?n+=a.entities[r]:n+=r,["text",n]}else if("&"==u)c("Incorrect escape."),n+=r,r=u;else if(/[a-z#0-9]/i.test(u))r+=u;else if(";"==u){var l=void 0;(l=r.match(/^&#(x?[0-9]+)$/))?n+=String.fromCharCode("0"+l[1]):a.entities[r+u]?n+=a.entities[r+u]:(l=Object.keys(o).find(function(e){return r.startsWith(e)}))?n+=a.entities[l]+r.slice(l.length)+u:(c("Incorrect escape."),n+=r+";"),t="data"}else c("Incorrect escape."),n+=r+u,t="data";else if("tag"==t)if(" "==u||"\n"==u||"\f"==u||" "==u)t="start tag annotation";else if("."==u)t="start tag class";else if("/"==u)t="end tag";else if(/\d/.test(u))n=u,t="timestamp tag";else{if(">"==u||void 0==u)return">"==u&&s++,["start tag","",[],""];n=u,t="start tag"}else if("start tag"==t)if(" "==u||"\f"==u||" "==u)t="start tag annotation";else if("\n"==u)r=u,t="start tag annotation";else if("."==u)t="start tag class";else{if(">"==u||void 0==u)return">"==u&&s++,["start tag",n,[],""];n+=u}else if("start tag class"==t)if(" "==u||"\f"==u||" "==u)r&&i.push(r),r="",t="start tag annotation";else if("\n"==u)r&&i.push(r),r=u,t="start tag annotation";else if("."==u)r&&i.push(r),r="";else{if(">"==u||void 0==u)return">"==u&&s++,r&&i.push(r),["start tag",n,i,""];r+=u}else if("start tag annotation"==t)if(">"==u||void 0==u)return">"==u&&s++,["start tag",n,i,r=r.split(/[\u0020\t\f\r\n]+/).filter(function(e){if(e)return!0}).join(" ")];else r+=u;else if("end tag"==t)if(">"==u||void 0==u)return">"==u&&s++,["end tag",n];else n+=u;else if("timestamp tag"==t)if(">"==u||void 0==u)return">"==u&&s++,["timestamp",n];else n+=u;else c("Never happens.");s++}}();if("text"==v[0])l.children.push({type:"text",value:v[1],parent:l});else if("start tag"==v[0]){"chapters"==n&&c("Start tags not allowed in chapter title text.");var h=v[1];"v"!=h&&"lang"!=h&&""!=v[3]&&c("Only<v>and<lang>can have an annotation."),"c"==h||"i"==h||"b"==h||"u"==h||"ruby"==h||"rt"==h&&"ruby"==l.name?d(v):"v"==h?(function(e){for(var t=l;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&c("<v>cannot be nested inside itself."),d(v),l.value=v[3],v[3]||c("<v>requires an annotation.")):"lang"==h?(d(v),l.value=v[3]):c("Incorrect start tag.")}else if("end tag"==v[0])"chapters"==n&&c("End tags not allowed in chapter title text."),v[1]==l.name?l=l.parent:"ruby"==v[1]&&"rt"==l.name?l=l.parent.parent:c("Incorrect end tag.");else if("timestamp"==v[0]){"chapters"==n&&c("Timestamp not allowed in chapter title text.");var m=new r(v[1],c).parseTimestamp();void 0!=m&&((m<=t||m>=u)&&c("Timestamp must be between start timestamp and end timestamp."),p.length>0&&p[p.length-1]>=m&&c("Timestamp must be greater than any previous timestamp."),l.children.push({type:"timestamp",value:m,parent:l}),p.push(m))}}for(;l.parent;)"v"!=l.name&&c("Required end tag missing."),l=l.parent;return function e(t){var n=(0,i._)({},t);return t.children&&(n.children=t.children.map(e)),n.parent&&delete n.parent,n}(f)}},a=function(){function t(e){var t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),n=0,r=0,i=0;return e>=3600&&(n=Math.floor(e/3600)),r=Math.floor((e-3600*n)/60),i=Math.floor(e-3600*n-60*r),(n?n+":":"")+(""+r).padStart(2,"0")+":"+(""+i).padStart(2,"0")+"."+t}this.serialize=function(n,r){var i="WEBVTT\n\n";if(r)for(var o=0;o<r.length;o++)i+="STYLE\n"+r[o]+"\n\n";for(var o=0;o<n.length;o++)i+=function(n){var r,i;return(void 0!==n.id?n.id+"\n":"")+t(n.startTime)+" --\x3e "+t(n.endTime)+(r="",(i=Object.keys(e).filter(function(t){return n[t]!==e[t]})).includes("direction")&&(r+=" vertical:"+n.direction),i.includes("alignment")&&(r+=" align:"+n.alignment),i.includes("size")&&(r+=" size:"+n.size+"%"),(i.includes("lineAlign")||i.includes("linePosition"))&&(r+=" line:"+n.linePosition+(n.snapToLines?"":"%")+(n.lineAlign&&n.lineAlign!=e.lineAlign?","+n.lineAlign:"")),(i.includes("textPosition")||i.includes("positionAlign"))&&(r+=" position:"+n.textPosition+"%"+(n.positionAlign&&n.positionAlign!==e.positionAlign?","+n.positionAlign:"")),r)+"\n"+function e(n){for(var r="",i=0;i<n.length;i++){var o=n[i];if("text"==o.type)r+=o.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==o.type){if(r+="<"+o.name,o.classes)for(var a=0;a<o.classes.length;a++)r+="."+o.classes[a];o.value&&(r+=" "+o.value),r+=">",o.children&&(r+=e(o.children)),r+="</"+o.name+">"}else"timestamp"==o.type?r+="<"+t(o.value)+">":r+="<"+o.value+">"}return r}(n.tree.children)+"\n\n"}(n[o]);return i}};function s(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=r,e.WebVTTCueTextParser=o,e.WebVTTSerializer=a}"undefined"!=typeof window&&s(window),s(n)}()},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj"}]},["bNEbP"],"bNEbP","parcelRequire4dc0",{}); |