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Aa;IAEhF,OAAO,SAAS,sBAAsB,CAAC,KAA6B;QAClE,OAAO,IAAI,mBAAmB,CAAU,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC","file":"except.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { arrayIndexOfAsync } from '../../util/arrayindexof';\nimport { comparerAsync } from '../../util/comparer';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\nimport { wrapWithAbort } from './withabort';\nimport { throwIfAborted } from '../../aborterror';\n\nexport class ExceptAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n  private _first: AsyncIterable<TSource>;\n  private _second: AsyncIterable<TSource>;\n  private _comparer: (x: TSource, y: TSource) => boolean | Promise<boolean>;\n\n  constructor(\n    first: AsyncIterable<TSource>,\n    second: AsyncIterable<TSource>,\n    comparer: (x: TSource, y: TSource) => boolean | Promise<boolean>\n  ) {\n    super();\n    this._first = first;\n    this._second = second;\n    this._comparer = comparer;\n  }\n\n  async *[Symbol.asyncIterator](signal?: AbortSignal) {\n    throwIfAborted(signal);\n    const map = [] as TSource[];\n    for await (const secondItem of wrapWithAbort(this._second, signal)) {\n      map.push(secondItem);\n    }\n\n    for await (const firstItem of wrapWithAbort(this._first, signal)) {\n      if ((await arrayIndexOfAsync(map, firstItem, this._comparer)) === -1) {\n        map.push(firstItem);\n        yield firstItem;\n      }\n    }\n  }\n}\n\n/**\n *  Produces the set difference of two async-iterable sequences by using the specified equality comparer to compare values.\n *\n * @export\n * @template TSource The type of the elements of the input sequences.\n * @param {AsyncIterable<TSource>} second An async-iterable sequence whose elements that also occur in the\n * operator sequence will cause those elements to be removed from the returned sequence.\n * @param {((x: TSource, y: TSource) => boolean | Promise<boolean>)} [comparer=comparerAsync] An equality comparer to compare values\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An operator that returns a sequence that contains the set\n * difference of the elements of two sequences.\n */\nexport function except<TSource>(\n  second: AsyncIterable<TSource>,\n  comparer: (x: TSource, y: TSource) => boolean | Promise<boolean> = comparerAsync\n): MonoTypeOperatorAsyncFunction<TSource> {\n  return function exceptOperatorFunction(first: AsyncIterable<TSource>): AsyncIterableX<TSource> {\n    return new ExceptAsyncIterable<TSource>(first, second, comparer);\n  };\n}\n"]}