Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

danmu.js

Package Overview
Dependencies
Maintainers
5
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danmu.js - npm Package Compare versions

Comparing version 1.0.7 to 1.1.0

4

browser/index.js

@@ -1,3 +0,3 @@

/*! Built @Mon, 08 Aug 2022 06:46:19 GMT */
window.DanmuJs=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";function i(e,t){return e.classList?Array.prototype.some.call(e.classList,(function(e){return e===t})):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function o(e,t){e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):i(e,t)||(e.className+=" "+t)}function r(e,t){e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):i(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}))}function a(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(e);return o.className=i,o.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,r=n[t];"video"===e||"audio"===e?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},t.hasClass=i,t.addClass=o,t.removeClass=r,t.toggleClass=function(e,t){t.split(/\s+/g).forEach((function(t){i(e,t)?r(e,t):o(e,t)}))},t.findDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],n=void 0;try{n=e.querySelector(t)}catch(i){t.startsWith("#")&&(n=e.getElementById(t.slice(1)))}return n},t.deepCopy=function e(t,n){if("Object"===a(n)&&"Object"===a(t))return Object.keys(n).forEach((function(i){"Object"!==a(n[i])||n[i]instanceof Node?"Array"===a(n[i])?t[i]="Array"===a(t[i])?t[i].concat(n[i]):n[i]:t[i]=n[i]:t[i]?e(t[i],n[i]):t[i]=n[i]})),t},t.typeOf=a,t.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},t.attachEventListener=function(e,t,n,i){if(i)e.on(t,n),function(e,t,n,i){e.once(i,(function o(){e.off(t,n),e.off(i,o)}))}(e,t,n,i);else{e.on(t,(function i(o){n(o),e.off(t,i)}))}},t.styleUtil=function(e,t,n){var i=e.style;try{i[t]=n}catch(e){i.setProperty(t,n)}},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.throttle=function(e,t){var n=this,i=0;return function(){for(var o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];clearTimeout(i),i=setTimeout((function(){return e.apply(n,r)}),t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(26),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"setLogger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.logger=new a.default(e+".js")}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var i=n(18)();e.exports=function(e){return e!==i&&null!==e}},function(e,t,n){"use strict";e.exports=function(e){return null!=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(34),t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DanmuJs=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=f(n(6)),r=n(25),a=f(n(1)),s=f(n(27)),l=f(n(32)),u=n(33),c=n(0);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=t.DanmuJs=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;i.setLogger("danmu"),i.logger&&i.logger.info("danmu.js version: "+r.version);var a=i.config={overlap:!1,area:{start:0,end:1,lines:void 0},live:!1,comments:[],direction:"r2l",needResizeObserver:!1,dropStaleComments:!1,channelSize:void 0,maxCommentsLength:void 0,interval:2e3};if((0,c.deepCopy)(a,e),(0,o.default)(i),i.hideArr=[],i.domObj=new l.default,i.freezeId=null,a.comments.forEach((function(e){e.duration=e.duration?e.duration:5e3,e.mode||(e.mode="scroll")})),i.container=a.container&&1===a.container.nodeType?a.container:null,!i.container)return i.emit("error","container id can't be empty"),!1,h(n,!1);if(a.containerStyle){var u=a.containerStyle;Object.keys(u).forEach((function(e){i.container.style[e]=u[e]}))}return i.live=a.live,i.player=a.player,i.direction=a.direction,(0,c.addClass)(i.container,"danmu"),i.bulletBtn=new s.default(i),i.main=i.bulletBtn.main,i.isReady=!0,i.emit("ready"),n.logger&&n.logger.info("ready"),n.addResizeObserver(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"addResizeObserver",value:function(){var e=this;this.config.needResizeObserver&&(0,u.addObserver)(this.container,(function(){e.logger&&e.logger.info("needResizeObserver"),e.resize()}))}},{key:"start",value:function(){this.logger&&this.logger.info("start"),this.main.start()}},{key:"pause",value:function(){this.logger&&this.logger.info("pause"),this.main.pause()}},{key:"play",value:function(){this.logger&&this.logger.info("play"),this.main.play()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),this.main.stop()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.main.clear()}},{key:"destroy",value:function(){for(var e in(0,u.unObserver)(this.container),this.logger&&this.logger.info("destroy"),this.stop(),this.bulletBtn.destroy(),this.domObj.destroy(),this)delete this[e];this.emit("destroy")}},{key:"sendComment",value:function(e){this.logger&&this.logger.info("sendComment: "+(e.txt||"[DOM Element]")),e.duration||(e.duration=15e3),e&&e.id&&e.duration&&(e.el||e.txt)&&(e.duration=e.duration?e.duration:5e3,e.style||(e.style={opacity:void 0,fontSize:void 0}),e.style&&(this.opacity&&this.opacity!==e.style.opacity&&(e.style.opacity=this.opacity),this.fontSize&&this.fontSize!==e.style.fontSize&&(e.style.fontSize=this.fontSize)),e.prior||e.realTime?(this.main.data.unshift(e),e.realTime&&(this.main.readData(),this.main.dataHandle())):this.main.data.push(e))}},{key:"setCommentID",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentID: oldID "+e+" newID "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.id=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.id=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentDuration",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentDuration: id "+e+" duration "+t),e&&t&&(t=t||5e3,this.main.data.some((function(n){return n.id===e&&(n.duration=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.duration=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentLike",value:function(e,t){this.logger&&this.logger.info("setCommentLike: id "+e+" like "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.like=t,!0)})),this.main.queue.some((function(n){return n.id===e&&(n.pauseMove(),n.setLikeDom(t.el,t.style),"paused"!==n.danmu.main.status&&n.startMove(),!0)})))}},{key:"restartComment",value:function(e){if(this.logger&&this.logger.info("restartComment: id "+e),e){var t=this.main;if(this._releaseCtrl(e),"closed"===t.status)return;t.queue.some((function(n){return n.id===e&&("paused"!==t.status?n.startMove(!0):n.status="paused",!0)}))}}},{key:"_releaseCtrl",value:function(e){this.freezeId&&e==this.freezeId&&(this.mouseControl=!1,this.freezeId=null)}},{key:"_freezeCtrl",value:function(e){this.mouseControl=!0,this.freezeId=e}},{key:"freezeComment",value:function(e){if(this.logger&&this.logger.info("freezeComment: id "+e),e){this._freezeCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.status="forcedPause",t.pauseMove(),t.el&&t.el.style&&(0,c.styleUtil)(t.el,"zIndex",10),!0)}))}}},{key:"removeComment",value:function(e){if(this.logger&&this.logger.info("removeComment: id "+e),e){this._releaseCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.remove(),!0)})),this.main.data=this.main.data.filter((function(t){return t.id!==e}))}}},{key:"updateComments",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config,i=this.main,o=this.player,r=[],a=0;if(this.logger&&this.logger.info("updateComments: "+e.length+", isClear "+t),"boolean"==typeof t&&t&&(i.data=[]),i.data=i.data.concat(e),i.sortData(),"number"==typeof n.maxCommentsLength&&i.data.length>n.maxCommentsLength){a=i.data.length-n.maxCommentsLength;for(var s,l=0;l<a;l++)(s=i.data[l]).prior&&!s.attached_&&r.push(i.data[l])}else if(n.dropStaleComments&&o&&o.currentTime){var u=Math.floor(1e3*o.currentTime),c=u-n.interval;if(c>0)for(var f,h=0;h<i.data.length;h++)if((f=i.data[h]).prior&&!f.attached_&&r.push(i.data[h]),f.start>c){a=h;break}a>0&&(i.data.splice(0,a),i.data=r.concat(i.data))}}},{key:"willChange",value:function(){var e=this.container,t=this.main;e.style.willChange="opacity",t.willChanges.push("contents"),t.queue.forEach((function(e){e.willChange()}))}},{key:"stopWillChange",value:function(){this.container.style.willChange="",this.main.willChanges.splice(0),this.main.queue.forEach((function(e){e.willChange()}))}},{key:"setAllDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",t=this,n=arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.logger&&this.logger.info("setAllDuration: mode "+e+" duration "+n+" force "+i),n&&(n=n||5e3,i&&(this.main.forceDuration=n),this.main.data.forEach((function(t){e===t.mode&&(t.duration=n)})),this.main.queue.forEach((function(i){e===i.mode&&(i.duration=n,i.pauseMove(),"paused"!==t.main.status&&i.startMove())})))}},{key:"setOpacity",value:function(e){this.logger&&this.logger.info("setOpacity: opacity "+e),this.container.style.opacity=e}},{key:"setFontSize",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{reflow:!0};this.logger&&this.logger.info("setFontSize: size "+e+" channelSize "+t),this.fontSize=e+"px",e&&(this.main.data.forEach((function(e){e.style&&(e.style.fontSize=n.fontSize)})),this.main.queue.forEach((function(e){e.options.style||(e.options.style={}),e.options.style.fontSize=n.fontSize,e.setFontSize(n.fontSize),t&&(e.top=e.channel_id[0]*t,e.topInit())}))),t&&(this.config.channelSize=t,i.reflow&&this.main.channel.resizeSync(!0))}},{key:"setArea",value:function(e){this.logger&&this.logger.info("setArea: area "+e),this.config.area=e,!1!==e.reflow&&this.main.channel.resizeSync(!0)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("hide: mode "+e),this.hideArr.indexOf(e)<0&&this.hideArr.push(e);var t=this.main.queue.filter((function(t){return e===t.mode||"color"===e&&t.color}));t.forEach((function(e){return e.remove()}))}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("show: mode "+e);var t=this.hideArr.indexOf(e);t>-1&&this.hideArr.splice(t,1)}},{key:"setDirection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.logger&&this.logger.info("setDirection: direction "+e),this.emit("changeDirection",e)}},{key:"resize",value:function(){this.logger&&this.logger.info("resize"),this.emit("channel_resize")}},{key:"status",get:function(){return this.main.status}},{key:"state",get:function(){var e=this.main;return{status:e.status,comments:e.data,bullets:e.queue}}},{key:"containerPos",get:function(){return this.main.channel.containerPos}}]),t}(a.default);t.default=d},function(e,t,n){"use strict";var i,o,r,a,s,l,u,c=n(7),f=n(24),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,g=Object.defineProperty,m=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};o=function(e,t){var n,o;return f(t),o=this,i.call(this,e,n=function(){r.call(o,e,n),h.call(t,this,arguments)}),n.__eeOnceListener__=t,this},s={on:i=function(e,t){var n;return f(t),v.call(this,"__ee__")?n=this.__ee__:(n=y.value=p(null),g(this,"__ee__",y),y.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:o,off:r=function(e,t){var n,i,o,r;if(f(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(i=n[e]))for(r=0;o=i[r];++r)o!==t&&o.__eeOnceListener__!==t||(2===i.length?n[e]=i[r?0:1]:i.splice(r,1));else i!==t&&i.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];for(o=o.slice(),t=0;i=o[t];++t)h.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];h.call(o,this,r)}}},l={on:c(i),once:c(o),off:c(r),emit:c(a)},u=m({},l),e.exports=t=function(e){return null==e?p(u):m(Object(e),l)},t.methods=s},function(e,t,n){"use strict";var i=n(3),o=n(8),r=n(12),a=n(20),s=n(21);(e.exports=function(e,t){var n,o,l,u,c;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],i(e)?(n=s.call(e,"c"),o=s.call(e,"e"),l=s.call(e,"w")):(n=l=!0,o=!1),c={value:t,configurable:n,enumerable:o,writable:l},u?r(a(u),c):c}).gs=function(e,t,n){var l,u,c,f;return"string"!=typeof e?(c=n,n=t,t=e,e=null):c=arguments[3],i(t)?o(t)?i(n)?o(n)||(c=n,n=void 0):n=void 0:(c=t,t=n=void 0):t=void 0,i(e)?(l=s.call(e,"c"),u=s.call(e,"e")):(l=!0,u=!1),f={get:t,set:n,configurable:l,enumerable:u},c?r(a(c),f):f}},function(e,t,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;e.exports=function(e){return!!i(e)&&!o.test(r.call(e))}},function(e,t,n){"use strict";var i=n(10);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!i(e)}},function(e,t,n){"use strict";var i=n(11);e.exports=function(e){if(!i(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(3),o={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!i(e)&&hasOwnProperty.call(o,typeof e)}},function(e,t,n){"use strict";e.exports=n(13)()?Object.assign:n(14)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var i=n(15),o=n(19),r=Math.max;e.exports=function(e,t){var n,a,s,l=r(arguments.length,2);for(e=Object(o(e)),s=function(i){try{e[i]=t[i]}catch(e){n||(n=e)}},a=1;a<l;++a)i(t=arguments[a]).forEach(s);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(16)()?Object.keys:n(17)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(2),o=Object.keys;e.exports=function(e){return o(i(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var i=n(2);e.exports=function(e){if(!i(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var i=n(2),o=Array.prototype.forEach,r=Object.create,a=function(e,t){var n;for(n in e)t[n]=e[n]};e.exports=function(e){var t=r(null);return o.call(arguments,(function(e){i(e)&&a(Object(e),t)})),t}},function(e,t,n){"use strict";e.exports=n(22)()?String.prototype.contains:n(23)},function(e,t,n){"use strict";var i="razdwatrzy";e.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(e,t,n){"use strict";var i=String.prototype.indexOf;e.exports=function(e){return i.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e){e.exports=JSON.parse('{"version":"1.0.7"}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var o="undefined"!=typeof window&&window.location.href.indexOf("danmu-debug")>-1,r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructorName=t||""}return i(e,[{key:"info",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];o&&(t=console).log.apply(t,["[Danmu Log]["+this.constructorName+"]",e].concat(i))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=s(n(1)),r=n(0),a=s(n(28));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("control"),n.danmu=e,n.main=new a.default(e),e.config.defaultOff||n.main.start(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"createSwitch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.logger&&this.logger.info("createSwitch"),this.switchBtn=(0,r.createDom)("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(e?"danmu-switch-active":"")),this.switchBtn}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.main.destroy(),this)delete this[e]}}]),t}(o.default);t.default=l,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=l(n(1)),r=l(n(29)),a=l(n(30)),s=n(0);function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("main"),n.danmu=e,n.container=e.container,n.channel=new a.default(e),n.data=[].concat(e.config.comments),n.playedData=[],n.queue=[],n.timer=null,n.retryStatus="normal",n.interval=e.config.interval,n.willChanges=[],n._status="idle",(0,s.attachEventListener)(e,"bullet_remove",n.updateQueue.bind(n),"destroy"),(0,s.attachEventListener)(e,"changeDirection",(function(e){n.danmu.direction=e}),"destroy"),n.nums=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),clearTimeout(this.dataHandleTimer),this.channel.destroy(),this.data=[],this)delete this[e]}},{key:"updateQueue",value:function(e){this.logger&&this.logger.info("updateQueue");var t=this;t.queue.some((function(n,i){return n.id===e.bullet.id&&(t.queue.splice(i,1),!0)})),t.data.some((function(t){return t.id===e.bullet.id&&(t.attached_=!1,!0)}))}},{key:"init",value:function(){var e=this;e.logger&&e.logger.info("init"),e.retryStatus="normal",e.sortData(),function t(){e.dataHandleTimer&&(clearTimeout(e.dataHandleTimer),e.dataHandleTimer=null),"closed"===e._status&&"stop"===e.retryStatus||("playing"===e._status&&(e.readData(),e.dataHandle()),"stop"===e.retryStatus&&"paused"!==e._status||(e.dataHandleTimer=setTimeout((function(){t()}),e.interval-1e3)))}()}},{key:"start",value:function(){this.logger&&this.logger.info("start");this._status="playing",this.queue=[],this.container.innerHTML="",this.channel.reset(),this.init()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop");this._status="closed",this.retryStatus="stop",this.queue=[],this.container.innerHTML="",this.channel.reset()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.channel.reset(),this.data=[],this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){var e=this;if("closed"!==this._status){this.logger&&this.logger.info("play"),this._status="playing";var t=this.channel.channels;t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){e.queue.forEach((function(e){e.startMove(),e.resized=!0}));for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(e){e.resized=!1}))}))}else this.logger&&this.logger.info("play ignored")}},{key:"pause",value:function(){if("closed"!==this._status){this.logger&&this.logger.info("pause"),this._status="paused";var e=this.channel.channels;e&&e.length>0&&this.queue.forEach((function(e){e.pauseMove()}))}else this.logger&&this.logger.info("pause ignored")}},{key:"dataHandle",value:function(){"paused"!==this._status&&"closed"!==this._status&&this.queue.length&&this.queue.forEach((function(e){"waiting"===e.status&&e.startMove()}))}},{key:"readData",value:function(){if(this.danmu.isReady){var e=this,t=this.danmu,n=t.player,i=e.interval,o=e.channel,a=void 0,s=void 0;if(n){var l=n.currentTime?Math.floor(1e3*n.currentTime):0;s=e.data.filter((function(t){return!t.start&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&(t.start=l),e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&t.start-i<=l&&l<=t.start+i})),t.live&&(e.data=[])}else 0===(s=e.data.splice(0,1)).length&&(s=e.playedData.splice(0,1));s.length>0&&(o.updatePos(),s.forEach((function(n){if(e.forceDuration&&e.forceDuration!=n.duration&&(n.duration=e.forceDuration),(a=new r.default(t,n))&&!a.bulletCreateFail)if(n.attached_){for(var i in a.detach(),a)delete a[i];a=null,n.attached_=!1,n.noDiscard&&(n.prior?e.data.unshift(n):e.data.push(n))}else if(a.attach(),n.attached_=!0,o.addBullet(a).result)e.queue.push(a),e.nums++,a.topInit();else{for(var s in a.detach(),a)delete a[s];a=null,n.attached_=!1,n.noDiscard&&(n.prior?e.data.unshift(n):e.data.push(n))}})))}}},{key:"sortData",value:function(){this.data.sort((function(e,t){return(e.start||-1)-(t.start||-1)}))}},{key:"status",get:function(){return this._status}}]),t}(o.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bullet=void 0;var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=t.Bullet=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),o=i,r=void 0;if(i.setLogger("bullet"),i.danmu=e,i.options=n,i.duration=n.duration,i.moveV=n.moveV,i.id=n.id,i.container=e.container,i.start=n.start,i.prior=n.prior,i.color=n.color,i.bookChannelId=n.bookChannelId,i.direction=e.direction,i.reuseDOM=!0,i.willChanges=[],i.domObj=e.domObj,n.el&&1===n.el.nodeType){if(n.el.parentNode)return l(i,{bulletCreateFail:!0});if(e.config.disableCopyDOM)r=n.el,i.reuseDOM=!1;else{r=i.domObj.use();var a=(0,s.copyDom)(n.el);n.eventListeners&&n.eventListeners.length>0&&n.eventListeners.forEach((function(e){a.addEventListener(e.event,e.listener,e.useCapture||!1)})),r.appendChild(a)}}else(r=i.domObj.use()).textContent=n.txt;if(i.onChangeDirection=function(e){o.direction=e},i.danmu.on("changeDirection",i.onChangeDirection),n.style){var u=n.style;Object.keys(u).forEach((function(e){(0,s.styleUtil)(r,e,u[e])}))}"top"===n.mode||"bottom"===n.mode?i.mode=n.mode:i.mode="scroll",i.el=r,n.like&&n.like.el&&i.setLikeDom(n.like.el,n.like.style),i.status="waiting";var c=e.containerPos,f=Math.floor(Math.random()*(c.width/10>100?200:c.width/10));return n.realTime&&(f=0),(0,s.styleUtil)(i.el,"left",c.width+f+"px"),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),"b2t"===this.direction?(this.width=this.elPos.height,this.height=this.elPos.width):(this.width=this.elPos.width,this.height=this.elPos.height),this.moveV&&(this.duration=(this.danmu.containerPos.width+this.width)/this.moveV*1e3),this.danmu.config&&(this.danmu.config.mouseControl&&(this.mouseoverFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseover",this.mouseoverFunWrapper,!1)),this.danmu.config.mouseEnterControl&&(this.mouseEnterFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseenter",this.mouseEnterFunWrapper,!1)))}},{key:"detach",value:function(){var e=this.el;if(e){var t=this.danmu.config;t&&(t.mouseControl&&e.removeEventListener("mouseover",this.mouseoverFunWrapper,!1),t.mouseEnterControl&&e.removeEventListener("mouseenter",this.mouseEnterFunWrapper,!1)),e.parentNode&&e.parentNode.removeChild(e),this.reuseDOM&&this.domObj.unuse(e),this.el=null}this.danmu.off("changeDirection",this.onChangeDirection)}},{key:"willChange",value:function(){var e=this.danmu.main.willChanges.concat(this.willChanges).join();(0,s.styleUtil)(this.el,"willChange",e)}},{key:"mouseoverFun",value:function(e){this.danmu&&this.danmu.mouseControl&&this.danmu.config.mouseControlPause||"waiting"===this.status||"end"===this.status||this.danmu&&this.danmu.emit("bullet_hover",{bullet:this,event:e})}},{key:"topInit",value:function(){this.logger&&this.logger.info("topInit #"+(this.options.txt||"[DOM Element]")+"#"),"b2t"===this.direction?((0,s.styleUtil)(this.el,"transformOrigin","left top"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+this.danmu.containerPos.height+"px) translateZ(0px) rotate(90deg)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")):(0,s.styleUtil)(this.el,"top",this.top+"px")}},{key:"pauseMove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if("paused"!==t.status&&("forcedPause"!==t.status&&(this.status="paused"),t._clearAsyncTimer(),this.el))if(this.willChange(),"scroll"===this.mode){var n=t.danmu.containerPos;if(e){var i=((new Date).getTime()-t.moveTime)/1e3,o=i*this.moveV,r=0;r=t.moveMoreS-o>=0?"b2t"===this.direction?(t.moveMoreS-o)/t.moveContainerHeight*n.height:(t.moveMoreS-o)/t.moveContainerWidth*n.width:t.moveMoreS-o,"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",r+"px")}else"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-n.top)+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",this.el.getBoundingClientRect().left-n.left+"px");"b2t"===this.direction||(0,s.styleUtil)(this.el,"transform","translateX(0px) translateY(0px) translateZ(0px)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if(n.hasMove||(n.danmu.emit("bullet_start",n),n.hasMove=!0),("forcedPause"!==n.status||e)&&this.el&&"start"!==this.status)if(this.status="start",this.willChanges=["transform","transition"],this.willChange(),(0,s.styleUtil)(this.el,"backface-visibility","hidden"),(0,s.styleUtil)(this.el,"perspective","500em"),"scroll"===this.mode){var i=n.danmu.containerPos;if("b2t"===this.direction){this.moveV=(i.height+this.height)/this.duration*1e3;var o=(n.el.getBoundingClientRect().bottom-i.top)/this.moveV;(0,s.styleUtil)(this.el,"transition","transform "+o+"s linear 0s"),this.reqStartMoveId=requestAnimationFrame((function(){n.el&&((0,s.styleUtil)(n.el,"transform","translateX(-"+n.top+"px) translateY(-"+n.height+"px) translateZ(0px) rotate(90deg)"),n.moveTime=(new Date).getTime(),n.moveMoreS=n.el.getBoundingClientRect().top-i.top,n.moveContainerHeight=i.height,n.removeTimer=setTimeout(l,1e3*o))}))}else{var r=function(){if(n.el){n.moveV=(i.width+n.width)/n.duration*1e3;var e=n.el.getBoundingClientRect(),t=(e.right-i.left)/n.moveV;(0,s.styleUtil)(n.el,"transition","transform "+t+"s linear 0s");var o=(e.right-i.left)/t;e.right>i.left&&o>n.moveV-1&&o<n.moveV+1?((0,s.styleUtil)(n.el,"transform","translateX(-"+(e.right-i.left)+"px) translateY(0px) translateZ(0px)"),n.moveTime=(new Date).getTime(),n.moveMoreS=e.left-i.left,n.moveContainerWidth=i.width,n.removeTimer=setTimeout(l,1e3*t)):(n.status="end",n.remove())}};t?r():this.reqStartMoveId=requestAnimationFrame((function(){r()}))}}else{(0,s.styleUtil)(this.el,"left","50%"),(0,s.styleUtil)(this.el,"margin","0 0 0 -"+this.width/2+"px"),this.pastDuration||(this.pastDuration=1);var a=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(l,a),this.startTime=(new Date).getTime()}function l(){if(n.el)if("scroll"===n.mode){var e=n.danmu.containerPos,t=n.el.getBoundingClientRect();"b2t"===n.direction?t&&t.bottom<=e.top+100?(n.status="end",n.remove()):(n.pauseMove(),"paused"!==n.danmu.status&&n.startMove()):t&&t.right<=e.left+100?(n.status="end",n.remove()):(n.pauseMove(),"paused"!==n.danmu.status&&n.startMove())}else n.status="end",n.remove()}}},{key:"remove",value:function(){this.logger&&this.logger.info("remove #"+(this.options.txt||"[DOM Element]")+"#");this._clearAsyncTimer(),this.pauseMove(),this.el&&this.el.parentNode&&(this.willChanges=[],this.willChange(),this.detach(),this.options.el&&1===this.options.el.nodeType&&this.danmu.config.disableCopyDOM&&(0,s.styleUtil)(this.options.el,"transform","none"),this.danmu.emit("bullet_remove",{bullet:this}))}},{key:"_clearAsyncTimer",value:function(){this.removeTimer&&(clearTimeout(this.removeTimer),this.removeTimer=null),this.reqStartMoveId&&(cancelAnimationFrame(this.reqStartMoveId),this.reqStartMoveId=null)}},{key:"setFontSize",value:function(e){this.el&&(this.el.style.fontSize=e)}},{key:"setLikeDom",value:function(e,t){if(e){Object.keys(t).forEach((function(n){e.style[n]=t[n]}));if(e.className="danmu-like",this.el){var n=this.el.querySelector(".danmu-like");n&&this.el.removeChild(n),this.el.innerHTML=""+this.el.innerHTML+e.outerHTML}}return e}}]),t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0),l=n(31);var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;return i.setLogger("channel"),i.danmu=e,i.reset(!0),i.direction=e.direction,i.updatePos(),(0,s.attachEventListener)(n.danmu,"bullet_remove",(function(e){i.removeBullet(e.bullet)}),"destroy"),(0,s.attachEventListener)(n.danmu,"changeDirection",(function(e){i.direction=e}),"destroy"),(0,s.attachEventListener)(n.danmu,"channel_resize",(function(){i.resize(!0)}),"destroy"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updatePos",value:function(){var e=this.container.getBoundingClientRect();this.containerPos=e,this.containerWidth=e.width,this.containerHeight=e.height,this.containerTop=e.top,this.containerBottom=e.bottom,this.containerLeft=e.left,this.containerRight=e.right}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.channels=[],this._cancelResizeTimer(),this)delete this[e]}},{key:"addBullet",value:function(e){var t=this,n=this.danmu,i=this.channels,o=void 0,r=void 0,a=void 0;if("b2t"===t.direction?(r=this.channelWidth,a=Math.ceil(e.width/r)):(o=this.channelHeight,a=Math.ceil(e.height/o)),a>i.length)return{result:!1,message:"exceed channels.length, occupy="+a+",channelsSize="+i.length};for(var s=!0,l=void 0,u=-1,c=0,f=i.length;c<f;c++)if(i[c].queue[e.mode].some((function(t){return t.id===e.id})))return{result:!1,message:"exited, channelOrder="+c+",danmu_id="+e.id};if("scroll"===e.mode)for(var h=0,d=i.length-a;h<=d;h++){s=!0;for(var p=h;p<h+a;p++){if((l=i[p]).operating.scroll){s=!1;break}if(l.bookId.scroll&&l.bookId.scroll!==e.id){s=!1;break}l.operating.scroll=!0;var g=l.queue.scroll[0];if(g){var m=g.el.getBoundingClientRect();if("b2t"===t.direction){if(m.bottom>=t.containerPos.bottom){s=!1,l.operating.scroll=!1;break}}else if(m.right>=t.containerPos.right){s=!1,l.operating.scroll=!1;break}var v,y=void 0,b=void 0,_=void 0,w=void 0;if("b2t"===t.direction?(b=(m.top-t.containerTop+m.height)/(y=(t.containerHeight+m.height)/g.duration),_=t.containerHeight,w=(t.containerHeight+e.height)/e.duration):(b=(m.left-t.containerPos.left+m.width)/(y=(t.containerPos.width+m.width)/g.duration),_=t.containerPos.width,w=(t.containerPos.width+e.width)/e.duration),v=_/w,n.config.bOffset||(n.config.bOffset=0),y<w&&b+n.config.bOffset>v){s=!1,l.operating.scroll=!1;break}}l.operating.scroll=!1}if(s){u=h;break}}else if("top"===e.mode)for(var k=0,O=i.length-a;k<=O;k++){s=!0;for(var x=k;x<k+a;x++){if(x>Math.floor(i.length/2)){s=!1;break}if((l=i[x]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=k;break}}else if("bottom"===e.mode)for(var C=i.length-a;C>=0;C--){s=!0;for(var j=C;j<C+a;j++){if(j<=Math.floor(i.length/2)){s=!1;break}if((l=i[j]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=C;break}}if(-1!==u){for(var M=u,E=u+a;M<E;M++)(l=i[M]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&(delete l.bookId[e.mode],t.logger&&t.logger.info(M+"号轨道恢复正常使用")),l.operating[e.mode]=!1;if(e.prior)if(t.logger&&t.logger.info(e.id+"号优先弹幕运行完毕"),delete e.bookChannelId,n.player)n.bulletBtn.main.data.some((function(t){return t.id===e.id&&(delete t.bookChannelId,!0)}));return e.channel_id=[u,a],"b2t"===t.direction?(e.top=u*r,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerWidth*t.danmu.config.area.start)):(e.top=u*o,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start)),{result:e,message:"success"}}if(e.options.realTime){var T=0,L=-1,S=null;if(t.danmu.bulletBtn.main.queue.forEach((function(e,n){!e.prior&&!e.options.realTime&&e.el&&e.el.getBoundingClientRect().left>t.containerPos.right&&e.start>=T&&(T=e.start,L=n,S=e)})),S){S.remove(),t.removeBullet(S),t.danmu.bulletBtn.main.queue.splice(L,1),e.channel_id=S.channel_id;for(var z=S.channel_id[0],P=S.channel_id[0]+S.channel_id[1];z<P;z++)(l=i[z]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&delete l.bookId[e.mode],l.operating[e.mode]=!1;return e.top=S.top,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start),{result:e,message:"success"}}}if(e.prior)if(e.bookChannelId||t.danmu.live){if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,!0)}))}else{u=-1;for(var D=0,I=i.length-a;D<=I;D++){s=!0;for(var q=D;q<D+a;q++)if(i[q].bookId[e.mode]){s=!1;break}if(s){u=D;break}}if(-1!==u){for(var A=u;A<u+a;A++)i[A].bookId[e.mode]=e.id,t.logger&&t.logger.info(A+"号轨道被"+e.id+"号优先弹幕预定");if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,n.bookChannelId=[u,a],t.logger&&t.logger.info(e.id+"号优先弹幕预定了"+u+"~"+(u+a-1)+"号轨道"),!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(e){this.logger&&this.logger.info("removeBullet "+(e.options.txt||"[DOM Element]"));for(var t=this.channels,n=e.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=t[o]){i.operating[e.mode]=!0;var a=-1;i.queue[e.mode].some((function(t,n){return t.id===e.id&&(a=n,!0)})),a>-1&&i.queue[e.mode].splice(a,1),i.operating[e.mode]=!1}e.options.loop&&this.danmu.bulletBtn.main.playedData.push(e.options)}},{key:"resizeSync",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.resize(e,!0)}},{key:"resize",value:function(){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.logger&&this.logger.info("resize");var t=this;function n(){var e=t.danmu,n=e.container,i=e.config,o=e.bulletBtn,r=void 0;if(t.updatePos(),t._cancelResizeTimer(),o.main.data&&o.main.data.forEach((function(e){e.bookChannelId&&(delete e.bookChannelId,t.logger&&t.logger.info("resize导致"+e.id+"号优先弹幕预定取消"))})),t.logger&&t.logger.info("resize导致所有轨道恢复正常使用"),t.width=t.containerWidth,t.height=t.containerHeight,i.area){var a=i.area,u=a.lines,c=a.start,f=a.end;(0,l.validAreaLineRule)(u)?r=u:c>=0&&f>=c&&("b2t"===t.direction?t.width=t.width*(f-c):t.height=t.height*(f-c))}t.container=n;var h=i.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(r)||(r="b2t"===t.direction?Math.floor(t.width/h):Math.floor(t.height/h));for(var d=[],p=0;p<r;p++)d[p]={id:p,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(t.channels&&t.channels.length<=d.length){for(var g=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){t.channels[e].queue[n].forEach((function(t){t.el&&d[e].queue[n].push(t)}))})),t.channels[e].queue.bottom.forEach((function(n){if(n.el&&(d[e+d.length-t.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===e)){var i=[].concat(n.channel_id);n.channel_id=[i[0]-t.channels.length+d.length,i[1]],n.top=n.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(n.top+=t.containerHeight*t.danmu.config.area.start),n.topInit()}}))},m=0;m<t.channels.length;m++)g(m);for(var v=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},y=0;y<d.length;y++)v(y);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}else if(t.channels&&t.channels.length>d.length){for(var b=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&e>Math.floor(d.length/2));else if("bottom"===n&&e<=Math.floor(d.length/2));else{var i="bottom"===n?e-d.length+t.channels.length:e;t.channels[i].queue[n].forEach((function(o,r){if(o.el&&(d[e].queue[n].push(o),"bottom"===n&&o.channel_id[0]+o.channel_id[1]-1===i)){var a=[].concat(o.channel_id);o.channel_id=[a[0]-t.channels.length+d.length,a[1]],o.top=o.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(o.top+=t.containerHeight*t.danmu.config.area.start),o.topInit()}t.channels[i].queue[n].splice(r,1)}))}}))},_=0;_<d.length;_++)b(_);for(var w=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},k=0;k<d.length;k++)w(k);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}t.resizing=!1}t.resizing||(t.resizing=!0,e?n():(this._cancelResizeTimer(),this.resizeId=requestAnimationFrame(n)))}},{key:"_cancelResizeTimer",value:function(){this.resizeId&&(cancelAnimationFrame(this.resizeId),this.resizeId=null)}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("reset");var t=this,n=t.danmu,i=n.container,o=n.bulletBtn,r=n.config;function a(){var e=void 0,n=i.getBoundingClientRect();if(t.width=n.width,t.height=n.height,t.resetId&&(cancelAnimationFrame(t.resetId),t.resetId=null),r.area){var o=r.area,a=o.lines,u=o.start,c=o.end;(0,l.validAreaLineRule)(a)?e=a:u>=0&&c>=u&&("b2t"===t.direction?t.width=t.width*(c-u):t.height=t.height*(c-u))}var f=r.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(e)||(e="b2t"===t.direction?Math.floor(t.width/f):Math.floor(t.height/f));for(var h=[],d=0;d<e;d++)h[d]={id:d,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};t.channels=h,"b2t"===t.direction?t.channelWidth=f:t.channelHeight=f}t.container=i,o&&o.main&&o.main.queue.forEach((function(e){e.remove()})),t.channels&&t.channels.length>0&&["scroll","top","bottom"].forEach((function(e){for(var n=0;n<t.channels.length;n++)t.channels[n].queue[e].forEach((function(e){e.remove()}))})),o&&o.main&&o.main.data&&o.main.data.forEach((function(e){e.attached_=!1})),e?this.resetId=requestAnimationFrame(a):a()}}]),t}(a.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validAreaLineRule=function(e){return"number"==typeof e&&e>=0&&Number.isInteger(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t={initDOM:function(){return document.createElement("div")},initSize:10},this.init(t)}return i(e,[{key:"init",value:function(e){this.idleList=[],this.usingList=[],this._id=0,this.options=e,this._expand(e.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var e=this.idleList.shift();return this.usingList.push(e),e}},{key:"unuse",value:function(e){var t=this.usingList.indexOf(e);t<0||(this.usingList.splice(t,1),e.innerHTML="",e.textcontent="",this.clearElementStyle(e),this.idleList.push(e))}},{key:"_expand",value:function(e){for(var t=0;t<e;t++)this.idleList.push(this.options.initDOM(this._id++))}},{key:"destroy",value:function(){for(var e=0;e<this.idleList.length;e++)this.idleList[e].innerHTML="",this.idleList[e].textcontent="",this.clearElementStyle(this.idleList[e]);for(var t=0;t<this.usingList.length;t++)this.usingList[t].innerHTML="",this.usingList[t].textcontent="",this.clearElementStyle(this.usingList[t]);for(var n in this)delete this[n]}},{key:"clearElementStyle",value:function(e){var t="undefined"!=typeof window?window.navigator.userAgent:null;t&&(t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1?(0,o.styleUtil)(e,"transform","none"):e.setAttribute("style",""))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.destroyObserver=t.unObserver=t.addObserver=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=new(function(){function e(){var t=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__handlers=[],window.ResizeObserver)try{this.observer=new window.ResizeObserver((0,o.throttle)((function(e){t.__trigger(e)}),100))}catch(e){}}return i(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var n=this.__handlers,i=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(i=o);i>-1?this.__handlers[i].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,i){e===n.target&&(t=i)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,n=0;n<t.length;n++)if(t[n]&&e===t[n].target){t[n].handler&&t[n].handler.map((function(e){try{e()}catch(e){console.error(e)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){t.__runHandler(e.target)}))}}]),e}());t.addObserver=function(e,t){r.addObserver(e,t)},t.unObserver=function(e,t){r.unObserver(e,t)},t.destroyObserver=function(e,t){r.destroyObserver(e,t)}},function(e,t,n){var i=n(35);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(37)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(36)(!1)).push([e.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,f=[],h=n(38);function d(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],t))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],t));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function g(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function v(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),y(t,e.attrs),g(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,i,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var a=c++;n=u||(u=v(t)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),g(e,t),t}(t),i=x.bind(null,n,t),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),i=O.bind(null,n),o=function(){m(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}e&&d(p(e,t),t);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete r[s.id]}}}};var _,w=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function k(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function O(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function x(e,t,n){var i=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(i=h(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,i=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}]);
/*! Built @Thu, 11 Aug 2022 14:51:23 GMT */
window.DanmuJs=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";function i(e,t){return e.classList?Array.prototype.some.call(e.classList,(function(e){return e===t})):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function o(e,t){e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):i(e,t)||(e.className+=" "+t)}function r(e,t){e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):i(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}))}function a(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(e);return o.className=i,o.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,r=n[t];"video"===e||"audio"===e?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},t.hasClass=i,t.addClass=o,t.removeClass=r,t.toggleClass=function(e,t){t.split(/\s+/g).forEach((function(t){i(e,t)?r(e,t):o(e,t)}))},t.findDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],n=void 0;try{n=e.querySelector(t)}catch(i){t.startsWith("#")&&(n=e.getElementById(t.slice(1)))}return n},t.deepCopy=function e(t,n){if("Object"===a(n)&&"Object"===a(t))return Object.keys(n).forEach((function(i){"Object"!==a(n[i])||n[i]instanceof Node?"Array"===a(n[i])?t[i]="Array"===a(t[i])?t[i].concat(n[i]):n[i]:t[i]=n[i]:t[i]?e(t[i],n[i]):t[i]=n[i]})),t},t.typeOf=a,t.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},t.attachEventListener=function(e,t,n,i){if(i)e.on(t,n),function(e,t,n,i){e.once(i,(function o(){e.off(t,n),e.off(i,o)}))}(e,t,n,i);else{e.on(t,(function i(o){n(o),e.off(t,i)}))}},t.styleUtil=function(e,t,n){var i=e.style;try{i[t]=n}catch(e){i.setProperty(t,n)}},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.throttle=function(e,t){var n=this,i=0;return function(){for(var o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];clearTimeout(i),i=setTimeout((function(){return e.apply(n,r)}),t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(26),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"setLogger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.logger=new a.default(e+".js")}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var i=n(18)();e.exports=function(e){return e!==i&&null!==e}},function(e,t,n){"use strict";e.exports=function(e){return null!=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(34),t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DanmuJs=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=f(n(6)),r=n(25),a=f(n(1)),s=f(n(27)),l=f(n(32)),u=n(33),c=n(0);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=t.DanmuJs=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;i.setLogger("danmu"),i.logger&&i.logger.info("danmu.js version: "+r.version);var a=i.config={overlap:!1,area:{start:0,end:1,lines:void 0},live:!1,comments:[],direction:"r2l",needResizeObserver:!1,dropStaleComments:!1,channelSize:void 0,maxCommentsLength:void 0,interval:2e3};if((0,c.deepCopy)(a,e),(0,o.default)(i),i.hideArr=[],i.domObj=new l.default,i.freezeId=null,a.comments.forEach((function(e){e.duration=e.duration?e.duration:5e3,e.mode||(e.mode="scroll")})),i.container=a.container&&1===a.container.nodeType?a.container:null,!i.container)return i.emit("error","container id can't be empty"),!1,h(n,!1);if(a.containerStyle){var u=a.containerStyle;Object.keys(u).forEach((function(e){i.container.style[e]=u[e]}))}return i.live=a.live,i.player=a.player,i.direction=a.direction,(0,c.addClass)(i.container,"danmu"),i.bulletBtn=new s.default(i),i.main=i.bulletBtn.main,i.isReady=!0,i.emit("ready"),n.logger&&n.logger.info("ready"),n.addResizeObserver(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"addResizeObserver",value:function(){var e=this;this.config.needResizeObserver&&(0,u.addObserver)(this.container,(function(){e.logger&&e.logger.info("needResizeObserver"),e.resize()}))}},{key:"start",value:function(){this.logger&&this.logger.info("start"),this.main.start()}},{key:"pause",value:function(){this.logger&&this.logger.info("pause"),this.main.pause()}},{key:"play",value:function(){this.logger&&this.logger.info("play"),this.main.play()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),this.main.stop()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.main.clear()}},{key:"destroy",value:function(){for(var e in(0,u.unObserver)(this.container),this.logger&&this.logger.info("destroy"),this.stop(),this.bulletBtn.destroy(),this.domObj.destroy(),this)delete this[e];this.emit("destroy")}},{key:"sendComment",value:function(e){this.logger&&this.logger.info("sendComment: "+(e.txt||"[DOM Element]")),e.duration||(e.duration=15e3),e&&e.id&&e.duration&&(e.el||e.txt)&&(e.duration=e.duration?e.duration:5e3,e.style||(e.style={opacity:void 0,fontSize:void 0}),e.style&&(this.opacity&&this.opacity!==e.style.opacity&&(e.style.opacity=this.opacity),this.fontSize&&this.fontSize!==e.style.fontSize&&(e.style.fontSize=this.fontSize)),e.prior||e.realTime?(this.main.data.unshift(e),e.realTime&&(this.main.readData(),this.main.dataHandle())):this.main.data.push(e))}},{key:"setCommentID",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentID: oldID "+e+" newID "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.id=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.id=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentDuration",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentDuration: id "+e+" duration "+t),e&&t&&(t=t||5e3,this.main.data.some((function(n){return n.id===e&&(n.duration=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.duration=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentLike",value:function(e,t){this.logger&&this.logger.info("setCommentLike: id "+e+" like "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.like=t,!0)})),this.main.queue.some((function(n){return n.id===e&&(n.pauseMove(),n.setLikeDom(t.el,t.style),"paused"!==n.danmu.main.status&&n.startMove(),!0)})))}},{key:"restartComment",value:function(e){if(this.logger&&this.logger.info("restartComment: id "+e),e){var t=this.main;if(this._releaseCtrl(e),"closed"===t.status)return;t.queue.some((function(n){return n.id===e&&("paused"!==t.status?n.startMove(!0):n.status="paused",!0)}))}}},{key:"_releaseCtrl",value:function(e){this.freezeId&&e==this.freezeId&&(this.mouseControl=!1,this.freezeId=null)}},{key:"_freezeCtrl",value:function(e){this.mouseControl=!0,this.freezeId=e}},{key:"freezeComment",value:function(e){if(this.logger&&this.logger.info("freezeComment: id "+e),e){this._freezeCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.status="forcedPause",t.pauseMove(),t.el&&t.el.style&&(0,c.styleUtil)(t.el,"zIndex",10),!0)}))}}},{key:"removeComment",value:function(e){if(this.logger&&this.logger.info("removeComment: id "+e),e){this._releaseCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.remove(),!0)})),this.main.data=this.main.data.filter((function(t){return t.id!==e}))}}},{key:"updateComments",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config,i=this.main,o=this.player,r=[],a=0;if(this.logger&&this.logger.info("updateComments: "+e.length+", isClear "+t),"boolean"==typeof t&&t&&(i.data=[]),i.data=i.data.concat(e),i.sortData(),"number"==typeof n.maxCommentsLength&&i.data.length>n.maxCommentsLength){a=i.data.length-n.maxCommentsLength;for(var s,l=0;l<a;l++)(s=i.data[l]).prior&&!s.attached_&&r.push(i.data[l])}else if(n.dropStaleComments&&o&&o.currentTime){var u=Math.floor(1e3*o.currentTime),c=u-n.interval;if(c>0)for(var f,h=0;h<i.data.length;h++)if((f=i.data[h]).prior&&!f.attached_&&r.push(i.data[h]),f.start>c){a=h;break}a>0&&(i.data.splice(0,a),i.data=r.concat(i.data))}}},{key:"willChange",value:function(){var e=this.container,t=this.main;e.style.willChange="opacity",t.willChanges.push("contents"),t.queue.forEach((function(e){e.willChange()}))}},{key:"stopWillChange",value:function(){this.container.style.willChange="",this.main.willChanges.splice(0),this.main.queue.forEach((function(e){e.willChange()}))}},{key:"setAllDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",t=this,n=arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.logger&&this.logger.info("setAllDuration: mode "+e+" duration "+n+" force "+i),n&&(n=n||5e3,i&&(this.main.forceDuration=n),this.main.data.forEach((function(t){e===t.mode&&(t.duration=n)})),this.main.queue.forEach((function(i){e===i.mode&&(i.duration=n,i.pauseMove(),"paused"!==t.main.status&&i.startMove())})))}},{key:"setPlayRate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",n=arguments[1];this.logger&&this.logger.info("setPlayRate: "+n),(0,c.isNumber)(n)&&n>0&&(this.main.playRate=n,this.main.queue.forEach((function(n){t===n.mode&&(n.pauseMove(),"paused"!==e.main.status&&n.startMove())})))}},{key:"setOpacity",value:function(e){this.logger&&this.logger.info("setOpacity: opacity "+e),this.container.style.opacity=e}},{key:"setFontSize",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{reflow:!0};this.logger&&this.logger.info("setFontSize: size "+e+" channelSize "+t),this.fontSize=e+"px",e&&(this.main.data.forEach((function(e){e.style&&(e.style.fontSize=n.fontSize)})),this.main.queue.forEach((function(e){e.options.style||(e.options.style={}),e.options.style.fontSize=n.fontSize,e.setFontSize(n.fontSize),t&&(e.top=e.channel_id[0]*t,e.topInit())}))),t&&(this.config.channelSize=t,i.reflow&&this.main.channel.resizeSync())}},{key:"setArea",value:function(e){this.logger&&this.logger.info("setArea: area "+e),this.config.area=e,!1!==e.reflow&&this.main.channel.resizeSync()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("hide: mode "+e),this.hideArr.indexOf(e)<0&&this.hideArr.push(e);var t=this.main.queue.filter((function(t){return e===t.mode||"color"===e&&t.color}));t.forEach((function(e){return e.remove()}))}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("show: mode "+e);var t=this.hideArr.indexOf(e);t>-1&&this.hideArr.splice(t,1)}},{key:"setDirection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.logger&&this.logger.info("setDirection: direction "+e),this.emit("changeDirection",e)}},{key:"resize",value:function(){this.logger&&this.logger.info("resize"),this.emit("channel_resize")}},{key:"status",get:function(){return this.main.status}},{key:"state",get:function(){var e=this.main;return{status:e.status,comments:e.data,bullets:e.queue}}},{key:"containerPos",get:function(){return this.main.channel.containerPos}}]),t}(a.default);t.default=d},function(e,t,n){"use strict";var i,o,r,a,s,l,u,c=n(7),f=n(24),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};o=function(e,t){var n,o;return f(t),o=this,i.call(this,e,n=function(){r.call(o,e,n),h.call(t,this,arguments)}),n.__eeOnceListener__=t,this},s={on:i=function(e,t){var n;return f(t),v.call(this,"__ee__")?n=this.__ee__:(n=y.value=p(null),m(this,"__ee__",y),y.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:o,off:r=function(e,t){var n,i,o,r;if(f(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(i=n[e]))for(r=0;o=i[r];++r)o!==t&&o.__eeOnceListener__!==t||(2===i.length?n[e]=i[r?0:1]:i.splice(r,1));else i!==t&&i.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];for(o=o.slice(),t=0;i=o[t];++t)h.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];h.call(o,this,r)}}},l={on:c(i),once:c(o),off:c(r),emit:c(a)},u=g({},l),e.exports=t=function(e){return null==e?p(u):g(Object(e),l)},t.methods=s},function(e,t,n){"use strict";var i=n(3),o=n(8),r=n(12),a=n(20),s=n(21);(e.exports=function(e,t){var n,o,l,u,c;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],i(e)?(n=s.call(e,"c"),o=s.call(e,"e"),l=s.call(e,"w")):(n=l=!0,o=!1),c={value:t,configurable:n,enumerable:o,writable:l},u?r(a(u),c):c}).gs=function(e,t,n){var l,u,c,f;return"string"!=typeof e?(c=n,n=t,t=e,e=null):c=arguments[3],i(t)?o(t)?i(n)?o(n)||(c=n,n=void 0):n=void 0:(c=t,t=n=void 0):t=void 0,i(e)?(l=s.call(e,"c"),u=s.call(e,"e")):(l=!0,u=!1),f={get:t,set:n,configurable:l,enumerable:u},c?r(a(c),f):f}},function(e,t,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;e.exports=function(e){return!!i(e)&&!o.test(r.call(e))}},function(e,t,n){"use strict";var i=n(10);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!i(e)}},function(e,t,n){"use strict";var i=n(11);e.exports=function(e){if(!i(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(3),o={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!i(e)&&hasOwnProperty.call(o,typeof e)}},function(e,t,n){"use strict";e.exports=n(13)()?Object.assign:n(14)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var i=n(15),o=n(19),r=Math.max;e.exports=function(e,t){var n,a,s,l=r(arguments.length,2);for(e=Object(o(e)),s=function(i){try{e[i]=t[i]}catch(e){n||(n=e)}},a=1;a<l;++a)i(t=arguments[a]).forEach(s);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(16)()?Object.keys:n(17)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(2),o=Object.keys;e.exports=function(e){return o(i(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var i=n(2);e.exports=function(e){if(!i(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var i=n(2),o=Array.prototype.forEach,r=Object.create,a=function(e,t){var n;for(n in e)t[n]=e[n]};e.exports=function(e){var t=r(null);return o.call(arguments,(function(e){i(e)&&a(Object(e),t)})),t}},function(e,t,n){"use strict";e.exports=n(22)()?String.prototype.contains:n(23)},function(e,t,n){"use strict";var i="razdwatrzy";e.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(e,t,n){"use strict";var i=String.prototype.indexOf;e.exports=function(e){return i.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e){e.exports=JSON.parse('{"version":"1.1.0"}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var o="undefined"!=typeof window&&window.location.href.indexOf("danmu-debug")>-1,r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructorName=t||""}return i(e,[{key:"info",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];o&&(t=console).log.apply(t,["[Danmu Log]["+this.constructorName+"]",e].concat(i))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=s(n(1)),r=n(0),a=s(n(28));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("control"),n.danmu=e,n.main=new a.default(e),e.config.defaultOff||n.main.start(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"createSwitch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.logger&&this.logger.info("createSwitch"),this.switchBtn=(0,r.createDom)("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(e?"danmu-switch-active":"")),this.switchBtn}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.main.destroy(),this)delete this[e]}}]),t}(o.default);t.default=l,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=l(n(1)),r=l(n(29)),a=l(n(30)),s=n(0);function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("main"),n.danmu=e,n.container=e.container,n.channel=new a.default(e),n.data=[].concat(e.config.comments),n.playedData=[],n.queue=[],n.timer=null,n.playRate=1,n.retryStatus="normal",n.interval=e.config.interval,n.willChanges=[],n._status="idle",(0,s.attachEventListener)(e,"bullet_remove",n.updateQueue.bind(n),"destroy"),(0,s.attachEventListener)(e,"changeDirection",(function(e){n.danmu.direction=e}),"destroy"),n.nums=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"_cancelDataHandleTimer",value:function(){this.handleId&&(clearTimeout(this.handleId),this.handleId=null),this.handleTimer&&(clearTimeout(this.handleTimer),this.handleTimer=null)}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this._cancelDataHandleTimer(),this.channel.destroy(),this.data=[],this)delete this[e]}},{key:"updateQueue",value:function(e){this.logger&&this.logger.info("updateQueue");var t=this;t.queue.some((function(n,i){return n.id===e.bullet.id&&(t.queue.splice(i,1),!0)})),t.data.some((function(t){return t.id===e.bullet.id&&(t.attached_=!1,!0)}))}},{key:"init",value:function(){var e=this;e.logger&&e.logger.info("init"),e.retryStatus="normal",e.sortData(),function t(){"closed"!==e._status||"stop"!==e.retryStatus?("playing"===e._status&&(e.readData(),e.dataHandle()),"stop"===e.retryStatus&&"paused"!==e._status||(e.handleTimer=setTimeout((function(){e.handleId=requestAnimationFrame((function(){t()}))}),250))):e._cancelDataHandleTimer()}()}},{key:"start",value:function(){this.logger&&this.logger.info("start");this._status="playing",this.queue=[],this.container.innerHTML="",this.channel.reset(),this.init()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop");this._status="closed",this.retryStatus="stop",this.queue=[],this.container.innerHTML="",this.channel.reset()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.channel.reset(),this.data=[],this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){var e=this;if("closed"!==this._status){this.logger&&this.logger.info("play"),this._status="playing";var t=this.channel.channels;t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){e.queue.forEach((function(e){e.startMove(),e.resized=!0}));for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(e){e.resized=!1}))}))}else this.logger&&this.logger.info("play ignored")}},{key:"pause",value:function(){if("closed"!==this._status){this.logger&&this.logger.info("pause"),this._status="paused";var e=this.channel.channels;e&&e.length>0&&this.queue.forEach((function(e){e.pauseMove()}))}else this.logger&&this.logger.info("pause ignored")}},{key:"dataHandle",value:function(){"paused"!==this._status&&"closed"!==this._status&&this.queue.length&&this.queue.forEach((function(e){"waiting"===e.status&&e.startMove()}))}},{key:"readData",value:function(){if(this.danmu.isReady){var e=this,t=this.danmu,n=t.player,i=e.interval,o=e.channel,a=void 0,s=void 0;if(n){var l=n.currentTime?Math.floor(1e3*n.currentTime):0;s=e.data.filter((function(t){return!t.start&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&(t.start=l),!t.attached_&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&t.start-i<=l&&l<=t.start+i})),t.live&&(e.data=[])}else 0===(s=e.data.splice(0,1)).length&&(s=e.playedData.splice(0,1));if(s.length>0){o.updatePos();var u=2;e:for(var c,f=0;f<s.length;f++)if(c=s[f],e.forceDuration&&e.forceDuration!=c.duration&&(c.duration=e.forceDuration),(a=new r.default(t,c))&&!a.bulletCreateFail)if(a.attach(),c.attached_=!0,o.addBullet(a).result)e.queue.push(a),e.nums++,a.topInit(),u=2;else{for(var h in a.detach(),a)delete a[h];if(a=null,c.attached_=!1,c.noDiscard&&(c.prior?e.data.unshift(c):e.data.push(c)),0===u)break e;u--}else{if(0===u)break e;u--}}}}},{key:"sortData",value:function(){this.data.sort((function(e,t){return(e.start||-1)-(t.start||-1)}))}},{key:"status",get:function(){return this._status}}]),t}(o.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bullet=void 0;var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=t.Bullet=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),o=i,r=void 0;if(i.setLogger("bullet"),i.danmu=e,i.options=n,i.duration=n.duration,i.id=n.id,i.container=e.container,i.start=n.start,i.prior=n.prior,i.realTime=n.realTime,i.color=n.color,i.bookChannelId=n.bookChannelId,i.direction=e.direction,i.reuseDOM=!0,i.willChanges=[],i.domObj=e.domObj,n.el&&1===n.el.nodeType){if(n.el.parentNode)return l(i,{bulletCreateFail:!0});if(e.config.disableCopyDOM)r=n.el,i.reuseDOM=!1;else{r=i.domObj.use();var a=(0,s.copyDom)(n.el);n.eventListeners&&n.eventListeners.length>0&&n.eventListeners.forEach((function(e){a.addEventListener(e.event,e.listener,e.useCapture||!1)})),r.appendChild(a)}}else(r=i.domObj.use()).textContent=n.txt;if(i.onChangeDirection=function(e){o.direction=e},i.danmu.on("changeDirection",i.onChangeDirection),n.style){var u=n.style;Object.keys(u).forEach((function(e){(0,s.styleUtil)(r,e,u[e])}))}"top"===n.mode||"bottom"===n.mode?i.mode=n.mode:i.mode="scroll",i.el=r,n.like&&n.like.el&&i.setLikeDom(n.like.el,n.like.style),i.status="waiting";var c=e.containerPos,f=Math.floor(Math.random()*(c.width/10>100?200:c.width/10));return n.realTime&&(f=0),i.updateOffset(f),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updateOffset",value:function(e){this.random=e,(0,s.styleUtil)(this.el,"left",this.danmu.containerPos.width+e+"px")}},{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),"b2t"===this.direction?(this.width=this.elPos.height,this.height=this.elPos.width):(this.width=this.elPos.width,this.height=this.elPos.height),this.moveV&&(this.duration=(this.danmu.containerPos.width+this.random+this.width)/this.moveV*1e3),this.danmu.config&&(this.danmu.config.mouseControl&&(this.mouseoverFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseover",this.mouseoverFunWrapper,!1)),this.danmu.config.mouseEnterControl&&(this.mouseEnterFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseenter",this.mouseEnterFunWrapper,!1)))}},{key:"detach",value:function(){var e=this.el;if(e){var t=this.danmu.config;t&&(t.mouseControl&&e.removeEventListener("mouseover",this.mouseoverFunWrapper,!1),t.mouseEnterControl&&e.removeEventListener("mouseenter",this.mouseEnterFunWrapper,!1)),e.parentNode&&e.parentNode.removeChild(e),this.reuseDOM&&this.domObj.unuse(e),this.el=null}this.elPos=void 0,this.danmu.off("changeDirection",this.onChangeDirection)}},{key:"willChange",value:function(){var e=this.danmu.main.willChanges.concat(this.willChanges).join();(0,s.styleUtil)(this.el,"willChange",e)}},{key:"mouseoverFun",value:function(e){this.danmu&&this.danmu.mouseControl&&this.danmu.config.mouseControlPause||"waiting"===this.status||"end"===this.status||this.danmu&&this.danmu.emit("bullet_hover",{bullet:this,event:e})}},{key:"topInit",value:function(){this.logger&&this.logger.info("topInit #"+(this.options.txt||"[DOM Element]")+"#"),"b2t"===this.direction?((0,s.styleUtil)(this.el,"transformOrigin","left top"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+this.danmu.containerPos.height+"px) translateZ(0px) rotate(90deg)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")):(0,s.styleUtil)(this.el,"top",this.top+"px")}},{key:"pauseMove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if("paused"!==t.status&&("forcedPause"!==t.status&&(this.status="paused"),t._clearAsyncTimer(),t._moveV=void 0,this.el))if(this.willChange(),"scroll"===this.mode){var n=t.danmu.containerPos;if(e){var i=((new Date).getTime()-t.moveTime)/1e3,o=i*this.moveV,r=0;r=t.moveMoreS-o>=0?"b2t"===this.direction?(t.moveMoreS-o)/t.moveContainerHeight*n.height:(t.moveMoreS-o)/t.moveContainerWidth*n.width:t.moveMoreS-o,"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",r+"px")}else"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-n.top)+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",this.el.getBoundingClientRect().left-n.left+"px");"b2t"===this.direction||(0,s.styleUtil)(this.el,"transform","translateX(0px) translateY(0px) translateZ(0px)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(e){var t=this;if(t.hasMove||(t.danmu.emit("bullet_start",t),t.hasMove=!0),("forcedPause"!==t.status||e)&&this.el&&"start"!==this.status)if(this.status="start",this.willChanges=["transform","transition"],this.willChange(),(0,s.styleUtil)(this.el,"backface-visibility","hidden"),(0,s.styleUtil)(this.el,"perspective","500em"),"scroll"===this.mode){var n=t.danmu.containerPos;if("b2t"===this.direction){var i=(t.el.getBoundingClientRect().bottom-n.top)/this.moveV;(0,s.styleUtil)(t.el,"transition","transform "+i+"s linear 0s"),(0,s.styleUtil)(t.el,"transform","translateX(-"+t.top+"px) translateY(-"+t.height+"px) translateZ(0px) rotate(90deg)"),t.moveTime=(new Date).getTime(),t.moveMoreS=t.el.getBoundingClientRect().top-n.top,t.moveContainerHeight=n.height,t.removeTimer=setTimeout(u,1e3*i)}else{if(!t.el)return;var o=t.el.getBoundingClientRect(),r=o.right-n.left,a=r/t.moveV;o.right>n.left?((0,s.styleUtil)(t.el,"transition","transform "+a+"s linear 0s"),(0,s.styleUtil)(t.el,"transform","translateX(-"+r+"px) translateY(0px) translateZ(0px)"),t.moveTime=(new Date).getTime(),t.moveMoreS=o.left-n.left,t.moveContainerWidth=n.width,t.removeTimer=setTimeout(u,1e3*a)):(t.status="end",t.remove())}}else{(0,s.styleUtil)(this.el,"left","50%"),(0,s.styleUtil)(this.el,"margin","0 0 0 -"+this.width/2+"px"),this.pastDuration||(this.pastDuration=1);var l=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(u,l),this.startTime=(new Date).getTime()}function u(){if(t.el)if("scroll"===t.mode){var e=t.danmu.containerPos,n=t.el.getBoundingClientRect();"b2t"===t.direction?n&&n.bottom<=e.top+100?(t.status="end",t.remove()):(t.pauseMove(),"paused"!==t.danmu.status&&t.startMove()):n&&n.right<=e.left+100?(t.status="end",t.remove()):(t.pauseMove(),"paused"!==t.danmu.status&&t.startMove())}else t.status="end",t.remove()}}},{key:"remove",value:function(){this.logger&&this.logger.info("remove #"+(this.options.txt||"[DOM Element]")+"#");this._clearAsyncTimer(),this.pauseMove(),this.el&&this.el.parentNode&&(this.willChanges=[],this.willChange(),this.detach(),this.options.el&&1===this.options.el.nodeType&&this.danmu.config.disableCopyDOM&&(0,s.styleUtil)(this.options.el,"transform","none"),this.danmu.emit("bullet_remove",{bullet:this}))}},{key:"_clearAsyncTimer",value:function(){this.removeTimer&&(clearTimeout(this.removeTimer),this.removeTimer=null)}},{key:"setFontSize",value:function(e){this.el&&(this.el.style.fontSize=e)}},{key:"setLikeDom",value:function(e,t){if(e){Object.keys(t).forEach((function(n){e.style[n]=t[n]}));if(e.className="danmu-like",this.el){var n=this.el.querySelector(".danmu-like");n&&this.el.removeChild(n),this.el.innerHTML=""+this.el.innerHTML+e.outerHTML}}return e}},{key:"moveV",get:function(){var e=this._moveV;if(!e){if(this.options.moveV)e=this.options.moveV;else if(this.elPos){var t=this.danmu.containerPos;e=("b2t"===this.direction?t.height+this.height:t.width+this.width)/this.duration*1e3}e&&(e*=this.danmu.main.playRate,this._moveV=e)}return e}}]),t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0),l=n(31);var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;return i.setLogger("channel"),i.danmu=e,i.reset(!0),i.direction=e.direction,i.channels=[],i.updatePos(),(0,s.attachEventListener)(n.danmu,"bullet_remove",(function(e){i.removeBullet(e.bullet)}),"destroy"),(0,s.attachEventListener)(n.danmu,"changeDirection",(function(e){i.direction=e}),"destroy"),(0,s.attachEventListener)(n.danmu,"channel_resize",(function(){i.resize()}),"destroy"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updatePos",value:function(){var e=this.container.getBoundingClientRect();this.containerPos=e,this.containerWidth=e.width,this.containerHeight=e.height,this.containerTop=e.top,this.containerBottom=e.bottom,this.containerLeft=e.left,this.containerRight=e.right}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.channels.splice(0,this.channels.length),this._cancelResizeTimer(),this)delete this[e]}},{key:"addBullet",value:function(e){var t=this,n=this.danmu,i=this.channels,o=void 0,r=void 0,a=void 0;if("b2t"===t.direction?(r=this.channelWidth,a=Math.ceil(e.width/r)):(o=this.channelHeight,a=Math.ceil(e.height/o)),a>i.length)return{result:!1,message:"exceed channels.length, occupy="+a+",channelsSize="+i.length};for(var s=!0,l=void 0,u=-1,c=0,f=i.length;c<f;c++)if(i[c].queue[e.mode].some((function(t){return t.id===e.id})))return{result:!1,message:"exited, channelOrder="+c+",danmu_id="+e.id};if("scroll"===e.mode)for(var h=0,d=i.length-a;h<=d;h++){s=!0;for(var p=h;p<h+a;p++){if((l=i[p]).operating.scroll){s=!1;break}if(l.bookId.scroll&&l.bookId.scroll!==e.id){s=!1;break}l.operating.scroll=!0;var m=l.queue.scroll[0];if(m){var g=m.el.getBoundingClientRect();if("b2t"===t.direction){if(g.bottom>=t.containerPos.bottom){s=!1,l.operating.scroll=!1;break}}else if(g.right>=t.containerPos.right){s=!1,l.operating.scroll=!1;break}var v=void 0,y=m.moveV,b=void 0,_=e.moveV,w=void 0;if("b2t"===t.direction?(b=(v=g.bottom-t.containerTop)/y,w=t.containerHeight+e.random-v):(b=(v=g.right-t.containerLeft)/y,w=t.containerWidth+e.random-v),_>y){var k=w/(_-y);if(n.config.bOffset||(n.config.bOffset=0),b+n.config.bOffset>=k){var O=b*_-t.containerPos.width;O>0&&e.updateOffset(O+(5+Math.ceil(10*Math.random())))}}}l.operating.scroll=!1}if(s){u=h;break}}else if("top"===e.mode)for(var x=0,C=i.length-a;x<=C;x++){s=!0;for(var j=x;j<x+a;j++){if(j>Math.floor(i.length/2)){s=!1;break}if((l=i[j]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=x;break}}else if("bottom"===e.mode)for(var E=i.length-a;E>=0;E--){s=!0;for(var M=E;M<E+a;M++){if(M<=Math.floor(i.length/2)){s=!1;break}if((l=i[M]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=E;break}}if(-1!==u){for(var T=u,L=u+a;T<L;T++)(l=i[T]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&(delete l.bookId[e.mode],t.logger&&t.logger.info(T+"号轨道恢复正常使用")),l.operating[e.mode]=!1;if(e.prior)if(t.logger&&t.logger.info(e.id+"号优先弹幕运行完毕"),delete e.bookChannelId,n.player)n.bulletBtn.main.data.some((function(t){return t.id===e.id&&(delete t.bookChannelId,!0)}));return e.channel_id=[u,a],"b2t"===t.direction?(e.top=u*r,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerWidth*t.danmu.config.area.start)):(e.top=u*o,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start)),{result:e,message:"success"}}if(e.options.realTime){var z=0,P=-1,S=null;if(t.danmu.bulletBtn.main.queue.forEach((function(e,n){!e.prior&&!e.options.realTime&&e.el&&e.el.getBoundingClientRect().left>t.containerPos.right&&e.start>=z&&(z=e.start,P=n,S=e)})),S){S.remove(),t.removeBullet(S),t.danmu.bulletBtn.main.queue.splice(P,1),e.channel_id=S.channel_id;for(var D=S.channel_id[0],I=S.channel_id[0]+S.channel_id[1];D<I;D++)(l=i[D]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&delete l.bookId[e.mode],l.operating[e.mode]=!1;return e.top=S.top,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start),{result:e,message:"success"}}}if(e.prior)if(e.bookChannelId||t.danmu.live){if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,!0)}))}else{u=-1;for(var q=0,R=i.length-a;q<=R;q++){s=!0;for(var A=q;A<q+a;A++)if(i[A].bookId[e.mode]){s=!1;break}if(s){u=q;break}}if(-1!==u){for(var U=u;U<u+a;U++)i[U].bookId[e.mode]=e.id,t.logger&&t.logger.info(U+"号轨道被"+e.id+"号优先弹幕预定");if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,n.bookChannelId=[u,a],t.logger&&t.logger.info(e.id+"号优先弹幕预定了"+u+"~"+(u+a-1)+"号轨道"),!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(e){this.logger&&this.logger.info("removeBullet "+(e.options.txt||"[DOM Element]"));for(var t=this.channels,n=e.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=t[o]){i.operating[e.mode]=!0;var a=-1;i.queue[e.mode].some((function(t,n){return t.id===e.id&&(a=n,!0)})),a>-1&&i.queue[e.mode].splice(a,1),i.operating[e.mode]=!1}e.options.loop&&this.danmu.bulletBtn.main.playedData.push(e.options)}},{key:"resizeSync",value:function(){this.resize(!0)}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("resize");var t=this;function n(){var e=t.danmu,n=e.container,i=e.config,o=e.bulletBtn,r=void 0;if(t.updatePos(),t._cancelResizeTimer(),o.main.data&&o.main.data.forEach((function(e){e.bookChannelId&&(delete e.bookChannelId,t.logger&&t.logger.info("resize导致"+e.id+"号优先弹幕预定取消"))})),t.logger&&t.logger.info("resize导致所有轨道恢复正常使用"),t.width=t.containerWidth,t.height=t.containerHeight,i.area){var a=i.area,u=a.lines,c=a.start,f=a.end;(0,l.validAreaLineRule)(u)?r=u:c>=0&&f>=c&&("b2t"===t.direction?t.width=t.width*(f-c):t.height=t.height*(f-c))}t.container=n;var h=i.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(r)||(r="b2t"===t.direction?Math.floor(t.width/h):Math.floor(t.height/h));for(var d=[],p=0;p<r;p++)d[p]={id:p,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(t.channels&&t.channels.length<=d.length){for(var m=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){t.channels[e].queue[n].forEach((function(t){t.el&&d[e].queue[n].push(t)}))})),t.channels[e].queue.bottom.forEach((function(n){if(n.el&&(d[e+d.length-t.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===e)){var i=[].concat(n.channel_id);n.channel_id=[i[0]-t.channels.length+d.length,i[1]],n.top=n.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(n.top+=t.containerHeight*t.danmu.config.area.start),n.topInit()}}))},g=0;g<t.channels.length;g++)m(g);for(var v=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},y=0;y<d.length;y++)v(y);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}else if(t.channels&&t.channels.length>d.length){for(var b=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&e>Math.floor(d.length/2));else if("bottom"===n&&e<=Math.floor(d.length/2));else{var i="bottom"===n?e-d.length+t.channels.length:e;t.channels[i].queue[n].forEach((function(o,r){if(o.el&&(d[e].queue[n].push(o),"bottom"===n&&o.channel_id[0]+o.channel_id[1]-1===i)){var a=[].concat(o.channel_id);o.channel_id=[a[0]-t.channels.length+d.length,a[1]],o.top=o.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(o.top+=t.containerHeight*t.danmu.config.area.start),o.topInit()}t.channels[i].queue[n].splice(r,1)}))}}))},_=0;_<d.length;_++)b(_);for(var w=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},k=0;k<d.length;k++)w(k);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}t.resizing=!1}t.resizing||(t.resizing=!0,e?n():(this._cancelResizeTimer(),this.resizeId=requestAnimationFrame(n)))}},{key:"_cancelResizeTimer",value:function(){this.resizeId&&(cancelAnimationFrame(this.resizeId),this.resizeId=null)}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("reset");var t=this,n=t.danmu,i=n.container,o=n.bulletBtn,r=n.config;function a(){var e=void 0,n=i.getBoundingClientRect();if(t.width=n.width,t.height=n.height,t.resetId&&(cancelAnimationFrame(t.resetId),t.resetId=null),r.area){var o=r.area,a=o.lines,u=o.start,c=o.end;(0,l.validAreaLineRule)(a)?e=a:u>=0&&c>=u&&("b2t"===t.direction?t.width=t.width*(c-u):t.height=t.height*(c-u))}var f=r.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(e)||(e="b2t"===t.direction?Math.floor(t.width/f):Math.floor(t.height/f));for(var h=[],d=0;d<e;d++)h[d]={id:d,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};t.channels=h,"b2t"===t.direction?t.channelWidth=f:t.channelHeight=f}t.container=i,o&&o.main&&o.main.queue.forEach((function(e){e.remove()})),t.channels&&t.channels.length>0&&["scroll","top","bottom"].forEach((function(e){for(var n=0;n<t.channels.length;n++)t.channels[n].queue[e].forEach((function(e){e.remove()}))})),o&&o.main&&o.main.data&&o.main.data.forEach((function(e){e.attached_=!1})),e?this.resetId=requestAnimationFrame(a):a()}}]),t}(a.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validAreaLineRule=function(e){return"number"==typeof e&&e>=0&&Number.isInteger(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t={initDOM:function(){return document.createElement("div")},initSize:10},this.init(t)}return i(e,[{key:"init",value:function(e){this.idleList=[],this.usingList=[],this._id=0,this.options=e,this._expand(e.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var e=this.idleList.shift();return this.usingList.push(e),e}},{key:"unuse",value:function(e){var t=this.usingList.indexOf(e);t<0||(this.usingList.splice(t,1),e.innerHTML="",e.textcontent="",this.clearElementStyle(e),this.idleList.push(e))}},{key:"_expand",value:function(e){for(var t=0;t<e;t++)this.idleList.push(this.options.initDOM(this._id++))}},{key:"destroy",value:function(){for(var e=0;e<this.idleList.length;e++)this.idleList[e].innerHTML="",this.idleList[e].textcontent="",this.clearElementStyle(this.idleList[e]);for(var t=0;t<this.usingList.length;t++)this.usingList[t].innerHTML="",this.usingList[t].textcontent="",this.clearElementStyle(this.usingList[t]);for(var n in this)delete this[n]}},{key:"clearElementStyle",value:function(e){var t="undefined"!=typeof window?window.navigator.userAgent:null;t&&(t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1?(0,o.styleUtil)(e,"transform","none"):e.setAttribute("style",""))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.destroyObserver=t.unObserver=t.addObserver=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=new(function(){function e(){var t=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__handlers=[],window.ResizeObserver)try{this.observer=new window.ResizeObserver((0,o.throttle)((function(e){t.__trigger(e)}),100))}catch(e){}}return i(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var n=this.__handlers,i=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(i=o);i>-1?this.__handlers[i].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,i){e===n.target&&(t=i)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,n=0;n<t.length;n++)if(t[n]&&e===t[n].target){t[n].handler&&t[n].handler.map((function(e){try{e()}catch(e){console.error(e)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){t.__runHandler(e.target)}))}}]),e}());t.addObserver=function(e,t){r.addObserver(e,t)},t.unObserver=function(e,t){r.unObserver(e,t)},t.destroyObserver=function(e,t){r.destroyObserver(e,t)}},function(e,t,n){var i=n(35);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(37)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(36)(!1)).push([e.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,f=[],h=n(38);function d(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],t))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],t));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function m(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function g(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function v(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),y(t,e.attrs),m(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,i,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var a=c++;n=u||(u=v(t)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),m(e,t),t}(t),i=x.bind(null,n,t),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),i=O.bind(null,n),o=function(){g(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}e&&d(p(e,t),t);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete r[s.id]}}}};var _,w=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function k(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function O(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function x(e,t,n){var i=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(i=h(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,i=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}]);
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

