// 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/mathUtils ../../../core/maybe ../../../core/ObjectPool ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../core/libs/gl-matrix-2/math/common ../../../geometry/ellipsoidUtils ../../../geometry/support/aaBoundingRect ../../../chunks/sphere ../../../layers/support/layerUtils ./ElevationBounds ./ElevationTileAgent ./interfaces ./LayerClass ./MapTileAgent ./NeighborIndex ./TerrainConst ./TerrainData ./terrainUtils ./TileAgent ./TileFrustumVisibility ./TilePerLayerInfo ./TileUpdate ./tileUtils".split(" "),
function(p,W,X,M,k,w,Y,Z,E,z,N,O,P,A,q,Q,t,aa,x,g,u,y,F,l,G){function C(a){a.dispose();P.isElevationTileAgent(a)?H.release(a):Q.isMapTileAgent(a)&&I.release(a)}function R(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]}function S(a,b,c){return null==a||null==b||b===a?!1:a.level>=b.level?T(a,b,c):T(b,a,g.oppositeCorner(c))}function T(a,b,c){g.internalAssert(a.level>=b.level);var d=g.isWestCorner(c),e=g.isNorthCorner(c),f=a.extent;c=b.extent;var h=[d?f[0]:f[2],e?f[3]:f[1]];const n=[d?c[2]:c[0],e?
c[1]:c[3]];d=1E-5*(f[2]-f[0]);e=g.almostEquals(h[0],n[0],d)||a.surface.isGlobal&&g.almostEquals(h[0],-n[0],d);h=g.almostEquals(h[1],n[1],d);if(e&&h)return!0;if(a.level===b.level||!e&&!h)return g.internalAssert(!1),!1;e?(a=f[1],f=f[3],c=c[1]-d<=a&&a<=f&&f<=c[3]+d):(a=f[0],f=f[2],c=c[0]-d<=a&&a<=f&&f<=c[2]+d);g.internalAssert(c);return c}class ba{constructor(){this._lij=[0,0,0];this._children=[null,null,null,null];this._pendingUpdates=0;this.renderData=null;this._dirty=!0;this._previouslyRendered=!1;
this.extent=E.create();this._elevationBoundsMin=NaN;this._elevationBoundsMax=0;this.layerInfo=[[],[]];this.extentInRadians=E.create();this.centerAtSeaLevel=w.create();this._center=[w.create(),z.create(),w.create()];this.up=w.unitZ();this._intersectsClippingArea=this._isWithinClippingArea=!0;this._maxTesselation=0;this._usedMemory=null;this.extentMidY=this.extentMidX=this._curvatureHeight=this._edgeLen2=this._edgeLen=this.renderOrder=this.screenDepth=this._mapDataRefCount=this._mapTileMemoryInternal=
0;this.distanceToPOI=-1;this._lastPOI=w.create();this.unmergableChildCount=this.maxLevelDeltaNeighborCount=0}get lij(){return this._lij}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}static prune(){I.prune(0);H.prune(0);F.TilePerLayerInfo.prune()}get _isCached(){return!this.isLeaf&&0>=this._mapDataRefCount}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[p.CenterPosition.MIDDLE][3]}get visible(){this._dirty&&
this.computeVisibility();return this._visible}get frustumVisibility(){this._dirty&&this.computeVisibility();return this._frustumVisibility}computeVisibility(){this._dirty=!1;var a=this.parent?.frustumVisibility??y.TileFrustumVisibility.INTERSECTS;this._frustumVisibility=a===y.TileFrustumVisibility.INSIDE?y.TileFrustumVisibility.INSIDE:a===y.TileFrustumVisibility.OUTSIDE?y.TileFrustumVisibility.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);a=this._frustumVisibility!==y.TileFrustumVisibility.OUTSIDE&&
this._intersectsClippingArea;a!==this._visible&&(this._visible=a,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const a=!!this.renderData;a!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=a,this._surface.renderer.setDirty());return a}init(a,b,c,d,e){this._lij[0]=a;this._lij[1]=b;this._lij[2]=
c;this.ellipsoid=Z.getReferenceEllipsoid(e.tilingScheme.spatialReference);e.tilingScheme.getExtent(a,b,c,this.extent);e.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians);this.extentMidX=.5*(this.extent[0]+this.extent[2]);this.extentMidY=.5*(this.extent[1]+this.extent[3]);this._intersectsClippingArea=this._isWithinClippingArea=!0;this._clippingArea=null;this._mapDataRefCount=0;e.upsampleMapCache.pop(this.key);this._edgeLen2=this._edgeLen=0;this._center[p.CenterPosition.MIDDLE][3]=
0;this.elevationLevel=a;d&&!Number.isNaN(d.elevationBoundsMin)?(this._elevationBoundsMin=d.elevationBoundsMin,this._elevationBoundsMax=d.elevationBoundsMax):this._elevationBoundsMax=this._elevationBoundsMin=0;this._pendingUpdates=0;this.renderData=null;this.screenDepth=0;this._previouslyRendered=this._visible=!1;this._parent=d;this.unsetChildren();this._surface=e;this.updateVisibility();this.unmergableChildCount=this.maxLevelDeltaNeighborCount=0;for(const f of q.LayerClasses){a=e.numLayers(f);b=this.layerInfo[f];
for(const h of b)h.release();b.length=a;for(c=0;ca;++a)this._children[a]=null;this._surface=null;this.setMemoryDirty()}refMapData(){++this._mapDataRefCount;this._isCached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount;if(this._isCached){this.setMemoryDirty();const a=this._cachedMemory;0a+(x.isVectorTile(b)?b.usedMemory/b.referenced:0),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const a=this._surface.tilingScheme.pixelSize;return a*a*4}_ensureUsedMemory(){if(null!=this._usedMemory)return this._usedMemory;this._usedMemory=this._baseUsedMemory;let a=this._mapTileMemoryInternal=0;for(var {data:b}of this.layerInfo[q.LayerClass.MAP])x.isVectorTile(b)?
a+=this._getTerrainDataMemory(b):this._mapTileMemoryInternal+=this._getTerrainDataMemory(b);b=this._cpuImageMemorySize;for(const c of this.layerInfo[q.LayerClass.ELEVATION])this._usedMemory+=c.data?b:0;this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=this.renderData.texture?.usedMemory??0);this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+a);return this._usedMemory}getUsedMemoryForLayer(a,
b){b=this.layerInfo[a][b];return b?.data?a===q.LayerClass.MAP?this._isCached?0:this._getTerrainDataMemory(b.data):a===q.LayerClass.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(a){return x.isTileTexture(a)?a.texture.usedMemory:x.isRasterTile(a)?a.memoryUsage:x.isVectorTile(a)?a.usedMemory/a.referenced:x.isImageWithType(a)||a instanceof HTMLImageElement?this._cpuImageMemorySize:0}updateScreenDepth(a){var b=this._center[p.CenterPosition.MIDDLE];const c=b[0],d=b[1];b=b[2];const e=a[2]*
c+a[6]*d+a[10]*b+a[14];this.screenDepth=0>e?0:e/(a[3]*c+a[7]*d+a[11]*b+a[15])}shouldSplit(a,b,c){if(!this.visible||a.frustum&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(a.frustum)===y.TileFrustumVisibility.OUTSIDE))return l.TileUpdate.NONE;const d=this.level;k.subtract(D,z.getCenter(this._center[p.CenterPosition.MIDDLE]),b);var e=k.squaredLength(D),f=D;let h=z.getCenter(this._center[p.CenterPosition.MIDDLE]);k.subtract(J,this._center[p.CenterPosition.TOP],b);var n=k.squaredLength(J);
ne&&d{if(d=B)return v();const L=k.dot(this.up,D);n=this._elevationBoundsMax-this._elevationBoundsMin;const V=n/this.edgeLen;if(a.aboveGround&&0V&&0=a.maxLod)return v();if(7>d)return l.TileUpdate.SPLIT;k.scale(r,this.up,L);k.subtract(r,r,f);f=k.squaredLength(r);if(f<=this.radius*this.radius)return l.TileUpdate.SPLIT;
k.scale(r,r,this.radius/Math.sqrt(f));k.add(r,r,h);k.subtract(r,b,r);return Math.min(1,(Math.abs(k.dot(r,this.up))+.5*n+this._curvatureHeight)/k.length(r))*(this._edgeLen/(a.fovY*e*2))*c<.1/a.angledSplitBias*a.relativeHeightLimit?l.TileUpdate.NONE:l.TileUpdate.SPLIT}setChildren(a,b,c,d){g.weakAssert(!!(a&&b&&c&&d),"Null child passed");const e=this._children;e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e}unsetChildren(){this._children[0]=null;this._children[1]=null;this._children[2]=null;this._children[3]=null}get isLoaded(){return this.renderData?.hasGeometry??
!1}load(){this.refMapData();for(const a of q.LayerClasses)this._createOrUpdateAgents(0,a);this.surface.renderer.loadTile(this)}unload(a){a.unloadTile(this);for(const b of q.LayerClasses){a=this.layerInfo[b];for(const c of a)c.loadingAgent&&c.loadingAgent!==u.tileAgentDone&&(C(c.loadingAgent),c.loadingAgent=null),c.pendingUpdates=0}this.resetPendingUpdate(l.TileUpdate.GEOMETRY);this.resetPendingUpdate(l.TileUpdate.TEXTURE_NOFADING);this.resetPendingUpdate(l.TileUpdate.TEXTURE_FADING);this.unrefMapData()}unloadMapData(){const a=
this.layerInfo[q.LayerClass.MAP];for(const b of a)b.loadingAgent&&b.loadingAgent!==u.tileAgentDone&&(C(b.loadingAgent),b.loadingAgent=null),b.pendingUpdates=0;this.renderData&&this.renderData.releaseTexture();this.setMemoryDirty()}updateClippingStatus(a){if(E.equals(a,this._clippingArea))return!1;var b=this._intersectsClippingArea;const c=this._isWithinClippingArea;null!=a?(this._intersectsClippingArea=this.intersectsExtent(a),this._isWithinClippingArea=this._isWithinExtent(a)):this._isWithinClippingArea=
this._intersectsClippingArea=!0;this._clippingArea=a;this.updateVisibility();a=c&&this._isWithinClippingArea;b=!c&&!b&&!this._isWithinClippingArea&&!this._intersectsClippingArea;!this.renderData||a||b||this.setPendingUpdate(l.TileUpdate.GEOMETRY);return!0}updateVisibility(){this._dirty=!0;this._surface.setTileTreeDirty()}getLayerInfo(a,b){return this.layerInfo[b][a]}hasLayerData(a,b){a=this.layerInfo[b][a];return!(!a?.data||a.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const a of q.LayerClasses){const b=
this.layerInfo[a];for(const c of b)if(c.loadingAgent&&c.loadingAgent!==u.tileAgentDone&&c.loadingAgent.updating)return!0}return!1}_isSuspended(a){return this.hasPendingUpdate(l.TileUpdate.SPLIT)?!0:a===q.LayerClass.ELEVATION?!1:!this.loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(a){return(this._pendingUpdates&a)===a}setPendingUpdate(a){const b=this._pendingUpdates;this._pendingUpdates|=a;a===l.TileUpdate.SPLIT||a===l.TileUpdate.MERGE?this._surface.setTileTreeDirty():
this._surface.requestUpdate();return b!==this._pendingUpdates}resetPendingUpdate(a){return this.hasPendingUpdate(a)?(this._pendingUpdates&=~a,!0):!1}requestLayerData(a,b,c){const d=this.layerInfo[b][a];if(d.waitingAgents.has(c))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),c.tile.lij.toString(),b,a),!0;d.waitingAgents.push(c);if(d.data&&!d.dataInvalidated)return console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",
this._lij.toString(),c.tile.lij.toString(),b,a),a=x.isVectorTile(d.data),c.dataArrived(this,a),!0;if(d.requestPromise)return!0;X.abortMaybe(d.requestAbort);d.requestAbort=new AbortController;const e=this._surface.requestTileData(this,a,b,d.requestAbort);if(!e)return d.requestAbort=null,!1;c=()=>{d.requestPromise===e&&(d.requestPromise=null,d.requestAbort=null)};d.requestPromise=e;e.then(c,c);return!0}get isLeaf(){return null==this._children[0]}hasLij(a){return this._lij[0]===a[0]&&this._lij[1]===
a[1]&&this._lij[2]===a[2]}findByLij(a){if(this.hasLij(a))return this;const b=this._children;return b[0]?b[0].findByLij(a)||b[1].findByLij(a)||b[2].findByLij(a)||b[3].findByLij(a):null}distanceToSquared(a){return k.squaredLength(k.subtract(r,z.getCenter(this._center[p.CenterPosition.MIDDLE]),a))}containsPoint(a){const b=this.extent;return a[0]>=b[0]&&a[1]>=b[1]&&a[0]<=b[2]&&a[1]<=b[3]}containsPointXY(a,b){const c=this.extent;return a>=c[0]&&b>=c[1]&&a<=c[2]&&b<=c[3]}unrequestLayerData(a,b,c){a=this.layerInfo[b][a];
b=a.waitingAgents;c=null!=b.removeUnordered(c);g.weakAssert(c,"agent has not requested this piece of map data");1>b.length&&(a.abortRequest(),this.setMemoryDirty())}dataArrived(a,b,c){const d=x.isVectorTile(c);a=this.layerInfo[b][a];a.data=c;a.dataInvalidated=!1;a.waitingAgents.forAll(e=>e.dataArrived(this,d));a.waitingAgents.clear();this.setMemoryDirty()}dataMissing(a,b){a=this.layerInfo[b][a];a.dataMissing=!0;a.waitingAgents.forAll(c=>c.dataMissing());a.waitingAgents.clear();this.setMemoryDirty()}updateRenderData(a,
b,c){c&&this.forEachLoadedNeighbor(d=>d.updateRenderData(a,b));switch(a){case q.LayerClass.MAP:return this._updateTexture(b);case q.LayerClass.ELEVATION:return this._updateGeometry()}}_updateTexture(a){this.renderData&&(this.resetPendingUpdate(a===A.TextureUpdate.FADING?l.TileUpdate.TEXTURE_NOFADING:l.TileUpdate.TEXTURE_FADING),this.setPendingUpdate(a===A.TextureUpdate.FADING?l.TileUpdate.TEXTURE_FADING:l.TileUpdate.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(l.TileUpdate.GEOMETRY);
for(const a of this.layerInfo[q.LayerClass.ELEVATION])a.pendingUpdates|=l.TileUpdate.GEOMETRY}invalidateLayerData(a,b){this.layerInfo[b][a].invalidateSourceData();this.restartAgents(b)}computeElevationBounds(){const a=this._elevationBoundsMin,b=this._elevationBoundsMax;let c=Infinity,d=-Infinity;const e=this.layerInfo[q.LayerClass.ELEVATION];let f=!0;for(const h of e)null!=h.elevationBounds&&(c=Math.min(c,h.elevationBounds.min),d=Math.max(d,h.elevationBounds.max),h.elevationBounds.hasNoDataValues||
(f=!1));f&&(c=Math.min(c,0),d=Math.max(d,0));if(a!==c||b!==d)this._elevationBoundsMin=c,this._elevationBoundsMax=d,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty()}_updateCenter(){const a=this._elevationBoundsMin,b=this._elevationBoundsMax,c=this._center;k.scale(r,this.up,.5*(a+b));k.add(z.getCenter(c[p.CenterPosition.MIDDLE]),this.centerAtSeaLevel,r);k.scale(r,this.up,a);k.add(c[p.CenterPosition.TOP],this.centerAtSeaLevel,r);k.scale(r,this.up,b);k.add(c[p.CenterPosition.BOTTOM],this.centerAtSeaLevel,
r)}findElevationBoundsForLayer(a,b){const c=this.layerInfo[q.LayerClass.ELEVATION][a],d=this.elevationLevelDelta,e=Math.max(this.elevationLevel-d,0);var f=c.elevationBounds;if(!(null!=f&&f.level>=b&&f.level<=e)&&(b=this._surface.layerViewByIndex(a,q.LayerClass.ELEVATION),b=g.getLayerWithExtentRange(b),G.fallsWithinLayer(this,b,!1))){b=ca;f=!1;var h=c.data;if(h&&h.level<=e)a=c.data,b.min=a.samplerData.data.minValue,b.max=a.samplerData.data.maxValue,b.hasNoDataValues=a.samplerData.data.hasNoDataValues,
b.level=this.level,f=!0;else{h=0;let n,m;for(let v=this._parent;v&&(!m||h=a[0]&&a[2]>=b[2]&&b[1]>=a[1]&&a[3]>=b[3]}intersectsExtent(a){const b=this.extent;return b[2]>=a[0]&&a[2]>=b[0]&&b[3]>=
a[1]&&a[3]>=b[1]}getElevationVerticesPerSide(a){a=W.clamp((this.maxTesselation>>Math.max(this.level-a,this.elevationLevelDelta-(this.elevationLevel-this.level)))+1,2,this.maxTesselation+1);const b=this.getDefaultVerticesPerSide();return Math.max(a,b)}_findLIJ(a,b){if(!a)return null;var c=this.surface.rootTiles;if(null!=c)for(var d of c){{c=d.lij;const e=a[0]-c[0];c=0>e?!1:a[1]>>e===c[1]&&a[2]>>e===c[2]}if(c){for(c=a[0]-d.level-1;0<=c&&!d.isLeaf&&!b(d);)d=d.children[2*(a[1]>>c&1)+(a[2]>>c&1)],c--;
return b(d)?d:null}}return null}findNeighborTile(a,b){const c=this._lij;return(a=this.getNeighborLIJ(c,a))?R(c,a)?b(this)?this:null:this._findLIJ(a,b):null}findCorner(a,b){a=a===t.NeighborIndex.NORTH_EAST?1:a===t.NeighborIndex.NORTH_WEST?0:a===t.NeighborIndex.SOUTH_WEST?2:3;let c=this;for(;c.children[0]&&(!b||!b(c));)c=c.children[a];return c}findNeighborCornerTileExact(a,b){return this.findNeighborTile(a,c=>b(c)||c.level===this.level)?.findCorner(g.oppositeCorner(a),b)||null}forAllSubtreeOnSide(a,
b){const c=a===t.NeighborIndex.NORTH?[0,1]:a===t.NeighborIndex.NORTH_EAST?[1]:a===t.NeighborIndex.EAST?[1,3]:a===t.NeighborIndex.SOUTH_EAST?[3]:a===t.NeighborIndex.SOUTH?[2,3]:a===t.NeighborIndex.SOUTH_WEST?[2]:a===t.NeighborIndex.WEST?[0,2]:[0],d=e=>{const f=e.children;!b(e)&&f[0]&&c.forEach(h=>d(f[h]))};d(this)}getNeighborEdgeStartVertexIndex(a,b){if(!b)return 0;var c=this.level-b.level;g.internalAssert(!g.enableTerrainInternalChecks||0<=c);if(0===c)return 0;c=2**c;var d=(a=1===(a&1))?0:1;b=b.lij[d+
1]*c;d=this._lij[d+1];const e=d-b;a=a?c-1-e:e;g.enableTerrainInternalChecks&&(g.internalAssert(b<=d&&dd.level===b||d.isLoaded;g.neighborEdgeIndices.forEach(d=>{const e=this.findNeighborTile(d,c);null!=e&&e!==this&&e.forAllSubtreeOnSide(g.oppositeEdge(d),f=>f.isLoaded?(a(f,d),!0):!1)});g.neighborCornerIndices.forEach(d=>{const e=this.findNeighborTile(d,c)?.findCorner(g.oppositeCorner(d),f=>f.isLoaded);g.internalAssert(!e||
S(this,e,d));e?.isLoaded&&a(e,d)})}getNeighborLIJ(a,b){const c=g.isNorth(b)?-1:g.isSouth(b)?1:0;b=g.isWest(b)?-1:g.isEast(b)?1:0;a=[a[0],a[1]+c,a[2]+b];return 0>a[1]?null:this.surface.isGlobal?this.wrapLIJ(a):0>a[2]?null:a}wrapLIJ(a){return!a||0>a[1]||a[1]>=2**a[0]?null:this.surface.wrapEastWest(a)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-
1}get isWestEnd(){return 0===this._lij[2]}get isNorthEnd(){return 0===this._lij[1]}get isSouthEnd(){const a=this.surface.extent?.[1]??null;return null!=a&&this.extent[1]+Y.getEpsilon()>=a}checkGeometryWaterproofness(){g.enableWaterproofTests&&(g.internalAssert(this.isLoaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(a){const b=this.extent,c=this.surface.rootTilesExtent,d=.25*(b[2]-b[0]);if(g.isNorth(a)&&b[3]+d>=c[3]||g.isSouth(a)&&b[1]-d<=c[1])return!1;const e=this.surface.isGlobal;
return!e&&g.isWest(a)&&b[0]-d<=c[0]||!e&&g.isEast(a)&&b[2]+d>=c[2]?!1:!0}updateDistanceToPOI(a){var b=this._lastPOI;if(!(0<=this.distanceToPOI&&b[0]===a[0]&&b[1]===a[1]&&b[2]===a[2])){k.copy(this._lastPOI,a);var c=this._center[p.CenterPosition.MIDDLE];b=a[0]-c[0];var d=a[1]-c[1];a=a[2]-c[2];this.distanceToPOI=b*b+d*d+a*a}}get test(){return{cachedMemory:this._cachedMemory}}}const I=new M(Q.MapTileAgent),H=new M(P.ElevationTileAgent),ca=new O.ElevationBounds;p.CenterPosition=void 0;(function(a){a[a.TOP=
0]="TOP";a[a.MIDDLE=1]="MIDDLE";a[a.BOTTOM=2]="BOTTOM"})(p.CenterPosition||(p.CenterPosition={}));const D=w.create(),J=w.create(),K=w.create(),r=w.create();p.Tile=ba;p.isCornerNeighbor=S;p.isEdgeNeighbor=function(a,b,c){if(null==a||null==b)return!1;if(0===a.level&&0===b.level&&(a.isEastEnd&&b.isWestEnd&&c===t.NeighborIndex.EAST||a.isWestEnd&&b.isEastEnd&&c===t.NeighborIndex.WEST))return!0;const d=Math.max(1E-6*(a.extent[2]-a.extent[0]),1);switch(c){case t.NeighborIndex.NORTH:return g.almostEquals(a.extent[3],
b.extent[1],d);case t.NeighborIndex.SOUTH:return g.almostEquals(a.extent[1],b.extent[3],d);case t.NeighborIndex.EAST:return g.almostEquals(a.extent[2],b.extent[0],d)||g.almostEquals(a.extent[2],-b.extent[0],d);case t.NeighborIndex.WEST:return g.almostEquals(a.extent[0],b.extent[2],d)||g.almostEquals(a.extent[0],-b.extent[2],d)}};p.lijEquals=R;Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});