import { getTabbableNodes } from "./utils/DOMutils.js";
import { getAllAffectedNodes } from "./utils/all-affected.js";
import { isNotAGuard, isGuard } from "./utils/is.js";
import { getTopCommonParent } from "./utils/parenting.js";
var getFocusabledIn = function(topNode) {
  var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
  var commonParent = getTopCommonParent(topNode, topNode, entries);
  var visibilityCache = /* @__PURE__ */ new Map();
  var outerNodes = getTabbableNodes([commonParent], visibilityCache, true);
  var innerElements = getTabbableNodes(entries, visibilityCache).filter(function(_a) {
    var node = _a.node;
    return isNotAGuard(node);
  }).map(function(_a) {
    var node = _a.node;
    return node;
  });
  return outerNodes.map(function(_a) {
    var node = _a.node, index = _a.index;
    return {
      node,
      index,
      lockItem: innerElements.indexOf(node) >= 0,
      guard: isGuard(node)
    };
  });
};
export {
  getFocusabledIn
};
//# sourceMappingURL=focusables.js.map
