System.register(["./tabbable.cjs.js"],function(_export,_context){"use strict";var t,s,i;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}return{setters:[function(_tabbableCjsJs){t=_tabbableCjsJs.g;}],execute:function execute(){s=[];_export("M",i=/*#__PURE__*/function(){function i(t){_classCallCheck(this,i);this.tabDirection="forward",this.element=t,this.handleFocusIn=this.handleFocusIn.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this);}return _createClass(i,[{key:"activate",value:function activate(){s.push(this.element),document.addEventListener("focusin",this.handleFocusIn),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp);}},{key:"deactivate",value:function deactivate(){var _this=this;s=s.filter(function(t){return t!==_this.element;}),document.removeEventListener("focusin",this.handleFocusIn),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp);}},{key:"isActive",value:function isActive(){return s[s.length-1]===this.element;}},{key:"checkFocus",value:function checkFocus(){if(this.isActive()&&!this.element.matches(":focus-within")){var _t=t(this.element),_s=_t.start,_i=_t.end,h="forward"===this.tabDirection?_s:_i;"function"==typeof(h===null||h===void 0?void 0:h.focus)&&h.focus({preventScroll:!0});}}},{key:"handleFocusIn",value:function handleFocusIn(){this.checkFocus();}},{key:"handleKeyDown",value:function handleKeyDown(t){var _this2=this;"Tab"===t.key&&t.shiftKey&&(this.tabDirection="backward",requestAnimationFrame(function(){return _this2.checkFocus();}));}},{key:"handleKeyUp",value:function handleKeyUp(){this.tabDirection="forward";}}]);}());}};});
//# sourceMappingURL=modal.cjs.js.map
