Files
ArtPlayer/docs/compiled/artplayer-plugin-danmuku.js
T
Harvey Zack 89b8525f2f Add unescape utility function and
artplayerPluginMultipleSubtitles plugin
2023-11-23 23:23:51 +08:00

73 lines
39 KiB
JavaScript

/*!
* artplayer-plugin-danmuku.js v5.0.1
* 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(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;d<e.length;d++)u(e[d]);if(i){// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var m=u(i);// CommonJS
"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):n&&(this[n]=m)}}({bgm6t:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>d);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;r<t.length;r++){let n=t[r];n.$ref=this.getRef(),n.$ref.innerText=n.text,this.$danmuku.appendChild(n.$ref),n.$ref.style.left=`${e}px`,n.$ref.style.opacity=this.option.opacity,n.$ref.style.fontSize=`${this.option.fontSize}px`,n.$ref.style.color=n.color,n.$ref.style.border=n.border?`1px solid ${n.color}`:null,n.$ref.style.backgroundColor=n.border?"rgb(0 0 0 / 50%)":null,n.$ref.style.marginLeft="0px",n.$lastStartTime=Date.now(),n.$restTime=this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed;let a={mode:n.mode,height:n.$ref.clientHeight,speed:(e+n.$ref.clientWidth)/n.$restTime},{top:o}=await this.postMessage({target:a,emits:this.getEmits(),antiOverlap:this.option.antiOverlap,clientWidth:e,clientHeight:i,marginBottom:this.marginBottom,marginTop:this.marginTop});if(n.$ref){if(this.isStop||void 0===o)n.$state="ready",this.$refs.push(n.$ref),n.$ref=null;else switch(n.$state="emit",n.$ref.style.visibility="visible",n.mode){case 0:{n.$ref.style.top=`${o}px`;let t=e+n.$ref.clientWidth;n.$ref.style.transform=`translateX(${-t}px)`,n.$ref.style.transition=`transform ${n.$restTime}s linear 0s`;break}case 1:n.$ref.style.left="50%",n.$ref.style.top=`${o}px`,n.$ref.style.marginLeft=`-${n.$ref.clientWidth/2}px`}}}}this.isStop||this.update()}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.stop(),this.queue.forEach(t=>this.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 (?:.*? )??p="(?<p>.+?)"(?: .*?)?>(?<text>.+?)<\/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("&quot;",'"').replaceAll("&apos;","'").replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&");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<s.length;e+=1){let i=s[e],r=s[e-1],n=r.top+r.height,a=i.top-n;if(a>=t.height)return n}let l=[];for(let t=1;t<s.length-1;t+=1){let e=s[t];if(l.length){let t=l[l.length-1];t[0].top===e.top?t.push(e):l.push([e])}else l.push([e])}if(o)switch(t.mode){case 0:{let e=l.find(e=>e.every(e=>{if(i<e.distance)return!1;if(t.speed<e.speed)return!0;let r=e.right/(t.speed-e.speed);return r>e.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`<div class="art-danmuku-style-panel-color${e}" data-color="${t}" style="background-color:${t}"></div>`}),s=d(r,`
<div class="art-danmuku-emitter" style="max-width: ${i.maxWidth?`${i.maxWidth}px`:"100%"}">
<div class="art-danmuku-left">
<div class="art-danmuku-style">
<div class="art-danmuku-style-panel">
<div class="art-danmuku-style-panel-inner">
<div class="art-danmuku-style-panel-title">u{6A21}\u{5F0F}</div>
<div class="art-danmuku-style-panel-modes">
<div class="art-danmuku-style-panel-mode art-current" data-mode="0">u{6EDA}\u{52A8}</div>
<div class="art-danmuku-style-panel-mode" data-mode="1">u{9759}\u{6B62}</div>
</div>
<div class="art-danmuku-style-panel-title">u{989C}\u{8272}</div>
<div class="art-danmuku-style-panel-colors">
${a.join("")}
</div>
</div>
</div>
</div>
<input class="art-danmuku-input" maxlength="${i.maxLength}" placeholder="\u{53D1}\u{4E2A}\u{5F39}\u{5E55}\u{89C1}\u{8BC1}\u{5F53}\u{4E0B}" />
</div>
<div class="art-danmuku-send">u{53D1}\u{9001}</div>
</div>
`),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,'<div class="art-layer-danmuku-emitter"></div>');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<i.minWidth?(d(x,s),p(x,"display","flex"),l(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom","40px")):(d(r,s),p(x,"display","none"),o(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom",null))}d(u,b),t.proxy(h,"click",D),t.proxy(m,"keypress",t=>{"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='<svg viewBox="0 0 1152 1024" width="22" height="22" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M311.467 661.333c0 4.267-4.267 8.534-8.534 12.8 0 4.267 0 4.267-4.266 8.534h-12.8c-4.267 0-8.534-4.267-17.067-8.534-8.533-8.533-17.067-8.533-25.6-8.533-8.533 0-12.8 4.267-17.067 12.8-4.266 12.8-8.533 21.333-4.266 29.867 4.266 8.533 12.8 17.066 25.6 21.333 17.066 8.533 34.133 17.067 46.933 17.067 12.8 0 21.333-4.267 34.133-8.534 8.534-4.266 17.067-17.066 25.6-29.866 8.534-12.8 12.8-34.134 17.067-55.467 4.267-21.333 4.267-51.2 4.267-85.333 0-12.8 0-21.334-4.267-29.867 0-8.533-4.267-12.8-8.533-17.067-4.267-4.266-8.534-8.533-12.8-8.533-4.267 0-12.8-4.267-21.334-4.267h-55.466s-4.267-4.266 0-8.533l4.266-38.4c0-4.267 0-8.533 4.267-8.533h46.933c17.067 0 25.6-4.267 34.134-12.8 8.533-8.534 12.8-21.334 12.8-42.667v-72.533c0-17.067-4.267-34.134-8.534-42.667-12.8-12.8-25.6-17.067-42.666-17.067H243.2c-8.533 0-17.067 0-21.333 4.267-4.267 8.533-4.267 12.8-4.267 25.6 0 8.533 0 17.067 4.267 21.333 4.266 4.267 12.8 8.534 21.333 8.534h64c4.267 0 8.533 0 8.533 4.266v34.134c0 8.533 0 12.8-4.266 12.8 0 0-4.267 4.266-8.534 4.266H268.8c-8.533 0-12.8 0-21.333 4.267-4.267 0-8.534 4.267-8.534 4.267-4.266 4.266-8.533 12.8-8.533 17.066 0 8.534-4.267 17.067-4.267 25.6l-8.533 72.534v29.866c0 8.534 4.267 12.8 8.533 17.067 4.267 4.267 8.534 4.267 17.067 8.533h68.267c4.266 0 8.533 0 8.533 4.267s4.267 8.533 4.267 17.067c0 21.333 0 42.666-4.267 55.466 0 8.534-4.267 21.334-8.533 25.6zM896 486.4c-93.867 0-174.933 51.2-217.6 123.733H571.733V576H640c21.333 0 34.133-4.267 42.667-12.8 8.533-8.533 12.8-21.333 12.8-42.667V358.4c0-21.333-4.267-34.133-12.8-42.667-8.534-8.533-21.334-12.8-42.667-12.8 0-4.266 4.267-4.266 4.267-8.533-4.267 0-4.267-4.267-4.267-4.267 4.267-12.8 8.533-21.333 4.267-25.6 0-8.533-4.267-12.8-12.8-21.333-8.534-4.267-17.067-4.267-21.334-4.267-8.533 4.267-12.8 8.534-21.333 21.334-4.267 8.533-8.533 12.8-12.8 21.333-4.267 8.533-8.533 12.8-12.8 21.333H512c-4.267-8.533-8.533-17.066-8.533-21.333-4.267-8.533-8.534-12.8-12.8-21.333-4.267-12.8-12.8-17.067-21.334-17.067s-17.066 0-25.6 8.533c-8.533 8.534-12.8 12.8-12.8 21.334s0 17.066 8.534 25.6l4.266 4.266L448 307.2c-17.067 0-29.867 4.267-38.4 12.8-8.533 4.267-12.8 21.333-12.8 38.4v157.867c0 21.333 4.267 34.133 12.8 42.666 8.533 8.534 21.333 12.8 42.667 12.8H512v34.134h-98.133c-12.8 0-21.334 0-25.6 4.266-4.267 4.267-8.534 8.534-8.534 21.334v17.066c0 4.267 4.267 8.534 4.267 8.534 4.267 0 4.267 4.266 8.533 4.266H512V716.8c0 12.8 4.267 21.333 8.533 25.6 4.267 4.267 12.8 8.533 21.334 8.533 12.8 0 21.333-4.266 25.6-8.533 4.266-4.267 4.266-12.8 4.266-25.6v-55.467H652.8c-8.533 25.6-12.8 51.2-12.8 76.8 0 140.8 115.2 256 256 256s256-115.2 256-256S1036.8 486.4 896 486.4zm-328.533-128h55.466c4.267 0 4.267 0 4.267 4.267V409.6h-59.733v-51.2zm0 102.4H627.2V512h-55.467v-51.2zM512 516.267h-55.467v-51.2H512v51.2zm0-102.4h-59.733V362.667H512v51.2zm384 499.2c-93.867 0-170.667-76.8-170.667-170.667S802.133 571.733 896 571.733s170.667 76.8 170.667 170.667S989.867 913.067 896 913.067z"/><path fill="#fff" d="M951.467 669.867 878.933 742.4l-29.866-25.6C832 699.733 806.4 704 789.333 721.067c-17.066 17.066-12.8 42.666 4.267 59.733l59.733 51.2c8.534 8.533 17.067 8.533 29.867 8.533s21.333-4.266 29.867-12.8l102.4-102.4c17.066-17.066 17.066-42.666 0-59.733-21.334-12.8-46.934-12.8-64 4.267zm-371.2 209.066H213.333c-72.533 0-128-55.466-128-119.466V230.4c0-64 55.467-119.467 128-119.467h512c72.534 0 128 55.467 128 119.467v140.8c0 25.6 17.067 42.667 42.667 42.667s42.667-17.067 42.667-42.667V230.4c0-115.2-93.867-204.8-213.334-204.8h-512C93.867 25.6 0 119.467 0 230.4v529.067c0 115.2 93.867 204.8 213.333 204.8h366.934c25.6 0 42.666-17.067 42.666-42.667s-21.333-42.667-42.666-42.667z"/></svg>'},{}],"9UR3U":[function(t,e,i){e.exports='<svg viewBox="0 0 1152 1024" width="22" height="22" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M311.296 661.504c0 4.096-4.096 8.704-8.704 12.8 0 4.096 0 4.096-4.096 8.704h-12.8c-4.096 0-8.704-4.096-16.896-8.704-8.704-8.704-16.896-8.704-25.6-8.704s-12.8 4.096-16.896 12.8c-4.096 12.8-8.704 21.504-4.096 29.696 4.096 8.704 12.8 16.896 25.6 21.504 16.896 8.704 34.304 16.896 47.104 16.896 12.8 0 21.504-4.096 34.304-8.704 8.704-4.096 16.896-16.896 25.6-29.696s12.8-34.304 16.896-55.296c4.096-21.504 4.096-51.2 4.096-85.504 0-12.8 0-21.504-4.096-29.696 0-8.704-4.096-12.8-8.704-16.896-4.096-4.096-8.704-8.704-12.8-8.704s-12.8-4.096-21.504-4.096h-55.808s-4.096-4.096 0-8.704l4.096-38.4c0-4.096 0-8.704 4.096-8.704h47.104c16.896 0 25.6-4.096 34.304-12.8s12.8-21.504 12.8-42.496v-72.704c0-16.896-4.096-34.304-8.704-42.496-12.8-12.8-25.6-16.896-42.496-16.896H243.2c-8.704 0-16.896 0-21.504 4.096-4.096 8.704-4.096 12.8-4.096 25.6 0 8.704 0 16.896 4.096 21.504 4.096 4.096 12.8 8.704 21.504 8.704h64c4.096 0 8.704 0 8.704 4.096v34.304c0 8.704 0 12.8-4.096 12.8 0 0-4.096 4.096-8.704 4.096H268.8c-8.704 0-12.8 0-21.504 4.096-4.096 0-8.704 4.096-8.704 4.096-4.096 4.096-8.704 12.8-8.704 16.896 0 8.704-4.096 16.896-4.096 25.6l-8.704 72.704v29.696c0 8.704 4.096 12.8 8.704 16.896s8.704 4.096 16.896 8.704h68.096c4.096 0 8.704 0 8.704 4.096s4.096 8.704 4.096 16.896c0 21.504 0 42.496-4.096 55.296.512 9.216-3.584 22.016-8.192 26.624zM896 486.4c-93.696 0-175.104 51.2-217.6 123.904H571.904V576H640c21.504 0 34.304-4.096 42.496-12.8 8.704-8.704 12.8-21.504 12.8-42.496V358.4c0-21.504-4.096-34.304-12.8-42.496-8.704-8.704-21.504-12.8-42.496-12.8 0-4.096 4.096-4.096 4.096-8.704-4.096 0-4.096-4.096-4.096-4.096 4.096-12.8 8.704-21.504 4.096-25.6 0-8.704-4.096-12.8-12.8-21.504-8.704-4.096-16.896-4.096-21.504-4.096-8.704 4.096-12.8 8.704-21.504 21.504-4.096 8.704-8.704 12.8-12.8 21.504s-8.704 12.8-12.8 21.504h-51.2c-4.096-8.704-8.704-16.896-8.704-21.504-4.096-8.704-8.704-12.8-12.8-21.504-4.096-12.8-12.8-16.896-21.504-16.896s-16.896 0-25.6 8.704-12.8 12.8-12.8 21.504 0 16.896 8.704 25.6l4.096 4.096 4.096 4.096c-16.896 0-29.696 4.096-38.4 12.8-8.704 4.096-12.8 21.504-12.8 38.4v157.696c0 21.504 4.096 34.304 12.8 42.496 8.704 8.704 21.504 12.8 42.496 12.8H512v34.304h-98.304c-12.8 0-21.504 0-25.6 4.096s-8.704 8.704-8.704 21.504v16.896c0 4.096 4.096 8.704 4.096 8.704 4.096 0 4.096 4.096 8.704 4.096H512V716.8c0 12.8 4.096 21.504 8.704 25.6 4.096 4.096 12.8 8.704 21.504 8.704 12.8 0 21.504-4.096 25.6-8.704 4.096-4.096 4.096-12.8 4.096-25.6v-55.296H652.8c-8.704 25.6-12.8 51.2-12.8 76.8 0 140.8 115.2 256 256 256s256-115.2 256-256S1036.8 486.4 896 486.4zm-328.704-128h55.296c4.096 0 4.096 0 4.096 4.096V409.6h-59.904v-51.2zm0 102.4H627.2V512h-55.296v-51.2h-4.608zM512 516.096h-55.296v-51.2H512v51.2zm0-102.4h-59.904v-51.2H512v51.2zm384 499.2c-93.696 0-170.496-76.8-170.496-170.496S802.304 571.904 896 571.904s170.496 76.8 170.496 170.496S989.696 912.896 896 912.896z"/><path fill="#fff" d="M580.096 879.104H213.504c-72.704 0-128-55.296-128-119.296V230.4c0-64 55.296-119.296 128-119.296h512c72.704 0 128 55.296 128 119.296v140.8c0 25.6 16.896 42.496 42.496 42.496s42.496-16.896 42.496-42.496V230.4c0-115.2-93.696-204.8-213.504-204.8h-512C93.696 25.6 0 119.296 0 230.4v528.896c0 115.2 93.696 204.8 213.504 204.8h367.104c25.6 0 42.496-16.896 42.496-42.496s-21.504-42.496-43.008-42.496zm171.52 10.752c-15.36-15.36-15.36-40.96 0-56.32l237.568-237.568c15.36-15.36 40.96-15.36 56.32 0s15.36 40.96 0 56.32L807.936 889.856c-15.36 15.36-40.448 15.36-56.32 0z"/></svg>'},{}],"4MPCW":[function(t,e,i){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M16.5 8c1.289 0 2.49.375 3.5 1.022V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7.022A6.5 6.5 0 0 1 16.5 8zM7 13H5a1 1 0 0 1 0-2h2a1 1 0 0 1 0 2zm2-4H5a1 1 0 0 1 0-2h4a1 1 0 0 1 0 2z"/><path d="m20.587 13.696-.787-.131a3.503 3.503 0 0 0-.593-1.051l.301-.804a.46.46 0 0 0-.21-.56l-1.005-.581a.52.52 0 0 0-.656.113l-.499.607a3.53 3.53 0 0 0-1.276 0l-.499-.607a.52.52 0 0 0-.656-.113l-1.005.581a.46.46 0 0 0-.21.56l.301.804c-.254.31-.456.665-.593 1.051l-.787.131a.48.48 0 0 0-.413.465v1.209a.48.48 0 0 0 .413.465l.811.135c.144.382.353.733.614 1.038l-.292.78a.46.46 0 0 0 .21.56l1.005.581a.52.52 0 0 0 .656-.113l.515-.626a3.549 3.549 0 0 0 1.136 0l.515.626a.52.52 0 0 0 .656.113l1.005-.581a.46.46 0 0 0 .21-.56l-.292-.78c.261-.305.47-.656.614-1.038l.811-.135A.48.48 0 0 0 21 15.37v-1.209a.48.48 0 0 0-.413-.465zM16.5 16.057a1.29 1.29 0 1 1 .002-2.582 1.29 1.29 0 0 1-.002 2.582z"/></svg>'},{}],"7lV5Q":[function(t,e,i){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="24" height="24"><path d="M17 16H5c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM6.96 15c.39 0 .74-.24.89-.6l.65-1.6h5l.66 1.6c.15.36.5.6.89.6.69 0 1.15-.71.88-1.34l-3.88-8.97C11.87 4.27 11.46 4 11 4s-.87.27-1.05.69l-3.88 8.97c-.27.63.2 1.34.89 1.34zM11 5.98 12.87 11H9.13L11 5.98z"/></svg>'},{}],"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;t<p.length;t++){let e=p[t],i=e[1];e[1]=i*(i>y?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=`
<svg viewBox="0 0 ${d.w} ${d.h}">
<defs>
<linearGradient id="heatmap-solids" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" />
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" id="heatmap-start" />
<stop offset="0%" style="stop-color:var(--art-progress-color);stop-opacity:1" id="heatmap-stop" />
<stop offset="100%" style="stop-color:var(--art-progress-color);stop-opacity:1" />
</linearGradient>
</defs>
<path fill="url(#heatmap-solids)" d="${b}"></path>
</svg>
`,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");