import React from 'react';
import { queryAncestors } from '../../dom-utils';
import { withContext } from './withContext';
export const AttachmentContext = React.createContext({});
export const withAttachmentContext = withContext(AttachmentContext, ({ element }) => {
    const isExternal = queryAncestors(element, 'external-material') != null;
    const name = element.getAttribute('name');
    return isExternal
        ? { displayNumber: element.getAttribute('display-number'), isExternal, name }
        : { displayNumber: null, isExternal, name };
});
//# sourceMappingURL=AttachmentContext.js.map