// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","../../../core/PooledArray","./RenderOrder"],function(f,k,q){function h(a,b){b(a);if(!a.isLeaf)for(const c of a.children)h(c,b)}function l(a,b){a=a.lij;b=b.lij;return a[0]-b[0]||a[1]-b[1]||a[2]-b[2]}function r(a,b){const c=b.screenDepth-a.screenDepth;if(0!==c)return c;a=a.lij;b=b.lij;return a[0]-b[0]||a[1]-b[1]||a[2]-b[2]}function t(a,b){const c=a.screenDepth-b.screenDepth;if(0!==c)return c;a=a.lij;b=b.lij;return a[0]-b[0]||a[1]-b[1]||a[2]-b[2]}function m(a,b,c){const d=a.screenDepth, e=b.screenDepth;return de?c:l(a,b)}function n(a,b,c,d){const e=p(a,d);d=p(b,d);return e===d?m(a,b,c):a?c:-c}function p(a,b){for(const c of b)if(a.intersectsExtent(c))return!0;return!1}function u(a,b){const c=a.distanceToPOI-b.distanceToPOI;if(0!==c)return c;a=a.lij;b=b.lij;return a[0]-b[0]||a[1]-b[1]||a[2]-b[2]}class v{constructor(){this._queue=new k;this.remove=()=>{}}get done(){return 0===this._queue.length&&(!this._last||this._last.isLeaf)}resetOne(a){this._queue.clear();this._queue.push(a); this._last=void 0}reset(a=null){this._queue.clear();null!=a&&this._queue.pushArray(a);this._last=void 0}skipSubtree(){this._last=void 0}next(){const a=this._last?.children;a?.[0]&&this._queue.pushArray(a);return this._last=this._queue.pop()}}class w{constructor(){this._q=new k}get done(){return 0===this._q.length}reset(a){this._q.clear();if(null!=a)for(this._q.pushArray(a),a=0;ad.xmax||e[3]>d.ymax)return!1}else if(d.xmin>e[2]|| d.ymin>e[3]||d.xmax1.00000001*c)return!1;b=b.maxScale;return 0e;e++){const g=d.children[e];if(g&&g!==c)return!0}}return!1};f.sortTiles=function(a,b,c=null){null==c||0===c.length?a===q.RenderOrder.BACK_TO_FRONT?b.sort(r):b.sort(t):b.sort((d,e)=>n(d,e,a,c))};f.sortTilesByPOI= function(a,b){const c=a.length;for(let d=0;d