function intersectsLineString(
  flatCoordinates,
  offset,
  end,
  stride,
  extent,
  coordinatesExtent,
) {
  coordinatesExtent =
    coordinatesExtent ??
    extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride);
  if (!intersects(extent, coordinatesExtent)) {
    return false;
  }
  if (
    (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) ||
    (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3])
  ) {
    return true;
  }
  return forEachSegment(
    flatCoordinates,
    offset,
    end,
    stride,
    /**
     * @param {import("../../coordinate.js").Coordinate} point1 Start point.
     * @param {import("../../coordinate.js").Coordinate} point2 End point.
     * @return {boolean} `true` if the segment and the extent intersect,
     *     `false` otherwise.
     */
    function (point1, point2) {
      return intersectsSegment(extent, point1, point2);
    },
  );
}
@param {Array<number>} flatCoordinates Flat coordinates.
@param {number} offset Offset.
@param {number} end End.
@param {number} stride Stride.
@param {import("../../extent.js").Extent} extent Extent.
@param {import('../../extent.js').Extent} [coordinatesExtent] Coordinates extent
@return {boolean} True if the geometry and the extent intersect.