// tracing: off
import * as Tp from "../../Collections/Immutable/Tuple"
import { pipe } from "../../Function"
import * as O from "../../Option"
import { map } from "./map"
import { zipWithNext } from "./zipWithNext"
import { zipWithPrevious } from "./zipWithPrevious"
/**
 * Zips each element with both the previous and next element.
 */

export function zipWithPreviousAndNext(self) {
  return map(
    ({
      tuple: [
        {
          tuple: [prev, curr]
        },
        next
      ]
    }) =>
      Tp.tuple(
        prev,
        curr,
        O.map_(next, ({ tuple: [_, r] }) => r)
      )
  )(zipWithNext(zipWithPrevious(self)))
}
//# sourceMappingURL=zipWithPreviousAndNext.js.map
