!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).koco={})}(this,(function(e){"use strict";var o=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(o,["enter"]);e.addSupportForTheKonamiCode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.requireEnterPress,r=void 0!==t&&t,i=e.allowedTimeBetweenKeys,d=void 0===i?0:i,u=o,a=null,l=0;function c(e){return a&&clearTimeout(a),u[l]!==e.key.toLowerCase()?(a=null,void(l=0)):(++l,u.length===l?(a=null,l=0,void function(e,o){var n,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?n=new window.CustomEvent(o,{detail:t,bubbles:r,cancelable:i}):(n=document.createEvent("CustomEvent")).initCustomEvent(o,r,i,t),e.dispatchEvent(n)}(e.target,"konamicode",{})):void(d>0&&(a=setTimeout((function(){a=null,l=0}),d))))}return r&&(u=n),document.addEventListener("keydown",c,!0),function(){document.removeEventListener("keydown",c,!0)}}}));