"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFirstFocusableElement = void 0;
/*
  finds the first element that is focusable by tabbing to it
  (the provided element or a child)
*/
var focusable = [
    'button',
    'a[href]',
    'area[href]',
    'input',
    'select',
    'textarea',
    '[contenteditable=true]',
    'iframe',
    'object',
    'embed',
    '[tabindex]'
]
    .map(function (selector) { return selector + ":not([disabled]):not([tabindex=\"-1\"])"; })
    .join(', ');
exports.getFirstFocusableElement = function (el) {
    if (el === null || el === void 0 ? void 0 : el.matches(focusable)) {
        return el;
    }
    else {
        return el === null || el === void 0 ? void 0 : el.querySelector(focusable);
    }
};
