## Introduction
-Nobody likes to copy & paste the same boilerplate code over and over, everytime they just want to test around with StreamElements custom widgets.
+Nobody likes to copy & paste the same boilerplate code over and over everytime they just want to test around with StreamElements custom widgets.
Or maybe you come from a more artistic background and feel overwhelmed by the required coding knowledge to start building widgets.
@@ -20,7 +20,7 @@ You can include this in your HTML-markup just like any other library.
```
-Make sure not to forget the `defer` attribute on the script-tag or the script may not work properly.
+Make sure to set the `defer` attribute on the script-tag or the script may not work properly.
If you find any bugs or have general improvements, feel free to contribute or report those.
@@ -70,19 +70,12 @@ For non-development support questions you can use the official [StreamElements D
However, none of these will offer support via personal/direct messages.
-Not for support questions, but you could also follow me on my socials ([Twitter](https://twitter.com/reboot0), [Twitch](https://twitch.tv/reboot0)) to stay up-to-date.
+If you found a more critical or urgent bug you can also add me on Discord under @reboot0
## Building
In most cases, you just want to include the already compiled file without needing to build anything.
If you modified or added some code and want to recompile the output, you can use the following npm scripts:
-- `npm run "generate docs"` - Generates & updates the documentation pages (locally).
-- `npm run "build"` - Recompiles and minifies the modules to the final `dist/se-tools.min.js` JavaScript file.
-
-## 3rd-Party Libraries
-We use a modified version of the [clean-jsdoc-theme](https://github.com/ankitskvmdam/clean-jsdoc-theme) to generate and style the documentation.
-
-It's located under ``jsdoc/template`` and is not installed as npm package. (But 'jsdoc' is)
-
-The template is a good starting point, but far from perfect. I'll update that as well over time.
\ No newline at end of file
+- `yarn jsdoc` or `npm run "jsdoc"` - Generates & updates the documentation pages (locally).
+- `yarn build` or `npm run "build"` - Recompiles and minifies the modules to the final `dist/se-tools.min.js` JavaScript file.
diff --git a/dist/se-tools.min.js b/dist/se-tools.min.js
index 02c645a..6f5b609 100644
--- a/dist/se-tools.min.js
+++ b/dist/se-tools.min.js
@@ -1 +1 @@
-(()=>{"use strict";function e(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||t(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:null;return null===t?document.querySelector(e):t.querySelector(e)}},{key:"findAll",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null===t?document.querySelectorAll(e):t.querySelectorAll(e)}},{key:"findAllOrNull",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=n.findAll(e,t);return r.length>0?r:null}},{key:"onFirst",value:function(e,t){var r=n.isHTMLElement(e)?e:n.find(e);null!==r&&t(r)}},{key:"onEach",value:function(e,r){var i="string"==typeof e?n.findAll(e):e;if(null!==i){var o,a=function(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=t(e))){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}}(i);try{for(a.s();!(o=a.n()).done;)r(o.value)}catch(e){a.e(e)}finally{a.f()}}}},{key:"isHTMLElement",value:function(e){return 1===(null==e?void 0:e.nodeType)}},{key:"isAudioElement",value:function(e){var t;return n.isHTMLElement(e)&&"audio"===(null===(t=e.nodeName)||void 0===t?void 0:t.toLowerCase())}},{key:"isImgElement",value:function(e){var t;return n.isHTMLElement(e)&&"img"===(null===(t=e.nodeName)||void 0===t?void 0:t.toLowerCase())}},{key:"isPictureElement",value:function(e){var t;return n.isHTMLElement(e)&&"picture"===(null===(t=e.nodeName)||void 0===t?void 0:t.toLowerCase())}},{key:"isImageElement",value:function(e){return n.isImgElement(e)||n.isPictureElement(e)}},{key:"isVideoElement",value:function(e){var t;return n.isHTMLElement(e)&&"video"===(null===(t=e.nodeName)||void 0===t?void 0:t.toLowerCase())}},{key:"isMediaElement",value:function(e){return n.isAudioElement(e)||n.isImageElement(e)||n.isVideoElement(e)}},{key:"updateSrc",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=n.isHTMLElement(e)?e:n.find(e);n.isImgElement(i)?n.updateImgSrc(i,t):n.isPictureElement(i)?n.updatePictureSrc(i,t,r):n.isAudioElement(i)?n.updateAudioSrc(i,t,r):n.isVideoElement(i)&&n.updateVideoSrc(i,t,r)}},{key:"updateImgSrc",value:function(e,t){e.src!==t&&(e.src=t)}},{key:"updatePictureSrc",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=n.find(""===r?"source":"source[media='(".concat(r,")']"),e);null!==i&&i.srcset!==t&&(i.srcset=t)}},{key:"updateAudioSrc",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Utils.isset(r,!1)||r.startsWith("audio/")){var i=n.find(""===r?"source":"source[type='".concat(r,"']"),e);null!==i&&i.src!==t&&(i.src=t)}}},{key:"updateVideoSrc",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Utils.isset(r,!1)||r.startsWith("video/")){var i=n.find(""===r?"source":"source[type='".concat(r,"']"),e);null!==i&&i.src!==t&&(i.src=t)}}},{key:"setVolume",value:function(e,t){var r=n.isHTMLElement(e)?e:n.find(e);(n.isAudioElement(r)||n.isVideoElement(r))&&(r.volume=t/100)}},{key:"addClass",value:function(t,r){n.onEach(t,(function(t){var n;Array.isArray(r)?(n=t.classList).add.apply(n,e(r)):t.classList.add(r)}))}},{key:"removeClass",value:function(t,r){n.onEach(t,(function(t){var n;Array.isArray(r)?(n=t.classList).remove.apply(n,e(r)):t.classList.remove(r)}))}},{key:"swapClass",value:function(e,t,r){n.removeClass(e,t),n.addClass(e,r)}},{key:"setText",value:function(e,t){n.onEach(e,(function(e){e.innerText=t}))}},{key:"setHTML",value:function(e,t){n.onEach(e,(function(e){e.innerHTML=t}))}},{key:"getCSS",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=n.isHTMLElement(e)?e:n.find(e);if(!Utils.allset(e,t))return null;if("*"===t)return window.getComputedStyle(i,r);t.includes("-")&&(t=Utils.kebabCaseToCamelCase(t));var o=window.getComputedStyle(i,r);return Utils.isset(o)?o.getPropertyValue(t):null}},{key:"getCSSInt",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=n.isHTMLElement(e)?e:n.find(e),o=n.getCSS(i,t,r);return Utils.isset(o)?parseInt(o):null}},{key:"getCSSFloat",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=n.isHTMLElement(e)?e:n.find(e),o=n.getCSS(i,t,r);return Utils.isset(o)?parseFloat(o):null}},{key:"setCSSProp",value:function(e,t,r){n.onEach(e,(function(e){Utils.allset(null==e?void 0:e.style,t)&&(t.includes("-")&&(t=Utils.kebabCaseToCamelCase(t)),e.style[t]=r)}))}},{key:"setCSS",value:function(e,r){n.onEach(e,(function(e){for(var n=0,i=Object.entries(r);n]+)>/g,(function(e,t){return"$"+a[t]})))}if("function"==typeof i){var u=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!==o(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,u)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},a.apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1])||arguments[1];return t?null!=e&&""!==e:null!=e}},{key:"allset",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}(e.split("."));try{for(r.s();!(n=r.n()).done;){var i,o=n.value;if(void 0===(null===(i=t)||void 0===i?void 0:i[o]))return!1;t=t[o]}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"funcExists",value:function(e){return void 0!==window[e]}},{key:"callFunc",value:function(t){if(e.funcExists(t)){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:",",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e.isString(t))return[];for(var i=t.split(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:1,n=t>=0&&t<=1?t:1;return"rgba(".concat(e.getRandomNumber(0,255),", ").concat(e.getRandomNumber(0,255),", ").concat(e.getRandomNumber(0,255),", ").concat(n,")")}},{key:"getRandomNumber",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"getRandomDecimal",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return parseFloat((Math.random()*(t-e)+e).toFixed(n))}},{key:"getPercentageOf",value:function(e,t){return e>0&&t>0?e/t*100:0}},{key:"divisibleBy",value:function(e,t){return 0!==t&&e%t==0}},{key:"isWholeNumber",value:function(t){return e.divisibleBy(t,1)}},{key:"nextIterator",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.abs(e)>=Math.abs(t)?0:e+n}},{key:"formatTimerValue",value:function(e){return e>=0&&e<10?"0".concat(e):e.toString()}},{key:"isChrome",value:function(){return e.matchesRegex(window.navigator.userAgent,/Chrom(e|ium)/i)}},{key:"getChromeVersion",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=e.matchRegexGroups(window.navigator.userAgent,a(/Chrom(e|ium)\/(([0-9]+.?[0-9]+.?[0-9]+.?[0-9]+))/i,{version:2})),r=null!=n&&n.version?n.version:0;return t?r:parseInt(r)}},{key:"isBrowserSource",value:function(){return e.isset(window.obsstudio)}},{key:"camelCaseToKebabCase",value:function(e){return e.split("").map((function(e,t){return e.toUpperCase()===e?"".concat(t>0?"-":"").concat(e.toLowerCase()):e})).join("")}},{key:"kebabCaseToCamelCase",value:function(e){return e.split("-").map((function(e,t){return t?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e})).join("")}},{key:"formatCurrency",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=e.isWholeNumber(t)?0:2;return t.toLocaleString(r,{style:"currency",minimumFractionDigits:i,currency:n})}},{key:"containsText",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.isString(t)&&e.isString(n)?!!e.allset(t,n)&&(r&&t.includes(n)||t.toLocaleLowerCase().includes(null==n?void 0:n.toLocaleLowerCase())):null}},{key:"matchesRegex",value:function(t,n){return!!e.allset(t,n)&&n.test(t)}},{key:"matchRegexGroups",value:function(e,t){var n=t.exec(e);return null!=n&&n.groups?n.groups:null}},{key:"parseTier",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"==typeof e){if("prime"===e)return t?1:"prime";e=Number(e)}switch(e){case 1e3:case 1:return 1;case 2e3:case 2:return 2;case 3e3:case 3:return 3;default:return 0}}},{key:"resumeSEQueue",value:function(){var e;null===(e=SE_API)||void 0===e||e.resumeQueue()}}],null&&c(t.prototype,null),n&&c(t,n),e}();function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(){v=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,i){var o=new RegExp(e,r);return t.set(o,i||t.get(e)),m(o,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce((function(t,n){return t[n]=e[r[n]],t}),Object.create(null))}return h(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);return n&&(n.groups=r(n,this)),n},n.prototype[Symbol.replace]=function(n,i){if("string"==typeof i){var o=t.get(this);return e[Symbol.replace].call(this,n,i.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+o[t]})))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!==d(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,a)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},v.apply(this,arguments)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n[2|3]0)?[0-9]+","i").exec(this.raw.data.tags.badges);return null===n?0:"20"===(null==n||null===(e=n.groups)||void 0===e?void 0:e.tier)?2:"30"===(null==n||null===(t=n.groups)||void 0===t?void 0:t.tier)?3:1}},{key:"getMonthsSubscribed",value:function(){var e=f.matchRegexGroups(this.badgeInfo,v(/subscriber\/([1-9][0-9]*)/i,{months:1}));return null!=e&&e.months?parseInt(e.months):0}},{key:"getBitsBadge",value:function(){var e=f.matchRegexGroups(this.raw.data.tags.badges,v(/bits\/([1-9][0-9]*)/i,{bits:1}));return null!=e&&e.bits?parseInt(e.bits):0}},{key:"getGiftsBadge",value:function(){var e=f.matchRegexGroups(this.raw.data.tags.badges,v(/sub\x2Dgifter\/([1-9][0-9]*)/i,{gifts:1}));return null!=e&&e.gifts?parseInt(e.gifts):0}},{key:"isAction",value:function(){return!0===this.raw.data.isAction}},{key:"isCustomReward",value:function(){return f.isset(this.customRewardId)}},{key:"isCommand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.startsWith("!")?e:"!"+e;return this.text.startsWith(t)}},{key:"getCommand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isCommand())return null;var t=f.matchRegexGroups(this.text,v(/!([0-9A-Z_a-z]+)([\t-\r \*0-9A-Z_a-z\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)/i,{cmd:1,args:2}));return null===t?null:e?{command:t.cmd,args:f.createList(t.args," ",!0)}:t.cmd}},{key:"getWordList",value:function(){return f.createList(this.text," ")}},{key:"contains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return f.containsText(this.text,e,t)}},{key:"containsRegex",value:function(e){return f.matchesRegex(this.text,e)}},{key:"usernameOnList",value:function(e){if(Array.isArray(e)&&e.length>0){var t,n=y(e);try{for(n.s();!(t=n.n()).done;){var r,i=t.value;if((null===(r=i.toLocaleLowerCase)||void 0===r?void 0:r.call(i))===this.username.toLocaleLowerCase())return!0}}catch(e){n.e(e)}finally{n.f()}}return!1}},{key:"hasUsername",value:function(e){var t;return this.username.toLocaleLowerCase()===(null===(t=e.toLocaleLowerCase)||void 0===t?void 0:t.call(e))}},{key:"hasUserId",value:function(e){return this.userId===e}},{key:"usernameContains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return f.containsText(this.username,e,t)}},{key:"usernameContainsRegex",value:function(e){return f.matchesRegex(this.username,e)}}])&&g(t.prototype,n),e}();function k(e,t){for(var n=0;n0}},{key:"expectsEventListener",value:function(e){return this.expectedEventListeners.includes(e)}},{key:"expectsEventName",value:function(e){return this.expectedEventNames.includes(e)}},{key:"isSkippable",value:function(e){return this.skippable.includes(e)}},{key:"disableSenderCorrection",value:function(){this.useSenderCorrection=!1}},{key:"registerOnWidgetLoad",value:function(){this.expectsOnWidgetLoad&&window.addEventListener("onWidgetLoad",this.onWidgetLoadHandler.bind(this))}},{key:"unregisterOnWidgetLoad",value:function(){window.removeEventListener("onWidgetLoad",this.onWidgetLoadHandler)}},{key:"registerOnSessionUpdate",value:function(){this.expectsOnSessionUpdate&&window.addEventListener("onSessionUpdate",this.onSessionUpdateHandler.bind(this))}},{key:"unregisterOnSessionUpdate",value:function(){window.removeEventListener("onSessionUpdate",this.onSessionUpdateHandler)}},{key:"registerOnEventReceived",value:function(){this.expectsEvents()&&window.addEventListener("onEventReceived",this.onEventReceivedHandler.bind(this))}},{key:"unregisterOnEventReceived",value:function(){window.removeEventListener("onEventReceived",this.onEventReceivedHandler)}},{key:"onWidgetLoadHandler",value:function(e){f.callFunc("onWidgetLoad",e)}},{key:"onSessionUpdateHandler",value:function(e){f.callFunc("onSessionUpdate",e)}},{key:"onEventReceivedHandler",value:function(e){var t,n,r=null==e||null===(t=e.detail)||void 0===t?void 0:t.listener,i=null==e||null===(n=e.detail)||void 0===n?void 0:n.event;if(void 0!==r&&void 0!==i&&this.expectsEventListener(r))if(this.expectsEventName("Message")&&"message"===r)this.onMessageHandler(i);else if(this.expectsEventName("DeleteMessage")&&"delete-message"===r)this.onDeleteMessageHandler(i);else if(this.expectsEventName("DeleteMessages")&&"delete-messages"===r)this.onDeleteMessagesHandler(i);else if("subscriber-latest"===r){if(!this.useSenderCorrection||!i.isTest||i.gifted&&i.isCommunityGift||i.bulkGifted||(i.sender=void 0),this.expectsEventName("Subscriber")&&!i.gifted&&1===i.amount&&void 0===i.sender)this.onSubscriberHandler(i);else if(this.expectsEventName("SubGift")&&i.gifted&&!i.isCommunityGift)this.onSubGiftHandler(i);else if(this.expectsEventName("Resub")&&i.amount>1&&void 0===i.sender)this.onResubHandler(i);else if(i.bulkGifted){if(this.expectsEventName("SubBombComplete")){var o,a=null==i||null===(o=i.sender)||void 0===o?void 0:o.toLowerCase();a&&void 0===this.giftCollection[a]&&(this.giftCollection[a]={amount:i.amount,recipients:[]})}this.expectsEventName("SubBomb")&&this.onSubBombHandler(i)}else if(i.gifted&&i.isCommunityGift){if(this.expectsEventName("CommunityGift")&&this.onCommunityGiftHandler(i),this.expectsEventName("SubBombComplete")){var u,s,l=null==i||null===(u=i.sender)||void 0===u?void 0:u.toLowerCase();l&&void 0!==this.giftCollection[l]&&(this.giftCollection[l].recipients.push(i.name),this.giftCollection[l].amount===(null===(s=this.giftCollection[l].recipients)||void 0===s?void 0:s.length)&&(i.amount=this.giftCollection[l].amount,this.onSubBombCompleteHandler(i,this.giftCollection[l].recipients),delete this.giftCollection[l]))}f.resumeSEQueue()}}else this.expectsEventName("Tip")&&"tip-latest"===r?this.onTipHandler(i):this.expectsEventName("Cheer")&&"cheer-latest"===r?this.onCheerHandler(i):this.expectsEventName("Host")&&"host-latest"===r?this.onHostHandler(i):this.expectsEventName("Raid")&&"raid-latest"===r?this.onRaidHandler(i):this.expectsEventName("Follow")&&"follower-latest"===r?this.onFollowHandler(i):this.expectsEventName("BotCounter")&&"bot:counter"===r?this.onBotCounterHandler(i):this.expectsEventName("EventSkip")&&"event:skip"===r?this.onEventSkipHandler(i):this.expectsEventName("WidgetButton")&&"event:test"===r&&"widget-button"===i.listener?this.onWidgetButtonHandler(i):this.expectsEventName("KVStoreUpdate")&&"kvstore:update"===r?this.onKVStoreUpdateHandler(i.data):this.expectsEventName("ToggleSound")&&"alertService:toggleSound"===r?this.onToggleSoundHandler(i):f.resumeSEQueue();else f.resumeSEQueue()}},{key:"onSubscriberHandler",value:function(e){f.callFunc("onSubscriber",e)}},{key:"onResubHandler",value:function(e){f.callFunc("onResub",e)}},{key:"onSubGiftHandler",value:function(e){f.callFunc("onSubGift",e)}},{key:"onCommunityGiftHandler",value:function(e){f.callFunc("onCommunityGift",e)}},{key:"onSubBombHandler",value:function(e){f.callFunc("onSubBomb",e)}},{key:"onSubBombCompleteHandler",value:function(e,t){f.callFunc("onSubBombComplete",e,t)}},{key:"onTipHandler",value:function(e){f.callFunc("onTip",e)}},{key:"onCheerHandler",value:function(e){f.callFunc("onCheer",e)}},{key:"onHostHandler",value:function(e){f.callFunc("onHost",e)}},{key:"onRaidHandler",value:function(e){f.callFunc("onRaid",e)}},{key:"onFollowHandler",value:function(e){f.callFunc("onFollow",e)}},{key:"onMessageHandler",value:function(e){var t="twitch"===e.service.toLowerCase()?new b(e):e;f.callFunc("onMessage",t)}},{key:"onDeleteMessageHandler",value:function(e){f.callFunc("onDeleteMessage",e)}},{key:"onDeleteMessagesHandler",value:function(e){f.callFunc("onDeleteMessages",e)}},{key:"onEventSkipHandler",value:function(){f.callFunc("onEventSkip")}},{key:"onBotCounterHandler",value:function(e){f.callFunc("onBotCounter",e)}},{key:"onWidgetButtonHandler",value:function(e){f.callFunc("onWidgetButton",e)}},{key:"onKVStoreUpdateHandler",value:function(e){f.callFunc("onKVStoreUpdate",e)}},{key:"onToggleSoundHandler",value:function(e){f.callFunc("onToggleSound",e)}}])&&k(t.prototype,n),e}();function w(e,t){for(var n=0;n0?e-1:0}},{key:"add",value:function(e){C(this,H).push(e)}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.empty()||C(this,H).splice(e,t)}},{key:"removeFirst",value:function(){this.remove(0)}},{key:"removeLast",value:function(){this.remove(-1)}},{key:"get",value:function(e){return this.empty()?null:e>=0&&e<=this.indexLength()?C(this,H)[e]:e<0&&Math.abs(e)<=this.length()?C(this,H)[this.length()-e]:null}},{key:"first",value:function(){return this.get(0)}},{key:"last",value:function(){return this.get(-1)}},{key:"processFirst",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(i,o){var a=t.first();null!==a&&t.ready()&&(x(t,A,!0),e(a).then((function(){setTimeout((function(){t.removeFirst(),x(t,A,!1),r&&f.resumeSEQueue(),i()}),n)})).catch(o))}))}},{key:"processEach",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.processFirst(e,n,r).then((function(){t.processEach(e,n,r)})).catch((function(e){console.error(e)}))}}])&&w(t.prototype,n),e}();window.DOM=i,window.Events=new S,window.Queue=new T,window.Utils=f})();
\ No newline at end of file
+(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:null;return null===t?document.querySelector(e):t.querySelector(e)}},{key:"findAll",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null===t?document.querySelectorAll(e):t.querySelectorAll(e)}},{key:"findAllOrNull",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=e.findAll(t,n);return r.length>0?r:null}},{key:"onFirst",value:function(t,n){var r=e.isHTMLElement(t)?t:e.find(t);null!==r&&n(r)}},{key:"onEach",value:function(t,n){var i="string"==typeof t?e.findAll(t):t;if(null!==i){var o,a=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=r(e))){t&&(e=t);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}(i);try{for(a.s();!(o=a.n()).done;)n(o.value)}catch(e){a.e(e)}finally{a.f()}}}},{key:"isHTMLElement",value:function(e){return 1===(null==e?void 0:e.nodeType)}},{key:"isAudioElement",value:function(t){var n;return e.isHTMLElement(t)&&"audio"===(null===(n=t.nodeName)||void 0===n?void 0:n.toLowerCase())}},{key:"isImgElement",value:function(t){var n;return e.isHTMLElement(t)&&"img"===(null===(n=t.nodeName)||void 0===n?void 0:n.toLowerCase())}},{key:"isPictureElement",value:function(t){var n;return e.isHTMLElement(t)&&"picture"===(null===(n=t.nodeName)||void 0===n?void 0:n.toLowerCase())}},{key:"isImageElement",value:function(t){return e.isImgElement(t)||e.isPictureElement(t)}},{key:"isVideoElement",value:function(t){var n;return e.isHTMLElement(t)&&"video"===(null===(n=t.nodeName)||void 0===n?void 0:n.toLowerCase())}},{key:"isMediaElement",value:function(t){return e.isAudioElement(t)||e.isImageElement(t)||e.isVideoElement(t)}},{key:"updateSrc",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=e.isHTMLElement(t)?t:e.find(t);e.isImgElement(i)?e.updateImgSrc(i,n):e.isPictureElement(i)?e.updatePictureSrc(i,n,r):e.isAudioElement(i)?e.updateAudioSrc(i,n,r):e.isVideoElement(i)&&e.updateVideoSrc(i,n,r)}},{key:"updateImgSrc",value:function(e,t){e.src!==t&&(e.src=t)}},{key:"updatePictureSrc",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=e.find(""===r?"source":"source[media='(".concat(r,")']"),t);null!==i&&i.srcset!==n&&(i.srcset=n)}},{key:"updateAudioSrc",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Utils.isset(r,!1)||r.startsWith("audio/")){var i=e.find(""===r?"source":"source[type='".concat(r,"']"),t);null!==i&&i.src!==n&&(i.src=n)}}},{key:"updateVideoSrc",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Utils.isset(r,!1)||r.startsWith("video/")){var i=e.find(""===r?"source":"source[type='".concat(r,"']"),t);null!==i&&i.src!==n&&(i.src=n)}}},{key:"setVolume",value:function(t,n){var r=e.isHTMLElement(t)?t:e.find(t);(e.isAudioElement(r)||e.isVideoElement(r))&&(r.volume=n/100)}},{key:"addClass",value:function(t,r){e.onEach(t,(function(e){var t;Array.isArray(r)?(t=e.classList).add.apply(t,n(r)):e.classList.add(r)}))}},{key:"removeClass",value:function(t,r){e.onEach(t,(function(e){var t;Array.isArray(r)?(t=e.classList).remove.apply(t,n(r)):e.classList.remove(r)}))}},{key:"swapClass",value:function(t,n,r){e.removeClass(t,n),e.addClass(t,r)}},{key:"setText",value:function(t,n){e.onEach(t,(function(e){e.innerText=n}))}},{key:"setHTML",value:function(t,n){e.onEach(t,(function(e){e.innerHTML=n}))}},{key:"getCSS",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.isHTMLElement(t)?t:e.find(t);if(!Utils.allset(t,n))return null;if("*"===n)return window.getComputedStyle(i,r);n.includes("-")&&(n=Utils.kebabCaseToCamelCase(n));var o=window.getComputedStyle(i,r);return Utils.isset(o)?o.getPropertyValue(n):null}},{key:"getCSSInt",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.isHTMLElement(t)?t:e.find(t),o=e.getCSS(i,n,r);return Utils.isset(o)?parseInt(o):null}},{key:"getCSSFloat",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.isHTMLElement(t)?t:e.find(t),o=e.getCSS(i,n,r);return Utils.isset(o)?parseFloat(o):null}},{key:"setCSSProp",value:function(t,n,r){e.onEach(t,(function(e){Utils.allset(null==e?void 0:e.style,n)&&(n.includes("-")&&(n=Utils.kebabCaseToCamelCase(n)),e.style[n]=r)}))}},{key:"setCSS",value:function(n,r){e.onEach(n,(function(e){for(var n=0,i=Object.entries(r);n]+)>/g,(function(e,t){var n=o[t];return"$"+(Array.isArray(n)?n.join("$"):n)})))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=s(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,a)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},l.apply(this,arguments)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]&&!arguments[1]?null!=e:null!=e&&""!==e}},{key:"allset",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}(e.split("."));try{for(r.s();!(n=r.n()).done;){var i,o=n.value;if(void 0===(null===(i=t)||void 0===i?void 0:i[o]))return!1;t=t[o]}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"funcExists",value:function(e){return void 0!==window[e]}},{key:"callFunc",value:function(t){if(e.funcExists(t)){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:",",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e.isString(t))return[];for(var i=t.split(n),o=0;o0&&void 0!==arguments[0]?arguments[0]:1,n=t>=0&&t<=1?t:1;return"rgba(".concat(e.getRandomNumber(0,255),", ").concat(e.getRandomNumber(0,255),", ").concat(e.getRandomNumber(0,255),", ").concat(n,")")}},{key:"getRandomNumber",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"getRandomDecimal",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return parseFloat((Math.random()*(t-e)+e).toFixed(n))}},{key:"getPercentageOf",value:function(e,t){return e>0&&t>0?e/t*100:0}},{key:"divisibleBy",value:function(e,t){return 0!==t&&e%t==0}},{key:"isWholeNumber",value:function(t){return e.divisibleBy(t,1)}},{key:"nextIterator",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.abs(e)>=Math.abs(t)?0:e+n}},{key:"formatTimerValue",value:function(e){return e>=0&&e<10?"0".concat(e):e.toString()}},{key:"isChrome",value:function(){return e.matchesRegex(window.navigator.userAgent,/Chrom(e|ium)/i)}},{key:"getChromeVersion",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=e.matchRegexGroups(window.navigator.userAgent,l(/Chrom(e|ium)\/(([0-9]+.?[0-9]+.?[0-9]+.?[0-9]+))/i,{version:2})),r=null!=n&&n.version?n.version:0;return t?r:parseInt(r)}},{key:"isBrowserSource",value:function(){return e.isset(window.obsstudio)}},{key:"camelCaseToKebabCase",value:function(e){return e.split("").map((function(e,t){return e.toUpperCase()===e?"".concat(t>0?"-":"").concat(e.toLowerCase()):e})).join("")}},{key:"kebabCaseToCamelCase",value:function(e){return e.split("-").map((function(e,t){return t?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e})).join("")}},{key:"formatCurrency",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=e.isWholeNumber(t)?0:2;return t.toLocaleString(r,{style:"currency",minimumFractionDigits:i,currency:n})}},{key:"containsText",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.isString(t)&&e.isString(n)?!!e.allset(t,n)&&(r&&t.includes(n)||t.toLocaleLowerCase().includes(null==n?void 0:n.toLocaleLowerCase())):null}},{key:"matchesRegex",value:function(t,n){return!!e.allset(t,n)&&n.test(t)}},{key:"matchRegexGroups",value:function(e,t){var n=t.exec(e);return null!=n&&n.groups?n.groups:null}},{key:"parseTier",value:function(e){if("string"==typeof e){if("prime"===e)return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?1:"prime";e=Number(e)}switch(e){case 1e3:case 1:return 1;case 2e3:case 2:return 2;case 3e3:case 3:return 3;default:return 0}}},{key:"resumeSEQueue",value:function(){var e;null===(e=SE_API)||void 0===e||e.resumeQueue()}}],null&&v(t.prototype,null),n&&v(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function h(){h=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,i){var o=RegExp(e,r);return t.set(o,i||t.get(e)),p(o,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce((function(t,n){var i=r[n];if("number"==typeof i)t[n]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1]+)>/g,(function(e,t){var n=o[t];return"$"+(Array.isArray(n)?n.join("$"):n)})))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=y(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,a)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},h.apply(this,arguments)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function g(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n[2|3]0)?[0-9]+","i").exec(this.raw.data.tags.badges);return null===n?0:"20"===(null==n||null===(e=n.groups)||void 0===e?void 0:e.tier)?2:"30"===(null==n||null===(t=n.groups)||void 0===t?void 0:t.tier)?3:1}},{key:"getMonthsSubscribed",value:function(){var e=m.matchRegexGroups(this.badgeInfo,h(/subscriber\/([1-9][0-9]*)/i,{months:1}));return null!=e&&e.months?parseInt(e.months):0}},{key:"getBitsBadge",value:function(){var e=m.matchRegexGroups(this.raw.data.tags.badges,h(/bits\/([1-9][0-9]*)/i,{bits:1}));return null!=e&&e.bits?parseInt(e.bits):0}},{key:"getGiftsBadge",value:function(){var e=m.matchRegexGroups(this.raw.data.tags.badges,h(/sub\x2Dgifter\/([1-9][0-9]*)/i,{gifts:1}));return null!=e&&e.gifts?parseInt(e.gifts):0}},{key:"isAction",value:function(){return!0===this.raw.data.isAction}},{key:"isCustomReward",value:function(){return m.isset(this.customRewardId)}},{key:"isCommand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.startsWith("!")?e:"!"+e;return this.text.startsWith(t)}},{key:"getCommand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isCommand())return null;var t=m.matchRegexGroups(this.text,h(/!(\w+)([\s\w*]*)/i,{cmd:1,args:2}));return null===t?null:e?{command:t.cmd,args:m.createList(t.args," ",!0)}:t.cmd}},{key:"getWordList",value:function(){return m.createList(this.text," ")}},{key:"contains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return m.containsText(this.text,e,t)}},{key:"containsRegex",value:function(e){return m.matchesRegex(this.text,e)}},{key:"usernameOnList",value:function(e){if(Array.isArray(e)&&e.length>0){var t,n=g(e);try{for(n.s();!(t=n.n()).done;){var r,i=t.value;if((null===(r=i.toLocaleLowerCase)||void 0===r?void 0:r.call(i))===this.username.toLocaleLowerCase())return!0}}catch(e){n.e(e)}finally{n.f()}}return!1}},{key:"hasUsername",value:function(e){var t;return this.username.toLocaleLowerCase()===(null===(t=e.toLocaleLowerCase)||void 0===t?void 0:t.call(e))}},{key:"hasUserId",value:function(e){return this.userId===e}},{key:"usernameContains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return m.containsText(this.username,e,t)}},{key:"usernameContainsRegex",value:function(e){return m.matchesRegex(this.username,e)}}],t&&S(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function C(e,t){for(var n=0;n0}},{key:"expectsEventListener",value:function(e){return this.expectedEventListeners.includes(e)}},{key:"expectsEventName",value:function(e){return this.expectedEventNames.includes(e)}},{key:"isSkippable",value:function(e){return this.skippable.includes(e)}},{key:"disableSenderCorrection",value:function(){this.useSenderCorrection=!1}},{key:"debugEvents",value:function(){this.debugEvents=!0}},{key:"registerOnWidgetLoad",value:function(){this.expectsOnWidgetLoad&&window.addEventListener("onWidgetLoad",this.onWidgetLoadHandler.bind(this))}},{key:"unregisterOnWidgetLoad",value:function(){window.removeEventListener("onWidgetLoad",this.onWidgetLoadHandler)}},{key:"registerOnSessionUpdate",value:function(){this.expectsOnSessionUpdate&&window.addEventListener("onSessionUpdate",this.onSessionUpdateHandler.bind(this))}},{key:"unregisterOnSessionUpdate",value:function(){window.removeEventListener("onSessionUpdate",this.onSessionUpdateHandler)}},{key:"registerOnEventReceived",value:function(){this.expectsEvents()&&window.addEventListener("onEventReceived",this.onEventReceivedHandler.bind(this))}},{key:"unregisterOnEventReceived",value:function(){window.removeEventListener("onEventReceived",this.onEventReceivedHandler)}},{key:"onWidgetLoadHandler",value:function(e){m.callFunc("onWidgetLoad",e)}},{key:"onSessionUpdateHandler",value:function(e){m.callFunc("onSessionUpdate",e)}},{key:"onEventReceivedHandler",value:function(e){var t,n;this.debugEvents&&console.log("SE-Tools - debug event: ",null==e?void 0:e.detail);var r=null==e||null===(t=e.detail)||void 0===t?void 0:t.listener,i=null==e||null===(n=e.detail)||void 0===n?void 0:n.event;if(void 0!==r&&void 0!==i&&this.expectsEventListener(r))if(this.expectsEventName("Message")&&"message"===r)this.onMessageHandler(i);else if(this.expectsEventName("DeleteMessage")&&"delete-message"===r)this.onDeleteMessageHandler(i);else if(this.expectsEventName("DeleteMessages")&&"delete-messages"===r)this.onDeleteMessagesHandler(i);else if("subscriber-latest"===r){if(!this.useSenderCorrection||!i.isTest||i.gifted&&i.isCommunityGift||i.bulkGifted||(i.sender=void 0),this.expectsEventName("Subscriber")&&!i.gifted&&1===i.amount&&void 0===i.sender)this.onSubscriberHandler(i);else if(this.expectsEventName("SubGift")&&i.gifted&&!i.isCommunityGift)this.onSubGiftHandler(i);else if(this.expectsEventName("Resub")&&i.amount>1&&void 0===i.sender)this.onResubHandler(i);else if(i.bulkGifted&&!i.isCommunityGift){if(this.expectsEventName("SubBombComplete")){var o,a=null==i||null===(o=i.sender)||void 0===o?void 0:o.toLowerCase();a&&void 0===this.giftCollection[a]&&(this.giftCollection[a]={amount:i.amount,recipients:[]})}this.expectsEventName("SubBomb")&&this.onSubBombHandler(i)}else if(i.gifted&&i.isCommunityGift){if(this.expectsEventName("CommunityGift")&&this.onCommunityGiftHandler(i),this.expectsEventName("SubBombComplete")){var u,s,l=null==i||null===(u=i.sender)||void 0===u?void 0:u.toLowerCase();l&&void 0!==this.giftCollection[l]&&(this.giftCollection[l].recipients.push(i.name),this.giftCollection[l].amount===(null===(s=this.giftCollection[l].recipients)||void 0===s?void 0:s.length)&&(i.amount=this.giftCollection[l].amount,this.onSubBombCompleteHandler(i,this.giftCollection[l].recipients),delete this.giftCollection[l]))}m.resumeSEQueue()}}else this.expectsEventName("Tip")&&"tip-latest"===r?this.onTipHandler(i):this.expectsEventName("Cheer")&&"cheer-latest"===r?this.onCheerHandler(i):this.expectsEventName("Raid")&&"raid-latest"===r?this.onRaidHandler(i):this.expectsEventName("Follow")&&"follower-latest"===r?this.onFollowHandler(i):this.expectsEventName("BotCounter")&&"bot:counter"===r?this.onBotCounterHandler(i):this.expectsEventName("EventSkip")&&"event:skip"===r?this.onEventSkipHandler(i):this.expectsEventName("WidgetButton")&&"event:test"===r&&"widget-button"===i.listener?this.onWidgetButtonHandler(i):this.expectsEventName("KVStoreUpdate")&&"kvstore:update"===r?this.onKVStoreUpdateHandler(i.data):this.expectsEventName("ToggleSound")&&"alertService:toggleSound"===r?this.onToggleSoundHandler(i):m.resumeSEQueue();else m.resumeSEQueue()}},{key:"onSubscriberHandler",value:function(e){m.callFunc("onSubscriber",e)}},{key:"onResubHandler",value:function(e){m.callFunc("onResub",e)}},{key:"onSubGiftHandler",value:function(e){m.callFunc("onSubGift",e)}},{key:"onCommunityGiftHandler",value:function(e){m.callFunc("onCommunityGift",e)}},{key:"onSubBombHandler",value:function(e){m.callFunc("onSubBomb",e)}},{key:"onSubBombCompleteHandler",value:function(e,t){m.callFunc("onSubBombComplete",e,t)}},{key:"onTipHandler",value:function(e){m.callFunc("onTip",e)}},{key:"onCheerHandler",value:function(e){m.callFunc("onCheer",e)}},{key:"onRaidHandler",value:function(e){m.callFunc("onRaid",e)}},{key:"onFollowHandler",value:function(e){m.callFunc("onFollow",e)}},{key:"onMessageHandler",value:function(e){var t="twitch"===e.service.toLowerCase()?new w(e):e;m.callFunc("onMessage",t)}},{key:"onDeleteMessageHandler",value:function(e){m.callFunc("onDeleteMessage",e)}},{key:"onDeleteMessagesHandler",value:function(e){m.callFunc("onDeleteMessages",e)}},{key:"onEventSkipHandler",value:function(){m.callFunc("onEventSkip")}},{key:"onBotCounterHandler",value:function(e){m.callFunc("onBotCounter",e)}},{key:"onWidgetButtonHandler",value:function(e){m.callFunc("onWidgetButton",e)}},{key:"onKVStoreUpdateHandler",value:function(e){m.callFunc("onKVStoreUpdate",e)}},{key:"onToggleSoundHandler",value:function(e){m.callFunc("onToggleSound",e)}}],t&&C(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function T(e,t){for(var n=0;n0?e-1:0}},{key:"add",value:function(e){O(P,this).push(e)}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.empty()||O(P,this).splice(e,t)}},{key:"removeFirst",value:function(){this.remove(0)}},{key:"removeLast",value:function(){this.remove(-1)}},{key:"get",value:function(e){return this.empty()?null:e>=0&&e<=this.indexLength()?O(P,this)[e]:e<0&&Math.abs(e)<=this.length()?O(P,this)[this.length()-e]:null}},{key:"first",value:function(){return this.get(0)}},{key:"last",value:function(){return this.get(-1)}},{key:"processFirst",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise((function(i,o){var a=t.first();null!==a&&t.ready()&&(j(N,t,!0),e(a).then((function(){setTimeout((function(){t.removeFirst(),j(N,t,!1),r&&m.resumeSEQueue(),i()}),n)})).catch(o))}))}},{key:"processEach",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.processFirst(e,n,r).then((function(){t.processEach(e,n,r)})).catch((function(e){console.error(e)}))}}],t&&T(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.DOM=u,window.Events=new L,window.Queue=new I,window.Utils=m})();
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index be3c6cb..2619601 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -10,7 +10,7 @@
-
+
@@ -89,7 +89,7 @@