"use strict";Object.defineProperty(exports, "__esModule", {value: true});






















var _chunk4UJTL2NYjs = require('./chunk-4UJTL2NY.js');





var _chunkAL2I6MSRjs = require('./chunk-AL2I6MSR.js');



var _chunkKT2LSWBGjs = require('./chunk-KT2LSWBG.js');



var _chunkVCW7SZ6Jjs = require('./chunk-VCW7SZ6J.js');












var _chunkY5WQY5GSjs = require('./chunk-Y5WQY5GS.js');



var _chunkDLEEPDK7js = require('./chunk-DLEEPDK7.js');













var _chunkS2Z5L3RBjs = require('./chunk-S2Z5L3RB.js');


var _chunkS3T27X3Ujs = require('./chunk-S3T27X3U.js');








var _chunkR2MJP25Ojs = require('./chunk-R2MJP25O.js');






var _chunk7K74W2G3js = require('./chunk-7K74W2G3.js');






var _chunkQ2LZCTWPjs = require('./chunk-Q2LZCTWP.js');



var _chunkEBISTSVAjs = require('./chunk-EBISTSVA.js');

















var _chunkOTKMOSH2js = require('./chunk-OTKMOSH2.js');






var _chunkSQA7G4TEjs = require('./chunk-SQA7G4TE.js');


var _chunk6C3VEZWHjs = require('./chunk-6C3VEZWH.js');

