diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index ea9b75946..7b5cd0004 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 在移动端,点击视频会切换控制栏的显示与隐藏 - 由于功能不常用,删除 `art.loop` 区间播放功能 - 字幕轨添加 `label` 属性,用于在移动设备上显示字幕名字 +- 添加 `unescape` 工具函数 +- 添加 `artplayerPluginMultipleSubtitles` 插件,用于显示合并后的字幕文件 ## [5.0.9] - 2023-5-14 diff --git a/docs/assets/example/multiple.subtitles.js b/docs/assets/example/multiple.subtitles.js new file mode 100644 index 000000000..c6dc5d24d --- /dev/null +++ b/docs/assets/example/multiple.subtitles.js @@ -0,0 +1,43 @@ +var art = new Artplayer({ + container: '.artplayer-app', + url: '/assets/sample/video.mp4', + plugins: [ + artplayerPluginMultipleSubtitles({ + subtitles: [ + { + name: 'chinese', + url: '/assets/sample/subtitle.cn.srt', + }, + { + name: 'japanese', + url: '/assets/sample/subtitle.jp.srt', + } + ] + }) + ] +}); + + +// 自定义你自己的样式,请勿复制以下代码 +// Customize your own style, please do not copy the following code +const style = ` +.art-subtitle-chinese { + color: red; + font-size: 18px; +} + +.art-subtitle-japanese { + color: yellow; + font-size: 12px; +} +`; + +const $style = document.getElementById('artplayer-subtitle-style'); +if ($style) { + $style.textContent = style; +} else { + const $style = document.createElement('style'); + $style.id = 'artplayer-subtitle-style'; + $style.textContent = style; + document.head.appendChild($style); +} \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-control.js b/docs/compiled/artplayer-plugin-control.js index a13b4d2d1..2d7636bd9 100644 --- a/docs/compiled/artplayer-plugin-control.js +++ b/docs/compiled/artplayer-plugin-control.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,o,n){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof l[o]&&l[o];if(!r&&n)return n(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;c{!function(e){const{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number);r(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);const{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;const c="artplayer-plugin-control";l(r,c);const d=o(t,'
'),s=o(t,'
'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t{d.innerText=n(e.currentTime),s.innerText=n(e.duration)}));return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(e){e?l(r,c):i(r,c)}}}}if(r.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:26","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){const e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{height:70px;width:400px;-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{width:15%;justify-content:center;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[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})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0"); \ No newline at end of file +!// 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,o,n){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[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 n="function"==typeof l[o]&&l[o];if(!r&&n)return n(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 c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;ca);var n=e("bundle-text:./style.less"),l=o.interopDefault(n);function a(){return e=>{!function(e){let{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number),n=o[0],l=o[1]/100;r(n+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);let{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;let c="artplayer-plugin-control";l(r,c);let d=o(t,'
'),s=o(t,'
'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t{d.innerText=n(e.currentTime),s.innerText=n(e.duration)});return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(state){state?l(r,c):i(r,c)}}}}if(a.env="production",a.version="2.0.0",a.build="2023-11-23 23:22:00","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){let e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;width:400px;height:70px;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{justify-content:center;width:15%;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[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})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-control.legacy.js b/docs/compiled/artplayer-plugin-control.legacy.js index c83690b3e..b4a95f019 100644 --- a/docs/compiled/artplayer-plugin-control.legacy.js +++ b/docs/compiled/artplayer-plugin-control.legacy.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,o,n){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof a[o]&&a[o];if(!r&&n)return n(t,!0);if(l)return l(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"))}(e);var t=e.template,r=t.$bottom,o=t.$player,n=e.constructor.utils,a=n.append,i=n.secondToTime,u=n.addClass,p=n.removeClass,c=n.hasClass;if(!n.isMobile){var d="artplayer-plugin-control";u(o,d);for(var s=a(r,'
'),f=a(r,'
'),y=["video:loadedmetadata","video:timeupdate","video:progress"],g=0;g 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,o,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[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 n="function"==typeof a[o]&&a[o];if(!r&&n)return n(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(l)return l(t,!0);// Try the node require function if it exists. +if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,o,n=e.template,a=n.$bottom,i=n.$player,u=e.constructor.utils,p=u.append,c=u.secondToTime,d=u.addClass,s=u.removeClass,f=u.hasClass;if(!u.isMobile){var y="artplayer-plugin-control";d(i,y);for(var g=p(a,'
'),m=p(a,'
'),b=["video:loadedmetadata","video:timeupdate","video:progress"],x=0;x{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=5,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,o.default)(e,n),t.heatmap&&(0,u.default)(e,n,t.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=d,d.env="production",d.version="5.0.1",d.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),s=i.interopDefault(a);class o{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',e}getReady(){const{currentTime:t}=this.art;return this.queue.filter((e=>"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1))}getEmits(){const t=[],{clientWidth:e}=this.$player,n=this.getLeft(this.$player);return this.filter("emit",(i=>{const r=i.$ref.offsetTop,a=this.getLeft(i.$ref)-n,s=i.$ref.clientHeight,o=i.$ref.clientWidth,l=a+o,u=e-l,d=l/i.$restTime,m={};m.top=r,m.left=a,m.height=s,m.width=o,m.right=u,m.speed=d,m.distance=l,m.time=i.$restTime,m.mode=i.mode,t.push(m)})),t}getFontSize(t){const{clamp:e}=this.utils,{clientHeight:n}=this.$player;if("number"==typeof t)return e(t,12,n);if("string"==typeof t&&t.endsWith("%")){return e(n*(parseFloat(t)/100),12,n)}return o.option.fontSize}postMessage(t={}){return new Promise((e=>{if(this.option.useWorker&&this.worker&&this.worker.postMessage)t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=n=>{const{data:i}=n;i.id===t.id&&e(i)};else{const n=(0,s.default)(t);e({top:n})}}))}async load(){try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await(0,r.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,this.utils.errorHandle(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.art.emit("artplayerPluginDanmuku:loaded",this.danmus),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach((t=>this.emit(t)))}catch(t){throw this.art.emit("artplayerPluginDanmuku:error",t),t}return this}config(t){const{clamp:e}=this.utils;return this.option=Object.assign({},o.option,this.option,t),this.validator(this.option,o.scheme),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(Math.floor(this.option.lockTime),0,60),this.option.maxLength=e(this.option.maxLength,0,500),this.option.minWidth=e(this.option.minWidth,0,500),this.option.maxWidth=e(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}makeWait(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}continue(){const{clientWidth:t}=this.$player;return this.filter("stop",(e=>{switch(e.$state="emit",e.$lastStartTime=Date.now(),e.mode){case 0:{const n=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-n}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`;break}}})),this}suspend(){const{clientWidth:t}=this.$player;return this.filter("emit",(e=>{switch(e.$state="stop",e.mode){case 0:{const n=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-n}px)`,e.$ref.style.transition="transform 0s linear 0s";break}}})),this}reset(){return this.queue.forEach((t=>this.makeWait(t))),this}update(){return this.timer=window.requestAnimationFrame((async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",(t=>{const e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)}));const t=this.getReady(),{clientWidth:e,clientHeight:n}=this.$player;for(let i=0;ithis.makeWait(t))),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}emit(t){return this.validator(t,{text:"string",mode:"number|undefined",color:"string|undefined",time:"number|undefined",border:"boolean|undefined"}),t.text.trim()&&this.option.filter(t)?(t.time?t.time=this.utils.clamp(t.time,0,1/0):t.time=this.art.currentTime+.5,void 0===t.mode&&(t.mode=this.option.mode),void 0===t.color&&(t.color=this.option.color),this.queue.push({...t,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0}),this):this}destroy(){this.stop(),this.worker&&this.worker.terminate&&this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}n.default=o},{"./bilibili":"f83sx","./getDanmuTop":"jPSuD","85d40535eae5f839":"fXq73","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");function r(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:case 5:return 1}}function a(t){if("string"!=typeof t)return[];const e=t.matchAll(/(?.+?)<\/d>/gs);return Array.from(e).map((t=>{const e=t.groups.p.split(",");if(e.length>=8){return{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:r(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}}return null})).filter(Boolean)}function s(t){return fetch(t).then((t=>t.text())).then((t=>a(t)))}i.defineInteropFlag(n),i.export(n,"getMode",(()=>r)),i.export(n,"bilibiliDanmuParseFromXml",(()=>a)),i.export(n,"bilibiliDanmuParseFromUrl",(()=>s))},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(t,e,n){n.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},n.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.exportAll=function(t,e){return Object.keys(t).forEach((function(n){"default"===n||"__esModule"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e},n.export=function(t,e,n){Object.defineProperty(t,e,{enumerable:!0,get:n})}},{}],jPSuD:[function(t,e,n){t("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=function({target:t,emits:e,clientWidth:n,clientHeight:i,marginBottom:r,marginTop:a,antiOverlap:s}){const o=e.filter((e=>e.mode===t.mode&&e.top<=i-r)).sort(((t,e)=>t.top-e.top));if(0===o.length)return a;o.unshift({top:0,left:0,right:0,height:a,width:n,speed:0,distance:n}),o.push({top:i-r,left:0,right:0,height:r,width:n,speed:0,distance:n});for(let e=1;e=t.height)return r}const l=[];for(let t=1;t{const n=Math.min(...e.map((t=>t.right))),i=Math.min(...t.map((t=>t.right)));return n*e.length-i*t.length}));break;case 1:l.sort(((t,e)=>{const n=Math.max(...e.map((t=>t.width)));return Math.max(...t.map((t=>t.width)))*t.length-n*e.length}))}return l[0][0].top}switch(t.mode){case 0:{const e=l.find((e=>e.every((e=>{if(ne.time}))));return e&&e[0]?e[0].top:void 0}case 1:return}}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],fXq73:[function(t,e,n){e.exports="data:application/javascript,function%20getDanmuTop%28%7Btarget%3At%2Cemits%3Ae%2CclientWidth%3An%2CclientHeight%3Ai%2CmarginBottom%3As%2CmarginTop%3Ah%2CantiOverlap%3Ao%7D%29%7Bconst%20r%3De.filter%28%28e%3D%3Ee.mode%3D%3D%3Dt.mode%26%26e.top%3C%3Di-s%29%29.sort%28%28%28t%2Ce%29%3D%3Et.top-e.top%29%29%3Bif%280%3D%3D%3Dr.length%29return%20h%3Br.unshift%28%7Btop%3A0%2Cleft%3A0%2Cright%3A0%2Cheight%3Ah%2Cwidth%3An%2Cspeed%3A0%2Cdistance%3An%7D%29%2Cr.push%28%7Btop%3Ai-s%2Cleft%3A0%2Cright%3A0%2Cheight%3As%2Cwidth%3An%2Cspeed%3A0%2Cdistance%3An%7D%29%3Bfor%28let%20e%3D1%3Be%3Cr.length%3Be%2B%3D1%29%7Bconst%20n%3Dr%5Be%5D%2Ci%3Dr%5Be-1%5D%2Cs%3Di.top%2Bi.height%3Bif%28n.top-s%3E%3Dt.height%29return%20s%7Dconst%20p%3D%5B%5D%3Bfor%28let%20t%3D1%3Bt%3Cr.length-1%3Bt%2B%3D1%29%7Bconst%20e%3Dr%5Bt%5D%3Bif%28p.length%29%7Bconst%20t%3Dp%5Bp.length-1%5D%3Bt%5B0%5D.top%3D%3D%3De.top%3Ft.push%28e%29%3Ap.push%28%5Be%5D%29%7Delse%20p.push%28%5Be%5D%29%7Dif%28%21o%29%7Bswitch%28t.mode%29%7Bcase%200%3Ap.sort%28%28%28t%2Ce%29%3D%3E%7Bconst%20n%3DMath.min%28...e.map%28%28t%3D%3Et.right%29%29%29%2Ci%3DMath.min%28...t.map%28%28t%3D%3Et.right%29%29%29%3Breturn%20n%2ae.length-i%2at.length%7D%29%29%3Bbreak%3Bcase%201%3Ap.sort%28%28%28t%2Ce%29%3D%3E%7Bconst%20n%3DMath.max%28...e.map%28%28t%3D%3Et.width%29%29%29%3Breturn%20Math.max%28...t.map%28%28t%3D%3Et.width%29%29%29%2at.length-n%2ae.length%7D%29%29%7Dreturn%20p%5B0%5D%5B0%5D.top%7Dswitch%28t.mode%29%7Bcase%200%3A%7Bconst%20e%3Dp.find%28%28e%3D%3Ee.every%28%28e%3D%3E%7Bif%28n%3Ce.distance%29return%211%3Bif%28t.speed%3Ce.speed%29return%210%3Breturn%20e.right%2F%28t.speed-e.speed%29%3Ee.time%7D%29%29%29%29%3Breturn%20e%26%26e%5B0%5D%3Fe%5B0%5D.top%3Avoid%200%7Dcase%201%3Areturn%7D%7Donmessage%3Dt%3D%3E%7Bconst%7Bdata%3Ae%7D%3Dt%2Cn%3DgetDanmuTop%28e%29%3Bself.postMessage%28%7Btop%3An%2Cid%3Ae.id%7D%29%7D%3B"},{}],lO8OT:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("bundle-text:./style.less"),a=i.interopDefault(r),s=t("bundle-text:./img/danmu-on.svg"),o=i.interopDefault(s),l=t("bundle-text:./img/danmu-off.svg"),u=i.interopDefault(l),d=t("bundle-text:./img/danmu-config.svg"),m=i.interopDefault(d),p=t("bundle-text:./img/danmu-style.svg"),h=i.interopDefault(p);if(n.default=function(t,e){const{option:n}=e,{template:{$controlsCenter:i,$player:r},constructor:{SETTING_ITEM_WIDTH:a,utils:{removeClass:s,addClass:l,append:d,setStyle:p,tooltip:c,query:f,inverseClass:g,getIcon:y}}}=t;p(i,"display","flex");const k=y("danmu-on",o.default),x=y("danmu-off",u.default),b=y("danmu-config",m.default),v=y("danmu-style",h.default);!function(){const a=["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"].map((t=>`
`)),o=d(i,`
模式
滚动
静止
颜色
${a.join("")}
发送
`),u=f(".art-danmuku-style",o),m=f(".art-danmuku-input",o),h=f(".art-danmuku-send",o),c=f(".art-danmuku-style-panel-inner",o),y=f(".art-danmuku-style-panel-modes",o),k=f(".art-danmuku-style-panel-colors",o),x=n.mount||d(r,'
');t.option.backdrop&&l(c,"art-backdrop-filter"),n.theme&&l(o,`art-danmuku-theme-${n.theme}`);let b=null,w=n.mode,$=n.color;function D(t){t<=0?(b=null,h.innerText="发送",s(h,"art-disabled")):(h.innerText=t,b=setTimeout((()=>D(t-1)),1e3))}function B(){const i={mode:w,color:$,border:!0,text:m.value.trim()};null===b&&n.beforeEmit(i)&&(m.value="",e.emit(i),l(h,"art-disabled"),D(n.lockTime),t.emit("artplayerPluginDanmuku:emit",i))}function M(){i.clientWidth{"Enter"===t.key&&(t.preventDefault(),B())})),t.proxy(y,"click",(t=>{const{dataset:e}=t.target;e.mode&&(w=Number(e.mode),g(t.target,"art-current"))})),t.proxy(k,"click",(t=>{const{dataset:e}=t.target;e.color&&($=e.color,g(t.target,"art-current"))})),M(),t.on("resize",(()=>{t.isInput||M()})),t.on("destroy",(()=>{n.mount&&o.parentElement===n.mount&&n.mount.removeChild(o)}))}(),t.controls.add({position:"right",name:"danmuku",click:function(){e.isHide?(e.show(),t.notice.show="弹幕显示",p(k,"display",null),p(x,"display","none")):(e.hide(),t.notice.show="弹幕隐藏",p(k,"display","none"),p(x,"display",null))},mounted(e){d(e,k),d(e,x),c(e,"弹幕开关"),p(x,"display","none"),t.on("artplayerPluginDanmuku:hide",(()=>{p(k,"display","none"),p(x,"display",null)})),t.on("artplayerPluginDanmuku:show",(()=>{p(k,"display",null),p(x,"display","none")}))}}),t.setting.add({width:260,name:"danmuku",html:"弹幕设置",tooltip:"更多",icon:b,selector:[{width:a,html:"播放速度",icon:"",tooltip:"适中",selector:[{html:"极慢",time:10},{html:"较慢",time:7.5},{default:!0,html:"适中",time:5},{html:"较快",time:2.5},{html:"极快",time:1}],onSelect:function(t){return e.config({speed:t.time}),t.html}},{width:a,html:"字体大小",icon:"",tooltip:"适中",selector:[{html:"极小",fontSize:"4%"},{html:"较小",fontSize:"5%"},{default:!0,html:"适中",fontSize:"6%"},{html:"较大",fontSize:"7%"},{html:"极大",fontSize:"8%"}],onSelect:function(t){return e.config({fontSize:t.fontSize}),t.html}},{width:a,html:"不透明度",icon:"",tooltip:"100%",selector:[{default:!0,opacity:1,html:"100%"},{opacity:.75,html:"75%"},{opacity:.5,html:"50%"},{opacity:.25,html:"25%"},{opacity:0,html:"0%"}],onSelect:function(t){return e.config({opacity:t.opacity}),t.html}},{width:a,html:"显示范围",icon:"",tooltip:"3/4",selector:[{html:"1/4",margin:[10,"75%"]},{html:"半屏",margin:[10,"50%"]},{default:!0,html:"3/4",margin:[10,"25%"]},{html:"满屏",margin:[10,10]}],onSelect:function(t){return e.config({margin:t.margin}),t.html}},{html:"弹幕防重叠",icon:"",tooltip:n.antiOverlap?"开启":"关闭",switch:n.antiOverlap,onSwitch:t=>(e.config({antiOverlap:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)},{html:"同步视频速度",icon:"",tooltip:n.synchronousPlayback?"开启":"关闭",switch:n.synchronousPlayback,onSwitch:t=>(e.config({synchronousPlayback:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)}]})},"undefined"!=typeof document&&!document.getElementById("artplayer-plugin-danmuku")){const t=document.createElement("style");t.id="artplayer-plugin-danmuku",t.textContent=a.default,document.head.appendChild(t)}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/danmu-on.svg":"4KfW9","bundle-text:./img/danmu-off.svg":"9UR3U","bundle-text:./img/danmu-config.svg":"4MPCW","bundle-text:./img/danmu-style.svg":"7lV5Q","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(t,e,n){e.exports='.art-danmuku-emitter{height:32px;width:100%;max-width:100%;background-color:#ffffff4d;border-radius:5px;font-size:12px;line-height:1;display:flex;position:relative}.art-danmuku-emitter .art-backdrop-filter{-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3!important}.art-danmuku-emitter .art-danmuku-left{border-radius:3px 0 0 3px;flex:1;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style{width:32px;justify-content:center;align-items:center;display:flex;position:relative}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{z-index:999;width:200px;padding-bottom:10px;display:none;position:absolute;bottom:30px;left:-85px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner{background-color:#000000e6;border-radius:3px;flex-direction:column;padding:10px 10px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-title{margin-bottom:10px;font-size:13px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes{justify-content:space-between;margin-bottom:15px;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes .art-danmuku-style-panel-mode{width:47%;cursor:pointer;color:#fff;border:1px solid #fff;justify-content:center;padding:5px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes .art-danmuku-style-panel-mode.art-current{background-color:#00a1d6;border:1px solid #00a1d6}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors{flex-wrap:wrap;justify-content:space-between;gap:5px;margin-bottom:10px;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color{cursor:pointer;width:20px;height:20px;border:1px solid #fff}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color.art-current{position:relative;box-shadow:0 0 2px #fff}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color.art-current:before{content:"";width:100%;height:100%;border:2px solid #000;position:absolute;inset:0}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style:hover .art-danmuku-style-panel{display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-icon{opacity:.75;cursor:pointer}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-icon:hover{opacity:1}.art-danmuku-emitter .art-danmuku-left .art-danmuku-input{width:100%;color:#fff;background-color:#0000;border:none;outline:none;flex:1;padding:0 10px 0 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-input::placeholder,.art-danmuku-emitter .art-danmuku-left .art-danmuku-input::-webkit-input-placeholder{color:#ffffff80}.art-danmuku-emitter .art-danmuku-send{width:50px;cursor:pointer;background-color:#00a1d6;border-radius:0 5px 5px 0;justify-content:center;align-items:center;display:flex}.art-danmuku-emitter .art-danmuku-send:hover{background-color:#00b5e5}.art-danmuku-emitter .art-danmuku-send.art-disabled{opacity:.5;pointer-events:none}.art-danmuku-emitter.art-danmuku-mount{max-width:100%!important}.art-danmuku-emitter.art-danmuku-mount .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{left:0}.art-danmuku-emitter.art-danmuku-mount .art-danmuku-send{width:60px}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left{background:#f4f4f4;border:1px solid #dadada}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-style .art-icon svg{fill:#666}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input{color:#000}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input::placeholder,.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input::-webkit-input-placeholder{color:#00000080}.art-layer-danmuku-emitter{z-index:99;width:100%;position:absolute;bottom:-40px;left:0;right:0}'},{}],"4KfW9":[function(t,e,n){e.exports=''},{}],"9UR3U":[function(t,e,n){e.exports=''},{}],"4MPCW":[function(t,e,n){e.exports=''},{}],"7lV5Q":[function(t,e,n){e.exports=''},{}],"8AxLD":[function(t,e,n){t("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n);const i={map:(t,e,n,i,r)=>(t-e)*(r-i)/(n-e)+i,range(t,e,n){const i=Math.round(t/n)*n;return Array.from({length:Math.floor((e-t)/n)},((t,e)=>e*n+i))}};n.default=function(t,e,n){const{query:r}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(a){let s=null,o=null;function l(l=[]){if(s=null,o=null,a.innerHTML="",!t.duration||t.option.isLive)return;const u={w:a.offsetWidth,h:a.offsetHeight},d={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof n&&Object.assign(d,n);let m=[];if(Array.isArray(l)&&l.length)m=[...l];else{const n=t.duration/u.w;for(let t=0;t<=u.w;t+=d.sampling){const i=e.danmus.filter((({time:e})=>e>t*n&&e<=(t+d.sampling)*n)).length;m.push([t,i])}}if(0===m.length)return;const p=m[m.length-1],h=p[0],c=p[1];h!==u.w&&m.push([u.w,c]);const f=m.map((t=>t[1])),g=(Math.min(...f)+Math.max(...f))/2;for(let t=0;tg?1+d.scale:1-d.scale)+d.minHeight}const y=(t,e,n,r)=>{const a=((t,e)=>{const n=e[0]-t[0],i=e[1]-t[1];return{length:Math.sqrt(Math.pow(n,2)+Math.pow(i,2)),angle:Math.atan2(i,n)}})(e||t,n||t),s=i.map(Math.cos(a.angle)*d.flattening,0,1,1,0),o=a.angle*s+(r?Math.PI:0),l=a.length*d.smoothing;return[t[0]+Math.cos(o)*l,t[1]+Math.sin(o)*l]},k=m.map((t=>[i.map(t[0],d.xMin,d.xMax,0,u.w),i.map(t[1],d.yMin,d.yMax,u.h,0)])).reduce(((t,e,n,i)=>0===n?`M ${i[i.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${((t,e,n)=>{const i=y(n[e-1],n[e-2],t),r=y(t,n[e-1],n[e+1],!0),a=e===n.length-1?" z":"";return`C ${i[0]},${i[1]} ${r[0]},${r[1]} ${t[0]},${t[1]}${a}`})(e,n,i)}`),"");a.innerHTML=``,s=r("#heatmap-start",a),o=r("#heatmap-stop",a),s.setAttribute("offset",100*t.played+"%"),o.setAttribute("offset",100*t.played+"%")}t.on("video:timeupdate",(()=>{s&&o&&(s.setAttribute("offset",100*t.played+"%"),o.setAttribute("offset",100*t.played+"%"))})),t.on("setBar",((t,e)=>{s&&o&&"played"===t&&(s.setAttribute("offset",100*e+"%"),o.setAttribute("offset",100*e+"%"))})),t.on("ready",(()=>l())),t.on("resize",(()=>l())),t.on("artplayerPluginDanmuku:loaded",(()=>l())),t.on("artplayerPluginDanmuku:points",(t=>l(t)))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file +!// 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(t,e,i,r,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[r]&&a[r],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,i){if(!s[e]){if(!t[e]){// 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 n="function"==typeof a[r]&&a[r];if(!i&&n)return n(e,!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(o)return o(e,!0);// Try the node require function if it exists. +if(l&&"string"==typeof e)return l(e);var d=Error("Cannot find module '"+e+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var r=t[e][1][i];return null!=r?r:i},p.cache={};var m=s[e]=new u.Module(e);t[e][0].call(m.exports,p,m,m.exports,this)}return s[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(u,"root",{get:function(){return a[r]}}),a[r]=u;for(var d=0;dd);var n=t("./danmuku"),a=r.interopDefault(n),o=t("./setting"),s=r.interopDefault(o),l=t("./heatmap"),u=r.interopDefault(l);function d(t){return e=>{!function(t){let{version:e,utils:{errorHandle:i}}=t.constructor,r=e.split(".").map(Number),n=r[0],a=r[1]/100;i(n+a>=5,`Artplayer.js@${e} \u{4E0D}\u{517C}\u{5BB9}\u{8BE5}\u{5F39}\u{5E55}\u{5E93}\u{FF0C}\u{8BF7}\u{66F4}\u{65B0}\u{5230} Artplayer.js@5.x.x \u{7248}\u{672C}\u{4EE5}\u{4E0A}`)}(e);let i=new a.default(e,t);return(0,s.default)(e,i),t.heatmap&&(0,u.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}d.env="production",d.version="5.0.1",d.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i);var n=t("./bilibili"),a=t("./getDanmuTop"),o=r.interopDefault(a);class s{constructor(e,i){let{constructor:r,template:n}=e;if(this.utils=r.utils,this.validator=r.validator,this.$danmuku=n.$danmuku,this.$player=n.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(i),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){// +}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){let{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[1]}filter(t,e){return this.queue.filter(e=>e.$state===t).map(e)}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){let t=this.$refs.pop();if(t)return t;let e=document.createElement("div");return e.style.cssText=` + user-select: none; + position: absolute; + white-space: pre; + pointer-events: none; + perspective: 500px; + display: inline-block; + will-change: transform; + font-weight: normal; + line-height: 1.125; + visibility: hidden; + font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; + text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; + `,e}getReady(){let{currentTime:t}=this.art;return this.queue.filter(e=>"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1)}getEmits(){let t=[],{clientWidth:e}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",r=>{let n=r.$ref.offsetTop,a=this.getLeft(r.$ref)-i,o=r.$ref.clientHeight,s=r.$ref.clientWidth,l=a+s,u=e-l,d=l/r.$restTime,m={};m.top=n,m.left=a,m.height=o,m.width=s,m.right=u,m.speed=d,m.distance=l,m.time=r.$restTime,m.mode=r.mode,t.push(m)}),t}getFontSize(t){let{clamp:e}=this.utils,{clientHeight:i}=this.$player;if("number"==typeof t)return e(t,12,i);if("string"==typeof t&&t.endsWith("%")){let r=parseFloat(t)/100;return e(i*r,12,i)}return s.option.fontSize}postMessage(t={}){return new Promise(e=>{if(this.option.useWorker&&this.worker&&this.worker.postMessage)t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:r}=i;r.id===t.id&&e(r)};else{let i=(0,o.default)(t);e({top:i})}})}async load(){try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,this.utils.errorHandle(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.art.emit("artplayerPluginDanmuku:loaded",this.danmus),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(t=>this.emit(t))}catch(t){throw this.art.emit("artplayerPluginDanmuku:error",t),t}return this}config(t){let{clamp:e}=this.utils;return this.option=Object.assign({},s.option,this.option,t),this.validator(this.option,s.scheme),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(Math.floor(this.option.lockTime),0,60),this.option.maxLength=e(this.option.maxLength,0,500),this.option.minWidth=e(this.option.minWidth,0,500),this.option.maxWidth=e(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}makeWait(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(e.$state="stop",0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition="transform 0s linear 0s"}}),this}reset(){return this.queue.forEach(t=>this.makeWait(t)),this}update(){return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let t=this.getReady(),{clientWidth:e,clientHeight:i}=this.$player;for(let r=0;rthis.makeWait(t)),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}emit(t){return this.validator(t,{text:"string",mode:"number|undefined",color:"string|undefined",time:"number|undefined",border:"boolean|undefined"}),t.text.trim()&&this.option.filter(t)&&(t.time?t.time=this.utils.clamp(t.time,0,1/0):t.time=this.art.currentTime+.5,void 0===t.mode&&(t.mode=this.option.mode),void 0===t.color&&(t.color=this.option.color),this.queue.push({...t,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0})),this}destroy(){this.stop(),this.worker&&this.worker.terminate&&this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}i.default=s},{"./bilibili":"f83sx","./getDanmuTop":"jPSuD",e55e9b30c441298a:"fXq73","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");function n(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:case 5:return 1}}function a(t){if("string"!=typeof t)return[];let e=t.matchAll(/(?.+?)<\/d>/gs);return Array.from(e).map(t=>{let e=t.groups.p.split(",");if(!(e.length>=8))return null;{let i=t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&");return{text:i,time:Number(e[0]),mode:n(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}}}).filter(Boolean)}function o(t){return fetch(t).then(t=>t.text()).then(t=>a(t))}r.defineInteropFlag(i),r.export(i,"getMode",()=>n),r.export(i,"bilibiliDanmuParseFromXml",()=>a),r.export(i,"bilibiliDanmuParseFromUrl",()=>o)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(t,e,i){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||e.hasOwnProperty(i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],jPSuD:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");function n({target:t,emits:e,clientWidth:i,clientHeight:r,marginBottom:n,marginTop:a,antiOverlap:o}){let s=e.filter(e=>e.mode===t.mode&&e.top<=r-n).sort((t,e)=>t.top-e.top);if(0===s.length)return a;s.unshift({top:0,left:0,right:0,height:a,width:i,speed:0,distance:i}),s.push({top:r-n,left:0,right:0,height:n,width:i,speed:0,distance:i});for(let e=1;e=t.height)return n}let l=[];for(let t=1;te.every(e=>{if(ie.time}));return e&&e[0]?e[0].top:void 0}case 1:return}else{switch(t.mode){case 0:l.sort((t,e)=>{let i=Math.min(...e.map(t=>t.right)),r=Math.min(...t.map(t=>t.right));return i*e.length-r*t.length});break;case 1:l.sort((t,e)=>{let i=Math.max(...e.map(t=>t.width)),r=Math.max(...t.map(t=>t.width));return r*t.length-i*e.length})}return l[0][0].top}}r.defineInteropFlag(i),r.export(i,"default",()=>n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],fXq73:[function(t,e,i){e.exports="data:application/javascript,onmessage%3De%3D%3E%7Blet%7Bdata%3At%7D%3De%2Ch%3Dfunction%28%7Btarget%3Ae%2Cemits%3At%2CclientWidth%3Ah%2CclientHeight%3Ai%2CmarginBottom%3Ar%2CmarginTop%3As%2CantiOverlap%3An%7D%29%7Blet%20l%3Dt.filter%28t%3D%3Et.mode%3D%3D%3De.mode%26%26t.top%3C%3Di-r%29.sort%28%28e%2Ct%29%3D%3Ee.top-t.top%29%3Bif%280%3D%3D%3Dl.length%29return%20s%3Bl.unshift%28%7Btop%3A0%2Cleft%3A0%2Cright%3A0%2Cheight%3As%2Cwidth%3Ah%2Cspeed%3A0%2Cdistance%3Ah%7D%29%2Cl.push%28%7Btop%3Ai-r%2Cleft%3A0%2Cright%3A0%2Cheight%3Ar%2Cwidth%3Ah%2Cspeed%3A0%2Cdistance%3Ah%7D%29%3Bfor%28let%20t%3D1%3Bt%3Cl.length%3Bt%2B%3D1%29%7Blet%20h%3Dl%5Bt%5D%2Ci%3Dl%5Bt-1%5D%2Cr%3Di.top%2Bi.height%2Cs%3Dh.top-r%3Bif%28s%3E%3De.height%29return%20r%7Dlet%20p%3D%5B%5D%3Bfor%28let%20e%3D1%3Be%3Cl.length-1%3Be%2B%3D1%29%7Blet%20t%3Dl%5Be%5D%3Bif%28p.length%29%7Blet%20e%3Dp%5Bp.length-1%5D%3Be%5B0%5D.top%3D%3D%3Dt.top%3Fe.push%28t%29%3Ap.push%28%5Bt%5D%29%7Delse%20p.push%28%5Bt%5D%29%7Dif%28n%29switch%28e.mode%29%7Bcase%200%3A%7Blet%20t%3Dp.find%28t%3D%3Et.every%28t%3D%3E%7Bif%28h%3Ct.distance%29return%211%3Bif%28e.speed%3Ct.speed%29return%210%3Blet%20i%3Dt.right%2F%28e.speed-t.speed%29%3Breturn%20i%3Et.time%7D%29%29%3Breturn%20t%26%26t%5B0%5D%3Ft%5B0%5D.top%3Avoid%200%7Dcase%201%3Areturn%7Delse%7Bswitch%28e.mode%29%7Bcase%200%3Ap.sort%28%28e%2Ct%29%3D%3E%7Blet%20h%3DMath.min%28...t.map%28e%3D%3Ee.right%29%29%2Ci%3DMath.min%28...e.map%28e%3D%3Ee.right%29%29%3Breturn%20h%2at.length-i%2ae.length%7D%29%3Bbreak%3Bcase%201%3Ap.sort%28%28e%2Ct%29%3D%3E%7Blet%20h%3DMath.max%28...t.map%28e%3D%3Ee.width%29%29%2Ci%3DMath.max%28...e.map%28e%3D%3Ee.width%29%29%3Breturn%20i%2ae.length-h%2at.length%7D%29%7Dreturn%20p%5B0%5D%5B0%5D.top%7D%7D%28t%29%3Bself.postMessage%28%7Btop%3Ah%2Cid%3At.id%7D%29%7D%3B"},{}],lO8OT:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>f);var n=t("bundle-text:./style.less"),a=r.interopDefault(n),o=t("bundle-text:./img/danmu-on.svg"),s=r.interopDefault(o),l=t("bundle-text:./img/danmu-off.svg"),u=r.interopDefault(l),d=t("bundle-text:./img/danmu-config.svg"),m=r.interopDefault(d),p=t("bundle-text:./img/danmu-style.svg"),h=r.interopDefault(p);function f(t,e){let{option:i}=e,{template:{$controlsCenter:r,$player:n},constructor:{SETTING_ITEM_WIDTH:a,utils:{removeClass:o,addClass:l,append:d,setStyle:p,tooltip:f,query:c,inverseClass:g,getIcon:y}}}=t;p(r,"display","flex");let k=y("danmu-on",s.default),x=y("danmu-off",u.default),v=y("danmu-config",m.default),b=y("danmu-style",h.default);!function(){let a=["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"].map(t=>{let e=i.color===t?" art-current":"";return`
`}),s=d(r,` +
+
+
+
+
+
u{6A21}\u{5F0F}
+
+
u{6EDA}\u{52A8}
+
u{9759}\u{6B62}
+
+
u{989C}\u{8272}
+
+ ${a.join("")} +
+
+
+
+ +
+
u{53D1}\u{9001}
+
+ `),u=c(".art-danmuku-style",s),m=c(".art-danmuku-input",s),h=c(".art-danmuku-send",s),f=c(".art-danmuku-style-panel-inner",s),y=c(".art-danmuku-style-panel-modes",s),k=c(".art-danmuku-style-panel-colors",s),x=i.mount||d(n,'
');t.option.backdrop&&l(f,"art-backdrop-filter"),i.theme&&l(s,`art-danmuku-theme-${i.theme}`);let v=null,w=i.mode,$=i.color;function D(){let r={mode:w,color:$,border:!0,text:m.value.trim()};null===v&&i.beforeEmit(r)&&(m.value="",e.emit(r),l(h,"art-disabled"),function t(e){e<=0?(v=null,h.innerText="发送",o(h,"art-disabled")):(h.innerText=e,v=setTimeout(()=>t(e-1),1e3))}(i.lockTime),t.emit("artplayerPluginDanmuku:emit",r))}function B(){r.clientWidth{"Enter"===t.key&&(t.preventDefault(),D())}),t.proxy(y,"click",t=>{let{dataset:e}=t.target;e.mode&&(w=Number(e.mode),g(t.target,"art-current"))}),t.proxy(k,"click",t=>{let{dataset:e}=t.target;e.color&&($=e.color,g(t.target,"art-current"))}),B(),t.on("resize",()=>{t.isInput||B()}),t.on("destroy",()=>{i.mount&&s.parentElement===i.mount&&i.mount.removeChild(s)})}(),t.controls.add({position:"right",name:"danmuku",click:function(){e.isHide?(e.show(),t.notice.show="弹幕显示",p(k,"display",null),p(x,"display","none")):(e.hide(),t.notice.show="弹幕隐藏",p(k,"display","none"),p(x,"display",null))},mounted(e){d(e,k),d(e,x),f(e,"弹幕开关"),p(x,"display","none"),t.on("artplayerPluginDanmuku:hide",()=>{p(k,"display","none"),p(x,"display",null)}),t.on("artplayerPluginDanmuku:show",()=>{p(k,"display",null),p(x,"display","none")})}}),t.setting.add({width:260,name:"danmuku",html:"弹幕设置",tooltip:"更多",icon:v,selector:[{width:a,html:"播放速度",icon:"",tooltip:"适中",selector:[{html:"极慢",time:10},{html:"较慢",time:7.5},{default:!0,html:"适中",time:5},{html:"较快",time:2.5},{html:"极快",time:1}],onSelect:function(t){return e.config({speed:t.time}),t.html}},{width:a,html:"字体大小",icon:"",tooltip:"适中",selector:[{html:"极小",fontSize:"4%"},{html:"较小",fontSize:"5%"},{default:!0,html:"适中",fontSize:"6%"},{html:"较大",fontSize:"7%"},{html:"极大",fontSize:"8%"}],onSelect:function(t){return e.config({fontSize:t.fontSize}),t.html}},{width:a,html:"不透明度",icon:"",tooltip:"100%",selector:[{default:!0,opacity:1,html:"100%"},{opacity:.75,html:"75%"},{opacity:.5,html:"50%"},{opacity:.25,html:"25%"},{opacity:0,html:"0%"}],onSelect:function(t){return e.config({opacity:t.opacity}),t.html}},{width:a,html:"显示范围",icon:"",tooltip:"3/4",selector:[{html:"1/4",margin:[10,"75%"]},{html:"半屏",margin:[10,"50%"]},{default:!0,html:"3/4",margin:[10,"25%"]},{html:"满屏",margin:[10,10]}],onSelect:function(t){return e.config({margin:t.margin}),t.html}},{html:"弹幕防重叠",icon:"",tooltip:i.antiOverlap?"开启":"关闭",switch:i.antiOverlap,onSwitch:t=>(e.config({antiOverlap:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)},{html:"同步视频速度",icon:"",tooltip:i.synchronousPlayback?"开启":"关闭",switch:i.synchronousPlayback,onSwitch:t=>(e.config({synchronousPlayback:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)}]})}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-danmuku")){let t=document.createElement("style");t.id="artplayer-plugin-danmuku",t.textContent=a.default,document.head.appendChild(t)}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/danmu-on.svg":"4KfW9","bundle-text:./img/danmu-off.svg":"9UR3U","bundle-text:./img/danmu-config.svg":"4MPCW","bundle-text:./img/danmu-style.svg":"7lV5Q","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(t,e,i){e.exports='.art-danmuku-emitter{background-color:#ffffff4d;border-radius:5px;width:100%;max-width:100%;height:32px;font-size:12px;line-height:1;display:flex;position:relative}.art-danmuku-emitter .art-backdrop-filter{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3!important}.art-danmuku-emitter .art-danmuku-left{border-radius:3px 0 0 3px;flex:1;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style{justify-content:center;align-items:center;width:32px;display:flex;position:relative}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{z-index:999;width:200px;padding-bottom:10px;display:none;position:absolute;bottom:30px;left:-85px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner{background-color:#000000e6;border-radius:3px;flex-direction:column;padding:10px 10px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-title{margin-bottom:10px;font-size:13px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes{justify-content:space-between;margin-bottom:15px;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes .art-danmuku-style-panel-mode{cursor:pointer;color:#fff;border:1px solid #fff;justify-content:center;width:47%;padding:5px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-modes .art-danmuku-style-panel-mode.art-current{background-color:#00a1d6;border:1px solid #00a1d6}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors{flex-wrap:wrap;justify-content:space-between;gap:5px;margin-bottom:10px;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color{cursor:pointer;border:1px solid #fff;width:20px;height:20px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color.art-current{position:relative;box-shadow:0 0 2px #fff}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-colors .art-danmuku-style-panel-color.art-current:before{content:"";border:2px solid #000;width:100%;height:100%;position:absolute;inset:0}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style:hover .art-danmuku-style-panel{display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-icon{opacity:.75;cursor:pointer}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-icon:hover{opacity:1}.art-danmuku-emitter .art-danmuku-left .art-danmuku-input{color:#fff;background-color:#0000;border:none;outline:none;flex:1;width:100%;padding:0 10px 0 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-input::placeholder{color:#ffffff80}.art-danmuku-emitter .art-danmuku-left .art-danmuku-input::placeholder{color:#ffffff80}.art-danmuku-emitter .art-danmuku-send{cursor:pointer;background-color:#00a1d6;border-radius:0 5px 5px 0;justify-content:center;align-items:center;width:50px;display:flex}.art-danmuku-emitter .art-danmuku-send:hover{background-color:#00b5e5}.art-danmuku-emitter .art-danmuku-send.art-disabled{opacity:.5;pointer-events:none}.art-danmuku-emitter.art-danmuku-mount{max-width:100%!important}.art-danmuku-emitter.art-danmuku-mount .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{left:0}.art-danmuku-emitter.art-danmuku-mount .art-danmuku-send{width:60px}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left{background:#f4f4f4;border:1px solid #dadada}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-style .art-icon svg{fill:#666}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input{color:#000}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input::placeholder{color:#00000080}.art-danmuku-emitter.art-danmuku-mount.art-danmuku-theme-light .art-danmuku-left .art-danmuku-input::placeholder{color:#00000080}.art-layer-danmuku-emitter{z-index:99;width:100%;position:absolute;bottom:-40px;left:0;right:0}'},{}],"4KfW9":[function(t,e,i){e.exports=''},{}],"9UR3U":[function(t,e,i){e.exports=''},{}],"4MPCW":[function(t,e,i){e.exports=''},{}],"7lV5Q":[function(t,e,i){e.exports=''},{}],"8AxLD":[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>o);let n={map:(t,e,i,r,n)=>(t-e)*(n-r)/(i-e)+r,range(t,e,i){let r=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+r)}},a=(t,e)=>{let i=e[0]-t[0],r=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(r,2)),angle:Math.atan2(r,i)}};function o(t,e,i){let{query:r}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(o){let s=null,l=null;function u(u=[]){if(s=null,l=null,o.innerHTML="",!t.duration||t.option.isLive)return;let d={w:o.offsetWidth,h:o.offsetHeight},m={xMin:0,xMax:d.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*d.h),sampling:Math.floor(d.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(m,i);let p=[];if(Array.isArray(u)&&u.length)p=[...u];else{let i=t.duration/d.w;for(let t=0;t<=d.w;t+=m.sampling){let r=e.danmus.filter(({time:e})=>e>t*i&&e<=(t+m.sampling)*i).length;p.push([t,r])}}if(0===p.length)return;let h=p[p.length-1],f=h[0],c=h[1];f!==d.w&&p.push([d.w,c]);let g=p.map(t=>t[1]),y=(Math.min(...g)+Math.max(...g))/2;for(let t=0;ty?1+m.scale:1-m.scale)+m.minHeight}let k=(t,e,i,r)=>{let o=a(e||t,i||t),s=n.map(Math.cos(o.angle)*m.flattening,0,1,1,0),l=o.angle*s+(r?Math.PI:0),u=o.length*m.smoothing,d=t[0]+Math.cos(l)*u,p=t[1]+Math.sin(l)*u;return[d,p]},x=(t,e,i)=>{let r=k(i[e-1],i[e-2],t),n=k(t,i[e-1],i[e+1],!0),a=e===i.length-1?" z":"";return`C ${r[0]},${r[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${a}`},v=p.map(t=>{let e=n.map(t[0],m.xMin,m.xMax,0,d.w),i=n.map(t[1],m.yMin,m.yMax,d.h,0);return[e,i]}),b=v.reduce((t,e,i,r)=>0===i?`M ${r[r.length-1][0]},${d.h} L ${e[0]},${d.h} L ${e[0]},${e[1]}`:`${t} ${x(e,i,r)}`,"");o.innerHTML=` + + + + + + + + + + + + `,s=r("#heatmap-start",o),l=r("#heatmap-stop",o),s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{s&&l&&(s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{s&&l&&"played"===t&&(s.setAttribute("offset",`${100*e}%`),l.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>u()),t.on("resize",()=>u()),t.on("artplayerPluginDanmuku:loaded",()=>u()),t.on("artplayerPluginDanmuku:points",t=>u(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-danmuku.legacy.js b/docs/compiled/artplayer-plugin-danmuku.legacy.js index 743519ed9..7ea8034f3 100644 --- a/docs/compiled/artplayer-plugin-danmuku.legacy.js +++ b/docs/compiled/artplayer-plugin-danmuku.legacy.js @@ -4,4 +4,36 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(t,e,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],s=i.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!s[e]){if(!t[e]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!0);if(i)return i(e,!0);if(u&&"string"==typeof e)return u(e);var c=new Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=s[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return s[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=s,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c=5,"Artplayer.js@".concat(r," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"))}(e);var r=new(0,o.default)(e,t);return(0,s.default)(e,r),t.heatmap&&(0,l.default)(e,r,t.heatmap),{name:"artplayerPluginDanmuku",emit:r.emit.bind(r),load:r.load.bind(r),config:r.config.bind(r),hide:r.hide.bind(r),show:r.show.bind(r),reset:r.reset.bind(r),get option(){return r.option},get isHide(){return r.isHide},get isStop(){return r.isStop}}}}r.default=c,c.env="production",c.version="5.0.1",c.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return b}));var a=t("@swc/helpers/src/_async_to_generator.mjs"),o=n.interopDefault(a),i=t("@swc/helpers/src/_class_call_check.mjs"),s=n.interopDefault(i),u=t("@swc/helpers/src/_create_class.mjs"),l=n.interopDefault(u),c=t("@swc/helpers/src/_object_spread.mjs"),p=n.interopDefault(c),f=t("@swc/helpers/src/_object_spread_props.mjs"),d=n.interopDefault(f),m=t("@swc/helpers/src/_ts_generator.mjs"),h=n.interopDefault(m),y=t("./bilibili"),g=t("./getDanmuTop"),v=n.interopDefault(g),b=function(){"use strict";function e(r,n){(0,s.default)(this,e);var a=r.constructor,o=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=o.$danmuku,this.$player=o.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,l.default)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter((function(e){return e.$state===t})).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',e}},{key:"getReady",value:function(){var t=this.art.currentTime;return this.queue.filter((function(e){return"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1}))}},{key:"getEmits",value:function(){var t=this,e=[],r=this.$player.clientWidth,n=this.getLeft(this.$player);return this.filter("emit",(function(a){var o=a.$ref.offsetTop,i=t.getLeft(a.$ref)-n,s=a.$ref.clientHeight,u=a.$ref.clientWidth,l=i+u,c=r-l,p=l/a.$restTime,f={};f.top=o,f.left=i,f.height=s,f.width=u,f.right=c,f.speed=p,f.distance=l,f.time=a.$restTime,f.mode=a.mode,e.push(f)})),e}},{key:"getFontSize",value:function(t){var r=this.utils.clamp,n=this.$player.clientHeight;return"number"==typeof t?r(t,12,n):"string"==typeof t&&t.endsWith("%")?r(n*(parseFloat(t)/100),12,n):e.option.fontSize}},{key:"postMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this;return new Promise((function(r){if(e.option.useWorker&&e.worker&&e.worker.postMessage)t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var n=e.data;n.id===t.id&&r(n)};else{var n=(0,v.default)(t);r({top:n})}}))}},{key:"load",value:function(){var t=this;return(0,o.default)((function(){var e;return(0,h.default)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),"function"!=typeof t.option.danmuku?[3,2]:[4,t.option.danmuku()];case 1:return t.danmus=r.sent(),[3,7];case 2:return"function"!=typeof t.option.danmuku.then?[3,4]:[4,t.option.danmuku];case 3:return t.danmus=r.sent(),[3,7];case 4:return"string"!=typeof t.option.danmuku?[3,6]:[4,(0,y.bilibiliDanmuParseFromUrl)(t.option.danmuku)];case 5:return t.danmus=r.sent(),[3,7];case 6:t.danmus=t.option.danmuku,r.label=7;case 7:return t.utils.errorHandle(Array.isArray(t.danmus),"Danmuku need return an array as result"),t.art.emit("artplayerPluginDanmuku:loaded",t.danmus),t.queue=[],t.$danmuku.innerText="",t.danmus.forEach((function(e){return t.emit(e)})),[3,9];case 8:throw e=r.sent(),t.art.emit("artplayerPluginDanmuku:error",e),e;case 9:return[2,t]}}))}))()}},{key:"config",value:function(t){var r=this.utils.clamp;return this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.speed=r(this.option.speed,1,10),this.option.opacity=r(this.option.opacity,0,1),this.option.lockTime=r(Math.floor(this.option.lockTime),0,60),this.option.maxLength=r(this.option.maxLength,0,500),this.option.minWidth=r(this.option.minWidth,0,500),this.option.maxWidth=r(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}},{key:"makeWait",value:function(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}},{key:"continue",value:function(){var t=this.$player.clientWidth;return this.filter("stop",(function(e){if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){var r=t+e.$ref.clientWidth;e.$ref.style.transform="translateX(".concat(-r,"px)"),e.$ref.style.transition="transform ".concat(e.$restTime,"s linear 0s")}})),this}},{key:"suspend",value:function(){var t=this,e=this.$player.clientWidth;return this.filter("emit",(function(r){if(r.$state="stop",0===r.mode){var n=e-(t.getLeft(r.$ref)-t.getLeft(t.$player));r.$ref.style.transform="translateX(".concat(-n,"px)"),r.$ref.style.transition="transform 0s linear 0s"}})),this}},{key:"reset",value:function(){var t=this;return this.queue.forEach((function(e){return t.makeWait(e)})),this}},{key:"update",value:function(){var t=this;return this.timer=window.requestAnimationFrame((0,o.default)((function(){var e,r,n,a,o,i,s,u,l;return(0,h.default)(this,(function(c){switch(c.label){case 0:if(!t.art.playing||t.isHide)return[3,4];t.filter("emit",(function(e){var r=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=r,e.$lastStartTime=Date.now(),e.$restTime<=0&&t.makeWait(e)})),e=t.getReady(),r=t.$player,n=r.clientWidth,a=r.clientHeight,o=0,c.label=1;case 1:return o=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function p(t,e){return function(r,n){e(r,n,t)}}function f(t,e,r,n,a,o){function i(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var s,u=n.kind,l="getter"===u?"get":"setter"===u?"set":"value",c=!e&&t?n.static?t:t.prototype:null,p=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,d=r.length-1;d>=0;d--){var m={};for(var h in n)m[h]="access"===h?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(t){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(t||null))};var y=(0,r[d])("accessor"===u?{get:p.get,set:p.set}:p[l],m);if("accessor"===u){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=i(y.get))&&(p.get=s),(s=i(y.set))&&(p.set=s),(s=i(y.init))&&a.push(s)}else(s=i(y))&&("field"===u?a.push(s):p[l]=s)}c&&Object.defineProperty(c,n.name,p),f=!0}function d(t,e,r){for(var n=arguments.length>2,a=0;a0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,a,o=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(t){a={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}function x(){for(var t=[],e=0;e1||s(t,e)}))})}function s(t,e){try{(r=a[t](e)).value instanceof C?Promise.resolve(r.value.v).then(u,l):c(o[0][2],r)}catch(t){c(o[0][3],t)}var r}function u(t){s("next",t)}function l(t){s("throw",t)}function c(t,e){t(e),o.shift(),o.length&&s(o[0][0],o[0][1])}}function O(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,a){e[n]=t[n]?function(e){return(r=!r)?{value:C(t[n](e)),done:!1}:a?a(e):e}:a}}function B(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=k(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,a){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,a,(e=t[r](e)).done,e.value)}))}}}function A(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var $=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function F(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&b(e,t,r);return $(e,t),e}function P(t){return t&&t.__esModule?t:{default:t}}function W(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function T(t,e,r,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(t,r):a?a.value=r:e.set(t,r),r}function M(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}},{"@swc/helpers/src/_type_of.mjs":"78qx0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"78qx0":[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return a._}));var a=t("../esm/_type_of.js")},{"../esm/_type_of.js":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}n.defineInteropFlag(r),n.export(r,"_type_of",(function(){return a})),n.export(r,"_",(function(){return a}))},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kMsXR:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:case 5:return 1}}function o(t){if("string"!=typeof t)return[];var e=t.matchAll(RegExp('(?.+?)<\\/d>',"gs"));return Array.from(e).map((function(t){var e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:a(Number(e[1])),fontSize:Number(e[2]),color:"#".concat(Number(e[3]).toString(16)),timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null})).filter(Boolean)}function i(t){return fetch(t).then((function(t){return t.text()})).then((function(t){return o(t)}))}n.defineInteropFlag(r),n.export(r,"getMode",(function(){return a})),n.export(r,"bilibiliDanmuParseFromXml",(function(){return o})),n.export(r,"bilibiliDanmuParseFromUrl",(function(){return i}))},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],fdr65:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var a=t("@swc/helpers/src/_to_consumable_array.mjs"),o=n.interopDefault(a);r.default=function(t){var e=t.target,r=t.emits,n=t.clientWidth,a=t.clientHeight,i=t.marginBottom,s=t.marginTop,u=t.antiOverlap,l=r.filter((function(t){return t.mode===e.mode&&t.top<=a-i})).sort((function(t,e){return t.top-e.top}));if(0===l.length)return s;l.unshift({top:0,left:0,right:0,height:s,width:n,speed:0,distance:n}),l.push({top:a-i,left:0,right:0,height:i,width:n,speed:0,distance:n});for(var c=1;c=e.height)return d}for(var m=[],h=1;ht.time)}))}));return v&&v[0]?v[0].top:void 0;case 1:return}}},{"@swc/helpers/src/_to_consumable_array.mjs":"inwWM","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],inwWM:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return a._}));var a=t("../esm/_to_consumable_array.js")},{"../esm/_to_consumable_array.js":"iwLF0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iwLF0:[function(t,e,r){var n=t("@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 a=t("./_array_without_holes.js"),o=t("./_iterable_to_array.js"),i=t("./_non_iterable_spread.js"),s=t("./_unsupported_iterable_to_array.js");function u(t){return(0,a._array_without_holes)(t)||(0,o._iterable_to_array)(t)||(0,s._unsupported_iterable_to_array)(t)||(0,i._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(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_array_without_holes",(function(){return o})),n.export(r,"_",(function(){return o}));var a=t("./_array_like_to_array.js");function o(t){if(Array.isArray(t))return(0,a._array_like_to_array)(t)}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r')})),i=h(a,'
模式
滚动
静止
颜色
').concat(n.join(""),'
发送
')),s=v(".art-danmuku-style",i),u=v(".art-danmuku-input",i),l=v(".art-danmuku-send",i),c=v(".art-danmuku-style-panel-inner",i),p=v(".art-danmuku-style-panel-modes",i),d=v(".art-danmuku-style-panel-colors",i),g=r.mount||h(o,'
');t.option.backdrop&&m(c,"art-backdrop-filter"),r.theme&&m(i,"art-danmuku-theme-".concat(r.theme));var _=null,k=r.mode,w=r.color;function x(t){t<=0?(_=null,l.innerText="发送",f(l,"art-disabled")):(l.innerText=t,_=setTimeout((function(){return x(t-1)}),1e3))}function D(){var n={mode:k,color:w,border:!0,text:u.value.trim()};null===_&&r.beforeEmit(n)&&(u.value="",e.emit(n),m(l,"art-disabled"),x(r.lockTime),t.emit("artplayerPluginDanmuku:emit",n))}function C(){a.clientWidth0&&void 0!==arguments[0]?arguments[0]:[];if(s=null,u=null,a.innerHTML="",t.duration&&!t.option.isLive){var f={w:a.offsetWidth,h:a.offsetHeight},d={xMin:0,xMax:f.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*f.h),sampling:Math.floor(f.w/100),smoothing:.2,flattening:.2};"object"==typeof r&&Object.assign(d,r);var m=[];if(Array.isArray(p)&&p.length)m=(0,o.default)(p);else for(var h=function(t){var r=e.danmus.filter((function(e){var r=e.time;return r>t*y&&r<=(t+d.sampling)*y})).length;m.push([t,r])},y=t.duration/f.w,g=0;g<=f.w;g+=d.sampling)h(g);if(0!==m.length){var v=m[m.length-1],b=v[0],_=v[1];b!==f.w&&m.push([f.w,_]);for(var k=m.map((function(t){return t[1]})),w=((l=Math).min.apply(l,(0,o.default)(k))+(c=Math).max.apply(c,(0,o.default)(k)))/2,x=0;xw?1+d.scale:1-d.scale)+d.minHeight}var C=function(t,e,r,n){var a,o,s,u,l=(a=e||t,s=(o=r||t)[0]-a[0],u=o[1]-a[1],{length:Math.sqrt(Math.pow(s,2)+Math.pow(u,2)),angle:Math.atan2(u,s)}),c=i(Math.cos(l.angle)*d.flattening,0,1,1,0),p=l.angle*c+(n?Math.PI:0),f=l.length*d.smoothing;return[t[0]+Math.cos(p)*f,t[1]+Math.sin(p)*f]},S=m.map((function(t){return[i(t[0],d.xMin,d.xMax,0,f.w),i(t[1],d.yMin,d.yMax,f.h,0)]})).reduce((function(t,e,r,n){return 0===r?"M ".concat(n[n.length-1][0],",").concat(f.h," L ").concat(e[0],",").concat(f.h," L ").concat(e[0],",").concat(e[1]):"".concat(t," ").concat(function(t,e,r){var n=C(r[e-1],r[e-2],t),a=C(t,r[e-1],r[e+1],!0),o=e===r.length-1?" z":"";return"C ".concat(n[0],",").concat(n[1]," ").concat(a[0],",").concat(a[1]," ").concat(t[0],",").concat(t[1]).concat(o)}(e,r,n))}),"");a.innerHTML=''),s=n("#heatmap-start",a),u=n("#heatmap-stop",a),s.setAttribute("offset","".concat(100*t.played,"%")),u.setAttribute("offset","".concat(100*t.played,"%"))}}}t.on("video:timeupdate",(function(){s&&u&&(s.setAttribute("offset","".concat(100*t.played,"%")),u.setAttribute("offset","".concat(100*t.played,"%")))})),t.on("setBar",(function(t,e){s&&u&&"played"===t&&(s.setAttribute("offset","".concat(100*e,"%")),u.setAttribute("offset","".concat(100*e,"%")))})),t.on("ready",(function(){return l()})),t.on("resize",(function(){return l()})),t.on("artplayerPluginDanmuku:loaded",(function(){return l()})),t.on("artplayerPluginDanmuku:points",(function(t){return l(t)}))}})}},{"@swc/helpers/src/_to_consumable_array.mjs":"inwWM","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["40mNk"],"40mNk","parcelRequire4dc0"); \ No newline at end of file +!// 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(t,e,r,n,a){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!u[e]){if(!t[e]){// 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 a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!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(i)return i(e,!0);// Try the node require function if it exists. +if(s&&"string"==typeof e)return s(e);var c=Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=u[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return u[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=u,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c=5,"Artplayer.js@".concat(n," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"));var r,n,a,i=new o.default(e,t);return(0,u.default)(e,i),t.heatmap&&(0,l.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}c.env="production",c.version="5.0.1",c.build="2023-11-23 23:22:00","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return d});var a=t("@swc/helpers/_/_async_to_generator"),o=t("@swc/helpers/_/_class_call_check"),i=t("@swc/helpers/_/_create_class"),u=t("@swc/helpers/_/_object_spread"),s=t("@swc/helpers/_/_object_spread_props"),l=t("@swc/helpers/_/_ts_generator"),c=t("./bilibili"),p=t("./getDanmuTop"),f=n.interopDefault(p),d=/*#__PURE__*/function(){function e(r,n){(0,o._)(this,e);var a=r.constructor,i=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){// +}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,i._)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter(function(e){return e.$state===t}).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',e}},{key:"getReady",value:function(){var t=this.art.currentTime;return this.queue.filter(function(e){return"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1})}},{key:"getEmits",value:function(){var t=this,e=[],r=this.$player.clientWidth,n=this.getLeft(this.$player);return this.filter("emit",function(a){var o=a.$ref.offsetTop,i=t.getLeft(a.$ref)-n,u=a.$ref.clientHeight,s=a.$ref.clientWidth,l=i+s,c=r-l,p=l/a.$restTime,f={};f.top=o,f.left=i,f.height=u,f.width=s,f.right=c,f.speed=p,f.distance=l,f.time=a.$restTime,f.mode=a.mode,e.push(f)}),e}},{key:"getFontSize",value:function(t){var r=this.utils.clamp,n=this.$player.clientHeight;return"number"==typeof t?r(t,12,n):"string"==typeof t&&t.endsWith("%")?r(n*(parseFloat(t)/100),12,n):e.option.fontSize}},{key:"postMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this;return new Promise(function(r){e.option.useWorker&&e.worker&&e.worker.postMessage?(t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var n=e.data;n.id===t.id&&r(n)}):r({top:(0,f.default)(t)})})}},{key:"load",value:function(){var t=this;return(0,a._)(function(){var e;return(0,l._)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,8,,9]),"function"!=typeof t.option.danmuku)return[3,2];return[4,t.option.danmuku()];case 1:case 3:case 5:return t.danmus=r.sent(),[3,7];case 2:if("function"!=typeof t.option.danmuku.then)return[3,4];return[4,t.option.danmuku];case 4:if("string"!=typeof t.option.danmuku)return[3,6];return[4,(0,c.bilibiliDanmuParseFromUrl)(t.option.danmuku)];case 6:t.danmus=t.option.danmuku,r.label=7;case 7:return t.utils.errorHandle(Array.isArray(t.danmus),"Danmuku need return an array as result"),t.art.emit("artplayerPluginDanmuku:loaded",t.danmus),t.queue=[],t.$danmuku.innerText="",t.danmus.forEach(function(e){return t.emit(e)}),[3,9];case 8:throw e=r.sent(),t.art.emit("artplayerPluginDanmuku:error",e),e;case 9:return[2,t]}})})()}},{key:"config",value:function(t){var r=this.utils.clamp;return this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.speed=r(this.option.speed,1,10),this.option.opacity=r(this.option.opacity,0,1),this.option.lockTime=r(Math.floor(this.option.lockTime),0,60),this.option.maxLength=r(this.option.maxLength,0,500),this.option.minWidth=r(this.option.minWidth,0,500),this.option.maxWidth=r(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}},{key:"makeWait",value:function(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}},{key:"continue",value:function(){var t=this.$player.clientWidth;return this.filter("stop",function(e){if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){var r=t+e.$ref.clientWidth;e.$ref.style.transform="translateX(".concat(-r,"px)"),e.$ref.style.transition="transform ".concat(e.$restTime,"s linear 0s")}}),this}},{key:"suspend",value:function(){var t=this,e=this.$player.clientWidth;return this.filter("emit",function(r){if(r.$state="stop",0===r.mode){var n=e-(t.getLeft(r.$ref)-t.getLeft(t.$player));r.$ref.style.transform="translateX(".concat(-n,"px)"),r.$ref.style.transition="transform 0s linear 0s"}}),this}},{key:"reset",value:function(){var t=this;return this.queue.forEach(function(e){return t.makeWait(e)}),this}},{key:"update",value:function(){var t=this;return this.timer=window.requestAnimationFrame(/*#__PURE__*/(0,a._)(function(){var e,r,n,a,o,i,u,s,c;return(0,l._)(this,function(l){switch(l.label){case 0:if(!(t.art.playing&&!t.isHide))return[3,4];t.filter("emit",function(e){var r=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=r,e.$lastStartTime=Date.now(),e.$restTime<=0&&t.makeWait(e)}),e=t.getReady(),n=(r=t.$player).clientWidth,a=r.clientHeight,o=0,l.label=1;case 1:if(!(oe.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(t);ae.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function l(t,e,r,n){var a,o=arguments.length,i=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function c(t,e){return function(r,n){e(r,n,t)}}function p(t,e,r,n,a,o){function i(t){if(void 0!==t&&"function"!=typeof t)throw TypeError("Function expected");return t}for(var u,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",c=!e&&t?n.static?t:t.prototype:null,p=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,d=r.length-1;d>=0;d--){var m={};for(var h in n)m[h]="access"===h?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(t){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(i(t||null))};var y=(0,r[d])("accessor"===s?{get:p.get,set:p.set}:p[l],m);if("accessor"===s){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw TypeError("Object expected");(u=i(y.get))&&(p.get=u),(u=i(y.set))&&(p.set=u),(u=i(y.init))&&a.unshift(u)}else(u=i(y))&&("field"===s?a.unshift(u):p[l]=u)}c&&Object.defineProperty(c,n.name,p),f=!0}function f(t,e,r){for(var n=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,a,o=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(t){a={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}function x(){for(var t=[],e=0;e1||u(t,e)})})}function u(t,e){try{var r;(r=a[t](e)).value instanceof j?Promise.resolve(r.value.v).then(s,l):c(o[0][2],r)}catch(t){c(o[0][3],t)}}function s(t){u("next",t)}function l(t){u("throw",t)}function c(t,e){t(e),o.shift(),o.length&&u(o[0][0],o[0][1])}}function C(t){var e,r;return e={},n("next"),n("throw",function(t){throw t}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,a){e[n]=t[n]?function(e){return(r=!r)?{value:j(t[n](e)),done:!1}:a?a(e):e}:a}}function O(t){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=b(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise(function(n,a){!function(t,e,r,n){Promise.resolve(n).then(function(e){t({value:e,done:r})},e)}(n,a,(e=t[r](e)).done,e.value)})}}}function B(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var $=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function F(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&v(e,t,r);return $(e,t),e}function A(t){return t&&t.__esModule?t:{default:t}}function P(t,e,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}function M(t,e,r,n,a){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(t,r):a?a.value=r:e.set(t,r),r}function T(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)}function W(t,e,r){if(null!=e){var n;if("object"!=typeof e&&"function"!=typeof e)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose]}if("function"!=typeof n)throw TypeError("Object not disposable.");t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}var E="function"==typeof SuppressedError?SuppressedError:function(t,e,r){var n=Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function H(t){function e(e){t.error=t.hasError?new E(e,t.error,"An error was suppressed during disposal."):e,t.hasError=!0}return function r(){for(;t.stack.length;){var n=t.stack.pop();try{var a=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(a).then(r,function(t){return e(t),r()})}catch(t){e(t)}}if(t.hasError)throw t.error}()}r.default={__extends:i,__assign:u,__rest:s,__decorate:l,__param:c,__metadata:h,__awaiter:y,__generator:g,__createBinding:v,__exportStar:_,__values:b,__read:k,__spread:x,__spreadArrays:w,__spreadArray:D,__await:j,__asyncGenerator:S,__asyncDelegator:C,__asyncValues:O,__makeTemplateObject:B,__importStar:F,__importDefault:A,__classPrivateFieldGet:P,__classPrivateFieldSet:M,__classPrivateFieldIn:T,__addDisposableResource:W,__disposeResources:H}},{"@swc/helpers/_/_type_of":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}n.defineInteropFlag(r),n.export(r,"_type_of",function(){return a}),n.export(r,"_",function(){return a})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kMsXR:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:case 5:return 1}}function o(t){return"string"!=typeof t?[]:Array.from(t.matchAll(RegExp('(?.+?)<\\/d>',"gs"))).map(function(t){var e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:a(Number(e[1])),fontSize:Number(e[2]),color:"#".concat(Number(e[3]).toString(16)),timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function i(t){return fetch(t).then(function(t){return t.text()}).then(function(t){return o(t)})}n.defineInteropFlag(r),n.export(r,"getMode",function(){return a}),n.export(r,"bilibiliDanmuParseFromXml",function(){return o}),n.export(r,"bilibiliDanmuParseFromUrl",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],fdr65:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return o});var a=t("@swc/helpers/_/_to_consumable_array");function o(t){var e=t.target,r=t.emits,n=t.clientWidth,o=t.clientHeight,i=t.marginBottom,u=t.marginTop,s=t.antiOverlap,l=r.filter(function(t){return t.mode===e.mode&&t.top<=o-i}).sort(function(t,e){return t.top-e.top});if(0===l.length)return u;l.unshift({top:0,left:0,right:0,height:u,width:n,speed:0,distance:n}),l.push({top:o-i,left:0,right:0,height:i,width:n,speed:0,distance:n});for(var c=1;c=e.height)return d}for(var m=[],h=1;ht.time)})});return v&&v[0]?v[0].top:void 0;case 1:return}else{switch(e.mode){case 0:m.sort(function(t,e){var r,n,o=(r=Math).min.apply(r,(0,a._)(e.map(function(t){return t.right}))),i=(n=Math).min.apply(n,(0,a._)(t.map(function(t){return t.right})));return o*e.length-i*t.length});break;case 1:m.sort(function(t,e){var r,n,o=(r=Math).max.apply(r,(0,a._)(e.map(function(t){return t.width})));return(n=Math).max.apply(n,(0,a._)(t.map(function(t){return t.width})))*t.length-o*e.length})}return m[0][0].top}}},{"@swc/helpers/_/_to_consumable_array":"iwLF0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iwLF0:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_to_consumable_array",function(){return s}),n.export(r,"_",function(){return s});var a=t("./_array_without_holes.js"),o=t("./_iterable_to_array.js"),i=t("./_non_iterable_spread.js"),u=t("./_unsupported_iterable_to_array.js");function s(t){return(0,a._array_without_holes)(t)||(0,o._iterable_to_array)(t)||(0,u._unsupported_iterable_to_array)(t)||(0,i._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(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_array_without_holes",function(){return o}),n.export(r,"_",function(){return o});var a=t("./_array_like_to_array.js");function o(t){if(Array.isArray(t))return(0,a._array_like_to_array)(t)}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r')}),i=h(a,'
模式
滚动
静止
颜色
').concat(n.join(""),'
发送
')),u=v(".art-danmuku-style",i),s=v(".art-danmuku-input",i),l=v(".art-danmuku-send",i),c=v(".art-danmuku-style-panel-inner",i),p=v(".art-danmuku-style-panel-modes",i),d=v(".art-danmuku-style-panel-colors",i),g=r.mount||h(o,'
');t.option.backdrop&&m(c,"art-backdrop-filter"),r.theme&&m(i,"art-danmuku-theme-".concat(r.theme));var b=null,k=r.mode,x=r.color;function w(){var n={mode:k,color:x,border:!0,text:s.value.trim()};null===b&&r.beforeEmit(n)&&(s.value="",e.emit(n),m(l,"art-disabled"),function t(e){e<=0?(b=null,l.innerText="发送",f(l,"art-disabled")):(l.innerText=e,b=setTimeout(function(){return t(e-1)},1e3))}(r.lockTime),t.emit("artplayerPluginDanmuku:emit",n))}function j(){a.clientWidth0&&void 0!==arguments[0]?arguments[0]:[];if(s=null,l=null,u.innerHTML="",t.duration&&!t.option.isLive){var d={w:u.offsetWidth,h:u.offsetHeight},m={xMin:0,xMax:d.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*d.h),sampling:Math.floor(d.w/100),smoothing:.2,flattening:.2};"object"==typeof r&&Object.assign(m,r);var h=[];if(Array.isArray(f)&&f.length)h=(0,a._)(f);else for(var y=function(t){var r=e.danmus.filter(function(e){var r=e.time;return r>t*g&&r<=(t+m.sampling)*g}).length;h.push([t,r])},g=t.duration/d.w,v=0;v<=d.w;v+=m.sampling)y(v);if(0!==h.length){var _=h[h.length-1],b=_[0],k=_[1];b!==d.w&&h.push([d.w,k]);for(var x=h.map(function(t){return t[1]}),w=((c=Math).min.apply(c,(0,a._)(x))+(p=Math).max.apply(p,(0,a._)(x)))/2,D=0;Dw?1+m.scale:1-m.scale)+m.minHeight}var C=function(t,e,r,n){var a=i(e||t,r||t),u=o.map(Math.cos(a.angle)*m.flattening,0,1,1,0),s=a.angle*u+(n?Math.PI:0),l=a.length*m.smoothing;return[t[0]+Math.cos(s)*l,t[1]+Math.sin(s)*l]},O=function(t,e,r){var n=C(r[e-1],r[e-2],t),a=C(t,r[e-1],r[e+1],!0),o=e===r.length-1?" z":"";return"C ".concat(n[0],",").concat(n[1]," ").concat(a[0],",").concat(a[1]," ").concat(t[0],",").concat(t[1]).concat(o)},B=h.map(function(t){return[o.map(t[0],m.xMin,m.xMax,0,d.w),o.map(t[1],m.yMin,m.yMax,d.h,0)]}).reduce(function(t,e,r,n){return 0===r?"M ".concat(n[n.length-1][0],",").concat(d.h," L ").concat(e[0],",").concat(d.h," L ").concat(e[0],",").concat(e[1]):"".concat(t," ").concat(O(e,r,n))},"");u.innerHTML=''),s=n("#heatmap-start",u),l=n("#heatmap-stop",u),s.setAttribute("offset","".concat(100*t.played,"%")),l.setAttribute("offset","".concat(100*t.played,"%"))}}}t.on("video:timeupdate",function(){s&&l&&(s.setAttribute("offset","".concat(100*t.played,"%")),l.setAttribute("offset","".concat(100*t.played,"%")))}),t.on("setBar",function(t,e){s&&l&&"played"===t&&(s.setAttribute("offset","".concat(100*e,"%")),l.setAttribute("offset","".concat(100*e,"%")))}),t.on("ready",function(){return c()}),t.on("resize",function(){return c()}),t.on("artplayerPluginDanmuku:loaded",function(){return c()}),t.on("artplayerPluginDanmuku:points",function(t){return c(t)})}})}},{"@swc/helpers/_/_to_consumable_array":"iwLF0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["40mNk"],"40mNk","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-dash-quality.js b/docs/compiled/artplayer-plugin-dash-quality.js index 7556338b4..971fb026b 100644 --- a/docs/compiled/artplayer-plugin-dash-quality.js +++ b/docs/compiled/artplayer-plugin-dash-quality.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,o,r){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],u=a.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);if(a)return a(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=u[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');const a=e.auto||"Auto",u=e.title||"Quality",l=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=l[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:u,icon:i.default,width:200,selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}n.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports=''},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0"); \ No newline at end of file +!// 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,n,o,r){/* 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[o]&&i[o],l=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[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 r="function"==typeof i[o]&&i[o];if(!n&&r)return r(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 s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;sa);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],i=o[1]/100;n(r+i>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');let a=e.auto||"Auto",l=e.title||"Quality",u=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=u[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:l,icon:i.default,width:200,selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}a.env="production",a.version="2.0.0",a.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports=''},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-dash-quality.legacy.js b/docs/compiled/artplayer-plugin-dash-quality.legacy.js index 3f8521b81..e77ab8f4d 100644 --- a/docs/compiled/artplayer-plugin-dash-quality.legacy.js +++ b/docs/compiled/artplayer-plugin-dash-quality.legacy.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[r]&&i[r],a=u.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!a[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var f=a[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var s=0;s=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o,u,a,l=t.dash||window.dash;r(l&&l.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=l.getBitrateInfoListFor("video"),c=l.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=l.getSettings(),g=f[c],v=(null==h||null===(o=h.streaming)||void 0===o||null===(u=o.abr)||void 0===u||null===(a=u.autoSwitchBitrate)||void 0===a?void 0:a.video)?d:p(g),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:v,style:{padding:"0 10px"},selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:v,html:s,icon:i.default,width:200,selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginDashQuality"}}}n.default=u,u.env="production",u.version="2.0.0",u.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports=''},{}],iWrD0:[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0"); \ No newline at end of file +!// 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,n,o,r){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[o]&&i[o],l=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[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 r="function"==typeof i[o]&&i[o];if(!n&&r)return r(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(u)return u(t,!0);// Try the node require function if it exists. +if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s=5,"Artplayer.js@".concat(o," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var n,o,r,l=t.template.$video,a=t.constructor.utils.errorHandle;function d(){var n,o,r,u=t.dash||window.dash;a(u&&u.getVideoElement()===l,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=u.getBitrateInfoListFor("video"),c=u.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=u.getSettings(),v=f[c],g=(null==h?void 0:null===(r=h.streaming)||void 0===r?void 0:null===(o=r.abr)||void 0===o?void 0:null===(n=o.autoSwitchBitrate)||void 0===n?void 0:n.video)?d:p(v),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:g,style:{padding:"0 10px"},selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:g,html:s,icon:i.default,width:200,selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",d),t.on("restart",d),{name:"artplayerPluginDashQuality"}}}u.env="production",u.version="2.0.0",u.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports=''},{}],iWrD0:[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-hls-quality.js b/docs/compiled/artplayer-plugin-hls-quality.js index d751689c8..755635d54 100644 --- a/docs/compiled/artplayer-plugin-hls-quality.js +++ b/docs/compiled/artplayer-plugin-hls-quality.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(s&&"string"==typeof t)return s(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new a.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=i,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return l[o]}}),l[o]=a;for(var f=0;f{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),a=r.levels[r.currentLevel],f=a?s(a):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports=''},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0"); \ No newline at end of file +!// 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,n,o,r){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[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 r="function"==typeof l[o]&&l[o];if(!n&&r)return r(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(i)return i(t,!0);// Try the node require function if it exists. +if(s&&"string"==typeof t)return s(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[o]}}),l[o]=f;for(var a=0;ai);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],l=o[1]/100;n(r+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');let i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.levels[r.currentLevel],a=f?s(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:a,style:{padding:"0 10px"},selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:a,html:u,icon:l.default,width:200,selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports=''},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-hls-quality.legacy.js b/docs/compiled/artplayer-plugin-hls-quality.legacy.js index 7430877a7..8911cac97 100644 --- a/docs/compiled/artplayer-plugin-hls-quality.legacy.js +++ b/docs/compiled/artplayer-plugin-hls-quality.legacy.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,o){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof l[r]&&l[r];if(!n&&o)return o(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o=t.hls||window.hls;r(o&&o.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');var i=e.auto||"Auto",u=e.title||"Quality",a=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=o.levels[o.currentLevel],s=f?a(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:u,icon:l.default,width:200,selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports=''},{}],iWrD0:[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0"); \ No newline at end of file +!// 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,n,r,o){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[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 l[r]&&l[r];if(!n&&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(i)return i(t,!0);// Try the node require function if it exists. +if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"));var n,r,o,u=t.template.$video,a=t.constructor.utils.errorHandle;function f(){var n=t.hls||window.hls;a(n&&n.media===u,'Cannot find instance of HLS from "art.hls" or "window.hls"');var r=e.auto||"Auto",o=e.title||"Quality",i=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=n.levels[n.currentLevel],s=f?i(f):r;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:o,icon:l.default,width:200,selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",f),t.on("restart",f),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports=''},{}],iWrD0:[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-iframe.js b/docs/compiled/artplayer-plugin-iframe.js index c0318a224..9d9e48d0b 100644 --- a/docs/compiled/artplayer-plugin-iframe.js +++ b/docs/compiled/artplayer-plugin-iframe.js @@ -4,4 +4,24 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,s){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[r]&&o[r],a=i.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!a[t]){if(!e[t]){var s="function"==typeof o[r]&&o[r];if(!n&&s)return s(t,!0);if(i)return i(t,!0);if(d&&"string"==typeof t)return d(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var u=a[t]=new f.Module(t);e[t][0].call(u.exports,l,u,u.exports,this)}return a[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=a,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return o[r]}}),o[r]=f;for(var c=0;cnull,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:n,id:r}=e.data;if("inject"===t)this.injected=!0;this.promises[r]&&("error"===t?this.promises[r].reject(new Error(n)):this.promises[r].resove(n),delete this.promises[r]),this.messageCallback&&this.messageCallback({type:t,data:n})}postMessage({type:e,data:t}){return new Promise(((n,r)=>{(function s(){if(this.destroyed)r(new Error("The instance has been destroyed"));else if(this.injected){const s=Date.now();this.promises[s]={resove:n,reject:r},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)}))}commit(e){if("function"!=typeof e)throw new Error('"commit.callback" needs to be a function');const t=e.toString(),n=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:n})}message(e){if("function"!=typeof e)throw new Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}n.default=r,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0"); \ No newline at end of file +!// 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,s){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],a=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!a[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 s="function"==typeof o[n]&&o[n];if(!r&&s)return s(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(i)return i(t,!0);// Try the node require function if it exists. +if(f&&"string"==typeof t)return f(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var u=a[t]=new d.Module(t);e[t][0].call(u.exports,c,u,u.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=i,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return o[n]}}),o[n]=d;for(var l=0;lnull,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){let{type:t,data:r,id:n}=e.data;"inject"===t&&(this.injected=!0),this.promises[n]&&("error"===t?this.promises[n].reject(Error(r)):this.promises[n].resove(r),delete this.promises[n]),this.messageCallback&&this.messageCallback({type:t,data:r})}postMessage({type:e,data:t}){return new Promise((r,n)=>{(function s(){if(this.destroyed)n(Error("The instance has been destroyed"));else if(this.injected){let s=Date.now();this.promises[s]={resove:r,reject:n},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)})}commit(e){if("function"!=typeof e)throw Error('"commit.callback" needs to be a function');let t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}message(e){if("function"!=typeof e)throw Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}r.default=n,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[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})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-iframe.legacy.js b/docs/compiled/artplayer-plugin-iframe.legacy.js index c1e9d3087..01f0d205b 100644 --- a/docs/compiled/artplayer-plugin-iframe.legacy.js +++ b/docs/compiled/artplayer-plugin-iframe.legacy.js @@ -4,4 +4,35 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,r,t,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof s[n]&&s[n],i=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!i[r]){if(!e[r]){var o="function"==typeof s[n]&&s[n];if(!t&&o)return o(r,!0);if(a)return a(r,!0);if(c&&"string"==typeof r)return c(r);var f=new Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=i[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return i[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=i,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return s[n]}}),s[n]=u;for(var f=0;f=0;i--)(o=e[i])&&(a=(s<3?o(a):s>3?o(r,t,a):o(r,t))||a);return s>3&&a&&Object.defineProperty(r,t,a),a}function l(e,r){return function(t,n){r(t,n,e)}}function p(e,r,t,n,o,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var i,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",f=!r&&e?n.static?e:e.prototype:null,l=r||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=t.length-1;d>=0;d--){var y={};for(var h in n)y[h]="access"===h?{}:n[h];for(var h in n.access)y.access[h]=n.access[h];y.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var m=(0,t[d])("accessor"===c?{get:l.get,set:l.set}:l[u],y);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(i=a(m.get))&&(l.get=i),(i=a(m.set))&&(l.set=i),(i=a(m.init))&&o.push(i)}else(i=a(m))&&("field"===c?o.push(i):l[u]=i)}f&&Object.defineProperty(f,n.name,l),p=!0}function d(e,r,t){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,s=t.call(e),a=[];try{for(;(void 0===r||r-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=s.return)&&t.call(s)}finally{if(o)throw o.error}}return a}function x(){for(var e=[],r=0;r1||i(e,r)}))})}function i(e,r){try{(t=o[e](r)).value instanceof E?Promise.resolve(t.value.v).then(c,u):f(s[0][2],t)}catch(e){f(s[0][3],e)}var t}function c(e){i("next",e)}function u(e){i("throw",e)}function f(e,r){e(r),s.shift(),s.length&&i(s[0][0],s[0][1])}}function k(e){var r,t;return r={},n("next"),n("throw",(function(e){throw e})),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,o){r[n]=e[n]?function(r){return(t=!t)?{value:E(e[n](r)),done:!1}:o?o(r):r}:o}}function M(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,t=e[Symbol.asyncIterator];return t?t.call(e):(e=j(e),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(t){r[t]=e[t]&&function(r){return new Promise((function(n,o){(function(e,r,t,n){Promise.resolve(n).then((function(r){e({value:r,done:t})}),r)})(n,o,(r=e[t](r)).done,r.value)}))}}}function T(e,r){return Object.defineProperty?Object.defineProperty(e,"raw",{value:r}):e.raw=r,e}var D=Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r};function S(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&w(r,e,t);return D(r,e),r}function F(e){return e&&e.__esModule?e:{default:e}}function W(e,r,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!n:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:r.get(e)}function C(e,r,t,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof r?e!==r||!o:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,t):o?o.value=t:r.set(e,t),t}function A(e,r){if(null===r||"object"!=typeof r&&"function"!=typeof r)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?r===e:e.has(r)}},{"@swc/helpers/src/_type_of.mjs":"78qx0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"78qx0":[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",(function(){return o._}));var o=e("../esm/_type_of.js")},{"../esm/_type_of.js":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(e,r,t){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(t),n.export(t,"_type_of",(function(){return o})),n.export(t,"_",(function(){return o}))},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["akNoT"],"akNoT","parcelRequire4dc0"); \ No newline at end of file +!// 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,r,t,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||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!s[r]){if(!e[r]){// 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(!t&&o)return o(r,!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(r,!0);// Try the node require function if it exists. +if(c&&"string"==typeof r)return c(r);var f=Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=s[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return s[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var f=0;fr.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);or.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]]);return t}function u(e,r,t,n){var o,i=arguments.length,a=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(r,t,a):o(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a}function f(e,r){return function(t,n){r(t,n,e)}}function l(e,r,t,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",f=!r&&e?n.static?e:e.prototype:null,l=r||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=t.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,t[d])("accessor"===c?{get:l.get,set:l.set}:l[u],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(s=a(h.get))&&(l.get=s),(s=a(h.set))&&(l.set=s),(s=a(h.init))&&o.unshift(s)}else(s=a(h))&&("field"===c?o.unshift(s):l[u]=s)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,r,t){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),a=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function j(){for(var e=[],r=0;r1||s(e,r)})})}function s(e,r){try{var t;(t=o[e](r)).value instanceof P?Promise.resolve(t.value.v).then(c,u):f(i[0][2],t)}catch(e){f(i[0][3],e)}}function c(e){s("next",e)}function u(e){s("throw",e)}function f(e,r){e(r),i.shift(),i.length&&s(i[0][0],i[0][1])}}function S(e){var r,t;return r={},n("next"),n("throw",function(e){throw e}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,o){r[n]=e[n]?function(r){return(t=!t)?{value:P(e[n](r)),done:!1}:o?o(r):r}:o}}function T(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,t=e[Symbol.asyncIterator];return t?t.call(e):(e=w(e),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(t){r[t]=e[t]&&function(r){return new Promise(function(n,o){!function(e,r,t,n){Promise.resolve(n).then(function(r){e({value:r,done:t})},r)}(n,o,(r=e[t](r)).done,r.value)})}}}function k(e,r){return Object.defineProperty?Object.defineProperty(e,"raw",{value:r}):e.raw=r,e}var M=Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r};function I(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&v(r,e,t);return M(r,e),r}function D(e){return e&&e.__esModule?e:{default:e}}function F(e,r,t,n){if("a"===t&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof r?e!==r||!n:!r.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:r.get(e)}function A(e,r,t,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 r?e!==r||!o:!r.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,t):o?o.value=t:r.set(e,t),t}function R(e,r){if(null===r||"object"!=typeof r&&"function"!=typeof r)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?r===e:e.has(r)}function C(e,r,t){if(null!=r){var n;if("object"!=typeof r&&"function"!=typeof r)throw TypeError("Object expected.");if(t){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=r[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=r[Symbol.dispose]}if("function"!=typeof n)throw TypeError("Object not disposable.");e.stack.push({value:r,dispose:n,async:t})}else t&&e.stack.push({async:!0});return r}var W="function"==typeof SuppressedError?SuppressedError:function(e,r,t){var n=Error(t);return n.name="SuppressedError",n.error=e,n.suppressed=r,n};function N(e){function r(r){e.error=e.hasError?new W(r,e.error,"An error was suppressed during disposal."):r,e.hasError=!0}return function t(){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(t,function(e){return r(e),t()})}catch(e){r(e)}}if(e.hasError)throw e.error}()}t.default={__extends:a,__assign:s,__rest:c,__decorate:u,__param:f,__metadata:_,__awaiter:h,__generator:m,__createBinding:v,__exportStar:b,__values:w,__read:g,__spread:j,__spreadArrays:x,__spreadArray:O,__await:P,__asyncGenerator:E,__asyncDelegator:S,__asyncValues:T,__makeTemplateObject:k,__importStar:I,__importDefault:D,__classPrivateFieldGet:F,__classPrivateFieldSet:A,__classPrivateFieldIn:R,__addDisposableResource:C,__disposeResources:N}},{"@swc/helpers/_/_type_of":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(e,r,t){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(t),n.export(t,"_type_of",function(){return o}),n.export(t,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["akNoT"],"akNoT","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-multiple-subtitles.js b/docs/compiled/artplayer-plugin-multiple-subtitles.js new file mode 100644 index 000000000..e265e45cc --- /dev/null +++ b/docs/compiled/artplayer-plugin-multiple-subtitles.js @@ -0,0 +1,46 @@ +/*! + * 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,n,i,r){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[i]&&a[i],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){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 r="function"==typeof a[i]&&a[i];if(!n&&r)return r(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(o)return o(t,!0);// Try the node require function if it exists. +if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},d.cache={};var c=s[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return s[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=o,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var f=0;fs);var r=e("./parser");function a(e){let t={"&":"&","<":"<",">":">","'":"'",""":'"'},n=RegExp(`(${Object.keys(t).join("|")})`,"g");return e.replace(n,e=>t[e]||e)}async function o(e){let{getExt:t,srtToVtt:n,assToVtt:i}=Artplayer.utils,r=await fetch(e.url),a=await r.arrayBuffer(),o=new TextDecoder(e.encoding||"utf-8"),s=o.decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}function s({subtitles:e}){return async t=>{let n=await Promise.all(e.map(o)),i=function(e,t){let n=new r.WebVTTParser,i=new r.WebVTTSerializer,a=n.parse("","metadata");for(let i=0;i${n.value}`}}if(0===a.cues.length)a.cues=o.cues;else for(let e=0;e","&lrm":"‎","&rlm":"‏"," ":"\xa0"}),this.entities=t,this.parse=function(n,a){// global search and replace for \0 +n=n.replace(/\0/g,"�");var o=Date.now(),s=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:s+1,col:t})}var m=l[s],g=m.length,h="WEBVTT",v=0,b=h.length;/* HEADER */for("\uFEFF"===m[0]&&(v=1,b+=1),(gb&&" "!==m[b]&&" "!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=l[s]&&void 0!=l[s];){if(p("No blank line after the signature."),-1!=l[s].indexOf("-->")){u=!0;break}s++}/* CUE LOOP */for(;void 0!=l[s];){for(;!u&&""==l[s];)s++;if(!u&&void 0==l[s])break;/* CUE CREATION */T=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 T,x=!0;if(-1==l[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(T.id=l[s],/^NOTE($|[ \t])/.test(T.id)){for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&p("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(T.id)){var y=[],w=!1;for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[s]),s++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(y.join("\n"));continue}if(""==l[++s]||void 0==l[s]){p("Cue identifier cannot be standalone.");continue}if(-1==l[s].indexOf("-->")){x=!1,p("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */u=!1;var O=new i(l[s],p),P=0;if(c.length>0&&(P=c[c.length-1].startTime),x&&!O.parse(T,P)){/* BAD CUE LOOP */for(/* BAD CUE */T=null,s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){u=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){p("Blank line missing before cue."),u=!0;break}""!=T.text&&(T.text+="\n"),T.text+=l[s],s++}/* CUE TEXT PROCESSING */var j=new r(T.text,p,a,t);T.tree=j.parse(T.startTime,T.endTime),c.push(T)}/* END */return c.sort(function(e,t){return e.startTimet.startTime?1:e.endTime>t.endTime?-1:e.endTime2||parseInt(t,10)>59)&&(l="hours"),":"!=e[r]){a("No time unit separator found.");return}if(r++,2!=// 9-11 +(n=s(/\d/)).length){a("Must be exactly two digits.");return}// 12 +if("hours"==l||":"==e[r]){if(":"!=e[r]){a("No seconds found or minutes is greater than 59.");return}if(r++,2!=(i=s(/\d/)).length){a("Must be exactly two digits.");return}}else{if(2!=t.length){a("Must be exactly two digits.");return}i=n,n=t,t="0"}// 13 +if("."!=e[r]){a('No decimal separator (".") found.');return}if(r++,3!=// 14-16 +(o=s(/\d/)).length){a("Milliseconds must be given in three digits.");return}// 17 +if(parseInt(n,10)>59){a("You cannot have more than 59 minutes.");return}if(parseInt(i,10)>59){a("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(n,10)+parseInt(i,10)+parseInt(o,10)/1e3}this.parse=function(t,s){if(o(n),t.startTime=l(),void 0!=t.startTime){// 6-8 +if(t.startTime' by whitespace."),o(n),"-"!=e[r]||"-"!=e[++r]||">"!=e[++r]){a("No valid timestamp separator found.");return}if(r++,i.test(e[r])&&a("'-->' not separated from timestamp by whitespace."),o(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&a("End timestamp is not greater than start timestamp."),i.test(e[r]),o(n),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var i=e.split(n),r=[],o=0;o100)){a("Line position cannot be >100%.");continue}if(""===d||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==c){if(!["start","center","end"].includes(c)){a("Line alignment needs to be one of start, center or end");continue}t.lineAlign=c}t.snapToLines=!p,t.linePosition=parseFloat(d),parseFloat(d).toString()!==d&&(t.nonSerializable=!0)}else if("position"==l){if(/,/.test(u)){var f=u.split(",");u=f[0];var m=f[1]}if("%"!=u[u.length-1]){a("Text position must be a percentage.");continue}if(parseInt(u,10)>100||0>parseInt(u,10)){a("Text position needs to be between 0 and 100%.");continue}if(""===(d=u.slice(0,u.length-1))||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==m){if(!["line-left","center","line-right"].includes(m)){a("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=m}t.textPosition=parseFloat(d)}else if("size"==l){if("%"!=u[u.length-1]){a("Size must be a percentage.");continue}if(parseInt(u,10)>100){a("Size cannot be >100%.");continue}var g=u.slice(0,u.length-1);if(void 0===g||""===g||isNaN(g)){a("Size needs to be a number"),g=100;continue}if((g=parseFloat(g))<0||g>100){a("Size needs to be between 0 and 100%.");continue}t.size=g}else if("align"==l){var h=["start","center","end","left","right"];if(-1==h.indexOf(u)){a("Alignment can only be set to one of "+h.join(", ")+".");continue}t.alignment=u}else a("Invalid setting.")}}(e.substring(r),t),!0}},this.parseTimestamp=function(){var t=l();if(void 0!=e[r]){a("Timestamp must not have trailing characters.");return}return t}},r=function(e,t,n,r){this.entities=r;var a=this,e=e,o=0,s=function(e){"metadata"!=n&&t(e,o+1)};this.parse=function(t,l){var u={children:[]},f=u,c=[];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[o];){var p=function(){for(var t="data",n="",i="",l=[];void 0!=e[o-1]||0==o;){var u=e[o];if("data"==t){if("&"==u)i=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){let e;return s("Incorrect escape."),(e=i.match(/^&#([0-9]+)$/))?n+=String.fromCharCode(e[1]):a.entities[i]?n+=a.entities[i]:n+=i,["text",n]}if("&"==u)s("Incorrect escape."),n+=i,i=u;else if(/[a-z#0-9]/i.test(u))i+=u;else if(";"==u){let e;(e=i.match(/^&#(x?[0-9]+)$/))?n+=String.fromCharCode("0"+e[1]):a.entities[i+u]?n+=a.entities[i+u]:(e=Object.keys(r).find(e=>i.startsWith(e)))?n+=a.entities[e]+i.slice(e.length)+u:(s("Incorrect escape."),n+=i+";"),t="data"}else s("Incorrect escape."),n+=i+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&&o++,["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)i=u,t="start tag annotation";else if("."==u)t="start tag class";else{if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,[],""];n+=u}}else if("start tag class"==t){if(" "==u||"\f"==u||" "==u)i&&l.push(i),i="",t="start tag annotation";else if("\n"==u)i&&l.push(i),i=u,t="start tag annotation";else if("."==u)i&&l.push(i),i="";else{if(">"==u||void 0==u)return">"==u&&o++,i&&l.push(i),["start tag",n,l,""];i+=u}}else if("start tag annotation"==t){if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,l,i=i.split(/[\u0020\t\f\r\n]+/).filter(function(e){if(e)return!0}).join(" ")];i+=u}else if("end tag"==t){if(">"==u||void 0==u)return">"==u&&o++,["end tag",n];n+=u}else if("timestamp tag"==t){if(">"==u||void 0==u)return">"==u&&o++,["timestamp",n];n+=u}else s("Never happens.")// The joke is it might. +;// 8 +o++}}();if("text"==p[0])f.children.push({type:"text",value:p[1],parent:f});else if("start tag"==p[0]){"chapters"==n&&s("Start tags not allowed in chapter title text.");var m=p[1];"v"!=m&&"lang"!=m&&""!=p[3]&&s("Only and can have an annotation."),"c"==m||"i"==m||"b"==m||"u"==m||"ruby"==m?d(p):"rt"==m&&"ruby"==f.name?d(p):"v"==m?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&s(" cannot be nested inside itself."),d(p),f.value=p[3]// annotation +,p[3]||s(" requires an annotation.")):"lang"==m?(d(p),f.value=p[3]// language +):s("Incorrect start tag.")}else if("end tag"==p[0])"chapters"==n&&s("End tags not allowed in chapter title text."),p[1]==f.name?f=f.parent:"ruby"==p[1]&&"rt"==f.name?f=f.parent.parent:s("Incorrect end tag.");else if("timestamp"==p[0]){"chapters"==n&&s("Timestamp not allowed in chapter title text.");var g=new i(p[1],s).parseTimestamp();void 0!=g&&((g<=t||g>=l)&&s("Timestamp must be between start timestamp and end timestamp."),c.length>0&&c[c.length-1]>=g&&s("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:g,parent:f}),c.push(g))}}for(;f.parent;)"v"!=f.name&&s("Required end tag missing."),f=f.parent;return function e(t){let n={...t};return t.children&&(n.children=t.children.map(e)),n.parent&&delete n.parent,n}(u)}},a=function(){function t(e){let t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),n=0,i=0,r=0;return e>=3600&&(n=Math.floor(e/3600)),i=Math.floor((e-3600*n)/60),r=Math.floor(e-3600*n-60*i),(n?n+":":"")+(""+i).padStart(2,"0")+":"+(""+r).padStart(2,"0")+"."+t}this.serialize=function(n,i){var r,a="WEBVTT\n\n";if(i)for(var o=0;o "+t(r.endTime)+function(t){var n="";let i=Object.keys(e).filter(n=>t[n]!==e[n]);return i.includes("direction")&&(n+=" vertical:"+t.direction),i.includes("alignment")&&(n+=" align:"+t.alignment),i.includes("size")&&(n+=" size:"+t.size+"%"),(i.includes("lineAlign")||i.includes("linePosition"))&&(n+=" line:"+t.linePosition+(t.snapToLines?"":"%")+(t.lineAlign&&t.lineAlign!=e.lineAlign?","+t.lineAlign:"")),(i.includes("textPosition")||i.includes("positionAlign"))&&(n+=" position:"+t.textPosition+"%"+(t.positionAlign&&t.positionAlign!==e.positionAlign?","+t.positionAlign:"")),n}(r)+"\n"+function e(n){for(var i="",r=0;r/g,">");else if("object"==a.type){if(i+="<"+a.name,a.classes)for(var o=0;o"}else"timestamp"==a.type?i+="<"+t(a.value)+">":i+="<"+a.value+">"}return i}(r.tree.children)+"\n\n";return a}};function o(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=i,e.WebVTTCueTextParser=r,e.WebVTTSerializer=a}"undefined"!=typeof window&&o(window),o(n)}()},{}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["4Kbf6"],"4Kbf6","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-multiple-subtitles.legacy.js b/docs/compiled/artplayer-plugin-multiple-subtitles.legacy.js new file mode 100644 index 000000000..9ef711a7e --- /dev/null +++ b/docs/compiled/artplayer-plugin-multiple-subtitles.legacy.js @@ -0,0 +1,59 @@ +/*! + * 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","'":"'",""":'"'},r=RegExp("(".concat(Object.keys(t).join("|"),")"),"g");return e.replace(r,function(e){return t[e]||e})}function f(e){return p.apply(this,arguments)}function p(){return(p=(0,o._)(function(e){var t,r,n,o,i,a;return(0,u._)(this,function(s){switch(s.label){case 0:return r=(t=Artplayer.utils).getExt,n=t.srtToVtt,o=t.assToVtt,[4,fetch(e.url)];case 1:return[4,s.sent().arrayBuffer()];case 2:switch(i=s.sent(),a=new TextDecoder(e.encoding||"utf-8").decode(i),e.type||r(e.url)){case"srt":return[2,n(a)];case"ass":return[2,o(a)];case"vtt":return[2,a];default:return[2,""]}return[2]}})})).apply(this,arguments)}function d(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(f))];case 1:return t=function(e,t){for(var r=new c.WebVTTParser,n=new c.WebVTTSerializer,o=r.parse("","metadata"),i=0;i').concat(m.value,"")}if(0===o.cues.length)o.cues=p.cues;else for(var y=0;ye.length)&&(t=e.length);for(var r=0,n=Array(t);rt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.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;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=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;t1||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! +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),(hv&&" "!==_[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(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.startTimet.startTime?1:e.endTime>t.endTime?-1:e.endTime2||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' 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;a100)){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){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){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){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 and 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(" cannot be nested inside itself."),d(_),f.value=_[3]// annotation +,_[3]||u(" requires an annotation.")):"lang"==h?(d(_),f.value=_[3]// language +):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 "+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/g,">");else if("object"==i.type){if(n+="<"+i.name,i.classes)for(var a=0;a"}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"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-vtt-thumbnail.js b/docs/compiled/artplayer-plugin-vtt-thumbnail.js index 3fb59673b..fb40e1dfb 100644 --- a/docs/compiled/artplayer-plugin-vtt-thumbnail.js +++ b/docs/compiled/artplayer-plugin-vtt-thumbnail.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(l)return l(t,!0);if(s&&"string"==typeof t)return s(t);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=l,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return i[r]}}),i[r]=f;for(var a=0;a{const{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await(0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",(async i=>{n(e,"display","block");const{second:l,width:s}=function(e,t){const{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth);return{width:i,second:i/n.clientWidth*e.duration}}(t,i),f=u.find((e=>l>=e.start&&l<=e.end));if(!f)return n(e,"display","none");n(e,"backgroundImage",`url(${f.url})`),n(e,"height",`${f.h}px`),n(e,"width",`${f.w}px`),n(e,"backgroundPosition",`-${f.x}px -${f.y}px`),s<=f.w/2?n(e,"left",0):s>o.clientWidth-f.w/2?n(e,"left",o.clientWidth-f.w+"px"):n(e,"left",s-f.w/2+"px")})),l(o,"mouseleave",(()=>{n(e,"display","none")})),t.on("hover",(t=>{t||n(e,"display","none")}))}}),{name:"artplayerPluginVttThumbnail"}}}n.default=l,l.env="production",l.version="1.0.0",l.build="2023-08-26 16:47:22","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){function r(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=(t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))),u=Number(l)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+u}e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=async function(e=""){const t=(await(await fetch(e)).text()).split(/[\n\r]/gm).filter((e=>e.trim())),n=[];for(let o=1;o ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,s=i.match(u),f=/(.*)#(\w{4})=(.*)/i,a=l.match(f),c=Math.floor(r(s[1])),d=Math.floor(r(s[2])),p=e.split("/");p.pop(),p.push(a[1]);const h={start:c,end:d,url:p.join("/")},m=a[2].split(""),g=a[3].split(",");for(let e=0;e numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +function(e,t,n,r,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[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[r]&&i[r];if(!n&&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(l)return l(t,!0);// Try the node require function if it exists. +if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var d=u[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=l,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var s=0;sl);var o=e("./getVttArray"),i=r.interopDefault(o);function l(e){return async t=>{let{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await (0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",async i=>{n(e,"display","block");let{second:l,width:f}=function(e,t){let{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth),l=i/n.clientWidth*e.duration;return{width:i,second:l}}(t,i),a=u.find(e=>l>=e.start&&l<=e.end);if(!a)return n(e,"display","none");n(e,"backgroundImage",`url(${a.url})`),n(e,"height",`${a.h}px`),n(e,"width",`${a.w}px`),n(e,"backgroundPosition",`-${a.x}px -${a.y}px`),f<=a.w/2?n(e,"left",0):f>o.clientWidth-a.w/2?n(e,"left",`${o.clientWidth-a.w}px`):n(e,"left",`${f-a.w/2}px`)}),l(o,"mouseleave",()=>{n(e,"display","none")}),t.on("hover",t=>{t||n(e,"display","none")})}}),{name:"artplayerPluginVttThumbnail"}}}l.env="production",l.version="1.0.0",l.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=Number((t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))))/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+l}async function i(e=""){let t=await (await fetch(e)).text(),n=t.split(/[\n\r]/gm).filter(e=>e.trim()),r=[];for(let t=1;t ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,f=i.match(u),a=/(.*)#(\w{4})=(.*)/i,s=l.match(a),d=Math.floor(o(f[1])),p=Math.floor(o(f[2])),c=s[1],h=/^\/|((https?|ftp|file):\/\/)/i.test(c);if(!h){let t=e.split("/");t.pop(),t.push(c),c=t.join("/")}let m={start:d,end:p,url:c},g=s[2].split(""),y=s[3].split(",");for(let e=0;ei)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){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||t.hasOwnProperty(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})}},{}]},["YTqB2"],"YTqB2","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-vtt-thumbnail.legacy.js b/docs/compiled/artplayer-plugin-vtt-thumbnail.legacy.js index 3f19bd836..53e1143da 100644 --- a/docs/compiled/artplayer-plugin-vtt-thumbnail.legacy.js +++ b/docs/compiled/artplayer-plugin-vtt-thumbnail.legacy.js @@ -4,4 +4,35 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[n]&&i[n],c=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!c[t]){if(!e[t]){var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);if(u)return u(t,!0);if(a&&"string"==typeof t)return a(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=c[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return c[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=c,s.parent=u,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f=e.start&&i<=e.end})))?(o(e,"backgroundImage","url(".concat(f.url,")")),o(e,"height","".concat(f.h,"px")),o(e,"width","".concat(f.w,"px")),o(e,"backgroundPosition","-".concat(f.x,"px -").concat(f.y,"px")),s<=f.w/2?o(e,"left",0):s>a.clientWidth-f.w/2?o(e,"left","".concat(a.clientWidth-f.w,"px")):o(e,"left","".concat(s-f.w/2,"px")),[2]):[2,o(e,"display","none")]}))}));return function(e){return r.apply(this,arguments)}}()),f(a,"mouseleave",(function(){o(e,"display","none")})),t.on("hover",(function(t){t||o(e,"display","none")}))}}),[2,{name:"artplayerPluginVttThumbnail"}]}}))})),function(e){return t.apply(this,arguments)};var t}r.default=f,f.env="production",f.version="1.0.0",f.build="2023-08-26 16:47:23","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=f)},{"@swc/helpers/src/_async_to_generator.mjs":"9vSoD","@swc/helpers/src/_ts_generator.mjs":"8UZjC","./getVttArray":"iUpz3","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9vSoD":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_async_to_generator.js")},{"../esm/_async_to_generator.js":"eONSn","@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,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var u=e.apply(t,r);function c(e){o(u,n,i,c,a,"next",e)}function a(e){o(u,n,i,c,a,"throw",e)}c(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})}},{}],"8UZjC":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_ts_generator.js")},{"../esm/_ts_generator.js":"6Xyd0","@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){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",(function(){return c})),n.export(r,"__assign",(function(){return a})),n.export(r,"__rest",(function(){return s})),n.export(r,"__decorate",(function(){return f})),n.export(r,"__param",(function(){return l})),n.export(r,"__esDecorate",(function(){return p})),n.export(r,"__runInitializers",(function(){return d})),n.export(r,"__propKey",(function(){return y})),n.export(r,"__setFunctionName",(function(){return h})),n.export(r,"__metadata",(function(){return m})),n.export(r,"__awaiter",(function(){return _})),n.export(r,"__generator",(function(){return v})),n.export(r,"__createBinding",(function(){return b})),n.export(r,"__exportStar",(function(){return g})),n.export(r,"__values",(function(){return w})),n.export(r,"__read",(function(){return j})),n.export(r,"__spread",(function(){return x})),n.export(r,"__spreadArrays",(function(){return O})),n.export(r,"__spreadArray",(function(){return P})),n.export(r,"__await",(function(){return S})),n.export(r,"__asyncGenerator",(function(){return D})),n.export(r,"__asyncDelegator",(function(){return I})),n.export(r,"__asyncValues",(function(){return T})),n.export(r,"__makeTemplateObject",(function(){return E})),n.export(r,"__importStar",(function(){return W})),n.export(r,"__importDefault",(function(){return M})),n.export(r,"__classPrivateFieldGet",(function(){return k})),n.export(r,"__classPrivateFieldSet",(function(){return C})),n.export(r,"__classPrivateFieldIn",(function(){return q}));var o=e("@swc/helpers/src/_type_of.mjs"),i=n.interopDefault(o),u=function(e,t){return u=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])},u(e,t)};function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(u=(i<3?o(u):i>3?o(t,r,u):o(t,r))||u);return i>3&&u&&Object.defineProperty(t,r,u),u}function l(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,i){function u(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,a=n.kind,s="getter"===a?"get":"setter"===a?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var y={};for(var h in n)y[h]="access"===h?{}:n[h];for(var h in n.access)y.access[h]=n.access[h];y.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(u(e||null))};var m=(0,r[d])("accessor"===a?{get:l.get,set:l.set}:l[s],y);if("accessor"===a){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(c=u(m.get))&&(l.get=c),(c=u(m.set))&&(l.set=c),(c=u(m.init))&&o.push(c)}else(c=u(m))&&("field"===a?o.push(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new 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),u=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)u.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 u}function x(){for(var e=[],t=0;t1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof S?Promise.resolve(r.value.v).then(a,s):f(i[0][2],r)}catch(e){f(i[0][3],e)}var r}function a(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),i.shift(),i.length&&c(i[0][0],i[0][1])}}function I(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:S(e[n](t)),done:!1}:o?o(t):t}:o}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=w(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 F=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function W(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)&&b(t,e,r);return F(t,e),t}function M(e){return e&&e.__esModule?e:{default:e}}function k(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new 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 C(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new 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 q(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}},{"@swc/helpers/src/_type_of.mjs":"78qx0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"78qx0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_type_of.js")},{"../esm/_type_of.js":"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"}],iUpz3:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var o=e("@swc/helpers/src/_async_to_generator.mjs"),i=n.interopDefault(o),u=e("@swc/helpers/src/_ts_generator.mjs"),c=n.interopDefault(u);function a(e){var t,r,n,o=e.split("."),i=o[0].split(":")||[],u=(t=o[1]||"0",r=3,n="0",t.length>r?String(t):((r-=t.length)>n.length&&(n+=n.repeat(r/n.length)),String(t)+n.slice(0,r))),c=Number(u)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+c}function s(){return s=(0,i.default)((function(){var e,t,r,n,o,i,u,s,f,l,p,d,y,h,m,_,v,b,g,w=arguments;return(0,c.default)(this,(function(c){switch(c.label){case 0:return e=w.length>0&&void 0!==w[0]?w[0]:"",[4,fetch(e)];case 1:return[4,c.sent().text()];case 2:for(t=c.sent(),r=t.split(/[\n\r]/gm).filter((function(e){return e.trim()})),n=[],o=1;o ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,f=i.match(s),l=/(.*)#(\w{4})=(.*)/i,p=u.match(l),d=Math.floor(a(f[1])),y=Math.floor(a(f[2])),(h=e.split("/")).pop(),h.push(p[1]),m=h.join("/"),_={start:d,end:y,url:m},v=p[2].split(""),b=p[3].split(","),g=0;g 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],u=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!u[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(c&&"string"==typeof t)return c(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=u[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=u,s.parent=a,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f=e.start&&u<=e.end}))?(n(e,"backgroundImage","url(".concat(l.url,")")),n(e,"height","".concat(l.h,"px")),n(e,"width","".concat(l.w,"px")),n(e,"backgroundPosition","-".concat(l.x,"px -").concat(l.y,"px")),s<=l.w/2?n(e,"left",0):s>c.clientWidth-l.w/2?n(e,"left","".concat(c.clientWidth-l.w,"px")):n(e,"left","".concat(s-l.w/2,"px")),[2]):[2,n(e,"display","none")]})}),function(e){return r.apply(this,arguments)})),s(c,"mouseleave",function(){n(e,"display","none")}),t.on("hover",function(t){t||n(e,"display","none")})}}),[2,{name:"artplayerPluginVttThumbnail"}]}})}),function(e){return t.apply(this,arguments)}}c.env="production",c.version="1.0.0",c.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=c)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_ts_generator":"6Xyd0","./getVttArray":"iUpz3","@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 u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).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 u(e){o(a,n,i,u,c,"next",e)}function c(e){o(a,n,i,u,c,"throw",e)}u(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})}},{}],"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 u}),n.export(r,"__rest",function(){return c}),n.export(r,"__decorate",function(){return s}),n.export(r,"__param",function(){return f}),n.export(r,"__esDecorate",function(){return l}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return y}),n.export(r,"__metadata",function(){return _}),n.export(r,"__awaiter",function(){return h}),n.export(r,"__generator",function(){return v}),n.export(r,"__createBinding",function(){return m}),n.export(r,"__exportStar",function(){return b}),n.export(r,"__values",function(){return g}),n.export(r,"__read",function(){return w}),/** @deprecated */n.export(r,"__spread",function(){return x}),/** @deprecated */n.export(r,"__spreadArrays",function(){return j}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return P}),n.export(r,"__asyncGenerator",function(){return S}),n.export(r,"__asyncDelegator",function(){return E}),n.export(r,"__asyncValues",function(){return T}),n.export(r,"__makeTemplateObject",function(){return D}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return k}),n.export(r,"__classPrivateFieldGet",function(){return R}),n.export(r,"__classPrivateFieldSet",function(){return A}),n.export(r,"__classPrivateFieldIn",function(){return M}),n.export(r,"__addDisposableResource",function(){return W}),n.export(r,"__disposeResources",function(){return q});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 u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;rt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(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 u=e.length-1;u>=0;u--)(o=e[u])&&(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 f(e,t){return function(r,n){t(r,n,e)}}function l(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,c=n.kind,s="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,r[d])("accessor"===c?{get:l.get,set:l.set}:l[s],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(u=a(h.get))&&(l.get=u),(u=a(h.set))&&(l.set=u),(u=a(h.init))&&o.unshift(u)}else(u=a(h))&&("field"===c?o.unshift(u):l[s]=u)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(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 x(){for(var e=[],t=0;t1||u(e,t)})})}function u(e,t){try{var r;(r=o[e](t)).value instanceof P?Promise.resolve(r.value.v).then(c,s):f(i[0][2],r)}catch(e){f(i[0][3],e)}}function c(e){u("next",e)}function s(e){u("throw",e)}function f(e,t){e(t),i.shift(),i.length&&u(i[0][0],i[0][1])}}function E(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:P(e[n](t)),done:!1}:o?o(t):t}:o}}function T(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(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 D(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=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)&&m(t,e,r);return I(t,e),t}function k(e){return e&&e.__esModule?e:{default:e}}function R(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 A(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 M(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 W(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 N="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function q(e){function t(t){e.error=e.hasError?new N(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:u,__rest:c,__decorate:s,__param:f,__metadata:_,__awaiter:h,__generator:v,__createBinding:m,__exportStar:b,__values:g,__read:w,__spread:x,__spreadArrays:j,__spreadArray:O,__await:P,__asyncGenerator:S,__asyncDelegator:E,__asyncValues:T,__makeTemplateObject:D,__importStar:F,__importDefault:k,__classPrivateFieldGet:R,__classPrivateFieldSet:A,__classPrivateFieldIn:M,__addDisposableResource:W,__disposeResources:q}},{"@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"}],iUpz3:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return u});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_ts_generator");function a(e){var t,r,n,o=e.split("."),i=o[0].split(":")||[],a=Number((t=o[1]||"0",r=3,n="0",t.length>r?String(t):((r-=t.length)>n.length&&(n+=n.repeat(r/n.length)),String(t)+n.slice(0,r))))/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+a}function u(){return c.apply(this,arguments)}function c(){return(c=(0,o._)(function(){var e,t,r,n,o,u,c,s,f,l,p,d,y,_,h,v,m,b,g=arguments;return(0,i._)(this,function(i){switch(i.label){case 0:return e=g.length>0&&void 0!==g[0]?g[0]:"",[4,fetch(e)];case 1:return[4,i.sent().text()];case 2:for(n=1,t=i.sent().split(/[\n\r]/gm).filter(function(e){return e.trim()}),r=[];n ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,s=o.match(c),f=/(.*)#(\w{4})=(.*)/i,l=u.match(f),p=Math.floor(a(s[1])),d=Math.floor(a(s[2])),y=l[1],/^\/|((https?|ftp|file):\/\/)/i.test(y)||((_=e.split("/")).pop(),_.push(y),y=_.join("/")),h={start:p,end:d,url:y},v=l[2].split(""),m=l[3].split(","),b=0;b{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)})),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){const e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){const t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){const t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);const i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then((()=>this.start()));const{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const r=this.creatScreenshotDate(),l=this.creatCanvas(),h=l.getContext("2d");this.emit("canvas",l);const a=r.map(((i,n)=>()=>new Promise((r=>{this.video.oncanplay=()=>{h.drawImage(this.video,i.x,i.y,e,o),l.toBlob((e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()}))},this.video.currentTime=i.time}))));return this.processing=!0,(0,s.runPromisesInSeries)(a).then((()=>{this.processing=!1,this.emit("done")})).catch((e=>{throw this.processing=!1,this.emit("error",e.message),e}))}creatScreenshotDate(){const{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i})))}creatCanvas(){const{number:e,width:t,height:i,column:n}=this.option,o=document.createElement("canvas"),r=o.getContext("2d");return o.width=t*n,o.height=Math.ceil(e/n)*i+30,r.fillStyle="black",r.fillRect(0,0,o.width,o.height),r.font="14px Georgia",r.fillStyle="#fff",r.fillText(`From: https://artplayer.org/, Number: ${e}, Width: ${t}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");const e=document.createElement("a"),t=`${(0,s.getFileName)(this.file.name)}.png`;return e.download=t,e.href=this.thumbnailUrl,document.body.appendChild(e),e.click(),document.body.removeChild(e),this.emit("download",t),this}errorHandle(e,t){if(!e)throw this.emit("error",t),new Error(t)}destroy(){this.option.fileInput.removeEventListener("change",this.inputChange),this.option.fileInput.removeEventListener("dragover",l.ondragover),this.option.fileInput.removeEventListener("drop",l.ondrop),document.body.removeChild(this.video),this.videoUrl&&URL.revokeObjectURL(this.videoUrl),this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.emit("destroy")}}i.default=l,window.ArtplayerToolThumbnail=l},{"./emitter":"f2NWK","./utils":"kQTVz","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f2NWK:[function(e,t,i){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(i);i.default=class{on(e,t,i){const n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const n=this;function o(...r){n.off(e,o),t.apply(i,r)}return o._=t,this.on(e,o,i)}emit(e,...t){const i=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;esetTimeout(t,e)))}function r(e){return e.reduce(((e,t)=>e.then(t)),Promise.resolve())}function s(e){const t=e.split(".");return t.pop(),t.join(".")}function l(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}n.defineInteropFlag(i),n.export(i,"sleep",(()=>o)),n.export(i,"runPromisesInSeries",(()=>r)),n.export(i,"getFileName",(()=>s)),n.export(i,"clamp",(()=>l))},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["eoujN"],"eoujN","parcelRequire4dc0"); \ No newline at end of file +!// 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,i,n,o){/* eslint-disable no-undef */var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof r[n]&&r[n],l=s.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,i){if(!l[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 r[n]&&r[n];if(!i&&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(s)return s(t,!0);// Try the node require function if it exists. +if(a&&"string"==typeof t)return a(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},p.cache={};var u=l[t]=new h.Module(t);e[t][0].call(u.exports,p,u,u.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.exports={}},h.modules=e,h.cache=l,h.parent=s,h.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(h,"root",{get:function(){return r[n]}}),r[n]=h;for(var d=0;d{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let r=this.creatScreenshotDate(),l=this.creatCanvas(),a=l.getContext("2d");this.emit("canvas",l);let h=r.map((i,n)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),l.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()})},this.video.currentTime=i.time}));return this.processing=!0,(0,s.runPromisesInSeries)(h).then(()=>{this.processing=!1,this.emit("done")}).catch(e=>{throw this.processing=!1,this.emit("error",e.message),e})}creatScreenshotDate(){let{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i}))}creatCanvas(){let{number:e,width:t,height:i,column:n}=this.option,o=document.createElement("canvas"),r=o.getContext("2d");return o.width=t*n,o.height=Math.ceil(e/n)*i+30,r.fillStyle="black",r.fillRect(0,0,o.width,o.height),r.font="14px Georgia",r.fillStyle="#fff",r.fillText(`From: https://artplayer.org/, Number: ${e}, Width: ${t}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");let e=document.createElement("a"),t=`${(0,s.getFileName)(this.file.name)}.png`;return e.download=t,e.href=this.thumbnailUrl,document.body.appendChild(e),e.click(),document.body.removeChild(e),this.emit("download",t),this}errorHandle(e,t){if(!e)throw this.emit("error",t),Error(t)}destroy(){this.option.fileInput.removeEventListener("change",this.inputChange),this.option.fileInput.removeEventListener("dragover",l.ondragover),this.option.fileInput.removeEventListener("drop",l.ondrop),document.body.removeChild(this.video),this.videoUrl&&URL.revokeObjectURL(this.videoUrl),this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.emit("destroy")}}i.default=l,window.ArtplayerToolThumbnail=l},{"./emitter":"f2NWK","./utils":"kQTVz","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f2NWK:[function(e,t,i){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(i),i.default=class{on(e,t,i){let n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){let n=this;function o(...r){n.off(e,o),t.apply(i,r)}return o._=t,this.on(e,o,i)}emit(e,...t){let i=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;esetTimeout(t,e))}function r(e){return e.reduce((e,t)=>e.then(t),Promise.resolve())}function s(e){let t=e.split(".");return t.pop(),t.join(".")}function l(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}n.defineInteropFlag(i),n.export(i,"sleep",()=>o),n.export(i,"runPromisesInSeries",()=>r),n.export(i,"getFileName",()=>s),n.export(i,"clamp",()=>l)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["eoujN"],"eoujN","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-tool-thumbnail.legacy.js b/docs/compiled/artplayer-tool-thumbnail.legacy.js index 56d5fff17..6cb116691 100644 --- a/docs/compiled/artplayer-tool-thumbnail.legacy.js +++ b/docs/compiled/artplayer-tool-thumbnail.legacy.js @@ -4,4 +4,22 @@ * (c) 2017-2023 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof s[n]&&s[n],a=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){var o="function"==typeof s[n]&&s[n];if(!r&&o)return o(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[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=a,c.parent=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return s[n]}}),s[n]=c;for(var u=0;u0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.default)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,s.default)(e)),e.ondrop=e.ondrop.bind((0,s.default)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,c.default)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,s=r.width,i=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==n.tagName||"file"!==n.type){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=(0,_.clamp)(o,10,1e3),this.option.width=(0,_.clamp)(s,10,1e3),this.option.column=(0,_.clamp)(i,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,_.sleep)(1e3).then((function(){return e.start()}));var t=this.option,r=t.width,n=t.number,o=t.begin,s=t.end,i=this.video.videoHeight/this.video.videoWidth*r;this.option.height=i,this.option.begin=(0,_.clamp)(o,0,this.video.duration),this.option.end=(0,_.clamp)(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),c=l.getContext("2d");this.emit("canvas",l);var u=a.map((function(t,o){return function(){return new Promise((function(s){e.video.oncanplay=function(){c.drawImage(e.video,t.x,t.y,r,i),l.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplay=null,s()}))},e.video.currentTime=t.time}))}}));return this.processing=!0,(0,_.runPromisesInSeries)(u).then((function(){e.processing=!1,e.emit("done")})).catch((function(t){throw e.processing=!1,e.emit("error",t.message),t}))}},{key:"creatScreenshotDate",value:function(){for(var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,s=e.begin,i=this.duration/t,a=[s+i];a.length1?t-1:0),n=1;n 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:{},s="function"==typeof i[n]&&i[n],a=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!a[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(s)return s(t,!0);// Try the node require function if it exists. +if(l&&"string"==typeof t)return l(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new u.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=a,u.parent=s,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var c=0;c0&&void 0!==arguments[0]?arguments[0]:{};return(0,i._)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,o._)(e)),e.ondrop=e.ondrop.bind((0,o._)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,s._)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,i=r.width,s=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),!("INPUT"===n.tagName&&"file"===n.type)){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))}),this.option.number=(0,f.clamp)(o,10,1e3),this.option.width=(0,f.clamp)(i,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,r=t.width,n=t.number,o=t.begin,i=t.end,s=this.video.videoHeight/this.video.videoWidth*r;this.option.height=s,this.option.begin=(0,f.clamp)(o,0,this.video.duration),this.option.end=(0,f.clamp)(i||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),u=l.getContext("2d");this.emit("canvas",l);var c=a.map(function(t,o){return function(){return new Promise(function(i){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,r,s),l.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplay=null,i()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(c).then(function(){e.processing=!1,e.emit("done")}).catch(function(t){throw e.processing=!1,e.emit("error",t.message),t})}},{key:"creatScreenshotDate",value:function(){for(var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,i=e.begin,s=this.duration/t,a=[i+s];a.length1?t-1:0),n=1;nartplayer-plugin-vtt-thumbnail +
  • + artplayer-plugin-multiple-subtitles +
    • Tools
    • diff --git a/docs/uncompiled/artplayer-plugin-multiple-subtitles/index.js b/docs/uncompiled/artplayer-plugin-multiple-subtitles/index.js new file mode 100644 index 000000000..caa91a662 --- /dev/null +++ b/docs/uncompiled/artplayer-plugin-multiple-subtitles/index.js @@ -0,0 +1,962 @@ +// 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 (modules, entry, mainEntry, parcelRequireName, globalName) { + /* eslint-disable no-undef */ + var globalObject = + typeof globalThis !== 'undefined' + ? globalThis + : typeof self !== 'undefined' + ? self + : typeof window !== 'undefined' + ? window + : typeof global !== 'undefined' + ? global + : {}; + /* eslint-enable no-undef */ + + // Save the require from previous bundle to this closure if any + var previousRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + + var cache = previousRequire.cache || {}; + // Do not use `require` to prevent Webpack from trying to bundle this call + var nodeRequire = + typeof module !== 'undefined' && + typeof module.require === 'function' && + module.require.bind(module); + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // 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 currentRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // 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 (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error("Cannot find module '" + name + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = (cache[name] = new newRequire.Module(name)); + + modules[name][0].call( + module.exports, + localRequire, + module, + module.exports, + this + ); + } + + return cache[name].exports; + + function localRequire(x) { + var res = localRequire.resolve(x); + return res === false ? {} : newRequire(res); + } + + function resolve(x) { + var id = modules[name][1][x]; + return id != null ? id : x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [ + function (require, module) { + module.exports = exports; + }, + {}, + ]; + }; + + Object.defineProperty(newRequire, 'root', { + get: function () { + return globalObject[parcelRequireName]; + }, + }); + + globalObject[parcelRequireName] = newRequire; + + for (var i = 0; i < entry.length; i++) { + newRequire(entry[i]); + } + + if (mainEntry) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(mainEntry); + + // CommonJS + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === 'function' && define.amd) { + define(function () { + return mainExports; + }); + + //