import { e } from "./chunk-M5BTTMP6.js"; import { h } from "./chunk-4GGRJYTB.js"; import { ge } from "./chunk-FYNVVMWY.js"; import { s as s3, t as t2 } from "./chunk-HBMVUVZX.js"; import { O } from "./chunk-WNCU6BFU.js"; import { D, u } from "./chunk-N2663GRX.js"; import { n } from "./chunk-DT6EAZQ5.js"; import { s, s3 as s2 } from "./chunk-EMJ4ZSM2.js"; import { a, r, t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/layers/graphics/data/BoundsStore.js var n2 = 5e4; var t3 = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; function e2(i2) { t3.minX = i2[0], t3.minY = i2[1], t3.maxX = i2[2], t3.maxY = i2[3]; } function o(i2, s4, d) { e2(s4), i2.search(t3, d); } var h2 = class { constructor() { this._indexInvalid = false, this._boundsToLoad = [], this._boundsById = new Map(), this._idByBounds = new Map(), this._index = new h(9, a("esri-csp-restrictions") ? (i2) => ({ minX: i2[0], minY: i2[1], maxX: i2[2], maxY: i2[3] }) : ["[0]", "[1]", "[2]", "[3]"]), this._loadIndex = () => { if (this._indexInvalid) { const i2 = new Array(this._idByBounds.size); let s4 = 0; this._idByBounds.forEach((d, n3) => { i2[s4++] = n3; }), this._indexInvalid = false, this._index.clear(), this._index.load(i2); } else this._boundsToLoad.length && (this._index.load(this._boundsToLoad.filter((i2) => this._idByBounds.has(i2))), this._boundsToLoad.length = 0); }; } get fullBounds() { if (!this._boundsById.size) return null; const i2 = D(); for (const s4 of this._boundsById.values()) s4 && (i2[0] = Math.min(s4[0], i2[0]), i2[1] = Math.min(s4[1], i2[1]), i2[2] = Math.max(s4[2], i2[2]), i2[3] = Math.max(s4[3], i2[3])); return i2; } get valid() { return !this._indexInvalid; } clear() { this._indexInvalid = false, this._boundsToLoad.length = 0, this._boundsById.clear(), this._idByBounds.clear(), this._index.clear(); } delete(i2) { const s4 = this._boundsById.get(i2); this._boundsById.delete(i2), s4 && (this._idByBounds.delete(s4), this._indexInvalid || this._index.remove(s4)); } forEachInBounds(i2, s4) { this._loadIndex(), o(this._index, i2, (i3) => s4(this._idByBounds.get(i3))); } get(i2) { return this._boundsById.get(i2); } has(i2) { return this._boundsById.has(i2); } invalidateIndex() { this._indexInvalid || (this._indexInvalid = true, this._boundsToLoad.length = 0); } set(i2, s4) { if (!this._indexInvalid) { const s5 = this._boundsById.get(i2); s5 && (this._index.remove(s5), this._idByBounds.delete(s5)); } this._boundsById.set(i2, s4), s4 && (this._idByBounds.set(s4, i2), this._indexInvalid || (this._boundsToLoad.push(s4), this._boundsToLoad.length > n2 && this._loadIndex())); } }; // node_modules/@arcgis/core/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js var i = { getObjectId: (t4) => t4.objectId, getAttributes: (t4) => t4.attributes, getAttribute: (t4, e3) => t4.attributes[e3], cloneWithGeometry: (t4, e3) => new s3(e3, t4.attributes, null, t4.objectId), getGeometry: (t4) => t4.geometry, getCentroid: (r2, i2) => (t(r2.centroid) && (r2.centroid = e(new t2(), r2.geometry, i2.hasZ, i2.hasM)), r2.centroid) }; // node_modules/@arcgis/core/layers/graphics/data/FeatureStore.js var u2 = class { constructor(e3) { this.geometryInfo = e3, this._boundsStore = new h2(), this._featuresById = new Map(), this._markedIds = new Set(), this.events = new n(), this.featureAdapter = i; } get geometryType() { return this.geometryInfo.geometryType; } get hasM() { return this.geometryInfo.hasM; } get hasZ() { return this.geometryInfo.hasZ; } get numFeatures() { return this._featuresById.size; } get fullBounds() { return this._boundsStore.fullBounds; } get storeStatistics() { let e3 = 0; return this._featuresById.forEach((t4) => { r(t4.geometry) && t4.geometry.coords && (e3 += t4.geometry.coords.length); }), { featureCount: this._featuresById.size, vertexCount: e3 / (this.hasZ ? this.hasM ? 4 : 3 : this.hasM ? 3 : 2) }; } add(e3) { this._add(e3), this._emitChanged(); } addMany(e3) { for (const t4 of e3) this._add(t4); this._emitChanged(); } clear() { this._featuresById.clear(), this._boundsStore.clear(), this._emitChanged(); } removeById(e3) { const t4 = this._featuresById.get(e3); return t4 ? (this._remove(t4), this._emitChanged(), t4) : null; } removeManyById(e3) { this._boundsStore.invalidateIndex(); for (const t4 of e3) { const e4 = this._featuresById.get(t4); e4 && this._remove(e4); } this._emitChanged(); } forEachBounds(e3, t4, r2) { for (const s4 of e3) { const e4 = this._boundsStore.get(s4.objectId); e4 && t4(O(r2, e4)); } } getFeature(e3) { return this._featuresById.get(e3); } has(e3) { return this._featuresById.has(e3); } toArray() { return Array.from(this._featuresById.values()); } forEach(e3) { this._featuresById.forEach((t4) => e3(t4)); } forEachInBounds(e3, t4) { this._boundsStore.forEachInBounds(e3, (e4) => { t4(this._featuresById.get(e4)); }); } startMarkingUsedFeatures() { this._boundsStore.invalidateIndex(), this._markedIds.clear(); } sweep() { let e3 = false; this._featuresById.forEach((t4, r2) => { this._markedIds.has(r2) || (e3 = true, this._remove(t4)); }), this._markedIds.clear(), e3 && this._emitChanged(); } _emitChanged() { this.events.emit("changed", void 0); } _add(t4) { if (!t4) return; const i2 = t4.objectId; if (i2 == null) return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new s2("featurestore:invalid-feature", "feature id is missing", { feature: t4 })); const n3 = this._featuresById.get(i2); let h3; if (this._markedIds.add(i2), n3 ? (t4.displayId = n3.displayId, h3 = this._boundsStore.get(i2), this._boundsStore.delete(i2)) : r(this.onFeatureAdd) && this.onFeatureAdd(t4), t(t4.geometry) || !t4.geometry.coords || !t4.geometry.coords.length) return this._boundsStore.set(i2, null), void this._featuresById.set(i2, t4); h3 = ge(r(h3) ? h3 : u(), t4.geometry, this.geometryInfo.hasZ, this.geometryInfo.hasM), r(h3) && this._boundsStore.set(i2, h3), this._featuresById.set(i2, t4); } _remove(e3) { return r(this.onFeatureRemove) && this.onFeatureRemove(e3), this._markedIds.delete(e3.objectId), this._boundsStore.delete(e3.objectId), this._featuresById.delete(e3.objectId), e3; } }; export { h2 as h, u2 as u }; //# sourceMappingURL=chunk-5FHVUYVE.js.map