// src/TaskEither.ts
var TaskEither_exports = {};
_chunk6C3VEZWHjs.__export.call(void 0, TaskEither_exports, {
  Alt: () => Alt,
  ApT: () => ApT,
  ApplicativePar: () => ApplicativePar2,
  ApplicativeSeq: () => ApplicativeSeq,
  ApplyPar: () => ApplyPar2,
  ApplySeq: () => ApplySeq2,
  Bifunctor: () => Bifunctor,
  Chain: () => Chain,
  ChainRec: () => ChainRec,
  Do: () => Do,
  FromEither: () => FromEither,
  FromIO: () => FromIO,
  FromTask: () => FromTask,
  Functor: () => Functor3,
  Monad: () => Monad2,
  MonadIO: () => MonadIO,
  MonadTask: () => MonadTask,
  MonadThrow: () => MonadThrow,
  Pointed: () => Pointed2,
  URI: () => URI,
  alt: () => alt2,
  altW: () => altW,
  ap: () => ap3,
  apFirst: () => apFirst2,
  apFirstW: () => apFirstW,
  apS: () => apS2,
  apSW: () => apSW,
  apSecond: () => apSecond2,
  apSecondW: () => apSecondW,
  apW: () => apW,
  as: () => as2,
  asUnit: () => asUnit2,
  bimap: () => bimap,
  bind: () => bind2,
  bindTo: () => bindTo2,
  bindW: () => bindW,
  bracket: () => bracket,
  bracketW: () => bracketW,
  chain: () => chain,
  chainEitherK: () => chainEitherK,
  chainEitherKW: () => chainEitherKW,
  chainFirst: () => chainFirst,
  chainFirstEitherK: () => chainFirstEitherK,
  chainFirstEitherKW: () => chainFirstEitherKW,
  chainFirstIOK: () => chainFirstIOK,
  chainFirstTaskK: () => chainFirstTaskK,
  chainFirstW: () => chainFirstW,
  chainIOEitherK: () => chainIOEitherK,
  chainIOEitherKW: () => chainIOEitherKW,
  chainIOK: () => chainIOK,
  chainNullableK: () => chainNullableK2,
  chainOptionK: () => chainOptionK2,
  chainOptionKW: () => chainOptionKW,
  chainRec: () => chainRec,
  chainTaskK: () => chainTaskK,
  chainTaskOptionK: () => chainTaskOptionK,
  chainTaskOptionKW: () => chainTaskOptionKW,
  chainW: () => chainW,
  do: () => do_2,
  filterOrElse: () => filterOrElse2,
  filterOrElseW: () => filterOrElseW,
  flap: () => flap2,
  flatMap: () => flatMap3,
  flatMapEither: () => flatMapEither2,
  flatMapIO: () => flatMapIO2,
  flatMapIOEither: () => flatMapIOEither,
  flatMapNullable: () => flatMapNullable2,
  flatMapOption: () => flatMapOption2,
  flatMapTask: () => flatMapTask2,
  flatMapTaskOption: () => flatMapTaskOption,
  flatten: () => flatten,
  flattenW: () => flattenW,
  fold: () => fold,
  foldW: () => foldW,
  fromEither: () => fromEither,
  fromEitherK: () => fromEitherK2,
  fromIO: () => fromIO2,
  fromIOEither: () => fromIOEither,
  fromIOEitherK: () => fromIOEitherK,
  fromIOK: () => fromIOK2,
  fromNullable: () => fromNullable2,
  fromNullableK: () => fromNullableK2,
  fromOption: () => fromOption3,
  fromOptionK: () => fromOptionK2,
  fromPredicate: () => fromPredicate2,
  fromTask: () => fromTask,
  fromTaskK: () => fromTaskK2,
  fromTaskOption: () => fromTaskOption,
  fromTaskOptionK: () => fromTaskOptionK,
  getAltTaskValidation: () => getAltTaskValidation,
  getApplicativeTaskValidation: () => getApplicativeTaskValidation,
  getApplyMonoid: () => getApplyMonoid,
  getApplySemigroup: () => getApplySemigroup2,
  getCompactable: () => getCompactable2,
  getFilterable: () => getFilterable2,
  getOrElse: () => getOrElse2,
  getOrElseW: () => getOrElseW,
  getSemigroup: () => getSemigroup2,
  getTaskValidation: () => getTaskValidation,
  left: () => left3,
  leftIO: () => leftIO,
  leftTask: () => leftTask,
  let: () => let_2,
  liftNullable: () => liftNullable2,
  liftOption: () => liftOption2,
  map: () => map4,
  mapBoth: () => mapBoth2,
  mapError: () => mapError2,
  mapLeft: () => mapLeft,
  match: () => match2,
  matchE: () => matchE2,
  matchEW: () => matchEW,
  matchW: () => matchW,
  of: () => of2,
  orElse: () => orElse2,
  orElseFirst: () => orElseFirst,
  orElseFirstIOK: () => orElseFirstIOK,
  orElseFirstTaskK: () => orElseFirstTaskK,
  orElseFirstW: () => orElseFirstW,
  orElseW: () => orElseW,
  orLeft: () => orLeft2,
  right: () => right4,
  rightIO: () => rightIO,
  rightTask: () => rightTask,
  sequenceArray: () => sequenceArray,
  sequenceSeqArray: () => sequenceSeqArray,
  swap: () => swap2,
  tap: () => tap2,
  tapEither: () => tapEither2,
  tapError: () => tapError2,
  tapIO: () => tapIO2,
  tapTask: () => tapTask2,
  taskEither: () => taskEither,
  taskEitherSeq: () => taskEitherSeq,
  taskify: () => taskify,
  throwError: () => throwError,
  toUnion: () => toUnion2,
  traverseArray: () => traverseArray,
  traverseArrayWithIndex: () => traverseArrayWithIndex,
  traverseReadonlyArrayWithIndex: () => traverseReadonlyArrayWithIndex,
  traverseReadonlyArrayWithIndexSeq: () => traverseReadonlyArrayWithIndexSeq,
  traverseReadonlyNonEmptyArrayWithIndex: () => traverseReadonlyNonEmptyArrayWithIndex3,
  traverseReadonlyNonEmptyArrayWithIndexSeq: () => traverseReadonlyNonEmptyArrayWithIndexSeq,
  traverseSeqArray: () => traverseSeqArray,
  traverseSeqArrayWithIndex: () => traverseSeqArrayWithIndex,
  tryCatch: () => tryCatch,
  tryCatchK: () => tryCatchK
});
var left3 = /* @__PURE__ */ _chunk4UJTL2NYjs.left.call(void 0, _chunkY5WQY5GSjs.Pointed);
var right4 = /* @__PURE__ */ _chunk4UJTL2NYjs.right.call(void 0, _chunkY5WQY5GSjs.Pointed);
var rightTask = /* @__PURE__ */ _chunk4UJTL2NYjs.rightF.call(void 0, _chunkY5WQY5GSjs.Functor);
var leftTask = /* @__PURE__ */ _chunk4UJTL2NYjs.leftF.call(void 0, _chunkY5WQY5GSjs.Functor);
var rightIO = /* @__PURE__ */ _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.fromIO, rightTask);
var leftIO = /* @__PURE__ */ _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.fromIO, leftTask);
var fromIO2 = rightIO;
var fromTask = rightTask;
var fromEither = _chunkY5WQY5GSjs.of;
var fromIOEither = _chunkY5WQY5GSjs.fromIO;
var fromTaskOption = (onNone) => _chunkY5WQY5GSjs.map.call(void 0, _chunkS2Z5L3RBjs.fromOption.call(void 0, onNone));
var match2 = /* @__PURE__ */ _chunk4UJTL2NYjs.match.call(void 0, _chunkY5WQY5GSjs.Functor);
var matchW = match2;
var matchE2 = /* @__PURE__ */ _chunk4UJTL2NYjs.matchE.call(void 0, _chunkY5WQY5GSjs.Monad);
var fold = matchE2;
var matchEW = matchE2;
var foldW = matchEW;
var getOrElse2 = /* @__PURE__ */ _chunk4UJTL2NYjs.getOrElse.call(void 0, _chunkY5WQY5GSjs.Monad);
var getOrElseW = getOrElse2;
var tryCatch = (f, onRejected) => async () => {
  try {
    return await f().then(_chunkOTKMOSH2js.right);
  } catch (reason) {
    return _chunkOTKMOSH2js.left.call(void 0, onRejected(reason));
  }
};
var tryCatchK = (f, onRejected) => (...a) => tryCatch(() => f(...a), onRejected);
var toUnion2 = /* @__PURE__ */ _chunk4UJTL2NYjs.toUnion.call(void 0, _chunkY5WQY5GSjs.Functor);
var fromNullable2 = /* @__PURE__ */ _chunk4UJTL2NYjs.fromNullable.call(void 0, 
  _chunkY5WQY5GSjs.Pointed
);
var fromNullableK2 = /* @__PURE__ */ _chunk4UJTL2NYjs.fromNullableK.call(void 0, _chunkY5WQY5GSjs.Pointed);
var chainNullableK2 = /* @__PURE__ */ _chunk4UJTL2NYjs.chainNullableK.call(void 0, _chunkY5WQY5GSjs.Monad);
var orElse2 = /* @__PURE__ */ _chunk4UJTL2NYjs.orElse.call(void 0, _chunkY5WQY5GSjs.Monad);
var orElseW = orElse2;
var tapError2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk4UJTL2NYjs.tapError.call(void 0, _chunkY5WQY5GSjs.Monad));
var orElseFirstIOK = (onLeft) => tapError2(fromIOK2(onLeft));
var orElseFirstTaskK = (onLeft) => tapError2(fromTaskK2(onLeft));
var orLeft2 = /* @__PURE__ */ _chunk4UJTL2NYjs.orLeft.call(void 0, _chunkY5WQY5GSjs.Monad);
var swap2 = /* @__PURE__ */ _chunk4UJTL2NYjs.swap.call(void 0, _chunkY5WQY5GSjs.Functor);
var fromTaskOptionK = (onNone) => {
  const from = fromTaskOption(onNone);
  return (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, from);
};
var chainTaskOptionKW = (onNone) => (f) => (ma) => flatMap3(ma, fromTaskOptionK(onNone)(f));
var chainTaskOptionK = chainTaskOptionKW;
var fromIOEitherK = (f) => _chunkSQA7G4TEjs.flow.call(void 0, f, fromIOEither);
var _map = (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map4(f));
var _apPar = (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, ap3(fa));
var _apSeq = (fab, fa) => flatMap3(fab, (f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, map4(f)));
var _alt = (fa, that) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, alt2(that));
var map4 = /* @__PURE__ */ _chunk4UJTL2NYjs.map.call(void 0, 
  _chunkY5WQY5GSjs.Functor
);
var mapBoth2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 3, _chunk4UJTL2NYjs.mapBoth.call(void 0, _chunkY5WQY5GSjs.Functor));
var bimap = mapBoth2;
var mapError2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk4UJTL2NYjs.mapError.call(void 0, _chunkY5WQY5GSjs.Functor));
var mapLeft = mapError2;
var ap3 = /* @__PURE__ */ _chunk4UJTL2NYjs.ap.call(void 0, _chunkY5WQY5GSjs.ApplyPar);
var apW = ap3;
var flatMap3 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk4UJTL2NYjs.flatMap.call(void 0, _chunkY5WQY5GSjs.Monad));
var flattenW = /* @__PURE__ */ flatMap3(_chunkSQA7G4TEjs.identity);
var flatten = flattenW;
var alt2 = /* @__PURE__ */ _chunk4UJTL2NYjs.alt.call(void 0, _chunkY5WQY5GSjs.Monad);
var altW = alt2;
var of2 = right4;
var throwError = left3;
var URI = "TaskEither";
function getApplicativeTaskValidation(A, S) {
  const ap4 = _chunkQ2LZCTWPjs.ap.call(void 0, A, _chunkS2Z5L3RBjs.getApplicativeValidation.call(void 0, S));
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: (fab, fa) => _chunkSQA7G4TEjs.pipe.call(void 0, fab, ap4(fa)),
    of: of2
  };
}
function getAltTaskValidation(S) {
  const alt3 = _chunk4UJTL2NYjs.altValidation.call(void 0, _chunkY5WQY5GSjs.Monad, S);
  return {
    URI,
    _E: void 0,
    map: _map,
    alt: (fa, that) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, alt3(that))
  };
}
var getCompactable2 = (M) => {
  const C = _chunkS2Z5L3RBjs.getCompactable.call(void 0, M);
  return {
    URI,
    _E: void 0,
    compact: _chunkKT2LSWBGjs.compact.call(void 0, _chunkY5WQY5GSjs.Functor, C),
    separate: _chunkKT2LSWBGjs.separate.call(void 0, _chunkY5WQY5GSjs.Functor, C, _chunkS2Z5L3RBjs.Functor)
  };
};
function getFilterable2(M) {
  const F = _chunkS2Z5L3RBjs.getFilterable.call(void 0, M);
  const C = getCompactable2(M);
  const filter2 = _chunkAL2I6MSRjs.filter.call(void 0, _chunkY5WQY5GSjs.Functor, F);
  const filterMap2 = _chunkAL2I6MSRjs.filterMap.call(void 0, _chunkY5WQY5GSjs.Functor, F);
  const partition2 = _chunkAL2I6MSRjs.partition.call(void 0, _chunkY5WQY5GSjs.Functor, F);
  const partitionMap2 = _chunkAL2I6MSRjs.partitionMap.call(void 0, _chunkY5WQY5GSjs.Functor, F);
  return {
    URI,
    _E: void 0,
    map: _map,
    compact: C.compact,
    separate: C.separate,
    filter: (fa, predicate) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, filter2(predicate)),
    filterMap: (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, filterMap2(f)),
    partition: (fa, predicate) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, partition2(predicate)),
    partitionMap: (fa, f) => _chunkSQA7G4TEjs.pipe.call(void 0, fa, partitionMap2(f))
  };
}
var Functor3 = {
  URI,
  map: _map
};
var as2 = _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunk7K74W2G3js.as.call(void 0, Functor3));
var asUnit2 = _chunk7K74W2G3js.asUnit.call(void 0, Functor3);
var flap2 = /* @__PURE__ */ _chunk7K74W2G3js.flap.call(void 0, Functor3);
var Pointed2 = {
  URI,
  of: of2
};
var ApplyPar2 = {
  URI,
  map: _map,
  ap: _apPar
};
var apFirst2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apFirst.call(void 0, ApplyPar2);
var apFirstW = apFirst2;
var apSecond2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apSecond.call(void 0, ApplyPar2);
var apSecondW = apSecond2;
var ApplicativePar2 = {
  URI,
  map: _map,
  ap: _apPar,
  of: of2
};
var ApplySeq2 = {
  URI,
  map: _map,
  ap: _apSeq
};
var ApplicativeSeq = {
  URI,
  map: _map,
  ap: _apSeq,
  of: of2
};
var Chain = {
  URI,
  map: _map,
  ap: _apPar,
  chain: flatMap3
};
var chainRec = (a, f) => async () => {
  let current = await f(a)();
  while (true) {
    if (_chunkS2Z5L3RBjs.isRight.call(void 0, current) && _chunkS2Z5L3RBjs.isLeft.call(void 0, current.right)) {
      current = await f(current.right.left)();
      continue;
    }
    if (_chunkS2Z5L3RBjs.isLeft.call(void 0, current)) {
      return current;
    }
    if (_chunkS2Z5L3RBjs.isRight.call(void 0, current.right)) {
      return _chunkS2Z5L3RBjs.right.call(void 0, current.right.right);
    }
  }
};
var ChainRec = {
  ...Chain,
  chainRec
};
var Monad2 = {
  URI,
  map: _map,
  ap: _apPar,
  chain: flatMap3,
  of: of2
};
var MonadIO = {
  URI,
  map: _map,
  ap: _apPar,
  chain: flatMap3,
  of: of2,
  fromIO: fromIO2
};
var MonadTask = {
  URI,
  map: _map,
  ap: _apPar,
  chain: flatMap3,
  of: of2,
  fromIO: fromIO2,
  fromTask
};
var MonadThrow = {
  URI,
  map: _map,
  ap: _apPar,
  chain: flatMap3,
  of: of2,
  throwError
};
var FromEither = {
  URI,
  fromEither
};
var FromIO = {
  URI,
  fromIO: fromIO2
};
var FromTask = {
  URI,
  fromIO: fromIO2,
  fromTask
};
var tap2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkEBISTSVAjs.tap.call(void 0, Chain));
var tapEither2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkR2MJP25Ojs.tapEither.call(void 0, FromEither, Chain));
var tapIO2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkDLEEPDK7js.tapIO.call(void 0, FromIO, Chain));
var tapTask2 = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 2, _chunkVCW7SZ6Jjs.tapTask.call(void 0, FromTask, Chain));
var Bifunctor = {
  URI,
  bimap: mapBoth2,
  mapLeft: mapError2
};
var Alt = {
  URI,
  map: _map,
  alt: _alt
};
var fromOption3 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromOption.call(void 0, FromEither);
var fromOptionK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromOptionK.call(void 0, FromEither);
var chainOptionK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.chainOptionK.call(void 0, 
  FromEither,
  Chain
);
var chainOptionKW = chainOptionK2;
var _FromEither = {
  fromEither: FromEither.fromEither
};
var liftNullable2 = /* @__PURE__ */ _chunkOTKMOSH2js.liftNullable.call(void 0, _FromEither);
var liftOption2 = /* @__PURE__ */ _chunkOTKMOSH2js.liftOption.call(void 0, _FromEither);
var _FlatMap = {
  flatMap: flatMap3
};
var _FromIO = {
  fromIO: FromIO.fromIO
};
var _FromTask = {
  fromTask
};
var flatMapNullable2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapNullable.call(void 0, _FromEither, _FlatMap);
var flatMapOption2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapOption.call(void 0, _FromEither, _FlatMap);
var flatMapEither2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapEither.call(void 0, _FromEither, _FlatMap);
var flatMapIO2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapIO.call(void 0, _FromIO, _FlatMap);
var flatMapTask2 = /* @__PURE__ */ _chunkOTKMOSH2js.flatMapTask.call(void 0, _FromTask, _FlatMap);
var flatMapIOEither = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  2,
  (self, f) => flatMap3(self, fromIOEitherK(f))
);
var flatMapTaskOption = /* @__PURE__ */ _chunkSQA7G4TEjs.dual.call(void 0, 
  3,
  (self, f, onNone) => flatMap3(self, (a) => fromTaskOption(() => onNone(a))(f(a)))
);
var chainEitherK = flatMapEither2;
var chainEitherKW = flatMapEither2;
var chainFirstEitherK = tapEither2;
var chainFirstEitherKW = tapEither2;
var fromPredicate2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromPredicate.call(void 0, FromEither);
var filterOrElse2 = /* @__PURE__ */ _chunkR2MJP25Ojs.filterOrElse.call(void 0, FromEither, Chain);
var filterOrElseW = filterOrElse2;
var fromEitherK2 = /* @__PURE__ */ _chunkR2MJP25Ojs.fromEitherK.call(void 0, FromEither);
var fromIOK2 = /* @__PURE__ */ _chunkDLEEPDK7js.fromIOK.call(void 0, FromIO);
var chainIOK = flatMapIO2;
var chainFirstIOK = tapIO2;
var fromTaskK2 = /* @__PURE__ */ _chunkVCW7SZ6Jjs.fromTaskK.call(void 0, FromTask);
var chainTaskK = flatMapTask2;
var chainFirstTaskK = tapTask2;
var chainIOEitherKW = flatMapIOEither;
var chainIOEitherK = flatMapIOEither;
function taskify(f) {
  return function() {
    const args = Array.prototype.slice.call(arguments);
    return () => new Promise((resolve) => {
      const cbResolver = (e, r) => e != null ? resolve(_chunkOTKMOSH2js.left.call(void 0, e)) : resolve(_chunkOTKMOSH2js.right.call(void 0, r));
      f.apply(null, args.concat(cbResolver));
    });
  };
}
var bracket = (acquire, use, release) => bracketW(acquire, use, release);
var bracketW = (acquire, use, release) => flatMap3(acquire, (a) => _chunkY5WQY5GSjs.flatMap.call(void 0, use(a), (e) => flatMap3(release(a, e), () => _chunkY5WQY5GSjs.of.call(void 0, e))));
var Do = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyRecord);
var bindTo2 = /* @__PURE__ */ _chunk7K74W2G3js.bindTo.call(void 0, Functor3);
var let_2 = /* @__PURE__ */ _chunk7K74W2G3js.let_.call(void 0, Functor3);
var bind2 = /* @__PURE__ */ _chunkEBISTSVAjs.bind.call(void 0, Chain);
var bindW = bind2;
var do_2 = _chunkS2Z5L3RBjs.do_3.call(void 0, Pointed2, ChainRec);
var apS2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.apS.call(void 0, ApplyPar2);
var apSW = apS2;
var ApT = /* @__PURE__ */ of2(_chunkOTKMOSH2js.emptyReadonlyArray);
var traverseReadonlyNonEmptyArrayWithIndex3 = (f) => _chunkSQA7G4TEjs.flow.call(void 0, _chunkY5WQY5GSjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, f), _chunkY5WQY5GSjs.map.call(void 0, _chunkS2Z5L3RBjs.traverseReadonlyNonEmptyArrayWithIndex.call(void 0, _chunkSQA7G4TEjs.SK)));
var traverseReadonlyArrayWithIndex = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex3(f);
  return (as3) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as3) ? g(as3) : ApT;
};
var traverseReadonlyNonEmptyArrayWithIndexSeq = (f) => (as3) => () => _chunkOTKMOSH2js.tail.call(void 0, as3).reduce(
  (acc, a, i) => acc.then(
    (ebs) => _chunkOTKMOSH2js.isLeft.call(void 0, ebs) ? acc : f(i + 1, a)().then((eb) => {
      if (_chunkOTKMOSH2js.isLeft.call(void 0, eb)) {
        return eb;
      }
      ebs.right.push(eb.right);
      return ebs;
    })
  ),
  f(0, _chunkOTKMOSH2js.head.call(void 0, as3))().then(_chunkS2Z5L3RBjs.map.call(void 0, _chunkOTKMOSH2js.singleton))
);
var traverseReadonlyArrayWithIndexSeq = (f) => {
  const g = traverseReadonlyNonEmptyArrayWithIndexSeq(f);
  return (as3) => _chunkOTKMOSH2js.isNonEmpty.call(void 0, as3) ? g(as3) : ApT;
};
var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;
var traverseArray = (f) => traverseReadonlyArrayWithIndex((_, a) => f(a));
var sequenceArray = /* @__PURE__ */ traverseArray(_chunkSQA7G4TEjs.identity);
var traverseSeqArrayWithIndex = traverseReadonlyArrayWithIndexSeq;
var traverseSeqArray = (f) => traverseReadonlyArrayWithIndexSeq((_, a) => f(a));
var sequenceSeqArray = /* @__PURE__ */ traverseSeqArray(_chunkSQA7G4TEjs.identity);
var chain = flatMap3;
var chainW = flatMap3;
var chainFirst = tap2;
var chainFirstW = tap2;
var orElseFirst = tapError2;
var orElseFirstW = tapError2;
var taskEither = {
  URI,
  bimap: mapBoth2,
  mapLeft: mapError2,
  map: _map,
  of: of2,
  ap: _apPar,
  chain: flatMap3,
  alt: _alt,
  fromIO: fromIO2,
  fromTask,
  throwError
};
var taskEitherSeq = {
  URI,
  bimap: mapBoth2,
  mapLeft: mapError2,
  map: _map,
  of: of2,
  ap: _apSeq,
  chain: flatMap3,
  alt: _alt,
  fromIO: fromIO2,
  fromTask,
  throwError
};
var getApplySemigroup2 = /* @__PURE__ */ _chunkQ2LZCTWPjs.getApplySemigroup.call(void 0, ApplySeq2);
var getApplyMonoid = /* @__PURE__ */ _chunkS3T27X3Ujs.getApplicativeMonoid.call(void 0, ApplicativeSeq);
var getSemigroup2 = (S) => _chunkQ2LZCTWPjs.getApplySemigroup.call(void 0, (0, _chunkY5WQY5GSjs.ApplySeq))(_chunkS2Z5L3RBjs.getSemigroup.call(void 0, S));
function getTaskValidation(SE) {
  const applicativeTaskValidation = getApplicativeTaskValidation(_chunkY5WQY5GSjs.ApplicativePar, SE);
  const altTaskValidation = getAltTaskValidation(SE);
  return {
    URI,
    _E: void 0,
    map: _map,
    ap: applicativeTaskValidation.ap,
    of: of2,
    chain: flatMap3,
    bimap: mapBoth2,
    mapLeft: mapError2,
    alt: altTaskValidation.alt,
    fromIO: fromIO2,
    fromTask,
    throwError
  };
}






















































































































































