{"version":3,"sources":["../src/combine.ts"],"sourcesContent":["import { createQueue } from './queue.js';\n\nexport const combine = <T, R = unknown>(...iterables: AsyncIterable<T>[]) => {\n  const queue = createQueue<IteratorResult<T, R>>();\n\n  Promise.all(\n    iterables.map(async (iterable) => {\n      for await (const value of iterable) {\n        await queue.push({ value, done: false }).promise;\n      }\n    }),\n  ).then(async () => queue.done({ value: null, done: true }));\n\n  return {\n    [Symbol.asyncIterator]() {\n      return {\n        next() {\n          return queue.pull().promise;\n        },\n      };\n    },\n  };\n};\n"],"names":["combine","iterables","queue","createQueue","Promise","all","map","iterable","value","push","done","promise","then","Symbol","asyncIterator","next","pull"],"mappings":";;;;+BAEaA;;;eAAAA;;;0BAFe;AAErB,MAAMA,UAAU,CAAiB,GAAGC;IACzC,MAAMC,QAAQC,IAAAA,qBAAW;IAEzBC,QAAQC,GAAG,CACTJ,UAAUK,GAAG,CAAC,OAAOC;QACnB,WAAW,MAAMC,SAASD,SAAU;YAClC,MAAML,MAAMO,IAAI,CAAC;gBAAED;gBAAOE,MAAM;YAAM,GAAGC,OAAO;QAClD;IACF,IACAC,IAAI,CAAC,UAAYV,MAAMQ,IAAI,CAAC;YAAEF,OAAO;YAAME,MAAM;QAAK;IAExD,OAAO;QACL,CAACG,OAAOC,aAAa,CAAC;YACpB,OAAO;gBACLC;oBACE,OAAOb,MAAMc,IAAI,GAAGL,OAAO;gBAC7B;YACF;QACF;IACF;AACF"}