import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/empty";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/fail";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_5 from "@tsplus/stdlib/collections/Chunk/append";
import * as tsplus_module_6 from "@effect/core/stm/STM/operations/foldSTM";
import * as tsplus_module_7 from "@effect/core/stm/TMap/operations/foldSTM";
/**
 * Finds all the key/value pairs matching the specified predicate, and uses
 * the provided effectful function to extract values out of them..
 *
 * @tsplus fluent ets/TMap findAllSTM
 */

export function findAllSTM_(self, pf) {
  return tsplus_module_7.foldSTM_(self, tsplus_module_1.empty(), (acc, kv) => tsplus_module_6.foldSTM_(pf(kv), _ => tsplus_module_4.fold_(_, () => tsplus_module_2.succeedNow(acc), e => tsplus_module_3.fail(() => e)), a => tsplus_module_2.succeedNow(tsplus_module_5.append_(acc, a))));
}
/**
 * Finds all the key/value pairs matching the specified predicate, and uses
 * the provided effectful function to extract values out of them..
 *
 * @tsplus static ets/TMap/Aspects findAllSTM
 */

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