exports.left = left3; exports.right = right4; exports.rightTask = rightTask; exports.leftTask = leftTask; exports.rightIO = rightIO; exports.leftIO = leftIO; exports.fromIO = fromIO2; exports.fromTask = fromTask; exports.fromEither = fromEither; exports.fromIOEither = fromIOEither; exports.fromTaskOption = fromTaskOption; exports.match = match2; exports.matchW = matchW; exports.matchE = matchE2; exports.fold = fold; exports.matchEW = matchEW; exports.foldW = foldW; exports.getOrElse = getOrElse2; exports.getOrElseW = getOrElseW; exports.tryCatch = tryCatch; exports.tryCatchK = tryCatchK; exports.toUnion = toUnion2; exports.fromNullable = fromNullable2; exports.fromNullableK = fromNullableK2; exports.chainNullableK = chainNullableK2; exports.orElse = orElse2; exports.orElseW = orElseW; exports.tapError = tapError2; exports.orElseFirstIOK = orElseFirstIOK; exports.orElseFirstTaskK = orElseFirstTaskK; exports.orLeft = orLeft2; exports.swap = swap2; exports.fromTaskOptionK = fromTaskOptionK; exports.chainTaskOptionKW = chainTaskOptionKW; exports.chainTaskOptionK = chainTaskOptionK; exports.fromIOEitherK = fromIOEitherK; exports.map = map4; exports.mapBoth = mapBoth2; exports.bimap = bimap; exports.mapError = mapError2; exports.mapLeft = mapLeft; exports.ap = ap3; exports.apW = apW; exports.flatMap = flatMap3; exports.flattenW = flattenW; exports.flatten = flatten; exports.alt = alt2; exports.altW = altW; exports.of = of2; exports.throwError = throwError; exports.URI = URI; exports.getApplicativeTaskValidation = getApplicativeTaskValidation; exports.getAltTaskValidation = getAltTaskValidation; exports.getCompactable = getCompactable2; exports.getFilterable = getFilterable2; exports.Functor = Functor3; exports.as = as2; exports.asUnit = asUnit2; exports.flap = flap2; exports.Pointed = Pointed2; exports.ApplyPar = ApplyPar2; exports.apFirst = apFirst2; exports.apFirstW = apFirstW; exports.apSecond = apSecond2; exports.apSecondW = apSecondW; exports.ApplicativePar = ApplicativePar2; exports.ApplySeq = ApplySeq2; exports.ApplicativeSeq = ApplicativeSeq; exports.Chain = Chain; exports.chainRec = chainRec; exports.ChainRec = ChainRec; exports.Monad = Monad2; exports.MonadIO = MonadIO; exports.MonadTask = MonadTask; exports.MonadThrow = MonadThrow; exports.FromEither = FromEither; exports.FromIO = FromIO; exports.FromTask = FromTask; exports.tap = tap2; exports.tapEither = tapEither2; exports.tapIO = tapIO2; exports.tapTask = tapTask2; exports.Bifunctor = Bifunctor; exports.Alt = Alt; exports.fromOption = fromOption3; exports.fromOptionK = fromOptionK2; exports.chainOptionK = chainOptionK2; exports.chainOptionKW = chainOptionKW; exports.liftNullable = liftNullable2; exports.liftOption = liftOption2; exports.flatMapNullable = flatMapNullable2; exports.flatMapOption = flatMapOption2; exports.flatMapEither = flatMapEither2; exports.flatMapIO = flatMapIO2; exports.flatMapTask = flatMapTask2; exports.flatMapIOEither = flatMapIOEither; exports.flatMapTaskOption = flatMapTaskOption; exports.chainEitherK = chainEitherK; exports.chainEitherKW = chainEitherKW; exports.chainFirstEitherK = chainFirstEitherK; exports.chainFirstEitherKW = chainFirstEitherKW; exports.fromPredicate = fromPredicate2; exports.filterOrElse = filterOrElse2; exports.filterOrElseW = filterOrElseW; exports.fromEitherK = fromEitherK2; exports.fromIOK = fromIOK2; exports.chainIOK = chainIOK; exports.chainFirstIOK = chainFirstIOK; exports.fromTaskK = fromTaskK2; exports.chainTaskK = chainTaskK; exports.chainFirstTaskK = chainFirstTaskK; exports.chainIOEitherKW = chainIOEitherKW; exports.chainIOEitherK = chainIOEitherK; exports.taskify = taskify; exports.bracket = bracket; exports.bracketW = bracketW; exports.Do = Do; exports.bindTo = bindTo2; exports.let_ = let_2; exports.bind = bind2; exports.bindW = bindW; exports.do_ = do_2; exports.apS = apS2; exports.apSW = apSW; exports.ApT = ApT; exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex3; exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex; exports.traverseReadonlyNonEmptyArrayWithIndexSeq = traverseReadonlyNonEmptyArrayWithIndexSeq; exports.traverseReadonlyArrayWithIndexSeq = traverseReadonlyArrayWithIndexSeq; exports.traverseArrayWithIndex = traverseArrayWithIndex; exports.traverseArray = traverseArray; exports.sequenceArray = sequenceArray; exports.traverseSeqArrayWithIndex = traverseSeqArrayWithIndex; exports.traverseSeqArray = traverseSeqArray; exports.sequenceSeqArray = sequenceSeqArray; exports.chain = chain; exports.chainW = chainW; exports.chainFirst = chainFirst; exports.chainFirstW = chainFirstW; exports.orElseFirst = orElseFirst; exports.orElseFirstW = orElseFirstW; exports.taskEither = taskEither; exports.taskEitherSeq = taskEitherSeq; exports.getApplySemigroup = getApplySemigroup2; exports.getApplyMonoid = getApplyMonoid; exports.getSemigroup = getSemigroup2; exports.getTaskValidation = getTaskValidation; exports.TaskEither_exports = TaskEither_exports;
