import * as tsplus_module_1 from "@tsplus/stdlib/data/Function";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Maybe/fold";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/mapError";
/**
 * Unwraps the optional error, defaulting to the provided value.
 *
 * @tsplus fluent ets/STM flattenErrorMaybe
 */

export function flattenErrorMaybe_(self, def) {
  return tsplus_module_3.mapError_(self, option => tsplus_module_2.fold_(option, def, tsplus_module_1.identity));
}
/**
 * Unwraps the optional error, defaulting to the provided value.
 *
 * @tsplus static ets/STM/Aspects flattenErrorMaybe
 */

export const flattenErrorMaybe = def => self => flattenErrorMaybe_(self, def);
//# sourceMappingURL=flattenErrorMaybe.mjs.map