"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function T(n,I,{concurrency:o=Number.POSITIVE_INFINITY,stopOnError:b=!0,signal:a}={}){return new Promise((w,x)=>{if(n[Symbol.iterator]===void 0&&n[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof n})`);if(typeof I!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(o)&&o>=1||o===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${o}\` (${typeof o})`);const p=[],c=[],d=new Map;let m=!1,s=!1,S=!1,u=0,h=0;const g=n[Symbol.iterator]===void 0?n[Symbol.asyncIterator]():n[Symbol.iterator](),i=e=>{m=!0,s=!0,x(e)};a&&(a.aborted&&i(a.reason),a.addEventListener("abort",()=>{i(a.reason)}));const l=async()=>{if(s)return;const e=await g.next(),f=h;if(h++,e.done){if(S=!0,u===0&&!s){if(!b&&c.length>0){i(new AggregateError(c));return}if(s=!0,d.size===0){w(p);return}const t=[];for(const[r,E]of p.entries())d.get(r)!==y&&t.push(E);w(t)}return}u++,(async()=>{try{const t=await e.value;if(s)return;const r=await I(t,f);r===y&&d.set(f,r),p[f]=r,u--,await l()}catch(t){if(b)i(t);else{c.push(t),u--;try{await l()}catch(r){i(r)}}}})()};(async()=>{for(let e=0;e<o;e++){try{await l()}catch(f){i(f);break}if(S||m)break}})()})}const y=Symbol("skip");exports.default=T;exports.pMapSkip=y;
//# sourceMappingURL=index-CUgqEqMa.js.map
