import * as tsplus_module_1 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_2 from "@effect/core/stm/TQueue/operations/take";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/flatMap";
export const seek_ = seek_1;
/**
 * Drops elements from the queue while they do not satisfy the predicate,
 * taking and returning the first element that does satisfy the predicate.
 * Retries if no elements satisfy the predicate.
 *
 * @tsplus fluent ets/TQueue seek
 */

function seek_1(self, f) {
  return tsplus_module_3.flatMap_(tsplus_module_2.take(self), b => f(b) ? tsplus_module_1.succeedNow(b) : seek_1(self, f));
}
/**
 * Drops elements from the queue while they do not satisfy the predicate,
 * taking and returning the first element that does satisfy the predicate.
 * Retries if no elements satisfy the predicate.
 *
 * @tsplus static ets/TQueue/Aspects seek
 */


export const seek = f => self => seek_(self, f);
//# sourceMappingURL=seek.mjs.map