Comparing version 0.2.3 to 0.2.4
@@ -1,2 +0,2 @@ | ||
window.DanmuJs=function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(26),r=(i=o)&&i.__esModule?i:{default:i};var a={};a.domObj=new r.default,a.createDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=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(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach((function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},a.hasClass=function(t,e){return t.classList?Array.prototype.some.call(t.classList,(function(t){return t===e})):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},a.addClass=function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(e){e&&t.classList.add(e)})):a.hasClass(t,e)||(t.className+=" "+e)},a.removeClass=function(t,e){t.classList?e.split(/\s+/g).forEach((function(e){t.classList.remove(e)})):a.hasClass(t,e)&&e.split(/\s+/g).forEach((function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}))},a.toggleClass=function(t,e){e.split(/\s+/g).forEach((function(e){a.hasClass(t,e)?a.removeClass(t,e):a.addClass(t,e)}))},a.findDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},a.deepCopy=function(t,e){if("Object"===a.typeOf(e)&&"Object"===a.typeOf(t))return Object.keys(e).forEach((function(n){"Object"!==a.typeOf(e[n])||e[n]instanceof Node?"Array"===a.typeOf(e[n])?t[n]="Array"===a.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?a.deepCopy(t[n],e[n]):t[n]=e[n]})),t},a.typeOf=function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},a.copyDom=function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,(function(t){e.setAttribute(t.name,t.value)})),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},a.formatTime=function(t){var e=Math.floor(t);return 1e3*e+(t-e)},e.default=a,t.exports=e.default},function(t,e,n){"use strict";var i=n(18)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){"use strict";t.exports=function(t){return null!=t}},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(30),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(6)),r=s(n(25)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var n=this;if(this.config.comments.forEach((function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")})),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var i=this.config.containerStyle;Object.keys(i).forEach((function(t){n.container.style[t]=i[t]}))}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t.duration||(t.duration=15e3),t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.id=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.duration=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach((function(n){t===n.mode&&(n.duration=e)})),this.bulletBtn.main.queue.forEach((function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))})))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t);var e=this.bulletBtn.main.queue.filter((function(e){return t===e.mode||"color"===t&&e.color}));e.forEach((function(t){return t.remove()}))}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(7),h=n(24),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),v.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.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),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=g({},c),t.exports=e=function(t){return null==t?p(u):g(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(2),o=n(8),r=n(12),a=n(20),s=n(21);(t.exports=function(t,e){var n,o,c,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],i(t)?(n=s.call(t,"c"),o=s.call(t,"e"),c=s.call(t,"w")):(n=c=!0,o=!1),l={value:e,configurable:n,enumerable:o,writable:c},u?r(a(u),l):l}).gs=function(t,e,n){var c,u,l,h;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],i(e)?o(e)?i(n)?o(n)||(l=n,n=void 0):n=void 0:(l=e,e=n=void 0):e=void 0,i(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),h={get:e,set:n,configurable:c,enumerable:u},l?r(a(l),h):h}},function(t,e,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;t.exports=function(t){return!!i(t)&&!o.test(r.call(t))}},function(t,e,n){"use strict";var i=n(10);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!i(t)}},function(t,e,n){"use strict";var i=n(11);t.exports=function(t){if(!i(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(2),o={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!i(t)&&hasOwnProperty.call(o,typeof t)}},function(t,e,n){"use strict";t.exports=n(13)()?Object.assign:n(14)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(15),o=n(19),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(16)()?Object.keys:n(17)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create,a=function(t,e){var n;for(n in t)e[n]=t[n]};t.exports=function(t){var e=r(null);return o.call(arguments,(function(t){i(t)&&a(Object(t),e)})),e}},function(t,e,n){"use strict";t.exports=n(22)()?String.prototype.contains:n(23)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(27));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e={initDOM:function(){return document.createElement("div")},initSize:10},this.init(e)}return i(t,[{key:"init",value:function(t){this.idleList=[],this.usingList=[],this._id=0,this.options=t,this._expand(t.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var t=this.idleList.shift();return this.usingList.push(t),t}},{key:"unuse",value:function(t){var e=this.usingList.indexOf(t);e<0||(this.usingList.splice(e,1),t.innerHTML="",t.textcontent="",t.style="",this.idleList.push(t))}},{key:"_expand",value:function(t){for(var e=0;e<t;e++)this.idleList.push(this.options.initDOM(this._id++))}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(28)),r=s(n(29)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",(function(t){n.danmu.direction=t}))}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some((function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)}))}},{key:"init",value:function(t,e){e||(e=this),e.data.sort((function(t,e){return t.start-e.start})),e.retryTimer||(e.retryTimer=setInterval((function(){e.readData(),e.dataHandle()}),e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.resized||(t.startMove(e),t.resized=!0)}));for(var o=0;o<t.length;o++)t[o].queue[n].forEach((function(t){t.resized=!1}))}))}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.pauseMove(e)}))}))}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach((function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)}))}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter((function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o})),e.live&&(t.data=t.data.filter((function(t){return t.start||(t.start=n),t.start>n-3*o})))):c=t.data.splice(0,1),c.length>0&&c.forEach((function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):(i.detach(),n.noDiscard&&t.data.push(n))}))}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",(function(t){n.removeBullet(t.bullet)})),this.direction=e.direction,this.danmu.on("changeDirection",(function(t){n.direction=t})),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval((function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))}),50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout((function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach((function(t){t.bookChannelId&&delete t.bookChannelId}));var i=e.getBoundingClientRect();n.width=i.width,n.height=i.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&("b2t"===n.direction?n.width=n.width*(n.danmu.config.area.end-n.danmu.config.area.start):n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,r=void 0;r="b2t"===n.direction?Math.floor(n.width/o):Math.floor(n.height/o);for(var a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(i){n.channels[e].queue[i].forEach((function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))}))})),n.channels[e].queue.bottom.forEach((function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){var r=[].concat(i.channel_id);i.channel_id=[r[0]-n.channels.length+a.length,r[1]],i.top=i.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(i.top+=n.containerHeight*n.danmu.config.area.start),i.topInit()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}}))},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach((function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){var u=[].concat(s.channel_id);s.channel_id=[u[0]-n.channels.length+a.length,u[1]],s.top=s.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)}))}}))},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach((function(e){n.channels[t].queue[e].forEach((function(t){t.pauseMove(n.containerPos),t.remove()}))}))},m=a.length;m<n.channels.length;m++)p(m);for(var g=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},v=0;v<a.length;v++)g(v);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}}),10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some((function(e){return e.id===t.id})))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var g,v=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(v=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(v=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),g=y/w,e.config.bOffset||(e.config.bOffset=0),v<w&&b+e.config.bOffset>g){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(delete e.bookChannelId,!0)}));return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,!0)}))}else{c=-1;for(var j=0,P=n.length-r;j<=P;j++){a=!0;for(var T=j;T<j+r;T++)if(n[T].bookId[t.mode]){a=!1;break}if(a){c=j;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some((function(e,n){return e.id===t.id&&(a=n,!0)})),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"resetArea",value:function(){var t=this.danmu.container,e=this,n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(e.channels&&e.channels.length<=r.length){for(var s=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){e.channels[t].queue[n].forEach((function(i){i.el&&(r[t].queue[n].push(i),i.resized||(i.pauseMove(e.containerPos,!1),i.startMove(e.containerPos),i.resized=!0))}))})),e.channels[t].queue.bottom.forEach((function(n){if(n.el){if(r[t+r.length-e.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===t){var o=[].concat(n.channel_id);n.channel_id=[o[0]-e.channels.length+r.length,o[1]],n.top=n.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(n.top+=e.containerHeight*e.danmu.config.area.start),n.topInit()}n.resized||(n.pauseMove(e.containerPos,!1),n.startMove(e.containerPos),n.resized=!0)}}))},c=0;c<e.channels.length;c++)s(c);for(var u=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},l=0;l<r.length;l++)u(l);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}else if(e.channels&&e.channels.length>r.length){for(var h=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&t>Math.floor(r.length/2));else if("bottom"===n&&t<=Math.floor(r.length/2));else{var o="bottom"===n?t-r.length+e.channels.length:t;e.channels[o].queue[n].forEach((function(a,s){if(a.el){if(r[t].queue[n].push(a),"bottom"===n&&a.channel_id[0]+a.channel_id[1]-1===o){var c=[].concat(a.channel_id);a.channel_id=[c[0]-e.channels.length+r.length,c[1]],a.top=a.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(a.top+=e.containerHeight*e.danmu.config.area.start),a.topInit()}a.resized||(a.pauseMove(e.containerPos,!1),a.startMove(e.containerPos),a.resized=!0)}e.channels[o].queue[n].splice(s,1)}))}}))},f=0;f<r.length;f++)h(f);for(var d=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},p=0;p<r.length;p++)d(p);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach((function(t){t.pauseMove(e.containerPos),t.remove()}))})),setTimeout((function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}),200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach((function(t){t.pauseMove(i.containerPos),t.remove()}))}));var o=n.getBoundingClientRect();i.width=o.width,i.height=o.height,i.danmu.config.area&&i.danmu.config.area.start>=0&&i.danmu.config.area.end>=i.danmu.config.area.start&&("b2t"===i.direction?i.width=i.width*(i.danmu.config.area.end-i.danmu.config.area.start):i.height=i.height*(i.danmu.config.area.end-i.danmu.config.area.start)),i.container=n;var r=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.moveV=n.moveV,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",(function(t){i.direction=t}));var o=void 0;if(this.domObj=a.default.domObj,n.el&&1===n.el.nodeType)(o=this.domObj.use()).appendChild(a.default.copyDom(n.el));else if((o=this.domObj.use()).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach((function(t){o.style[t]=r[t]}))}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){if(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){var t=this.container.getBoundingClientRect();this.duration=(t.width+this.width)/this.moveV*1e3}}},{key:"detach",value:function(){this.container&&this.el&&(this.domObj.unuse(this.el),this.container.removeChild(this.el));var t=this;this.danmu.off("changeDirection",(function(e){t.direction=e})),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if("paused"!==this.status&&(this.status="paused",clearTimeout(n.removeTimer),this.el))if(this.el.style.willChange="auto","scroll"===this.mode){if(e){var i=((new Date).getTime()-n.moveTime)/1e3,o=i*this.moveV,r=0;r=n.moveMoreS-o>=0?"b2t"===this.direction?(n.moveMoreS-o)/n.moveContainerHeight*t.height:(n.moveMoreS-o)/n.moveContainerWidth*t.width:n.moveMoreS-o,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)":this.el.style.left=r+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.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(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start",this.el.style.willChange="transform","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))}),20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))}),20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(t.el.style.willChange="auto",this.danmu.off("changeDirection",(function(e){t.direction=e})),this.domObj.unuse(t.el),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(31);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(33)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(32)(!1)).push([t.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:#ffffff;-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}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"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(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,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(t){return document.querySelector(t)},c=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=s.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,l=0,h=[],f=n(34);function d(t,e){for(var n=0;n<t.length;n++){var i=t[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(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.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(t,e){var n=c(t.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=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),h.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=c(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),m(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=l++;n=u||(u=v(e)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),m(t,e),e}(e),i=M.bind(null,n,e),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=_.bind(null,n),o=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&d(p(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var w,x=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function k(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}function _(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function M(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=f(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}]); | ||
window.DanmuJs=function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(26),r=(i=o)&&i.__esModule?i:{default:i};var a={};a.domObj=new r.default,a.createDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=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(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach((function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},a.hasClass=function(t,e){return t.classList?Array.prototype.some.call(t.classList,(function(t){return t===e})):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},a.addClass=function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(e){e&&t.classList.add(e)})):a.hasClass(t,e)||(t.className+=" "+e)},a.removeClass=function(t,e){t.classList?e.split(/\s+/g).forEach((function(e){t.classList.remove(e)})):a.hasClass(t,e)&&e.split(/\s+/g).forEach((function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}))},a.toggleClass=function(t,e){e.split(/\s+/g).forEach((function(e){a.hasClass(t,e)?a.removeClass(t,e):a.addClass(t,e)}))},a.findDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},a.deepCopy=function(t,e){if("Object"===a.typeOf(e)&&"Object"===a.typeOf(t))return Object.keys(e).forEach((function(n){"Object"!==a.typeOf(e[n])||e[n]instanceof Node?"Array"===a.typeOf(e[n])?t[n]="Array"===a.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?a.deepCopy(t[n],e[n]):t[n]=e[n]})),t},a.typeOf=function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},a.copyDom=function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,(function(t){e.setAttribute(t.name,t.value)})),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},a.formatTime=function(t){var e=Math.floor(t);return 1e3*e+(t-e)},e.default=a,t.exports=e.default},function(t,e,n){"use strict";var i=n(18)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){"use strict";t.exports=function(t){return null!=t}},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(30),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(6)),r=s(n(25)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var n=this;if(this.config.comments.forEach((function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")})),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var i=this.config.containerStyle;Object.keys(i).forEach((function(t){n.container.style[t]=i[t]}))}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t.duration||(t.duration=15e3),t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,t.prior?this.bulletBtn.main.data.unshift(t):this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.id=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.duration=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach((function(n){t===n.mode&&(n.duration=e)})),this.bulletBtn.main.queue.forEach((function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))})))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t);var e=this.bulletBtn.main.queue.filter((function(e){return t===e.mode||"color"===t&&e.color}));e.forEach((function(t){return t.remove()}))}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(7),h=n(24),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),v.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.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),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=g({},c),t.exports=e=function(t){return null==t?p(u):g(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(2),o=n(8),r=n(12),a=n(20),s=n(21);(t.exports=function(t,e){var n,o,c,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],i(t)?(n=s.call(t,"c"),o=s.call(t,"e"),c=s.call(t,"w")):(n=c=!0,o=!1),l={value:e,configurable:n,enumerable:o,writable:c},u?r(a(u),l):l}).gs=function(t,e,n){var c,u,l,h;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],i(e)?o(e)?i(n)?o(n)||(l=n,n=void 0):n=void 0:(l=e,e=n=void 0):e=void 0,i(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),h={get:e,set:n,configurable:c,enumerable:u},l?r(a(l),h):h}},function(t,e,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;t.exports=function(t){return!!i(t)&&!o.test(r.call(t))}},function(t,e,n){"use strict";var i=n(10);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!i(t)}},function(t,e,n){"use strict";var i=n(11);t.exports=function(t){if(!i(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(2),o={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!i(t)&&hasOwnProperty.call(o,typeof t)}},function(t,e,n){"use strict";t.exports=n(13)()?Object.assign:n(14)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(15),o=n(19),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(16)()?Object.keys:n(17)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create,a=function(t,e){var n;for(n in t)e[n]=t[n]};t.exports=function(t){var e=r(null);return o.call(arguments,(function(t){i(t)&&a(Object(t),e)})),e}},function(t,e,n){"use strict";t.exports=n(22)()?String.prototype.contains:n(23)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(27));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e={initDOM:function(){return document.createElement("div")},initSize:10},this.init(e)}return i(t,[{key:"init",value:function(t){this.idleList=[],this.usingList=[],this._id=0,this.options=t,this._expand(t.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var t=this.idleList.shift();return this.usingList.push(t),t}},{key:"unuse",value:function(t){var e=this.usingList.indexOf(t);e<0||(this.usingList.splice(e,1),t.innerHTML="",t.textcontent="",t.style="",this.idleList.push(t))}},{key:"_expand",value:function(t){for(var e=0;e<t;e++)this.idleList.push(this.options.initDOM(this._id++))}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(28)),r=s(n(29)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",(function(t){n.danmu.direction=t}))}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some((function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)}))}},{key:"init",value:function(t,e){e||(e=this),e.data.sort((function(t,e){return t.start-e.start})),e.retryTimer||(e.retryTimer=setInterval((function(){e.readData(),e.dataHandle()}),e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.resized||(t.startMove(e),t.resized=!0)}));for(var o=0;o<t.length;o++)t[o].queue[n].forEach((function(t){t.resized=!1}))}))}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.pauseMove(e)}))}))}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach((function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)}))}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter((function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o})),e.live&&(t.data=t.data.filter((function(t){return t.start||(t.start=n),t.start>n-3*o})))):c=t.data.splice(0,1),c.length>0&&c.forEach((function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):(i.detach(),n.noDiscard&&(n.prior?t.data.unshift(n):t.data.push(n)))}))}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",(function(t){n.removeBullet(t.bullet)})),this.direction=e.direction,this.danmu.on("changeDirection",(function(t){n.direction=t})),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval((function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))}),50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout((function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach((function(t){t.bookChannelId&&delete t.bookChannelId}));var i=e.getBoundingClientRect();n.width=i.width,n.height=i.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&("b2t"===n.direction?n.width=n.width*(n.danmu.config.area.end-n.danmu.config.area.start):n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,r=void 0;r="b2t"===n.direction?Math.floor(n.width/o):Math.floor(n.height/o);for(var a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(i){n.channels[e].queue[i].forEach((function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))}))})),n.channels[e].queue.bottom.forEach((function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){var r=[].concat(i.channel_id);i.channel_id=[r[0]-n.channels.length+a.length,r[1]],i.top=i.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(i.top+=n.containerHeight*n.danmu.config.area.start),i.topInit()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}}))},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach((function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){var u=[].concat(s.channel_id);s.channel_id=[u[0]-n.channels.length+a.length,u[1]],s.top=s.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)}))}}))},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach((function(e){n.channels[t].queue[e].forEach((function(t){t.pauseMove(n.containerPos),t.remove()}))}))},m=a.length;m<n.channels.length;m++)p(m);for(var g=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},v=0;v<a.length;v++)g(v);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}}),10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some((function(e){return e.id===t.id})))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var g,v=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(v=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(v=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),g=y/w,e.config.bOffset||(e.config.bOffset=0),v<w&&b+e.config.bOffset>g){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)if(delete t.bookChannelId,e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(delete e.bookChannelId,!0)}));return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){if(e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,!0)}))}else{c=-1;for(var j=0,P=n.length-r;j<=P;j++){a=!0;for(var T=j;T<j+r;T++)if(n[T].bookId[t.mode]){a=!1;break}if(a){c=j;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;if(e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some((function(e,n){return e.id===t.id&&(a=n,!0)})),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"resetArea",value:function(){var t=this.danmu.container,e=this,n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(e.channels&&e.channels.length<=r.length){for(var s=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){e.channels[t].queue[n].forEach((function(i){i.el&&(r[t].queue[n].push(i),i.resized||(i.pauseMove(e.containerPos,!1),i.startMove(e.containerPos),i.resized=!0))}))})),e.channels[t].queue.bottom.forEach((function(n){if(n.el){if(r[t+r.length-e.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===t){var o=[].concat(n.channel_id);n.channel_id=[o[0]-e.channels.length+r.length,o[1]],n.top=n.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(n.top+=e.containerHeight*e.danmu.config.area.start),n.topInit()}n.resized||(n.pauseMove(e.containerPos,!1),n.startMove(e.containerPos),n.resized=!0)}}))},c=0;c<e.channels.length;c++)s(c);for(var u=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},l=0;l<r.length;l++)u(l);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}else if(e.channels&&e.channels.length>r.length){for(var h=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&t>Math.floor(r.length/2));else if("bottom"===n&&t<=Math.floor(r.length/2));else{var o="bottom"===n?t-r.length+e.channels.length:t;e.channels[o].queue[n].forEach((function(a,s){if(a.el){if(r[t].queue[n].push(a),"bottom"===n&&a.channel_id[0]+a.channel_id[1]-1===o){var c=[].concat(a.channel_id);a.channel_id=[c[0]-e.channels.length+r.length,c[1]],a.top=a.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(a.top+=e.containerHeight*e.danmu.config.area.start),a.topInit()}a.resized||(a.pauseMove(e.containerPos,!1),a.startMove(e.containerPos),a.resized=!0)}e.channels[o].queue[n].splice(s,1)}))}}))},f=0;f<r.length;f++)h(f);for(var d=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},p=0;p<r.length;p++)d(p);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach((function(t){t.pauseMove(e.containerPos),t.remove()}))})),setTimeout((function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}),200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach((function(t){t.pauseMove(i.containerPos),t.remove()}))}));var o=n.getBoundingClientRect();i.width=o.width,i.height=o.height,i.danmu.config.area&&i.danmu.config.area.start>=0&&i.danmu.config.area.end>=i.danmu.config.area.start&&("b2t"===i.direction?i.width=i.width*(i.danmu.config.area.end-i.danmu.config.area.start):i.height=i.height*(i.danmu.config.area.end-i.danmu.config.area.start)),i.container=n;var r=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.moveV=n.moveV,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",(function(t){i.direction=t}));var o=void 0;if(this.domObj=a.default.domObj,n.el&&1===n.el.nodeType)(o=this.domObj.use()).appendChild(a.default.copyDom(n.el));else if((o=this.domObj.use()).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach((function(t){o.style[t]=r[t]}))}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){if(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){var t=this.container.getBoundingClientRect();this.duration=(t.width+this.width)/this.moveV*1e3}}},{key:"detach",value:function(){this.container&&this.el&&(this.domObj.unuse(this.el),this.container.removeChild(this.el));var t=this;this.danmu.off("changeDirection",(function(e){t.direction=e})),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if("paused"!==this.status&&(this.status="paused",clearTimeout(n.removeTimer),this.el))if(this.el.style.willChange="auto","scroll"===this.mode){if(e){var i=((new Date).getTime()-n.moveTime)/1e3,o=i*this.moveV,r=0;r=n.moveMoreS-o>=0?"b2t"===this.direction?(n.moveMoreS-o)/n.moveContainerHeight*t.height:(n.moveMoreS-o)/n.moveContainerWidth*t.width:n.moveMoreS-o,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)":this.el.style.left=r+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.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(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start",this.el.style.willChange="transform","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))}),20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))}),20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(t.el.style.willChange="auto",this.danmu.off("changeDirection",(function(e){t.direction=e})),this.domObj.unuse(t.el),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(31);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(33)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(32)(!1)).push([t.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:#ffffff;-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}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"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(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,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(t){return document.querySelector(t)},c=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=s.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,l=0,h=[],f=n(34);function d(t,e){for(var n=0;n<t.length;n++){var i=t[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(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.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(t,e){var n=c(t.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=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),h.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=c(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),m(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=l++;n=u||(u=v(e)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),m(t,e),e}(e),i=M.bind(null,n,e),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=_.bind(null,n),o=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&d(p(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var w,x=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function k(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}function _(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function M(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=f(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}]); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(26),r=(i=o)&&i.__esModule?i:{default:i};var a={};a.domObj=new r.default,a.createDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=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(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach((function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},a.hasClass=function(t,e){return t.classList?Array.prototype.some.call(t.classList,(function(t){return t===e})):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},a.addClass=function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(e){e&&t.classList.add(e)})):a.hasClass(t,e)||(t.className+=" "+e)},a.removeClass=function(t,e){t.classList?e.split(/\s+/g).forEach((function(e){t.classList.remove(e)})):a.hasClass(t,e)&&e.split(/\s+/g).forEach((function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}))},a.toggleClass=function(t,e){e.split(/\s+/g).forEach((function(e){a.hasClass(t,e)?a.removeClass(t,e):a.addClass(t,e)}))},a.findDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},a.deepCopy=function(t,e){if("Object"===a.typeOf(e)&&"Object"===a.typeOf(t))return Object.keys(e).forEach((function(n){"Object"!==a.typeOf(e[n])||e[n]instanceof Node?"Array"===a.typeOf(e[n])?t[n]="Array"===a.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?a.deepCopy(t[n],e[n]):t[n]=e[n]})),t},a.typeOf=function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},a.copyDom=function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,(function(t){e.setAttribute(t.name,t.value)})),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},a.formatTime=function(t){var e=Math.floor(t);return 1e3*e+(t-e)},e.default=a,t.exports=e.default},function(t,e,n){"use strict";var i=n(18)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){"use strict";t.exports=function(t){return null!=t}},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(30),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(6)),r=s(n(25)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var n=this;if(this.config.comments.forEach((function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")})),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var i=this.config.containerStyle;Object.keys(i).forEach((function(t){n.container.style[t]=i[t]}))}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t.duration||(t.duration=15e3),t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.id=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.duration=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach((function(n){t===n.mode&&(n.duration=e)})),this.bulletBtn.main.queue.forEach((function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))})))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t);var e=this.bulletBtn.main.queue.filter((function(e){return t===e.mode||"color"===t&&e.color}));e.forEach((function(t){return t.remove()}))}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(7),h=n(24),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),v.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.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),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=g({},c),t.exports=e=function(t){return null==t?p(u):g(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(2),o=n(8),r=n(12),a=n(20),s=n(21);(t.exports=function(t,e){var n,o,c,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],i(t)?(n=s.call(t,"c"),o=s.call(t,"e"),c=s.call(t,"w")):(n=c=!0,o=!1),l={value:e,configurable:n,enumerable:o,writable:c},u?r(a(u),l):l}).gs=function(t,e,n){var c,u,l,h;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],i(e)?o(e)?i(n)?o(n)||(l=n,n=void 0):n=void 0:(l=e,e=n=void 0):e=void 0,i(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),h={get:e,set:n,configurable:c,enumerable:u},l?r(a(l),h):h}},function(t,e,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;t.exports=function(t){return!!i(t)&&!o.test(r.call(t))}},function(t,e,n){"use strict";var i=n(10);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!i(t)}},function(t,e,n){"use strict";var i=n(11);t.exports=function(t){if(!i(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(2),o={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!i(t)&&hasOwnProperty.call(o,typeof t)}},function(t,e,n){"use strict";t.exports=n(13)()?Object.assign:n(14)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(15),o=n(19),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(16)()?Object.keys:n(17)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create,a=function(t,e){var n;for(n in t)e[n]=t[n]};t.exports=function(t){var e=r(null);return o.call(arguments,(function(t){i(t)&&a(Object(t),e)})),e}},function(t,e,n){"use strict";t.exports=n(22)()?String.prototype.contains:n(23)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(27));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e={initDOM:function(){return document.createElement("div")},initSize:10},this.init(e)}return i(t,[{key:"init",value:function(t){this.idleList=[],this.usingList=[],this._id=0,this.options=t,this._expand(t.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var t=this.idleList.shift();return this.usingList.push(t),t}},{key:"unuse",value:function(t){var e=this.usingList.indexOf(t);e<0||(this.usingList.splice(e,1),t.innerHTML="",t.textcontent="",t.style="",this.idleList.push(t))}},{key:"_expand",value:function(t){for(var e=0;e<t;e++)this.idleList.push(this.options.initDOM(this._id++))}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(28)),r=s(n(29)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",(function(t){n.danmu.direction=t}))}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some((function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)}))}},{key:"init",value:function(t,e){e||(e=this),e.data.sort((function(t,e){return t.start-e.start})),e.retryTimer||(e.retryTimer=setInterval((function(){e.readData(),e.dataHandle()}),e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.resized||(t.startMove(e),t.resized=!0)}));for(var o=0;o<t.length;o++)t[o].queue[n].forEach((function(t){t.resized=!1}))}))}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.pauseMove(e)}))}))}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach((function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)}))}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter((function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o})),e.live&&(t.data=t.data.filter((function(t){return t.start||(t.start=n),t.start>n-3*o})))):c=t.data.splice(0,1),c.length>0&&c.forEach((function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):(i.detach(),n.noDiscard&&t.data.push(n))}))}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",(function(t){n.removeBullet(t.bullet)})),this.direction=e.direction,this.danmu.on("changeDirection",(function(t){n.direction=t})),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval((function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))}),50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout((function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach((function(t){t.bookChannelId&&delete t.bookChannelId}));var i=e.getBoundingClientRect();n.width=i.width,n.height=i.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&("b2t"===n.direction?n.width=n.width*(n.danmu.config.area.end-n.danmu.config.area.start):n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,r=void 0;r="b2t"===n.direction?Math.floor(n.width/o):Math.floor(n.height/o);for(var a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(i){n.channels[e].queue[i].forEach((function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))}))})),n.channels[e].queue.bottom.forEach((function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){var r=[].concat(i.channel_id);i.channel_id=[r[0]-n.channels.length+a.length,r[1]],i.top=i.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(i.top+=n.containerHeight*n.danmu.config.area.start),i.topInit()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}}))},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach((function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){var u=[].concat(s.channel_id);s.channel_id=[u[0]-n.channels.length+a.length,u[1]],s.top=s.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)}))}}))},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach((function(e){n.channels[t].queue[e].forEach((function(t){t.pauseMove(n.containerPos),t.remove()}))}))},m=a.length;m<n.channels.length;m++)p(m);for(var g=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},v=0;v<a.length;v++)g(v);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}}),10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some((function(e){return e.id===t.id})))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var g,v=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(v=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(v=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),g=y/w,e.config.bOffset||(e.config.bOffset=0),v<w&&b+e.config.bOffset>g){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,j=c+r;C<j;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(delete e.bookChannelId,!0)}));return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,!0)}))}else{c=-1;for(var E=0,P=n.length-r;E<=P;E++){a=!0;for(var T=E;T<E+r;T++)if(n[T].bookId[t.mode]){a=!1;break}if(a){c=E;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some((function(e,n){return e.id===t.id&&(a=n,!0)})),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"resetArea",value:function(){var t=this.danmu.container,e=this,n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(e.channels&&e.channels.length<=r.length){for(var s=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){e.channels[t].queue[n].forEach((function(i){i.el&&(r[t].queue[n].push(i),i.resized||(i.pauseMove(e.containerPos,!1),i.startMove(e.containerPos),i.resized=!0))}))})),e.channels[t].queue.bottom.forEach((function(n){if(n.el){if(r[t+r.length-e.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===t){var o=[].concat(n.channel_id);n.channel_id=[o[0]-e.channels.length+r.length,o[1]],n.top=n.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(n.top+=e.containerHeight*e.danmu.config.area.start),n.topInit()}n.resized||(n.pauseMove(e.containerPos,!1),n.startMove(e.containerPos),n.resized=!0)}}))},c=0;c<e.channels.length;c++)s(c);for(var u=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},l=0;l<r.length;l++)u(l);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}else if(e.channels&&e.channels.length>r.length){for(var h=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&t>Math.floor(r.length/2));else if("bottom"===n&&t<=Math.floor(r.length/2));else{var o="bottom"===n?t-r.length+e.channels.length:t;e.channels[o].queue[n].forEach((function(a,s){if(a.el){if(r[t].queue[n].push(a),"bottom"===n&&a.channel_id[0]+a.channel_id[1]-1===o){var c=[].concat(a.channel_id);a.channel_id=[c[0]-e.channels.length+r.length,c[1]],a.top=a.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(a.top+=e.containerHeight*e.danmu.config.area.start),a.topInit()}a.resized||(a.pauseMove(e.containerPos,!1),a.startMove(e.containerPos),a.resized=!0)}e.channels[o].queue[n].splice(s,1)}))}}))},f=0;f<r.length;f++)h(f);for(var d=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},p=0;p<r.length;p++)d(p);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach((function(t){t.pauseMove(e.containerPos),t.remove()}))})),setTimeout((function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}),200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach((function(t){t.pauseMove(i.containerPos),t.remove()}))}));var o=n.getBoundingClientRect();i.width=o.width,i.height=o.height,i.danmu.config.area&&i.danmu.config.area.start>=0&&i.danmu.config.area.end>=i.danmu.config.area.start&&("b2t"===i.direction?i.width=i.width*(i.danmu.config.area.end-i.danmu.config.area.start):i.height=i.height*(i.danmu.config.area.end-i.danmu.config.area.start)),i.container=n;var r=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.moveV=n.moveV,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",(function(t){i.direction=t}));var o=void 0;if(this.domObj=a.default.domObj,n.el&&1===n.el.nodeType)(o=this.domObj.use()).appendChild(a.default.copyDom(n.el));else if((o=this.domObj.use()).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach((function(t){o.style[t]=r[t]}))}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){if(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){var t=this.container.getBoundingClientRect();this.duration=(t.width+this.width)/this.moveV*1e3}}},{key:"detach",value:function(){this.container&&this.el&&(this.domObj.unuse(this.el),this.container.removeChild(this.el));var t=this;this.danmu.off("changeDirection",(function(e){t.direction=e})),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if("paused"!==this.status&&(this.status="paused",clearTimeout(n.removeTimer),this.el))if(this.el.style.willChange="auto","scroll"===this.mode){if(e){var i=((new Date).getTime()-n.moveTime)/1e3,o=i*this.moveV,r=0;r=n.moveMoreS-o>=0?"b2t"===this.direction?(n.moveMoreS-o)/n.moveContainerHeight*t.height:(n.moveMoreS-o)/n.moveContainerWidth*t.width:n.moveMoreS-o,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)":this.el.style.left=r+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.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(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start",this.el.style.willChange="transform","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))}),20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))}),20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(t.el.style.willChange="auto",this.danmu.off("changeDirection",(function(e){t.direction=e})),this.domObj.unuse(t.el),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(31);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(33)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(32)(!1)).push([t.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:#ffffff;-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}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"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(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,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(t){return document.querySelector(t)},c=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=s.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,l=0,h=[],f=n(34);function d(t,e){for(var n=0;n<t.length;n++){var i=t[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(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.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(t,e){var n=c(t.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=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),h.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=c(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),m(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=l++;n=u||(u=v(e)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),m(t,e),e}(e),i=M.bind(null,n,e),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=_.bind(null,n),o=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&d(p(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var w,x=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function k(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}function _(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function M(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=f(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(26),r=(i=o)&&i.__esModule?i:{default:i};var a={};a.domObj=new r.default,a.createDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=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(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach((function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o},a.hasClass=function(t,e){return t.classList?Array.prototype.some.call(t.classList,(function(t){return t===e})):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},a.addClass=function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(e){e&&t.classList.add(e)})):a.hasClass(t,e)||(t.className+=" "+e)},a.removeClass=function(t,e){t.classList?e.split(/\s+/g).forEach((function(e){t.classList.remove(e)})):a.hasClass(t,e)&&e.split(/\s+/g).forEach((function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}))},a.toggleClass=function(t,e){e.split(/\s+/g).forEach((function(e){a.hasClass(t,e)?a.removeClass(t,e):a.addClass(t,e)}))},a.findDom=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},a.deepCopy=function(t,e){if("Object"===a.typeOf(e)&&"Object"===a.typeOf(t))return Object.keys(e).forEach((function(n){"Object"!==a.typeOf(e[n])||e[n]instanceof Node?"Array"===a.typeOf(e[n])?t[n]="Array"===a.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?a.deepCopy(t[n],e[n]):t[n]=e[n]})),t},a.typeOf=function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},a.copyDom=function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,(function(t){e.setAttribute(t.name,t.value)})),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},a.formatTime=function(t){var e=Math.floor(t);return 1e3*e+(t-e)},e.default=a,t.exports=e.default},function(t,e,n){"use strict";var i=n(18)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){"use strict";t.exports=function(t){return null!=t}},function(t,e,n){t.exports=n(4)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(5),r=(i=o)&&i.__esModule?i:{default:i};n(30),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(6)),r=s(n(25)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var n=this;if(this.config.comments.forEach((function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")})),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var i=this.config.containerStyle;Object.keys(i).forEach((function(t){n.container.style[t]=i[t]}))}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t.duration||(t.duration=15e3),t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,t.prior?this.bulletBtn.main.data.unshift(t):this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.id=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some((function(n){return n.id===t&&(n.duration=e,!0)})),this.bulletBtn.main.queue.some((function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)})))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach((function(n){t===n.mode&&(n.duration=e)})),this.bulletBtn.main.queue.forEach((function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))})))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t);var e=this.bulletBtn.main.queue.filter((function(e){return t===e.mode||"color"===t&&e.color}));e.forEach((function(t){return t.remove()}))}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(7),h=n(24),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),v.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!v.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(v.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.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),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=g({},c),t.exports=e=function(t){return null==t?p(u):g(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(2),o=n(8),r=n(12),a=n(20),s=n(21);(t.exports=function(t,e){var n,o,c,u,l;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],i(t)?(n=s.call(t,"c"),o=s.call(t,"e"),c=s.call(t,"w")):(n=c=!0,o=!1),l={value:e,configurable:n,enumerable:o,writable:c},u?r(a(u),l):l}).gs=function(t,e,n){var c,u,l,h;return"string"!=typeof t?(l=n,n=e,e=t,t=null):l=arguments[3],i(e)?o(e)?i(n)?o(n)||(l=n,n=void 0):n=void 0:(l=e,e=n=void 0):e=void 0,i(t)?(c=s.call(t,"c"),u=s.call(t,"e")):(c=!0,u=!1),h={get:e,set:n,configurable:c,enumerable:u},l?r(a(l),h):h}},function(t,e,n){"use strict";var i=n(9),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;t.exports=function(t){return!!i(t)&&!o.test(r.call(t))}},function(t,e,n){"use strict";var i=n(10);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1}catch(t){return!1}return!i(t)}},function(t,e,n){"use strict";var i=n(11);t.exports=function(t){if(!i(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(2),o={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!i(t)&&hasOwnProperty.call(o,typeof t)}},function(t,e,n){"use strict";t.exports=n(13)()?Object.assign:n(14)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(15),o=n(19),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(16)()?Object.keys:n(17)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create,a=function(t,e){var n;for(n in t)e[n]=t[n]};t.exports=function(t){var e=r(null);return o.call(arguments,(function(t){i(t)&&a(Object(t),e)})),e}},function(t,e,n){"use strict";t.exports=n(22)()?String.prototype.contains:n(23)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(27));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e={initDOM:function(){return document.createElement("div")},initSize:10},this.init(e)}return i(t,[{key:"init",value:function(t){this.idleList=[],this.usingList=[],this._id=0,this.options=t,this._expand(t.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var t=this.idleList.shift();return this.usingList.push(t),t}},{key:"unuse",value:function(t){var e=this.usingList.indexOf(t);e<0||(this.usingList.splice(e,1),t.innerHTML="",t.textcontent="",t.style="",this.idleList.push(t))}},{key:"_expand",value:function(t){for(var e=0;e<t;e++)this.idleList.push(this.options.initDOM(this._id++))}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(28)),r=s(n(29)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",(function(t){n.danmu.direction=t}))}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some((function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)}))}},{key:"init",value:function(t,e){e||(e=this),e.data.sort((function(t,e){return t.start-e.start})),e.retryTimer||(e.retryTimer=setInterval((function(){e.readData(),e.dataHandle()}),e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.resized||(t.startMove(e),t.resized=!0)}));for(var o=0;o<t.length;o++)t[o].queue[n].forEach((function(t){t.resized=!1}))}))}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach((function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach((function(t){t.pauseMove(e)}))}))}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach((function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)}))}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter((function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o})),e.live&&(t.data=t.data.filter((function(t){return t.start||(t.start=n),t.start>n-3*o})))):c=t.data.splice(0,1),c.length>0&&c.forEach((function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):(i.detach(),n.noDiscard&&(n.prior?t.data.unshift(n):t.data.push(n)))}))}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",(function(t){n.removeBullet(t.bullet)})),this.direction=e.direction,this.danmu.on("changeDirection",(function(t){n.direction=t})),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval((function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))}),50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout((function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach((function(t){t.bookChannelId&&delete t.bookChannelId}));var i=e.getBoundingClientRect();n.width=i.width,n.height=i.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&("b2t"===n.direction?n.width=n.width*(n.danmu.config.area.end-n.danmu.config.area.start):n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,r=void 0;r="b2t"===n.direction?Math.floor(n.width/o):Math.floor(n.height/o);for(var a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(i){n.channels[e].queue[i].forEach((function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))}))})),n.channels[e].queue.bottom.forEach((function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){var r=[].concat(i.channel_id);i.channel_id=[r[0]-n.channels.length+a.length,r[1]],i.top=i.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(i.top+=n.containerHeight*n.danmu.config.area.start),i.topInit()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}}))},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach((function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){var u=[].concat(s.channel_id);s.channel_id=[u[0]-n.channels.length+a.length,u[1]],s.top=s.channel_id[0]*o,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)}))}}))},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach((function(e){n.channels[t].queue[e].forEach((function(t){t.pauseMove(n.containerPos),t.remove()}))}))},m=a.length;m<n.channels.length;m++)p(m);for(var g=function(t){["scroll","top","bottom"].forEach((function(e){a[t].queue[e].forEach((function(t){t.resized=!1}))}))},v=0;v<a.length;v++)g(v);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}}),10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some((function(e){return e.id===t.id})))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var g,v=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(v=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(v=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),g=y/w,e.config.bOffset||(e.config.bOffset=0),v<w&&b+e.config.bOffset>g){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,j=c+r;C<j;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)if(delete t.bookChannelId,e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(delete e.bookChannelId,!0)}));return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){if(e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,!0)}))}else{c=-1;for(var E=0,P=n.length-r;E<=P;E++){a=!0;for(var T=E;T<E+r;T++)if(n[T].bookId[t.mode]){a=!1;break}if(a){c=E;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;if(e.player)e.bulletBtn.main.data.some((function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some((function(e,n){return e.id===t.id&&(a=n,!0)})),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"resetArea",value:function(){var t=this.danmu.container,e=this,n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(e.channels&&e.channels.length<=r.length){for(var s=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach((function(n){e.channels[t].queue[n].forEach((function(i){i.el&&(r[t].queue[n].push(i),i.resized||(i.pauseMove(e.containerPos,!1),i.startMove(e.containerPos),i.resized=!0))}))})),e.channels[t].queue.bottom.forEach((function(n){if(n.el){if(r[t+r.length-e.channels.length].queue.bottom.push(n),n.channel_id[0]+n.channel_id[1]-1===t){var o=[].concat(n.channel_id);n.channel_id=[o[0]-e.channels.length+r.length,o[1]],n.top=n.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(n.top+=e.containerHeight*e.danmu.config.area.start),n.topInit()}n.resized||(n.pauseMove(e.containerPos,!1),n.startMove(e.containerPos),n.resized=!0)}}))},c=0;c<e.channels.length;c++)s(c);for(var u=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},l=0;l<r.length;l++)u(l);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}else if(e.channels&&e.channels.length>r.length){for(var h=function(t){r[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach((function(n){if("top"===n&&t>Math.floor(r.length/2));else if("bottom"===n&&t<=Math.floor(r.length/2));else{var o="bottom"===n?t-r.length+e.channels.length:t;e.channels[o].queue[n].forEach((function(a,s){if(a.el){if(r[t].queue[n].push(a),"bottom"===n&&a.channel_id[0]+a.channel_id[1]-1===o){var c=[].concat(a.channel_id);a.channel_id=[c[0]-e.channels.length+r.length,c[1]],a.top=a.channel_id[0]*i,e.danmu.config.area&&e.danmu.config.area.start&&(a.top+=e.containerHeight*e.danmu.config.area.start),a.topInit()}a.resized||(a.pauseMove(e.containerPos,!1),a.startMove(e.containerPos),a.resized=!0)}e.channels[o].queue[n].splice(s,1)}))}}))},f=0;f<r.length;f++)h(f);for(var d=function(t){["scroll","top","bottom"].forEach((function(e){r[t].queue[e].forEach((function(t){t.resized=!1}))}))},p=0;p<r.length;p++)d(p);e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach((function(t){t.pauseMove(e.containerPos),t.remove()}))})),setTimeout((function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i}),200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach((function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach((function(t){t.pauseMove(i.containerPos),t.remove()}))}));var o=n.getBoundingClientRect();i.width=o.width,i.height=o.height,i.danmu.config.area&&i.danmu.config.area.start>=0&&i.danmu.config.area.end>=i.danmu.config.area.start&&("b2t"===i.direction?i.width=i.width*(i.danmu.config.area.end-i.danmu.config.area.start):i.height=i.height*(i.danmu.config.area.end-i.danmu.config.area.start)),i.container=n;var r=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.moveV=n.moveV,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",(function(t){i.direction=t}));var o=void 0;if(this.domObj=a.default.domObj,n.el&&1===n.el.nodeType)(o=this.domObj.use()).appendChild(a.default.copyDom(n.el));else if((o=this.domObj.use()).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach((function(t){o.style[t]=r[t]}))}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){if(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){var t=this.container.getBoundingClientRect();this.duration=(t.width+this.width)/this.moveV*1e3}}},{key:"detach",value:function(){this.container&&this.el&&(this.domObj.unuse(this.el),this.container.removeChild(this.el));var t=this;this.danmu.off("changeDirection",(function(e){t.direction=e})),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this;if("paused"!==this.status&&(this.status="paused",clearTimeout(n.removeTimer),this.el))if(this.el.style.willChange="auto","scroll"===this.mode){if(e){var i=((new Date).getTime()-n.moveTime)/1e3,o=i*this.moveV,r=0;r=n.moveMoreS-o>=0?"b2t"===this.direction?(n.moveMoreS-o)/n.moveContainerHeight*t.height:(n.moveMoreS-o)/n.moveContainerWidth*t.width:n.moveMoreS-o,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)":this.el.style.left=r+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.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(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start",this.el.style.willChange="transform","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))}),20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout((function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))}),20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(t.el.style.willChange="auto",this.danmu.off("changeDirection",(function(e){t.direction=e})),this.domObj.unuse(t.el),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(31);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(33)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(32)(!1)).push([t.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:#ffffff;-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}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"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(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,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(t){return document.querySelector(t)},c=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=s.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,l=0,h=[],f=n(34);function d(t,e){for(var n=0;n<t.length;n++){var i=t[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(y(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(y(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function p(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.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(t,e){var n=c(t.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=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),h.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=c(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),m(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=l++;n=u||(u=v(e)),i=k.bind(null,n,a,!1),o=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),m(t,e),e}(e),i=M.bind(null,n,e),o=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=_.bind(null,n),o=function(){g(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&d(p(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var w,x=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function k(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=x(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}function _(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function M(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=f(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(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": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "HTML5 danmu (danmaku) plugin for any DOM element", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -409,11 +409,13 @@ /** | ||
delete bullet['bookChannelId'] | ||
let dataList = danmu.bulletBtn.main.data | ||
dataList.some(function (item) { | ||
if (item.id === bullet.id) { | ||
delete item['bookChannelId'] | ||
return true | ||
} else { | ||
return false | ||
} | ||
}) | ||
if(danmu.player) { | ||
let dataList = danmu.bulletBtn.main.data | ||
dataList.some(function (item) { | ||
if (item.id === bullet.id) { | ||
delete item['bookChannelId'] | ||
return true | ||
} else { | ||
return false | ||
} | ||
}) | ||
} | ||
} | ||
@@ -460,2 +462,21 @@ bullet.channel_id = [pos, occupy] | ||
let nextAddTime = 2 | ||
if(danmu.player) { | ||
let dataList = danmu.bulletBtn.main.data | ||
dataList.some(function (item) { | ||
if (item.id === bullet.id) { | ||
// console.log(bullet.id + '号优先弹幕将于' + nextAddTime + '秒后再次请求注册') | ||
item.start += nextAddTime * 1000 | ||
item.bookChannelId = [pos, occupy] | ||
// console.log(bullet.id + '号优先弹幕预定了' + pos + '~' + pos + occupy - 1 + '号轨道') | ||
// console.log(`${bullet.id}号优先弹幕预定了${pos}~${pos + occupy - 1}号轨道`) | ||
return true | ||
} else { | ||
return false | ||
} | ||
}) | ||
} | ||
} | ||
} else { | ||
let nextAddTime = 2 | ||
if(danmu.player) { | ||
let dataList = danmu.bulletBtn.main.data | ||
@@ -466,5 +487,2 @@ dataList.some(function (item) { | ||
item.start += nextAddTime * 1000 | ||
item.bookChannelId = [pos, occupy] | ||
// console.log(bullet.id + '号优先弹幕预定了' + pos + '~' + pos + occupy - 1 + '号轨道') | ||
// console.log(`${bullet.id}号优先弹幕预定了${pos}~${pos + occupy - 1}号轨道`) | ||
return true | ||
@@ -476,14 +494,2 @@ } else { | ||
} | ||
} else { | ||
let nextAddTime = 2 | ||
let dataList = danmu.bulletBtn.main.data | ||
dataList.some(function (item) { | ||
if (item.id === bullet.id) { | ||
// console.log(bullet.id + '号优先弹幕将于' + nextAddTime + '秒后再次请求注册') | ||
item.start += nextAddTime * 1000 | ||
return true | ||
} else { | ||
return false | ||
} | ||
}) | ||
} | ||
@@ -490,0 +496,0 @@ } |
@@ -68,3 +68,7 @@ import EventEmitter from 'event-emitter' | ||
comment.duration = comment.duration < 5000 ? 5000 : comment.duration | ||
this.bulletBtn.main.data.push(comment) | ||
if(comment.prior) { | ||
this.bulletBtn.main.data.unshift(comment) | ||
} else { | ||
this.bulletBtn.main.data.push(comment) | ||
} | ||
} | ||
@@ -71,0 +75,0 @@ } |
@@ -159,3 +159,7 @@ import Channel from './channel' | ||
if(item.noDiscard) { | ||
self.data.push(item) | ||
if(item.prior) { | ||
self.data.unshift(item) | ||
} else { | ||
self.data.push(item) | ||
} | ||
} | ||
@@ -162,0 +166,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
410355
1954