/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import r from"../../../../../../../core/Error.js";import{throwIfAborted as e}from"../../../../../../../core/promiseUtils.js";import{FeatureSnapshotSourceChunk as n}from"../chunks/FeatureSnapshotSourceChunk.js";async function o(e,n,o,a={}){const s=(await Promise.allSettled(o.map(r=>t(e,n,r,a)))).filter(r=>"rejected"===r.status).map(r=>r.reason);if(s.length)throw new r("featurelayer-query","Encountered errors when downloading data",{errors:s})}async function t(r,o,t,a={}){const s=`${r.chunkPrefix??""}${t.num}`,u=await r.fetch(t.query,a,{chunkId:s}),i=new n(u,t.query.inner.toJSON(),t.num,!1);i.chunkId=i.normalizedChunkId=s,e(a),o.insert(i)}export{o as fetchPages};
