/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../core/ObjectPool","../../../core/PooledArray","../../../chunks/vec4","../../../chunks/vec4f64"],(function(e,t,i,s,u){"use strict";let n=function(){this.extent=u.create(),this.minLevel=0,this.maxLevel=0,this.callback=null},r=function(){function e(){this._queries=new i({initialSize:10}),this._queriesInvPtr=0,this._queryQueue=new i({initialSize:30}),this._queryPool=new t(n)}var u=e.prototype;return u.queryVisibleLevelRange=function(e,t,i,u){const n=this._queryPool.acquire();s.copy(n.extent,e),n.minLevel=t||-Number.MAX_VALUE,n.maxLevel=null!=i?i:Number.MAX_VALUE,n.callback=u,this._queryQueue.push(n)},u.hasPendingQueries=function(){return 0!==this._queryQueue.length},u.prepareQueries=function(){for(;this._queries.length<this._queries.data.length&&this._queryQueue.length>0;){const e=this._queryQueue.pop();this._queries.push(e)}this._queriesInvPtr=this._queries.length},u.processQueries=function(){for(let e=0;e<this._queries.length;e++){const t=this._queries.data[e];this._queryPool.release(t),t.callback(e>=this._queriesInvPtr),t.callback=null}this._queries.clear()},u.scaleQueriesForTile=function(e){const t=e.level;let i=0;for(;i<this._queriesInvPtr;){const s=this._queries.data[i],u=s.extent;t>=s.minLevel&&t<=s.maxLevel&&u[0]<=e.extent[2]&&u[2]>=e.extent[0]&&u[1]<=e.extent[3]&&u[3]>=e.extent[1]?(this._queries.swapElements(i,this._queriesInvPtr-1),this._queriesInvPtr--):i++}},e}();e.ScaleRangeQueries=r,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
