(()=>{return(e,t)=>{let n;const r=[];const o=e=>{return{element:e,reuse:false,text:e.textContent||""}};const d=(e,t)=>{if(n){n.stop()}n=Observer.childListSubtree(e,e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const n=e.parentElement;const o=r.find(e=>e.element===n);if(!o){return}o.text=e.textContent||"";o.reuse=true;t.added&&t.added(o);return}if(!(e instanceof HTMLElement)){return}const n=o(e);r.push(n);t.added&&t.added(n)});e.removedNodes.forEach(e=>{if(!(e instanceof HTMLElement)){return}const n=r.findIndex(t=>t.element===e);if(n!==-1){const[e]=r.splice(n,1);t.removed&&t.removed(e)}})})})};const i=async e=>{const t=await videoCondition();if(!t){return}Observer.videoChange(async()=>{const t=await SpinQuery.select(".bilibili-player-video-danmaku");if(!t){return}d(t,e)})};return{export:{forEachVideoDanmaku:i}}}})();