export const createRangeFromVisibleMap = (visibleMap, start, end) => {
    if (!visibleMap || typeof document === "undefined")
        return null;
    if (end <= start)
        return null;
    const startMapping = visibleMap.get(start);
    let endMapping = visibleMap.get(Math.max(start, end - 1));
    if (!startMapping)
        return null;
    if (!endMapping)
        endMapping = startMapping;
    try {
        const range = document.createRange();
        range.setStart(startMapping.node, startMapping.offset);
        range.setEnd(endMapping.node, endMapping.offset + 1);
        return range;
    }
    catch {
        return null;
    }
};
//# sourceMappingURL=visible-map-range.js.map