/*! Built @Mon, 08 Aug 2022 06:46:19 GMT */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["danmu.js"]=t():e["danmu.js"]=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";function i(e,t){return e.classList?Array.prototype.some.call(e.classList,(function(e){return e===t})):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function o(e,t){e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):i(e,t)||(e.className+=" "+t)}function r(e,t){e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):i(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}))}function a(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(e);return o.className=i,o.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,r=n[t];"video"===e||"audio"===e?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},t.hasClass=i,t.addClass=o,t.removeClass=r,t.toggleClass=function(e,t){t.split(/\s+/g).forEach((function(t){i(e,t)?r(e,t):o(e,t)}))},t.findDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],n=void 0;try{n=e.querySelector(t)}catch(i){t.startsWith("#")&&(n=e.getElementById(t.slice(1)))}return n},t.deepCopy=function e(t,n){if("Object"===a(n)&&"Object"===a(t))return Object.keys(n).forEach((function(i){"Object"!==a(n[i])||n[i]instanceof Node?"Array"===a(n[i])?t[i]="Array"===a(t[i])?t[i].concat(n[i]):n[i]:t[i]=n[i]:t[i]?e(t[i],n[i]):t[i]=n[i]})),t},t.typeOf=a,t.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},t.attachEventListener=function(e,t,n,i){if(i)e.on(t,n),function(e,t,n,i){e.once(i,(function o(){e.off(t,n),e.off(i,o)}))}(e,t,n,i);else{e.on(t,(function i(o){n(o),e.off(t,i)}))}},t.styleUtil=function(e,t,n){var i=e.style;try{i[t]=n}catch(e){i.setProperty(t,n)}},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.throttle=function(e,t){var n=this,i=0;return function(){for(var o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];clearTimeout(i),i=setTimeout((function(){return e.apply(n,r)}),t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(26),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"setLogger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.logger=new a.default(e+".js")}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var i=n(18)();e.exports=function(e){return e!==i&&null!==e}},function(e,t,n){"use strict";e.exports=function(e){return null!=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(34),t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DanmuJs=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=f(n(6)),r=n(25),a=f(n(1)),s=f(n(27)),l=f(n(32)),u=n(33),c=n(0);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=t.DanmuJs=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;i.setLogger("danmu"),i.logger&&i.logger.info("danmu.js version: "+r.version);var a=i.config={overlap:!1,area:{start:0,end:1,lines:void 0},live:!1,comments:[],direction:"r2l",needResizeObserver:!1,dropStaleComments:!1,channelSize:void 0,maxCommentsLength:void 0,interval:2e3};if((0,c.deepCopy)(a,e),(0,o.default)(i),i.hideArr=[],i.domObj=new l.default,i.freezeId=null,a.comments.forEach((function(e){e.duration=e.duration?e.duration:5e3,e.mode||(e.mode="scroll")})),i.container=a.container&&1===a.container.nodeType?a.container:null,!i.container)return i.emit("error","container id can't be empty"),!1,h(n,!1);if(a.containerStyle){var u=a.containerStyle;Object.keys(u).forEach((function(e){i.container.style[e]=u[e]}))}return i.live=a.live,i.player=a.player,i.direction=a.direction,(0,c.addClass)(i.container,"danmu"),i.bulletBtn=new s.default(i),i.main=i.bulletBtn.main,i.isReady=!0,i.emit("ready"),n.logger&&n.logger.info("ready"),n.addResizeObserver(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"addResizeObserver",value:function(){var e=this;this.config.needResizeObserver&&(0,u.addObserver)(this.container,(function(){e.logger&&e.logger.info("needResizeObserver"),e.resize()}))}},{key:"start",value:function(){this.logger&&this.logger.info("start"),this.main.start()}},{key:"pause",value:function(){this.logger&&this.logger.info("pause"),this.main.pause()}},{key:"play",value:function(){this.logger&&this.logger.info("play"),this.main.play()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),this.main.stop()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.main.clear()}},{key:"destroy",value:function(){for(var e in(0,u.unObserver)(this.container),this.logger&&this.logger.info("destroy"),this.stop(),this.bulletBtn.destroy(),this.domObj.destroy(),this)delete this[e];this.emit("destroy")}},{key:"sendComment",value:function(e){this.logger&&this.logger.info("sendComment: "+(e.txt||"[DOM Element]")),e.duration||(e.duration=15e3),e&&e.id&&e.duration&&(e.el||e.txt)&&(e.duration=e.duration?e.duration:5e3,e.style||(e.style={opacity:void 0,fontSize:void 0}),e.style&&(this.opacity&&this.opacity!==e.style.opacity&&(e.style.opacity=this.opacity),this.fontSize&&this.fontSize!==e.style.fontSize&&(e.style.fontSize=this.fontSize)),e.prior||e.realTime?(this.main.data.unshift(e),e.realTime&&(this.main.readData(),this.main.dataHandle())):this.main.data.push(e))}},{key:"setCommentID",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentID: oldID "+e+" newID "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.id=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.id=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentDuration",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentDuration: id "+e+" duration "+t),e&&t&&(t=t||5e3,this.main.data.some((function(n){return n.id===e&&(n.duration=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.duration=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentLike",value:function(e,t){this.logger&&this.logger.info("setCommentLike: id "+e+" like "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.like=t,!0)})),this.main.queue.some((function(n){return n.id===e&&(n.pauseMove(),n.setLikeDom(t.el,t.style),"paused"!==n.danmu.main.status&&n.startMove(),!0)})))}},{key:"restartComment",value:function(e){if(this.logger&&this.logger.info("restartComment: id "+e),e){var t=this.main;if(this._releaseCtrl(e),"closed"===t.status)return;t.queue.some((function(n){return n.id===e&&("paused"!==t.status?n.startMove(!0):n.status="paused",!0)}))}}},{key:"_releaseCtrl",value:function(e){this.freezeId&&e==this.freezeId&&(this.mouseControl=!1,this.freezeId=null)}},{key:"_freezeCtrl",value:function(e){this.mouseControl=!0,this.freezeId=e}},{key:"freezeComment",value:function(e){if(this.logger&&this.logger.info("freezeComment: id "+e),e){this._freezeCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.status="forcedPause",t.pauseMove(),t.el&&t.el.style&&(0,c.styleUtil)(t.el,"zIndex",10),!0)}))}}},{key:"removeComment",value:function(e){if(this.logger&&this.logger.info("removeComment: id "+e),e){this._releaseCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.remove(),!0)})),this.main.data=this.main.data.filter((function(t){return t.id!==e}))}}},{key:"updateComments",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config,i=this.main,o=this.player,r=[],a=0;if(this.logger&&this.logger.info("updateComments: "+e.length+", isClear "+t),"boolean"==typeof t&&t&&(i.data=[]),i.data=i.data.concat(e),i.sortData(),"number"==typeof n.maxCommentsLength&&i.data.length>n.maxCommentsLength){a=i.data.length-n.maxCommentsLength;for(var s,l=0;l<a;l++)(s=i.data[l]).prior&&!s.attached_&&r.push(i.data[l])}else if(n.dropStaleComments&&o&&o.currentTime){var u=Math.floor(1e3*o.currentTime),c=u-n.interval;if(c>0)for(var f,h=0;h<i.data.length;h++)if((f=i.data[h]).prior&&!f.attached_&&r.push(i.data[h]),f.start>c){a=h;break}a>0&&(i.data.splice(0,a),i.data=r.concat(i.data))}}},{key:"willChange",value:function(){var e=this.container,t=this.main;e.style.willChange="opacity",t.willChanges.push("contents"),t.queue.forEach((function(e){e.willChange()}))}},{key:"stopWillChange",value:function(){this.container.style.willChange="",this.main.willChanges.splice(0),this.main.queue.forEach((function(e){e.willChange()}))}},{key:"setAllDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",t=this,n=arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.logger&&this.logger.info("setAllDuration: mode "+e+" duration "+n+" force "+i),n&&(n=n||5e3,i&&(this.main.forceDuration=n),this.main.data.forEach((function(t){e===t.mode&&(t.duration=n)})),this.main.queue.forEach((function(i){e===i.mode&&(i.duration=n,i.pauseMove(),"paused"!==t.main.status&&i.startMove())})))}},{key:"setOpacity",value:function(e){this.logger&&this.logger.info("setOpacity: opacity "+e),this.container.style.opacity=e}},{key:"setFontSize",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{reflow:!0};this.logger&&this.logger.info("setFontSize: size "+e+" channelSize "+t),this.fontSize=e+"px",e&&(this.main.data.forEach((function(e){e.style&&(e.style.fontSize=n.fontSize)})),this.main.queue.forEach((function(e){e.options.style||(e.options.style={}),e.options.style.fontSize=n.fontSize,e.setFontSize(n.fontSize),t&&(e.top=e.channel_id[0]*t,e.topInit())}))),t&&(this.config.channelSize=t,i.reflow&&this.main.channel.resizeSync(!0))}},{key:"setArea",value:function(e){this.logger&&this.logger.info("setArea: area "+e),this.config.area=e,!1!==e.reflow&&this.main.channel.resizeSync(!0)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("hide: mode "+e),this.hideArr.indexOf(e)<0&&this.hideArr.push(e);var t=this.main.queue.filter((function(t){return e===t.mode||"color"===e&&t.color}));t.forEach((function(e){return e.remove()}))}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("show: mode "+e);var t=this.hideArr.indexOf(e);t>-1&&this.hideArr.splice(t,1)}},{key:"setDirection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.logger&&this.logger.info("setDirection: direction "+e),this.emit("changeDirection",e)}},{key:"resize",value:function(){this.logger&&this.logger.info("resize"),this.emit("channel_resize")}},{key:"status",get:function(){return this.main.status}},{key:"state",get:function(){var e=this.main;return{status:e.status,comments:e.data,bullets:e.queue}}},{key:"containerPos",get:function(){return this.main.channel.containerPos}}]),t}(a.default);t.default=d},function(e,t,n){"use strict";var i,o,r,a,s,l,u,c=n(7),f=n(24),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,g=Object.defineProperty,m=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};o=function(e,t){var n,o;return f(t),o=this,i.call(this,e,n=function(){r.call(o,e,n),h.call(t,this,arguments)}),n.__eeOnceListener__=t,this},s={on:i=function(e,t){var n;return f(t),v.call(this,"__ee__")?n=this.__ee__:(n=y.value=p(null),g(this,"__ee__",y),y.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:o,off:r=function(e,t){var n,i,o,r;if(f(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(i=n[e]))for(r=0;o=i[r];++r)o!==t&&o.__eeOnceListener__!==t||(2===i.length?n[e]=i[r?0:1]:i.splice(r,1));else i!==t&&i.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];for(o=o.slice(),t=0;i=o[t];++t)h.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];h.call(o,this,r)}}},l={on:c(i),once:c(o),off:c(r),emit:c(a)},u=m({},l),e.exports=t=function(e){return null==e?p(u):m(Object(e),l)},t.methods=s},function(e,t,n){"use strict";var i=n(3),o=n(8),r=n(12),a=n(20),s=n(21);(e.exports=function(e,t){var n,o,l,u,c;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],i(e)?(n=s.call(e,"c"),o=s.call(e,"e"),l=s.call(e,"w")):(n=l=!0,o=!1),c={value:t,configurable:n,enumerable:o,writable:l},u?r(a(u),c):c}).gs=function(e,t,n){var l,u,c,f;return"string"!=typeof e?(c=n,n=t,t=e,e=null):c=arguments[3],i(t)?o(t)?i(n)?o(n)||(c=n,n=void 0):n=void 0:(c=t,t=n=void 0):t=void 0,i(e)?(l=s.call(e,"c"),u=s.call(e,"e")):(l=!0,u=!1),f={get:t,set:n,configurable:l,enumerable:u},c?r(a(c),f):f}},function(e,t,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;e.exports=function(e){return!!i(e)&&!o.test(r.call(e))}},function(e,t,n){"use strict";var i=n(10);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!i(e)}},function(e,t,n){"use strict";var i=n(11);e.exports=function(e){if(!i(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(3),o={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!i(e)&&hasOwnProperty.call(o,typeof e)}},function(e,t,n){"use strict";e.exports=n(13)()?Object.assign:n(14)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var i=n(15),o=n(19),r=Math.max;e.exports=function(e,t){var n,a,s,l=r(arguments.length,2);for(e=Object(o(e)),s=function(i){try{e[i]=t[i]}catch(e){n||(n=e)}},a=1;a<l;++a)i(t=arguments[a]).forEach(s);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(16)()?Object.keys:n(17)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(2),o=Object.keys;e.exports=function(e){return o(i(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var i=n(2);e.exports=function(e){if(!i(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var i=n(2),o=Array.prototype.forEach,r=Object.create,a=function(e,t){var n;for(n in e)t[n]=e[n]};e.exports=function(e){var t=r(null);return o.call(arguments,(function(e){i(e)&&a(Object(e),t)})),t}},function(e,t,n){"use strict";e.exports=n(22)()?String.prototype.contains:n(23)},function(e,t,n){"use strict";var i="razdwatrzy";e.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(e,t,n){"use strict";var i=String.prototype.indexOf;e.exports=function(e){return i.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e){e.exports=JSON.parse('{"version":"1.0.7"}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var o="undefined"!=typeof window&&window.location.href.indexOf("danmu-debug")>-1,r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructorName=t||""}return i(e,[{key:"info",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];o&&(t=console).log.apply(t,["[Danmu Log]["+this.constructorName+"]",e].concat(i))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=s(n(1)),r=n(0),a=s(n(28));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("control"),n.danmu=e,n.main=new a.default(e),e.config.defaultOff||n.main.start(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"createSwitch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.logger&&this.logger.info("createSwitch"),this.switchBtn=(0,r.createDom)("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(e?"danmu-switch-active":"")),this.switchBtn}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.main.destroy(),this)delete this[e]}}]),t}(o.default);t.default=l,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=l(n(1)),r=l(n(29)),a=l(n(30)),s=n(0);function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("main"),n.danmu=e,n.container=e.container,n.channel=new a.default(e),n.data=[].concat(e.config.comments),n.playedData=[],n.queue=[],n.timer=null,n.retryStatus="normal",n.interval=e.config.interval,n.willChanges=[],n._status="idle",(0,s.attachEventListener)(e,"bullet_remove",n.updateQueue.bind(n),"destroy"),(0,s.attachEventListener)(e,"changeDirection",(function(e){n.danmu.direction=e}),"destroy"),n.nums=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),clearTimeout(this.dataHandleTimer),this.channel.destroy(),this.data=[],this)delete this[e]}},{key:"updateQueue",value:function(e){this.logger&&this.logger.info("updateQueue");var t=this;t.queue.some((function(n,i){return n.id===e.bullet.id&&(t.queue.splice(i,1),!0)})),t.data.some((function(t){return t.id===e.bullet.id&&(t.attached_=!1,!0)}))}},{key:"init",value:function(){var e=this;e.logger&&e.logger.info("init"),e.retryStatus="normal",e.sortData(),function t(){e.dataHandleTimer&&(clearTimeout(e.dataHandleTimer),e.dataHandleTimer=null),"closed"===e._status&&"stop"===e.retryStatus||("playing"===e._status&&(e.readData(),e.dataHandle()),"stop"===e.retryStatus&&"paused"!==e._status||(e.dataHandleTimer=setTimeout((function(){t()}),e.interval-1e3)))}()}},{key:"start",value:function(){this.logger&&this.logger.info("start");this._status="playing",this.queue=[],this.container.innerHTML="",this.channel.reset(),this.init()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop");this._status="closed",this.retryStatus="stop",this.queue=[],this.container.innerHTML="",this.channel.reset()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.channel.reset(),this.data=[],this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){var e=this;if("closed"!==this._status){this.logger&&this.logger.info("play"),this._status="playing";var t=this.channel.channels;t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){e.queue.forEach((function(e){e.startMove(),e.resized=!0}));for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(e){e.resized=!1}))}))}else this.logger&&this.logger.info("play ignored")}},{key:"pause",value:function(){if("closed"!==this._status){this.logger&&this.logger.info("pause"),this._status="paused";var e=this.channel.channels;e&&e.length>0&&this.queue.forEach((function(e){e.pauseMove()}))}else this.logger&&this.logger.info("pause ignored")}},{key:"dataHandle",value:function(){"paused"!==this._status&&"closed"!==this._status&&this.queue.length&&this.queue.forEach((function(e){"waiting"===e.status&&e.startMove()}))}},{key:"readData",value:function(){if(this.danmu.isReady){var e=this,t=this.danmu,n=t.player,i=e.interval,o=e.channel,a=void 0,s=void 0;if(n){var l=n.currentTime?Math.floor(1e3*n.currentTime):0;s=e.data.filter((function(t){return!t.start&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&(t.start=l),e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&t.start-i<=l&&l<=t.start+i})),t.live&&(e.data=[])}else 0===(s=e.data.splice(0,1)).length&&(s=e.playedData.splice(0,1));s.length>0&&(o.updatePos(),s.forEach((function(n){if(e.forceDuration&&e.forceDuration!=n.duration&&(n.duration=e.forceDuration),(a=new r.default(t,n))&&!a.bulletCreateFail)if(n.attached_){for(var i in a.detach(),a)delete a[i];a=null,n.attached_=!1,n.noDiscard&&(n.prior?e.data.unshift(n):e.data.push(n))}else if(a.attach(),n.attached_=!0,o.addBullet(a).result)e.queue.push(a),e.nums++,a.topInit();else{for(var s in a.detach(),a)delete a[s];a=null,n.attached_=!1,n.noDiscard&&(n.prior?e.data.unshift(n):e.data.push(n))}})))}}},{key:"sortData",value:function(){this.data.sort((function(e,t){return(e.start||-1)-(t.start||-1)}))}},{key:"status",get:function(){return this._status}}]),t}(o.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bullet=void 0;var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=t.Bullet=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),o=i,r=void 0;if(i.setLogger("bullet"),i.danmu=e,i.options=n,i.duration=n.duration,i.moveV=n.moveV,i.id=n.id,i.container=e.container,i.start=n.start,i.prior=n.prior,i.color=n.color,i.bookChannelId=n.bookChannelId,i.direction=e.direction,i.reuseDOM=!0,i.willChanges=[],i.domObj=e.domObj,n.el&&1===n.el.nodeType){if(n.el.parentNode)return l(i,{bulletCreateFail:!0});if(e.config.disableCopyDOM)r=n.el,i.reuseDOM=!1;else{r=i.domObj.use();var a=(0,s.copyDom)(n.el);n.eventListeners&&n.eventListeners.length>0&&n.eventListeners.forEach((function(e){a.addEventListener(e.event,e.listener,e.useCapture||!1)})),r.appendChild(a)}}else(r=i.domObj.use()).textContent=n.txt;if(i.onChangeDirection=function(e){o.direction=e},i.danmu.on("changeDirection",i.onChangeDirection),n.style){var u=n.style;Object.keys(u).forEach((function(e){(0,s.styleUtil)(r,e,u[e])}))}"top"===n.mode||"bottom"===n.mode?i.mode=n.mode:i.mode="scroll",i.el=r,n.like&&n.like.el&&i.setLikeDom(n.like.el,n.like.style),i.status="waiting";var c=e.containerPos,f=Math.floor(Math.random()*(c.width/10>100?200:c.width/10));return n.realTime&&(f=0),(0,s.styleUtil)(i.el,"left",c.width+f+"px"),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),"b2t"===this.direction?(this.width=this.elPos.height,this.height=this.elPos.width):(this.width=this.elPos.width,this.height=this.elPos.height),this.moveV&&(this.duration=(this.danmu.containerPos.width+this.width)/this.moveV*1e3),this.danmu.config&&(this.danmu.config.mouseControl&&(this.mouseoverFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseover",this.mouseoverFunWrapper,!1)),this.danmu.config.mouseEnterControl&&(this.mouseEnterFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseenter",this.mouseEnterFunWrapper,!1)))}},{key:"detach",value:function(){var e=this.el;if(e){var t=this.danmu.config;t&&(t.mouseControl&&e.removeEventListener("mouseover",this.mouseoverFunWrapper,!1),t.mouseEnterControl&&e.removeEventListener("mouseenter",this.mouseEnterFunWrapper,!1)),e.parentNode&&e.parentNode.removeChild(e),this.reuseDOM&&this.domObj.unuse(e),this.el=null}this.danmu.off("changeDirection",this.onChangeDirection)}},{key:"willChange",value:function(){var e=this.danmu.main.willChanges.concat(this.willChanges).join();(0,s.styleUtil)(this.el,"willChange",e)}},{key:"mouseoverFun",value:function(e){this.danmu&&this.danmu.mouseControl&&this.danmu.config.mouseControlPause||"waiting"===this.status||"end"===this.status||this.danmu&&this.danmu.emit("bullet_hover",{bullet:this,event:e})}},{key:"topInit",value:function(){this.logger&&this.logger.info("topInit #"+(this.options.txt||"[DOM Element]")+"#"),"b2t"===this.direction?((0,s.styleUtil)(this.el,"transformOrigin","left top"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+this.danmu.containerPos.height+"px) translateZ(0px) rotate(90deg)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")):(0,s.styleUtil)(this.el,"top",this.top+"px")}},{key:"pauseMove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if("paused"!==t.status&&("forcedPause"!==t.status&&(this.status="paused"),t._clearAsyncTimer(),this.el))if(this.willChange(),"scroll"===this.mode){var n=t.danmu.containerPos;if(e){var i=((new Date).getTime()-t.moveTime)/1e3,o=i*this.moveV,r=0;r=t.moveMoreS-o>=0?"b2t"===this.direction?(t.moveMoreS-o)/t.moveContainerHeight*n.height:(t.moveMoreS-o)/t.moveContainerWidth*n.width:t.moveMoreS-o,"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",r+"px")}else"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-n.top)+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",this.el.getBoundingClientRect().left-n.left+"px");"b2t"===this.direction||(0,s.styleUtil)(this.el,"transform","translateX(0px) translateY(0px) translateZ(0px)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if(n.hasMove||(n.danmu.emit("bullet_start",n),n.hasMove=!0),("forcedPause"!==n.status||e)&&this.el&&"start"!==this.status)if(this.status="start",this.willChanges=["transform","transition"],this.willChange(),(0,s.styleUtil)(this.el,"backface-visibility","hidden"),(0,s.styleUtil)(this.el,"perspective","500em"),"scroll"===this.mode){var i=n.danmu.containerPos;if("b2t"===this.direction){this.moveV=(i.height+this.height)/this.duration*1e3;var o=(n.el.getBoundingClientRect().bottom-i.top)/this.moveV;(0,s.styleUtil)(this.el,"transition","transform "+o+"s linear 0s"),this.reqStartMoveId=requestAnimationFrame((function(){n.el&&((0,s.styleUtil)(n.el,"transform","translateX(-"+n.top+"px) translateY(-"+n.height+"px) translateZ(0px) rotate(90deg)"),n.moveTime=(new Date).getTime(),n.moveMoreS=n.el.getBoundingClientRect().top-i.top,n.moveContainerHeight=i.height,n.removeTimer=setTimeout(l,1e3*o))}))}else{var r=function(){if(n.el){n.moveV=(i.width+n.width)/n.duration*1e3;var e=n.el.getBoundingClientRect(),t=(e.right-i.left)/n.moveV;(0,s.styleUtil)(n.el,"transition","transform "+t+"s linear 0s");var o=(e.right-i.left)/t;e.right>i.left&&o>n.moveV-1&&o<n.moveV+1?((0,s.styleUtil)(n.el,"transform","translateX(-"+(e.right-i.left)+"px) translateY(0px) translateZ(0px)"),n.moveTime=(new Date).getTime(),n.moveMoreS=e.left-i.left,n.moveContainerWidth=i.width,n.removeTimer=setTimeout(l,1e3*t)):(n.status="end",n.remove())}};t?r():this.reqStartMoveId=requestAnimationFrame((function(){r()}))}}else{(0,s.styleUtil)(this.el,"left","50%"),(0,s.styleUtil)(this.el,"margin","0 0 0 -"+this.width/2+"px"),this.pastDuration||(this.pastDuration=1);var a=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(l,a),this.startTime=(new Date).getTime()}function l(){if(n.el)if("scroll"===n.mode){var e=n.danmu.containerPos,t=n.el.getBoundingClientRect();"b2t"===n.direction?t&&t.bottom<=e.top+100?(n.status="end",n.remove()):(n.pauseMove(),"paused"!==n.danmu.status&&n.startMove()):t&&t.right<=e.left+100?(n.status="end",n.remove()):(n.pauseMove(),"paused"!==n.danmu.status&&n.startMove())}else n.status="end",n.remove()}}},{key:"remove",value:function(){this.logger&&this.logger.info("remove #"+(this.options.txt||"[DOM Element]")+"#");this._clearAsyncTimer(),this.pauseMove(),this.el&&this.el.parentNode&&(this.willChanges=[],this.willChange(),this.detach(),this.options.el&&1===this.options.el.nodeType&&this.danmu.config.disableCopyDOM&&(0,s.styleUtil)(this.options.el,"transform","none"),this.danmu.emit("bullet_remove",{bullet:this}))}},{key:"_clearAsyncTimer",value:function(){this.removeTimer&&(clearTimeout(this.removeTimer),this.removeTimer=null),this.reqStartMoveId&&(cancelAnimationFrame(this.reqStartMoveId),this.reqStartMoveId=null)}},{key:"setFontSize",value:function(e){this.el&&(this.el.style.fontSize=e)}},{key:"setLikeDom",value:function(e,t){if(e){Object.keys(t).forEach((function(n){e.style[n]=t[n]}));if(e.className="danmu-like",this.el){var n=this.el.querySelector(".danmu-like");n&&this.el.removeChild(n),this.el.innerHTML=""+this.el.innerHTML+e.outerHTML}}return e}}]),t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0),l=n(31);var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;return i.setLogger("channel"),i.danmu=e,i.reset(!0),i.direction=e.direction,i.updatePos(),(0,s.attachEventListener)(n.danmu,"bullet_remove",(function(e){i.removeBullet(e.bullet)}),"destroy"),(0,s.attachEventListener)(n.danmu,"changeDirection",(function(e){i.direction=e}),"destroy"),(0,s.attachEventListener)(n.danmu,"channel_resize",(function(){i.resize(!0)}),"destroy"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updatePos",value:function(){var e=this.container.getBoundingClientRect();this.containerPos=e,this.containerWidth=e.width,this.containerHeight=e.height,this.containerTop=e.top,this.containerBottom=e.bottom,this.containerLeft=e.left,this.containerRight=e.right}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.channels=[],this._cancelResizeTimer(),this)delete this[e]}},{key:"addBullet",value:function(e){var t=this,n=this.danmu,i=this.channels,o=void 0,r=void 0,a=void 0;if("b2t"===t.direction?(r=this.channelWidth,a=Math.ceil(e.width/r)):(o=this.channelHeight,a=Math.ceil(e.height/o)),a>i.length)return{result:!1,message:"exceed channels.length, occupy="+a+",channelsSize="+i.length};for(var s=!0,l=void 0,u=-1,c=0,f=i.length;c<f;c++)if(i[c].queue[e.mode].some((function(t){return t.id===e.id})))return{result:!1,message:"exited, channelOrder="+c+",danmu_id="+e.id};if("scroll"===e.mode)for(var h=0,d=i.length-a;h<=d;h++){s=!0;for(var p=h;p<h+a;p++){if((l=i[p]).operating.scroll){s=!1;break}if(l.bookId.scroll&&l.bookId.scroll!==e.id){s=!1;break}l.operating.scroll=!0;var g=l.queue.scroll[0];if(g){var m=g.el.getBoundingClientRect();if("b2t"===t.direction){if(m.bottom>=t.containerPos.bottom){s=!1,l.operating.scroll=!1;break}}else if(m.right>=t.containerPos.right){s=!1,l.operating.scroll=!1;break}var v,y=void 0,b=void 0,_=void 0,w=void 0;if("b2t"===t.direction?(b=(m.top-t.containerTop+m.height)/(y=(t.containerHeight+m.height)/g.duration),_=t.containerHeight,w=(t.containerHeight+e.height)/e.duration):(b=(m.left-t.containerPos.left+m.width)/(y=(t.containerPos.width+m.width)/g.duration),_=t.containerPos.width,w=(t.containerPos.width+e.width)/e.duration),v=_/w,n.config.bOffset||(n.config.bOffset=0),y<w&&b+n.config.bOffset>v){s=!1,l.operating.scroll=!1;break}}l.operating.scroll=!1}if(s){u=h;break}}else if("top"===e.mode)for(var k=0,O=i.length-a;k<=O;k++){s=!0;for(var x=k;x<k+a;x++){if(x>Math.floor(i.length/2)){s=!1;break}if((l=i[x]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=k;break}}else if("bottom"===e.mode)for(var C=i.length-a;C>=0;C--){s=!0;for(var j=C;j<C+a;j++){if(j<=Math.floor(i.length/2)){s=!1;break}if((l=i[j]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=C;break}}if(-1!==u){for(var M=u,E=u+a;M<E;M++)(l=i[M]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&(delete l.bookId[e.mode],t.logger&&t.logger.info(M+"号轨道恢复正常使用")),l.operating[e.mode]=!1;if(e.prior)if(t.logger&&t.logger.info(e.id+"号优先弹幕运行完毕"),delete e.bookChannelId,n.player)n.bulletBtn.main.data.some((function(t){return t.id===e.id&&(delete t.bookChannelId,!0)}));return e.channel_id=[u,a],"b2t"===t.direction?(e.top=u*r,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerWidth*t.danmu.config.area.start)):(e.top=u*o,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start)),{result:e,message:"success"}}if(e.options.realTime){var T=0,L=-1,S=null;if(t.danmu.bulletBtn.main.queue.forEach((function(e,n){!e.prior&&!e.options.realTime&&e.el&&e.el.getBoundingClientRect().left>t.containerPos.right&&e.start>=T&&(T=e.start,L=n,S=e)})),S){S.remove(),t.removeBullet(S),t.danmu.bulletBtn.main.queue.splice(L,1),e.channel_id=S.channel_id;for(var z=S.channel_id[0],P=S.channel_id[0]+S.channel_id[1];z<P;z++)(l=i[z]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&delete l.bookId[e.mode],l.operating[e.mode]=!1;return e.top=S.top,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start),{result:e,message:"success"}}}if(e.prior)if(e.bookChannelId||t.danmu.live){if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,!0)}))}else{u=-1;for(var D=0,I=i.length-a;D<=I;D++){s=!0;for(var q=D;q<D+a;q++)if(i[q].bookId[e.mode]){s=!1;break}if(s){u=D;break}}if(-1!==u){for(var A=u;A<u+a;A++)i[A].bookId[e.mode]=e.id,t.logger&&t.logger.info(A+"号轨道被"+e.id+"号优先弹幕预定");if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,n.bookChannelId=[u,a],t.logger&&t.logger.info(e.id+"号优先弹幕预定了"+u+"~"+(u+a-1)+"号轨道"),!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(e){this.logger&&this.logger.info("removeBullet "+(e.options.txt||"[DOM Element]"));for(var t=this.channels,n=e.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=t[o]){i.operating[e.mode]=!0;var a=-1;i.queue[e.mode].some((function(t,n){return t.id===e.id&&(a=n,!0)})),a>-1&&i.queue[e.mode].splice(a,1),i.operating[e.mode]=!1}e.options.loop&&this.danmu.bulletBtn.main.playedData.push(e.options)}},{key:"resizeSync",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.resize(e,!0)}},{key:"resize",value:function(){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.logger&&this.logger.info("resize");var t=this;function n(){var e=t.danmu,n=e.container,i=e.config,o=e.bulletBtn,r=void 0;if(t.updatePos(),t._cancelResizeTimer(),o.main.data&&o.main.data.forEach((function(e){e.bookChannelId&&(delete e.bookChannelId,t.logger&&t.logger.info("resize导致"+e.id+"号优先弹幕预定取消"))})),t.logger&&t.logger.info("resize导致所有轨道恢复正常使用"),t.width=t.containerWidth,t.height=t.containerHeight,i.area){var a=i.area,u=a.lines,c=a.start,f=a.end;(0,l.validAreaLineRule)(u)?r=u:c>=0&&f>=c&&("b2t"===t.direction?t.width=t.width*(f-c):t.height=t.height*(f-c))}t.container=n;var h=i.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(r)||(r="b2t"===t.direction?Math.floor(t.width/h):Math.floor(t.height/h));for(var d=[],p=0;p<r;p++)d[p]={id:p,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(t.channels&&t.channels.length<=d.length){for(var g=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){t.channels[e].queue[n].forEach((function(t){t.el&&d[e].queue[n].push(t)}))})),t.channels[e].queue.bottom.forEach((function(n){if(n.el&&(d[e+d.length-t.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===e)){var i=[].concat(n.channel_id);n.channel_id=[i[0]-t.channels.length+d.length,i[1]],n.top=n.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(n.top+=t.containerHeight*t.danmu.config.area.start),n.topInit()}}))},m=0;m<t.channels.length;m++)g(m);for(var v=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},y=0;y<d.length;y++)v(y);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}else if(t.channels&&t.channels.length>d.length){for(var b=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&e>Math.floor(d.length/2));else if("bottom"===n&&e<=Math.floor(d.length/2));else{var i="bottom"===n?e-d.length+t.channels.length:e;t.channels[i].queue[n].forEach((function(o,r){if(o.el&&(d[e].queue[n].push(o),"bottom"===n&&o.channel_id[0]+o.channel_id[1]-1===i)){var a=[].concat(o.channel_id);o.channel_id=[a[0]-t.channels.length+d.length,a[1]],o.top=o.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(o.top+=t.containerHeight*t.danmu.config.area.start),o.topInit()}t.channels[i].queue[n].splice(r,1)}))}}))},_=0;_<d.length;_++)b(_);for(var w=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},k=0;k<d.length;k++)w(k);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}t.resizing=!1}t.resizing||(t.resizing=!0,e?n():(this._cancelResizeTimer(),this.resizeId=requestAnimationFrame(n)))}},{key:"_cancelResizeTimer",value:function(){this.resizeId&&(cancelAnimationFrame(this.resizeId),this.resizeId=null)}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("reset");var t=this,n=t.danmu,i=n.container,o=n.bulletBtn,r=n.config;function a(){var e=void 0,n=i.getBoundingClientRect();if(t.width=n.width,t.height=n.height,t.resetId&&(cancelAnimationFrame(t.resetId),t.resetId=null),r.area){var o=r.area,a=o.lines,u=o.start,c=o.end;(0,l.validAreaLineRule)(a)?e=a:u>=0&&c>=u&&("b2t"===t.direction?t.width=t.width*(c-u):t.height=t.height*(c-u))}var f=r.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(e)||(e="b2t"===t.direction?Math.floor(t.width/f):Math.floor(t.height/f));for(var h=[],d=0;d<e;d++)h[d]={id:d,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};t.channels=h,"b2t"===t.direction?t.channelWidth=f:t.channelHeight=f}t.container=i,o&&o.main&&o.main.queue.forEach((function(e){e.remove()})),t.channels&&t.channels.length>0&&["scroll","top","bottom"].forEach((function(e){for(var n=0;n<t.channels.length;n++)t.channels[n].queue[e].forEach((function(e){e.remove()}))})),o&&o.main&&o.main.data&&o.main.data.forEach((function(e){e.attached_=!1})),e?this.resetId=requestAnimationFrame(a):a()}}]),t}(a.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validAreaLineRule=function(e){return"number"==typeof e&&e>=0&&Number.isInteger(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t={initDOM:function(){return document.createElement("div")},initSize:10},this.init(t)}return i(e,[{key:"init",value:function(e){this.idleList=[],this.usingList=[],this._id=0,this.options=e,this._expand(e.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var e=this.idleList.shift();return this.usingList.push(e),e}},{key:"unuse",value:function(e){var t=this.usingList.indexOf(e);t<0||(this.usingList.splice(t,1),e.innerHTML="",e.textcontent="",this.clearElementStyle(e),this.idleList.push(e))}},{key:"_expand",value:function(e){for(var t=0;t<e;t++)this.idleList.push(this.options.initDOM(this._id++))}},{key:"destroy",value:function(){for(var e=0;e<this.idleList.length;e++)this.idleList[e].innerHTML="",this.idleList[e].textcontent="",this.clearElementStyle(this.idleList[e]);for(var t=0;t<this.usingList.length;t++)this.usingList[t].innerHTML="",this.usingList[t].textcontent="",this.clearElementStyle(this.usingList[t]);for(var n in this)delete this[n]}},{key:"clearElementStyle",value:function(e){var t="undefined"!=typeof window?window.navigator.userAgent:null;t&&(t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1?(0,o.styleUtil)(e,"transform","none"):e.setAttribute("style",""))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.destroyObserver=t.unObserver=t.addObserver=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=new(function(){function e(){var t=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__handlers=[],window.ResizeObserver)try{this.observer=new window.ResizeObserver((0,o.throttle)((function(e){t.__trigger(e)}),100))}catch(e){}}return i(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var n=this.__handlers,i=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(i=o);i>-1?this.__handlers[i].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,i){e===n.target&&(t=i)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,n=0;n<t.length;n++)if(t[n]&&e===t[n].target){t[n].handler&&t[n].handler.map((function(e){try{e()}catch(e){console.error(e)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){t.__runHandler(e.target)}))}}]),e}());t.addObserver=function(e,t){r.addObserver(e,t)},t.unObserver=function(e,t){r.unObserver(e,t)},t.destroyObserver=function(e,t){r.destroyObserver(e,t)}},function(e,t,n){var i=n(35);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(37)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(36)(!1)).push([e.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,f=[],h=n(38);function d(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],t))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],t));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function g(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function v(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),y(t,e.attrs),g(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,i,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var a=c++;n=u||(u=v(t)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),g(e,t),t}(t),i=x.bind(null,n,t),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),i=O.bind(null,n),o=function(){m(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}e&&d(p(e,t),t);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete r[s.id]}}}};var _,w=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function k(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function O(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function x(e,t,n){var i=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(i=h(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,i=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}])}));
/*! Built @Thu, 11 Aug 2022 14:51:23 GMT */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["danmu.js"]=t():e["danmu.js"]=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){"use strict";function i(e,t){return e.classList?Array.prototype.some.call(e.classList,(function(e){return e===t})):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function o(e,t){e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):i(e,t)||(e.className+=" "+t)}function r(e,t){e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):i(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}))}function a(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(e);return o.className=i,o.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,r=n[t];"video"===e||"audio"===e?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},t.hasClass=i,t.addClass=o,t.removeClass=r,t.toggleClass=function(e,t){t.split(/\s+/g).forEach((function(t){i(e,t)?r(e,t):o(e,t)}))},t.findDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],n=void 0;try{n=e.querySelector(t)}catch(i){t.startsWith("#")&&(n=e.getElementById(t.slice(1)))}return n},t.deepCopy=function e(t,n){if("Object"===a(n)&&"Object"===a(t))return Object.keys(n).forEach((function(i){"Object"!==a(n[i])||n[i]instanceof Node?"Array"===a(n[i])?t[i]="Array"===a(t[i])?t[i].concat(n[i]):n[i]:t[i]=n[i]:t[i]?e(t[i],n[i]):t[i]=n[i]})),t},t.typeOf=a,t.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},t.attachEventListener=function(e,t,n,i){if(i)e.on(t,n),function(e,t,n,i){e.once(i,(function o(){e.off(t,n),e.off(i,o)}))}(e,t,n,i);else{e.on(t,(function i(o){n(o),e.off(t,i)}))}},t.styleUtil=function(e,t,n){var i=e.style;try{i[t]=n}catch(e){i.setProperty(t,n)}},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.throttle=function(e,t){var n=this,i=0;return function(){for(var o=arguments.length,r=Array(o),a=0;a<o;a++)r[a]=arguments[a];clearTimeout(i),i=setTimeout((function(){return e.apply(n,r)}),t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(26),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"setLogger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.logger=new a.default(e+".js")}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var i=n(18)();e.exports=function(e){return e!==i&&null!==e}},function(e,t,n){"use strict";e.exports=function(e){return null!=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(34),t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DanmuJs=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=f(n(6)),r=n(25),a=f(n(1)),s=f(n(27)),l=f(n(32)),u=n(33),c=n(0);function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=t.DanmuJs=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;i.setLogger("danmu"),i.logger&&i.logger.info("danmu.js version: "+r.version);var a=i.config={overlap:!1,area:{start:0,end:1,lines:void 0},live:!1,comments:[],direction:"r2l",needResizeObserver:!1,dropStaleComments:!1,channelSize:void 0,maxCommentsLength:void 0,interval:2e3};if((0,c.deepCopy)(a,e),(0,o.default)(i),i.hideArr=[],i.domObj=new l.default,i.freezeId=null,a.comments.forEach((function(e){e.duration=e.duration?e.duration:5e3,e.mode||(e.mode="scroll")})),i.container=a.container&&1===a.container.nodeType?a.container:null,!i.container)return i.emit("error","container id can't be empty"),!1,h(n,!1);if(a.containerStyle){var u=a.containerStyle;Object.keys(u).forEach((function(e){i.container.style[e]=u[e]}))}return i.live=a.live,i.player=a.player,i.direction=a.direction,(0,c.addClass)(i.container,"danmu"),i.bulletBtn=new s.default(i),i.main=i.bulletBtn.main,i.isReady=!0,i.emit("ready"),n.logger&&n.logger.info("ready"),n.addResizeObserver(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"addResizeObserver",value:function(){var e=this;this.config.needResizeObserver&&(0,u.addObserver)(this.container,(function(){e.logger&&e.logger.info("needResizeObserver"),e.resize()}))}},{key:"start",value:function(){this.logger&&this.logger.info("start"),this.main.start()}},{key:"pause",value:function(){this.logger&&this.logger.info("pause"),this.main.pause()}},{key:"play",value:function(){this.logger&&this.logger.info("play"),this.main.play()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),this.main.stop()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.main.clear()}},{key:"destroy",value:function(){for(var e in(0,u.unObserver)(this.container),this.logger&&this.logger.info("destroy"),this.stop(),this.bulletBtn.destroy(),this.domObj.destroy(),this)delete this[e];this.emit("destroy")}},{key:"sendComment",value:function(e){this.logger&&this.logger.info("sendComment: "+(e.txt||"[DOM Element]")),e.duration||(e.duration=15e3),e&&e.id&&e.duration&&(e.el||e.txt)&&(e.duration=e.duration?e.duration:5e3,e.style||(e.style={opacity:void 0,fontSize:void 0}),e.style&&(this.opacity&&this.opacity!==e.style.opacity&&(e.style.opacity=this.opacity),this.fontSize&&this.fontSize!==e.style.fontSize&&(e.style.fontSize=this.fontSize)),e.prior||e.realTime?(this.main.data.unshift(e),e.realTime&&(this.main.readData(),this.main.dataHandle())):this.main.data.push(e))}},{key:"setCommentID",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentID: oldID "+e+" newID "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.id=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.id=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentDuration",value:function(e,t){var n=this;this.logger&&this.logger.info("setCommentDuration: id "+e+" duration "+t),e&&t&&(t=t||5e3,this.main.data.some((function(n){return n.id===e&&(n.duration=t,!0)})),this.main.queue.some((function(i){return i.id===e&&(i.duration=t,i.pauseMove(),"paused"!==n.main.status&&i.startMove(),!0)})))}},{key:"setCommentLike",value:function(e,t){this.logger&&this.logger.info("setCommentLike: id "+e+" like "+t),e&&t&&(this.main.data.some((function(n){return n.id===e&&(n.like=t,!0)})),this.main.queue.some((function(n){return n.id===e&&(n.pauseMove(),n.setLikeDom(t.el,t.style),"paused"!==n.danmu.main.status&&n.startMove(),!0)})))}},{key:"restartComment",value:function(e){if(this.logger&&this.logger.info("restartComment: id "+e),e){var t=this.main;if(this._releaseCtrl(e),"closed"===t.status)return;t.queue.some((function(n){return n.id===e&&("paused"!==t.status?n.startMove(!0):n.status="paused",!0)}))}}},{key:"_releaseCtrl",value:function(e){this.freezeId&&e==this.freezeId&&(this.mouseControl=!1,this.freezeId=null)}},{key:"_freezeCtrl",value:function(e){this.mouseControl=!0,this.freezeId=e}},{key:"freezeComment",value:function(e){if(this.logger&&this.logger.info("freezeComment: id "+e),e){this._freezeCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.status="forcedPause",t.pauseMove(),t.el&&t.el.style&&(0,c.styleUtil)(t.el,"zIndex",10),!0)}))}}},{key:"removeComment",value:function(e){if(this.logger&&this.logger.info("removeComment: id "+e),e){this._releaseCtrl(e),this.main.queue.some((function(t){return t.id===e&&(t.remove(),!0)})),this.main.data=this.main.data.filter((function(t){return t.id!==e}))}}},{key:"updateComments",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config,i=this.main,o=this.player,r=[],a=0;if(this.logger&&this.logger.info("updateComments: "+e.length+", isClear "+t),"boolean"==typeof t&&t&&(i.data=[]),i.data=i.data.concat(e),i.sortData(),"number"==typeof n.maxCommentsLength&&i.data.length>n.maxCommentsLength){a=i.data.length-n.maxCommentsLength;for(var s,l=0;l<a;l++)(s=i.data[l]).prior&&!s.attached_&&r.push(i.data[l])}else if(n.dropStaleComments&&o&&o.currentTime){var u=Math.floor(1e3*o.currentTime),c=u-n.interval;if(c>0)for(var f,h=0;h<i.data.length;h++)if((f=i.data[h]).prior&&!f.attached_&&r.push(i.data[h]),f.start>c){a=h;break}a>0&&(i.data.splice(0,a),i.data=r.concat(i.data))}}},{key:"willChange",value:function(){var e=this.container,t=this.main;e.style.willChange="opacity",t.willChanges.push("contents"),t.queue.forEach((function(e){e.willChange()}))}},{key:"stopWillChange",value:function(){this.container.style.willChange="",this.main.willChanges.splice(0),this.main.queue.forEach((function(e){e.willChange()}))}},{key:"setAllDuration",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",t=this,n=arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.logger&&this.logger.info("setAllDuration: mode "+e+" duration "+n+" force "+i),n&&(n=n||5e3,i&&(this.main.forceDuration=n),this.main.data.forEach((function(t){e===t.mode&&(t.duration=n)})),this.main.queue.forEach((function(i){e===i.mode&&(i.duration=n,i.pauseMove(),"paused"!==t.main.status&&i.startMove())})))}},{key:"setPlayRate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",n=arguments[1];this.logger&&this.logger.info("setPlayRate: "+n),(0,c.isNumber)(n)&&n>0&&(this.main.playRate=n,this.main.queue.forEach((function(n){t===n.mode&&(n.pauseMove(),"paused"!==e.main.status&&n.startMove())})))}},{key:"setOpacity",value:function(e){this.logger&&this.logger.info("setOpacity: opacity "+e),this.container.style.opacity=e}},{key:"setFontSize",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{reflow:!0};this.logger&&this.logger.info("setFontSize: size "+e+" channelSize "+t),this.fontSize=e+"px",e&&(this.main.data.forEach((function(e){e.style&&(e.style.fontSize=n.fontSize)})),this.main.queue.forEach((function(e){e.options.style||(e.options.style={}),e.options.style.fontSize=n.fontSize,e.setFontSize(n.fontSize),t&&(e.top=e.channel_id[0]*t,e.topInit())}))),t&&(this.config.channelSize=t,i.reflow&&this.main.channel.resizeSync())}},{key:"setArea",value:function(e){this.logger&&this.logger.info("setArea: area "+e),this.config.area=e,!1!==e.reflow&&this.main.channel.resizeSync()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("hide: mode "+e),this.hideArr.indexOf(e)<0&&this.hideArr.push(e);var t=this.main.queue.filter((function(t){return e===t.mode||"color"===e&&t.color}));t.forEach((function(e){return e.remove()}))}},{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("show: mode "+e);var t=this.hideArr.indexOf(e);t>-1&&this.hideArr.splice(t,1)}},{key:"setDirection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.logger&&this.logger.info("setDirection: direction "+e),this.emit("changeDirection",e)}},{key:"resize",value:function(){this.logger&&this.logger.info("resize"),this.emit("channel_resize")}},{key:"status",get:function(){return this.main.status}},{key:"state",get:function(){var e=this.main;return{status:e.status,comments:e.data,bullets:e.queue}}},{key:"containerPos",get:function(){return this.main.channel.containerPos}}]),t}(a.default);t.default=d},function(e,t,n){"use strict";var i,o,r,a,s,l,u,c=n(7),f=n(24),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};o=function(e,t){var n,o;return f(t),o=this,i.call(this,e,n=function(){r.call(o,e,n),h.call(t,this,arguments)}),n.__eeOnceListener__=t,this},s={on:i=function(e,t){var n;return f(t),v.call(this,"__ee__")?n=this.__ee__:(n=y.value=p(null),m(this,"__ee__",y),y.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:o,off:r=function(e,t){var n,i,o,r;if(f(t),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(i=n[e]))for(r=0;o=i[r];++r)o!==t&&o.__eeOnceListener__!==t||(2===i.length?n[e]=i[r?0:1]:i.splice(r,1));else i!==t&&i.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];for(o=o.slice(),t=0;i=o[t];++t)h.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];h.call(o,this,r)}}},l={on:c(i),once:c(o),off:c(r),emit:c(a)},u=g({},l),e.exports=t=function(e){return null==e?p(u):g(Object(e),l)},t.methods=s},function(e,t,n){"use strict";var i=n(3),o=n(8),r=n(12),a=n(20),s=n(21);(e.exports=function(e,t){var n,o,l,u,c;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],i(e)?(n=s.call(e,"c"),o=s.call(e,"e"),l=s.call(e,"w")):(n=l=!0,o=!1),c={value:t,configurable:n,enumerable:o,writable:l},u?r(a(u),c):c}).gs=function(e,t,n){var l,u,c,f;return"string"!=typeof e?(c=n,n=t,t=e,e=null):c=arguments[3],i(t)?o(t)?i(n)?o(n)||(c=n,n=void 0):n=void 0:(c=t,t=n=void 0):t=void 0,i(e)?(l=s.call(e,"c"),u=s.call(e,"e")):(l=!0,u=!1),f={get:t,set:n,configurable:l,enumerable:u},c?r(a(c),f):f}},function(e,t,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;e.exports=function(e){return!!i(e)&&!o.test(r.call(e))}},function(e,t,n){"use strict";var i=n(10);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!i(e)}},function(e,t,n){"use strict";var i=n(11);e.exports=function(e){if(!i(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(3),o={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!i(e)&&hasOwnProperty.call(o,typeof e)}},function(e,t,n){"use strict";e.exports=n(13)()?Object.assign:n(14)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var i=n(15),o=n(19),r=Math.max;e.exports=function(e,t){var n,a,s,l=r(arguments.length,2);for(e=Object(o(e)),s=function(i){try{e[i]=t[i]}catch(e){n||(n=e)}},a=1;a<l;++a)i(t=arguments[a]).forEach(s);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(16)()?Object.keys:n(17)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(2),o=Object.keys;e.exports=function(e){return o(i(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var i=n(2);e.exports=function(e){if(!i(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var i=n(2),o=Array.prototype.forEach,r=Object.create,a=function(e,t){var n;for(n in e)t[n]=e[n]};e.exports=function(e){var t=r(null);return o.call(arguments,(function(e){i(e)&&a(Object(e),t)})),t}},function(e,t,n){"use strict";e.exports=n(22)()?String.prototype.contains:n(23)},function(e,t,n){"use strict";var i="razdwatrzy";e.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(e,t,n){"use strict";var i=String.prototype.indexOf;e.exports=function(e){return i.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e){e.exports=JSON.parse('{"version":"1.1.0"}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var o="undefined"!=typeof window&&window.location.href.indexOf("danmu-debug")>-1,r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructorName=t||""}return i(e,[{key:"info",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];o&&(t=console).log.apply(t,["[Danmu Log]["+this.constructorName+"]",e].concat(i))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=s(n(1)),r=n(0),a=s(n(28));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("control"),n.danmu=e,n.main=new a.default(e),e.config.defaultOff||n.main.start(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"createSwitch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.logger&&this.logger.info("createSwitch"),this.switchBtn=(0,r.createDom)("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(e?"danmu-switch-active":"")),this.switchBtn}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.main.destroy(),this)delete this[e]}}]),t}(o.default);t.default=l,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=l(n(1)),r=l(n(29)),a=l(n(30)),s=n(0);function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.setLogger("main"),n.danmu=e,n.container=e.container,n.channel=new a.default(e),n.data=[].concat(e.config.comments),n.playedData=[],n.queue=[],n.timer=null,n.playRate=1,n.retryStatus="normal",n.interval=e.config.interval,n.willChanges=[],n._status="idle",(0,s.attachEventListener)(e,"bullet_remove",n.updateQueue.bind(n),"destroy"),(0,s.attachEventListener)(e,"changeDirection",(function(e){n.danmu.direction=e}),"destroy"),n.nums=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"_cancelDataHandleTimer",value:function(){this.handleId&&(clearTimeout(this.handleId),this.handleId=null),this.handleTimer&&(clearTimeout(this.handleTimer),this.handleTimer=null)}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this._cancelDataHandleTimer(),this.channel.destroy(),this.data=[],this)delete this[e]}},{key:"updateQueue",value:function(e){this.logger&&this.logger.info("updateQueue");var t=this;t.queue.some((function(n,i){return n.id===e.bullet.id&&(t.queue.splice(i,1),!0)})),t.data.some((function(t){return t.id===e.bullet.id&&(t.attached_=!1,!0)}))}},{key:"init",value:function(){var e=this;e.logger&&e.logger.info("init"),e.retryStatus="normal",e.sortData(),function t(){"closed"!==e._status||"stop"!==e.retryStatus?("playing"===e._status&&(e.readData(),e.dataHandle()),"stop"===e.retryStatus&&"paused"!==e._status||(e.handleTimer=setTimeout((function(){e.handleId=requestAnimationFrame((function(){t()}))}),250))):e._cancelDataHandleTimer()}()}},{key:"start",value:function(){this.logger&&this.logger.info("start");this._status="playing",this.queue=[],this.container.innerHTML="",this.channel.reset(),this.init()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop");this._status="closed",this.retryStatus="stop",this.queue=[],this.container.innerHTML="",this.channel.reset()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.channel.reset(),this.data=[],this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){var e=this;if("closed"!==this._status){this.logger&&this.logger.info("play"),this._status="playing";var t=this.channel.channels;t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){e.queue.forEach((function(e){e.startMove(),e.resized=!0}));for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(e){e.resized=!1}))}))}else this.logger&&this.logger.info("play ignored")}},{key:"pause",value:function(){if("closed"!==this._status){this.logger&&this.logger.info("pause"),this._status="paused";var e=this.channel.channels;e&&e.length>0&&this.queue.forEach((function(e){e.pauseMove()}))}else this.logger&&this.logger.info("pause ignored")}},{key:"dataHandle",value:function(){"paused"!==this._status&&"closed"!==this._status&&this.queue.length&&this.queue.forEach((function(e){"waiting"===e.status&&e.startMove()}))}},{key:"readData",value:function(){if(this.danmu.isReady){var e=this,t=this.danmu,n=t.player,i=e.interval,o=e.channel,a=void 0,s=void 0;if(n){var l=n.currentTime?Math.floor(1e3*n.currentTime):0;s=e.data.filter((function(t){return!t.start&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&(t.start=l),!t.attached_&&e.danmu.hideArr.indexOf(t.mode)<0&&(!t.color||e.danmu.hideArr.indexOf("color")<0)&&t.start-i<=l&&l<=t.start+i})),t.live&&(e.data=[])}else 0===(s=e.data.splice(0,1)).length&&(s=e.playedData.splice(0,1));if(s.length>0){o.updatePos();var u=2;e:for(var c,f=0;f<s.length;f++)if(c=s[f],e.forceDuration&&e.forceDuration!=c.duration&&(c.duration=e.forceDuration),(a=new r.default(t,c))&&!a.bulletCreateFail)if(a.attach(),c.attached_=!0,o.addBullet(a).result)e.queue.push(a),e.nums++,a.topInit(),u=2;else{for(var h in a.detach(),a)delete a[h];if(a=null,c.attached_=!1,c.noDiscard&&(c.prior?e.data.unshift(c):e.data.push(c)),0===u)break e;u--}else{if(0===u)break e;u--}}}}},{key:"sortData",value:function(){this.data.sort((function(e,t){return(e.start||-1)-(t.start||-1)}))}},{key:"status",get:function(){return this._status}}]),t}(o.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bullet=void 0;var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0);function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=t.Bullet=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),o=i,r=void 0;if(i.setLogger("bullet"),i.danmu=e,i.options=n,i.duration=n.duration,i.id=n.id,i.container=e.container,i.start=n.start,i.prior=n.prior,i.realTime=n.realTime,i.color=n.color,i.bookChannelId=n.bookChannelId,i.direction=e.direction,i.reuseDOM=!0,i.willChanges=[],i.domObj=e.domObj,n.el&&1===n.el.nodeType){if(n.el.parentNode)return l(i,{bulletCreateFail:!0});if(e.config.disableCopyDOM)r=n.el,i.reuseDOM=!1;else{r=i.domObj.use();var a=(0,s.copyDom)(n.el);n.eventListeners&&n.eventListeners.length>0&&n.eventListeners.forEach((function(e){a.addEventListener(e.event,e.listener,e.useCapture||!1)})),r.appendChild(a)}}else(r=i.domObj.use()).textContent=n.txt;if(i.onChangeDirection=function(e){o.direction=e},i.danmu.on("changeDirection",i.onChangeDirection),n.style){var u=n.style;Object.keys(u).forEach((function(e){(0,s.styleUtil)(r,e,u[e])}))}"top"===n.mode||"bottom"===n.mode?i.mode=n.mode:i.mode="scroll",i.el=r,n.like&&n.like.el&&i.setLikeDom(n.like.el,n.like.style),i.status="waiting";var c=e.containerPos,f=Math.floor(Math.random()*(c.width/10>100?200:c.width/10));return n.realTime&&(f=0),i.updateOffset(f),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updateOffset",value:function(e){this.random=e,(0,s.styleUtil)(this.el,"left",this.danmu.containerPos.width+e+"px")}},{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),"b2t"===this.direction?(this.width=this.elPos.height,this.height=this.elPos.width):(this.width=this.elPos.width,this.height=this.elPos.height),this.moveV&&(this.duration=(this.danmu.containerPos.width+this.random+this.width)/this.moveV*1e3),this.danmu.config&&(this.danmu.config.mouseControl&&(this.mouseoverFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseover",this.mouseoverFunWrapper,!1)),this.danmu.config.mouseEnterControl&&(this.mouseEnterFunWrapper=this.mouseoverFun.bind(this),this.el.addEventListener("mouseenter",this.mouseEnterFunWrapper,!1)))}},{key:"detach",value:function(){var e=this.el;if(e){var t=this.danmu.config;t&&(t.mouseControl&&e.removeEventListener("mouseover",this.mouseoverFunWrapper,!1),t.mouseEnterControl&&e.removeEventListener("mouseenter",this.mouseEnterFunWrapper,!1)),e.parentNode&&e.parentNode.removeChild(e),this.reuseDOM&&this.domObj.unuse(e),this.el=null}this.elPos=void 0,this.danmu.off("changeDirection",this.onChangeDirection)}},{key:"willChange",value:function(){var e=this.danmu.main.willChanges.concat(this.willChanges).join();(0,s.styleUtil)(this.el,"willChange",e)}},{key:"mouseoverFun",value:function(e){this.danmu&&this.danmu.mouseControl&&this.danmu.config.mouseControlPause||"waiting"===this.status||"end"===this.status||this.danmu&&this.danmu.emit("bullet_hover",{bullet:this,event:e})}},{key:"topInit",value:function(){this.logger&&this.logger.info("topInit #"+(this.options.txt||"[DOM Element]")+"#"),"b2t"===this.direction?((0,s.styleUtil)(this.el,"transformOrigin","left top"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+this.danmu.containerPos.height+"px) translateZ(0px) rotate(90deg)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")):(0,s.styleUtil)(this.el,"top",this.top+"px")}},{key:"pauseMove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if("paused"!==t.status&&("forcedPause"!==t.status&&(this.status="paused"),t._clearAsyncTimer(),t._moveV=void 0,this.el))if(this.willChange(),"scroll"===this.mode){var n=t.danmu.containerPos;if(e){var i=((new Date).getTime()-t.moveTime)/1e3,o=i*this.moveV,r=0;r=t.moveMoreS-o>=0?"b2t"===this.direction?(t.moveMoreS-o)/t.moveContainerHeight*n.height:(t.moveMoreS-o)/t.moveContainerWidth*n.width:t.moveMoreS-o,"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",r+"px")}else"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-n.top)+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",this.el.getBoundingClientRect().left-n.left+"px");"b2t"===this.direction||(0,s.styleUtil)(this.el,"transform","translateX(0px) translateY(0px) translateZ(0px)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(e){var t=this;if(t.hasMove||(t.danmu.emit("bullet_start",t),t.hasMove=!0),("forcedPause"!==t.status||e)&&this.el&&"start"!==this.status)if(this.status="start",this.willChanges=["transform","transition"],this.willChange(),(0,s.styleUtil)(this.el,"backface-visibility","hidden"),(0,s.styleUtil)(this.el,"perspective","500em"),"scroll"===this.mode){var n=t.danmu.containerPos;if("b2t"===this.direction){var i=(t.el.getBoundingClientRect().bottom-n.top)/this.moveV;(0,s.styleUtil)(t.el,"transition","transform "+i+"s linear 0s"),(0,s.styleUtil)(t.el,"transform","translateX(-"+t.top+"px) translateY(-"+t.height+"px) translateZ(0px) rotate(90deg)"),t.moveTime=(new Date).getTime(),t.moveMoreS=t.el.getBoundingClientRect().top-n.top,t.moveContainerHeight=n.height,t.removeTimer=setTimeout(u,1e3*i)}else{if(!t.el)return;var o=t.el.getBoundingClientRect(),r=o.right-n.left,a=r/t.moveV;o.right>n.left?((0,s.styleUtil)(t.el,"transition","transform "+a+"s linear 0s"),(0,s.styleUtil)(t.el,"transform","translateX(-"+r+"px) translateY(0px) translateZ(0px)"),t.moveTime=(new Date).getTime(),t.moveMoreS=o.left-n.left,t.moveContainerWidth=n.width,t.removeTimer=setTimeout(u,1e3*a)):(t.status="end",t.remove())}}else{(0,s.styleUtil)(this.el,"left","50%"),(0,s.styleUtil)(this.el,"margin","0 0 0 -"+this.width/2+"px"),this.pastDuration||(this.pastDuration=1);var l=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(u,l),this.startTime=(new Date).getTime()}function u(){if(t.el)if("scroll"===t.mode){var e=t.danmu.containerPos,n=t.el.getBoundingClientRect();"b2t"===t.direction?n&&n.bottom<=e.top+100?(t.status="end",t.remove()):(t.pauseMove(),"paused"!==t.danmu.status&&t.startMove()):n&&n.right<=e.left+100?(t.status="end",t.remove()):(t.pauseMove(),"paused"!==t.danmu.status&&t.startMove())}else t.status="end",t.remove()}}},{key:"remove",value:function(){this.logger&&this.logger.info("remove #"+(this.options.txt||"[DOM Element]")+"#");this._clearAsyncTimer(),this.pauseMove(),this.el&&this.el.parentNode&&(this.willChanges=[],this.willChange(),this.detach(),this.options.el&&1===this.options.el.nodeType&&this.danmu.config.disableCopyDOM&&(0,s.styleUtil)(this.options.el,"transform","none"),this.danmu.emit("bullet_remove",{bullet:this}))}},{key:"_clearAsyncTimer",value:function(){this.removeTimer&&(clearTimeout(this.removeTimer),this.removeTimer=null)}},{key:"setFontSize",value:function(e){this.el&&(this.el.style.fontSize=e)}},{key:"setLikeDom",value:function(e,t){if(e){Object.keys(t).forEach((function(n){e.style[n]=t[n]}));if(e.className="danmu-like",this.el){var n=this.el.querySelector(".danmu-like");n&&this.el.removeChild(n),this.el.innerHTML=""+this.el.innerHTML+e.outerHTML}}return e}},{key:"moveV",get:function(){var e=this._moveV;if(!e){if(this.options.moveV)e=this.options.moveV;else if(this.elPos){var t=this.danmu.containerPos;e=("b2t"===this.direction?t.height+this.height:t.width+this.width)/this.duration*1e3}e&&(e*=this.danmu.main.playRate,this._moveV=e)}return e}}]),t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),a=(i=r)&&i.__esModule?i:{default:i},s=n(0),l=n(31);var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),i=n;return i.setLogger("channel"),i.danmu=e,i.reset(!0),i.direction=e.direction,i.channels=[],i.updatePos(),(0,s.attachEventListener)(n.danmu,"bullet_remove",(function(e){i.removeBullet(e.bullet)}),"destroy"),(0,s.attachEventListener)(n.danmu,"changeDirection",(function(e){i.direction=e}),"destroy"),(0,s.attachEventListener)(n.danmu,"channel_resize",(function(){i.resize()}),"destroy"),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"updatePos",value:function(){var e=this.container.getBoundingClientRect();this.containerPos=e,this.containerWidth=e.width,this.containerHeight=e.height,this.containerTop=e.top,this.containerBottom=e.bottom,this.containerLeft=e.left,this.containerRight=e.right}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.channels.splice(0,this.channels.length),this._cancelResizeTimer(),this)delete this[e]}},{key:"addBullet",value:function(e){var t=this,n=this.danmu,i=this.channels,o=void 0,r=void 0,a=void 0;if("b2t"===t.direction?(r=this.channelWidth,a=Math.ceil(e.width/r)):(o=this.channelHeight,a=Math.ceil(e.height/o)),a>i.length)return{result:!1,message:"exceed channels.length, occupy="+a+",channelsSize="+i.length};for(var s=!0,l=void 0,u=-1,c=0,f=i.length;c<f;c++)if(i[c].queue[e.mode].some((function(t){return t.id===e.id})))return{result:!1,message:"exited, channelOrder="+c+",danmu_id="+e.id};if("scroll"===e.mode)for(var h=0,d=i.length-a;h<=d;h++){s=!0;for(var p=h;p<h+a;p++){if((l=i[p]).operating.scroll){s=!1;break}if(l.bookId.scroll&&l.bookId.scroll!==e.id){s=!1;break}l.operating.scroll=!0;var m=l.queue.scroll[0];if(m){var g=m.el.getBoundingClientRect();if("b2t"===t.direction){if(g.bottom>=t.containerPos.bottom){s=!1,l.operating.scroll=!1;break}}else if(g.right>=t.containerPos.right){s=!1,l.operating.scroll=!1;break}var v=void 0,y=m.moveV,b=void 0,_=e.moveV,w=void 0;if("b2t"===t.direction?(b=(v=g.bottom-t.containerTop)/y,w=t.containerHeight+e.random-v):(b=(v=g.right-t.containerLeft)/y,w=t.containerWidth+e.random-v),_>y){var k=w/(_-y);if(n.config.bOffset||(n.config.bOffset=0),b+n.config.bOffset>=k){var O=b*_-t.containerPos.width;O>0&&e.updateOffset(O+(5+Math.ceil(10*Math.random())))}}}l.operating.scroll=!1}if(s){u=h;break}}else if("top"===e.mode)for(var x=0,C=i.length-a;x<=C;x++){s=!0;for(var j=x;j<x+a;j++){if(j>Math.floor(i.length/2)){s=!1;break}if((l=i[j]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=x;break}}else if("bottom"===e.mode)for(var E=i.length-a;E>=0;E--){s=!0;for(var M=E;M<E+a;M++){if(M<=Math.floor(i.length/2)){s=!1;break}if((l=i[M]).operating[e.mode]){s=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){s=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){s=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(s){u=E;break}}if(-1!==u){for(var T=u,L=u+a;T<L;T++)(l=i[T]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&(delete l.bookId[e.mode],t.logger&&t.logger.info(T+"号轨道恢复正常使用")),l.operating[e.mode]=!1;if(e.prior)if(t.logger&&t.logger.info(e.id+"号优先弹幕运行完毕"),delete e.bookChannelId,n.player)n.bulletBtn.main.data.some((function(t){return t.id===e.id&&(delete t.bookChannelId,!0)}));return e.channel_id=[u,a],"b2t"===t.direction?(e.top=u*r,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerWidth*t.danmu.config.area.start)):(e.top=u*o,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start)),{result:e,message:"success"}}if(e.options.realTime){var z=0,P=-1,S=null;if(t.danmu.bulletBtn.main.queue.forEach((function(e,n){!e.prior&&!e.options.realTime&&e.el&&e.el.getBoundingClientRect().left>t.containerPos.right&&e.start>=z&&(z=e.start,P=n,S=e)})),S){S.remove(),t.removeBullet(S),t.danmu.bulletBtn.main.queue.splice(P,1),e.channel_id=S.channel_id;for(var D=S.channel_id[0],I=S.channel_id[0]+S.channel_id[1];D<I;D++)(l=i[D]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&delete l.bookId[e.mode],l.operating[e.mode]=!1;return e.top=S.top,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start),{result:e,message:"success"}}}if(e.prior)if(e.bookChannelId||t.danmu.live){if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,!0)}))}else{u=-1;for(var q=0,R=i.length-a;q<=R;q++){s=!0;for(var A=q;A<q+a;A++)if(i[A].bookId[e.mode]){s=!1;break}if(s){u=q;break}}if(-1!==u){for(var U=u;U<u+a;U++)i[U].bookId[e.mode]=e.id,t.logger&&t.logger.info(U+"号轨道被"+e.id+"号优先弹幕预定");if(n.player)n.bulletBtn.main.data.some((function(n){return n.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),n.start+=2e3,n.bookChannelId=[u,a],t.logger&&t.logger.info(e.id+"号优先弹幕预定了"+u+"~"+(u+a-1)+"号轨道"),!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(e){this.logger&&this.logger.info("removeBullet "+(e.options.txt||"[DOM Element]"));for(var t=this.channels,n=e.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=t[o]){i.operating[e.mode]=!0;var a=-1;i.queue[e.mode].some((function(t,n){return t.id===e.id&&(a=n,!0)})),a>-1&&i.queue[e.mode].splice(a,1),i.operating[e.mode]=!1}e.options.loop&&this.danmu.bulletBtn.main.playedData.push(e.options)}},{key:"resizeSync",value:function(){this.resize(!0)}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("resize");var t=this;function n(){var e=t.danmu,n=e.container,i=e.config,o=e.bulletBtn,r=void 0;if(t.updatePos(),t._cancelResizeTimer(),o.main.data&&o.main.data.forEach((function(e){e.bookChannelId&&(delete e.bookChannelId,t.logger&&t.logger.info("resize导致"+e.id+"号优先弹幕预定取消"))})),t.logger&&t.logger.info("resize导致所有轨道恢复正常使用"),t.width=t.containerWidth,t.height=t.containerHeight,i.area){var a=i.area,u=a.lines,c=a.start,f=a.end;(0,l.validAreaLineRule)(u)?r=u:c>=0&&f>=c&&("b2t"===t.direction?t.width=t.width*(f-c):t.height=t.height*(f-c))}t.container=n;var h=i.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(r)||(r="b2t"===t.direction?Math.floor(t.width/h):Math.floor(t.height/h));for(var d=[],p=0;p<r;p++)d[p]={id:p,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(t.channels&&t.channels.length<=d.length){for(var m=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){t.channels[e].queue[n].forEach((function(t){t.el&&d[e].queue[n].push(t)}))})),t.channels[e].queue.bottom.forEach((function(n){if(n.el&&(d[e+d.length-t.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===e)){var i=[].concat(n.channel_id);n.channel_id=[i[0]-t.channels.length+d.length,i[1]],n.top=n.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(n.top+=t.containerHeight*t.danmu.config.area.start),n.topInit()}}))},g=0;g<t.channels.length;g++)m(g);for(var v=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},y=0;y<d.length;y++)v(y);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}else if(t.channels&&t.channels.length>d.length){for(var b=function(e){d[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&e>Math.floor(d.length/2));else if("bottom"===n&&e<=Math.floor(d.length/2));else{var i="bottom"===n?e-d.length+t.channels.length:e;t.channels[i].queue[n].forEach((function(o,r){if(o.el&&(d[e].queue[n].push(o),"bottom"===n&&o.channel_id[0]+o.channel_id[1]-1===i)){var a=[].concat(o.channel_id);o.channel_id=[a[0]-t.channels.length+d.length,a[1]],o.top=o.channel_id[0]*h,t.danmu.config.area&&t.danmu.config.area.start&&(o.top+=t.containerHeight*t.danmu.config.area.start),o.topInit()}t.channels[i].queue[n].splice(r,1)}))}}))},_=0;_<d.length;_++)b(_);for(var w=function(e){["scroll","top","bottom"].forEach((function(t){d[e].queue[t].forEach((function(e){e.resized=!1}))}))},k=0;k<d.length;k++)w(k);t.channels=d,"b2t"===t.direction?t.channelWidth=h:t.channelHeight=h}t.resizing=!1}t.resizing||(t.resizing=!0,e?n():(this._cancelResizeTimer(),this.resizeId=requestAnimationFrame(n)))}},{key:"_cancelResizeTimer",value:function(){this.resizeId&&(cancelAnimationFrame(this.resizeId),this.resizeId=null)}},{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("reset");var t=this,n=t.danmu,i=n.container,o=n.bulletBtn,r=n.config;function a(){var e=void 0,n=i.getBoundingClientRect();if(t.width=n.width,t.height=n.height,t.resetId&&(cancelAnimationFrame(t.resetId),t.resetId=null),r.area){var o=r.area,a=o.lines,u=o.start,c=o.end;(0,l.validAreaLineRule)(a)?e=a:u>=0&&c>=u&&("b2t"===t.direction?t.width=t.width*(c-u):t.height=t.height*(c-u))}var f=r.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12);(0,s.isNumber)(e)||(e="b2t"===t.direction?Math.floor(t.width/f):Math.floor(t.height/f));for(var h=[],d=0;d<e;d++)h[d]={id:d,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};t.channels=h,"b2t"===t.direction?t.channelWidth=f:t.channelHeight=f}t.container=i,o&&o.main&&o.main.queue.forEach((function(e){e.remove()})),t.channels&&t.channels.length>0&&["scroll","top","bottom"].forEach((function(e){for(var n=0;n<t.channels.length;n++)t.channels[n].queue[e].forEach((function(e){e.remove()}))})),o&&o.main&&o.main.data&&o.main.data.forEach((function(e){e.attached_=!1})),e?this.resetId=requestAnimationFrame(a):a()}}]),t}(a.default);t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validAreaLineRule=function(e){return"number"==typeof e&&e>=0&&Number.isInteger(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t={initDOM:function(){return document.createElement("div")},initSize:10},this.init(t)}return i(e,[{key:"init",value:function(e){this.idleList=[],this.usingList=[],this._id=0,this.options=e,this._expand(e.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var e=this.idleList.shift();return this.usingList.push(e),e}},{key:"unuse",value:function(e){var t=this.usingList.indexOf(e);t<0||(this.usingList.splice(t,1),e.innerHTML="",e.textcontent="",this.clearElementStyle(e),this.idleList.push(e))}},{key:"_expand",value:function(e){for(var t=0;t<e;t++)this.idleList.push(this.options.initDOM(this._id++))}},{key:"destroy",value:function(){for(var e=0;e<this.idleList.length;e++)this.idleList[e].innerHTML="",this.idleList[e].textcontent="",this.clearElementStyle(this.idleList[e]);for(var t=0;t<this.usingList.length;t++)this.usingList[t].innerHTML="",this.usingList[t].textcontent="",this.clearElementStyle(this.usingList[t]);for(var n in this)delete this[n]}},{key:"clearElementStyle",value:function(e){var t="undefined"!=typeof window?window.navigator.userAgent:null;t&&(t.indexOf("MSIE ")>-1||t.indexOf("Trident/")>-1?(0,o.styleUtil)(e,"transform","none"):e.setAttribute("style",""))}}]),e}();t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.destroyObserver=t.unObserver=t.addObserver=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(0);var r=new(function(){function e(){var t=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__handlers=[],window.ResizeObserver)try{this.observer=new window.ResizeObserver((0,o.throttle)((function(e){t.__trigger(e)}),100))}catch(e){}}return i(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var n=this.__handlers,i=-1,o=0;o<n.length;o++)n[o]&&e===n[o].target&&(i=o);i>-1?this.__handlers[i].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t=-1;this.__handlers.map((function(n,i){e===n.target&&(t=i)})),this.observer&&this.observer.unobserve(e),t>-1&&this.__handlers.splice(t,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,n=0;n<t.length;n++)if(t[n]&&e===t[n].target){t[n].handler&&t[n].handler.map((function(e){try{e()}catch(e){console.error(e)}}));break}}},{key:"__trigger",value:function(e){var t=this;e.map((function(e){t.__runHandler(e.target)}))}}]),e}());t.addObserver=function(e,t){r.addObserver(e,t)},t.unObserver=function(e,t){r.unObserver(e,t)},t.destroyObserver=function(e,t){r.destroyObserver(e,t)}},function(e,t,n){var i=n(35);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(37)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(36)(!1)).push([e.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,f=[],h=n(38);function d(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],t))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],t));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function m(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function g(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function v(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),y(t,e.attrs),m(e,t),t}function y(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,i,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var a=c++;n=u||(u=v(t)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",y(t,e.attrs),m(e,t),t}(t),i=x.bind(null,n,t),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),i=O.bind(null,n),o=function(){g(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}e&&d(p(e,t),t);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete r[s.id]}}}};var _,w=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function k(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function O(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function x(e,t,n){var i=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(i=h(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,i=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}])}));
//# sourceMappingURL=index.js.map
{
"name": "danmu.js",
"version": "1.0.7",
"version": "1.1.0",
"description": "HTML5 danmu (danmaku) plugin for any DOM element",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc