import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/fail";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_5 from "@effect/core/stm/TMap/operations/findSTM";
/**
 * Finds the key/value pair matching the specified predicate, and uses the
 * provided function to extract a value out of it.
 *
 * @tsplus fluent ets/TMap find
 */

export function find_(self, pf) {
  return tsplus_module_5.findSTM_(self, kv => tsplus_module_4.fold_(pf(kv), () => tsplus_module_2.fail(() => tsplus_module_1.none), tsplus_module_3.succeedNow));
}
/**
 * Finds the key/value pair matching the specified predicate, and uses the
 * provided function to extract a value out of it.
 *
 * @tsplus static ets/TMap/Aspects find
 */

export const find = pf => self => find_(self, pf);
//# sourceMappingURL=find.mjs.map