{"version":3,"sources":["jsdelivr-header.js","/npm/p-all-limit@0.9.3/p-all-limit.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,8iBCNA,oBAAA,GAAA,SAAA,oBAAA,CAAA,gBAAA,IAAA,kBAAA,OAAA,QAAA,aAAA,qBAAO,IAAM,gBAAkB,CAC7B,EACA,EACA,KAEA,IAAI,EAAW,EAEf,OAAO,IAAI,SAAQ,CAAC,EAAS,KAC3B,IAAI,EAAU,GACV,GAAY,EAChB,MAAM,EAAO,KAGX,GAAqB,IAAjB,EAAM,QAA6B,IAAb,EACxB,OAAO,EAAQ,GAGjB,KAAO,EAAW,GAAS,EAAM,OAAS,GAAG,CAC3C,IACA,MAAM,EAAW,EAAM,QACvB,GAAa,EACb,MAAM,EAA6B,EACnC,EAAS,GACN,MAAM,IACL,EAAQ,GAA8B,EACtC,IACA,GAAK,IAEN,OAAO,IACN,EAAO,EAAK,GAElB,GAGF,GAAK,GACN","file":"/npm/p-all-limit@0.9.3/dist/p-all-limit.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/p-all-limit@0.9.3/dist/p-all-limit.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export const promiseAllLimit = <T>(\n  array: any[],\n  iterator: (item: any) => Promise<T>,\n  limit: number\n): Promise<T[]> => {\n  let inFlight = 0\n\n  return new Promise((resolve, reject) => {\n    let results = [] as T[]\n    let itemIndex = -1\n    const next = () => {\n\n\n      if (array.length === 0 && inFlight === 0) {\n        return resolve(results)\n      }\n\n      while (inFlight < limit && array.length > 0) {\n        inFlight++\n        const nextItem = array.shift() as T\n        itemIndex += 1\n        const currentIndexForThisClosure = itemIndex\n        iterator(nextItem)\n          .then((singleResult) => {\n            results[currentIndexForThisClosure] = singleResult\n            inFlight--\n            next()\n          })\n          .catch((error) => {\n            reject(error)\n          })\n      }\n    }\n\n    next()\n  })\n}\n"]}