text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/4.8/esri/copyright.txt for details.
  //>>built
  define("require exports @dojo/shim/Map @dojo/shim/Set ../../../../../core/SetPool ./Tile".split(" "),function(k,l,f,p,g,m){Object.defineProperty(l,"__esModule",{value:!0});var e=[],h=new p.default;k=function(){function c(){this._tileById=new f.default;this._tilesToFeatures=new f.default;this._featureToTiles=new f.default}c.prototype.destroy=function(){this.clear()};c.prototype.add=function(a){var b=this;this.has(a.id)||(this._tileById.set(a.id,a),this._tilesToFeatures.set(a,g.default.acquire()),this._tilesToFeatures.forEach(function(n,
  d){if(a!==d)if(m.isParentOf(a,d))n.forEach(function(d){b._link(a,d)});else if(m.isChildOf(a,d)){d=0;for(var e=b.store.searchBounds(a.bounds);d<e.length;d++){var c=e[d].oid;n.has(c)&&b._link(a,c)}}}))};c.prototype.clear=function(){this._tilesToFeatures.forEach(function(a){return g.default.release(a)});this._tilesToFeatures.clear();this._featureToTiles.forEach(function(a){return g.default.release(a)});this._featureToTiles.clear();this._tileById.clear()};c.prototype.delete=function(a){var b=this,c=this.get(a.id);
  e.length=0;this._tilesToFeatures.get(c).forEach(function(a){var d=b._featureToTiles.get(a);d.has(c)&&1===d.size?e.push(a):b._unlink(c,a)});for(a=0;a<e.length;a++)this._unlink(c,e[a]);this.store.delete(e);this._tilesToFeatures.delete(c);this._tileById.delete(c.id);e.length=0};c.prototype.forEach=function(a,b){return this._tileById.forEach(a,b)};c.prototype.get=function(a){return this._tileById.get(a)};c.prototype.has=function(a){return this._tileById.has(a)};c.prototype.load=function(a,b){var c=this,
  d=this.get(a.id);this._tilesToFeatures.has(d)||(this._tileById.set(d.id,d),this._tilesToFeatures.set(d,g.default.acquire()));a=this.store.objectIdField;for(var f=0;f<b.length;f++)h.add(b[f].attributes[a]);e.length=0;this._tilesToFeatures.get(d).forEach(function(a){if(!h.has(a)){var b=c._featureToTiles.get(a);b.has(d)&&1===b.size?e.push(a):c._unlink(d,a)}});for(a=0;a<e.length;a++)this._unlink(d,e[a]);this.store.delete(e);this.store.load(b);h.forEach(function(a){c._link(d,a)});h.clear();e.length=0};
  c.prototype._link=function(a,b){this._featureToTiles.get(b)||this._featureToTiles.set(b,g.default.acquire());this._featureToTiles.get(b).add(a);this._tilesToFeatures.get(a).add(b)};c.prototype._unlink=function(a,b){this._featureToTiles.get(b).delete(a);this._tilesToFeatures.get(a).delete(b);0===this._featureToTiles.get(b).size&&(g.default.release(this._featureToTiles.get(b)),this._featureToTiles.delete(b))};return c}();l.default=k});