import { l } from "./chunk-6RAL4JPQ.js"; import { i } from "./chunk-VAY3LZG7.js"; import { n as n2 } from "./chunk-H6ETEALK.js"; import { e } from "./chunk-FIYKFRB2.js"; import { n } from "./chunk-DT6EAZQ5.js"; import { a } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/views/2d/layers/features/support/TileStore.js var n3 = { added: [], removed: [] }; var r = new Set(); var d = new e(0, 0, 0, 0); var l2 = class extends n { constructor(e2) { super(), this._tiles = new Map(), this._index = i(9, a("esri-csp-restrictions") ? (e3) => ({ minX: e3.bounds[0], minY: e3.bounds[1], maxX: e3.bounds[2], maxY: e3.bounds[3] }) : [".bounds[0]", ".bounds[1]", ".bounds[2]", ".bounds[3]"]), this.tiles = [], this.tileScheme = e2; } destroy() { this.clear(); } clear() { this.tiles.length = 0, this._tiles.clear(), this._index.clear(); } has(e2) { return this._tiles.has(e2); } get(e2) { return this._tiles.get(e2); } boundsIntersections(e2) { return this._index.search({ minX: e2[0], minY: e2[1], maxX: e2[2], maxY: e2[3] }); } updateTiles(e2) { const t = { added: [], removed: [] }; for (const s of e2.added) if (!this.has(s)) { const e3 = new n2(this.tileScheme, s); this._tiles.set(s, e3), this._index.insert(e3), t.added.push(e3); } for (const s of e2.removed) if (this.has(s)) { const e3 = this.get(s); this._tiles.delete(s), this._index.remove(e3), t.removed.push(e3); } this.tiles.length = 0, this._tiles.forEach((e3) => this.tiles.push(e3)), (t.added.length || t.removed.length) && this.emit("update", t); } setViewState(e2) { const t = this.tileScheme.getTileCoverage(e2, 0); if (!t) return; const { spans: s, lodInfo: h } = t, { level: l3 } = h; if (s.length > 0) for (const { row: o, colFrom: a2, colTo: m } of s) for (let e3 = a2; e3 <= m; e3++) { const t2 = d.set(l3, o, h.normalizeCol(e3), h.getWorldForColumn(e3)).id; if (r.add(t2), !this.has(t2)) { const e4 = new n2(this.tileScheme, t2); this._tiles.set(t2, e4), this._index.insert(e4), this.tiles.push(e4), n3.added.push(e4); } } for (let i2 = this.tiles.length - 1; i2 >= 0; i2--) { const e3 = this.tiles[i2]; r.has(e3.id) || (this._tiles.delete(e3.id), this.tiles.splice(i2, 1), this._index.remove(e3), n3.removed.push(e3)); } (n3.added.length || n3.removed.length) && this.emit("update", n3), l.pool.release(t), r.clear(), n3.added.length = 0, n3.removed.length = 0; } }; export { l2 as l }; //# sourceMappingURL=chunk-TYZ4SNOQ.js.map