/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{tileSize as t}from"../../../engine/webgl/definitions.js";import{createArcadeEvaluationOptions as e}from"../support/arcadeUtils.js";class r{constructor(t){this._options=t}insert(t,r){const o=t.getCursor(),{arcadeContextInfo:s,scale:i}=this._options,n=e(i,s);for(;o.next();)this._insertFeature(o,n,this._options.sqlOptions,r)}_insertFeature(e,r,o,s){const{featureFilter:i}=this._options;if(null!==i&&!i.check(e,o))return;let n=0,c=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),c=e.readYWorldSpace();else{if(s){const r=e.readCentroidForDisplay();if(null==r)return;const[o,s]=r.coords;if(o<0||o>t||s<0||s>t)return}const r=e.readCentroidWorldSpace();if(null==r)return;n=r.coords[0],c=r.coords[1]}this._insert(e,n,c,r)}}export{r as AAggregateSpatialIndex};
