{"version":3,"sources":["iterable/operators/slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,aAAuB,SAAQ,SAAkB;IAK5D,YAAY,MAAyB,EAAE,KAAa,EAAE,GAAW;QAC/D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC;QACT,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAC5C,KAAK,EAAE,CAAC;SACT;QAED,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QACpB,IAAI,GAAG,GAAG,CAAC,EAAE;YACX,OAAO,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;gBAC/B,MAAM,IAAI,CAAC,KAAK,CAAC;gBACjB,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE;oBACf,MAAM;iBACP;aACF;SACF;IACH,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CACnB,KAAa,EACb,MAAc,QAAQ;IAEtB,OAAO,SAAS,qBAAqB,CAAC,MAAyB;QAC7D,OAAO,IAAI,aAAa,CAAU,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC","file":"slice.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { MonoTypeOperatorFunction } from '../../interfaces';\n\nexport class SliceIterable<TSource> extends IterableX<TSource> {\n  private _source: Iterable<TSource>;\n  private _begin: number;\n  private _end: number;\n\n  constructor(source: Iterable<TSource>, begin: number, end: number) {\n    super();\n    this._source = source;\n    this._begin = begin;\n    this._end = end;\n  }\n\n  *[Symbol.iterator]() {\n    const it = this._source[Symbol.iterator]();\n    let begin = this._begin;\n    let next;\n    while (begin > 0 && !(next = it.next()).done) {\n      begin--;\n    }\n\n    let end = this._end;\n    if (end > 0) {\n      while (!(next = it.next()).done) {\n        yield next.value;\n        if (--end === 0) {\n          break;\n        }\n      }\n    }\n  }\n}\n\n/**\n * Returns the elements from the source iterable sequence only after the function that returns a promise produces an element.\n *\n * @export\n * @template TSource The type of elements in the source sequence.\n * @param {number} begin Zero-based index at which to begin extraction.\n * @param {number} [end=Infinity] Zero-based index before which to end extraction.\n * @returns {MonoTypeOperatorFunction<TSource>} An iterable containing the extracted elements.\n */\nexport function slice<TSource>(\n  begin: number,\n  end: number = Infinity\n): MonoTypeOperatorFunction<TSource> {\n  return function sliceOperatorFunction(source: Iterable<TSource>): IterableX<TSource> {\n    return new SliceIterable<TSource>(source, begin, end);\n  };\n}\n"]}