import r from "./index-getNodeName.js";
import t from "./index-getDocumentElement.js";
import { isShadowRoot as a } from "./index-instanceOf.js";
function u(o) {
  return r(o) === "html" ? o : (
    // this is a quicker (but less type safe) way to save quite some bytes from the bundle
    // $FlowFixMe[incompatible-return]
    // $FlowFixMe[prop-missing]
    o.assignedSlot || // step into the shadow DOM of the parent of a slotted node
    o.parentNode || // DOM Element detected
    (a(o) ? o.host : null) || // ShadowRoot detected
    // $FlowFixMe[incompatible-call]: HTMLElement is a Node
    t(o)
  );
}
export {
  u as default
};
