/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
export default $arcgis.t(([f])=>{async function F(n,e){let t=[],s=n?n.map(o=>b(o,e)):[Promise.resolve()];return(await Promise.all(s)).forEach(o=>{t=[...t,...o||[]]}),t}async function d(n,e,t,s,r,o){let u=e.capabilities?.query.maxRecordCount||1e3,l=0;n.length===0&&(n=await e.queryObjectIds());let c=e.createQuery();if(c.returnGeometry=s,c.objectIds=n.slice(l,u),r&&(c.outSpatialReference=r),o){let q=e.fields.map(i=>i.name.toLowerCase());c.outFields=o.filter(i=>q.indexOf(i.toLowerCase())>-1)}let m=await e.queryFeatures(c);t=t.concat(m.features);let y=n.slice(u,n.length);return y.length>0?d(y,e,t,s,r,o):Promise.resolve(t)}async function I(n,e){let t=e.globalIdField;if(!t)return[];let s=e.createQuery();return s.returnGeometry=!1,s.outFields=[e.objectIdField],s.where=n.map(o=>`${t} = '${o}'`).join(" or "),(await e.queryFeatures(s)).features}async function p(n,e,t,s){let r=e.capabilities?.query.maxRecordCount||1e3,o=e.createQuery();o.start=n,o.num=r,o.geometry=t;let u=await e.queryFeatures(o);return s[e.id]=s[e.id].concat(u.features),u.exceededTransferLimit?p(n+=r,e,t,s):Promise.resolve(s)}async function w(n,e){let t=e.createQuery();return t.objectIds=n,e.queryExtent(t)}function x(n){let e=[],t=a(n,"polygon");t&&e.push(t);let s=a(n,"polyline");s&&e.push(s);let r=a(n,"point");return r&&e.push(r),e}function a(n,e){let t=(n||[]).filter(s=>s.type===e);return t.length<=1?t[0]:f.executeMany(t)}async function b(n,e){let t=e.createQuery();return t.spatialRelationship="intersects",t.geometry=n,e.queryObjectIds(t)}return{a:F,b:d,c:I,d:p,e:w,f:x}},"geometry/operators/unionOperator")