import { g } from "./chunk-RZFGRBD7.js"; import { y } from "./chunk-BJHM4JNS.js"; import { i } from "./chunk-UXF37FQ4.js"; import { c, d as d2 } from "./chunk-2Z6LERTI.js"; import { s } from "./chunk-PDKDCAAD.js"; import { o } from "./chunk-ECW2QABR.js"; import { k2 as k, r as r2 } from "./chunk-MRJEICT6.js"; import { d, e, l3 as l, n2 as n } from "./chunk-Y3WMVFTW.js"; import { m } from "./chunk-IKP3YN53.js"; import { e as e2, r } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/rest/support/FeatureSet.js var d3; var g2 = new s({ esriGeometryPoint: "point", esriGeometryMultipoint: "multipoint", esriGeometryPolyline: "polyline", esriGeometryPolygon: "polygon", esriGeometryEnvelope: "extent", mesh: "mesh", "": null }); var j = d3 = class extends l { constructor(e3) { super(e3), this.displayFieldName = null, this.exceededTransferLimit = false, this.features = [], this.fields = null, this.geometryType = null, this.hasM = false, this.hasZ = false, this.queryGeometry = null, this.spatialReference = null; } readFeatures(e3, t) { const o2 = k.fromJSON(t.spatialReference), s2 = []; for (let i2 = 0; i2 < e3.length; i2++) { const t2 = e3[i2], a = g.fromJSON(t2), p = t2.geometry && t2.geometry.spatialReference; r(a.geometry) && !p && (a.geometry.spatialReference = o2); const l2 = t2.aggregateGeometries, y2 = a.aggregateGeometries; if (l2 && r(y2)) for (const e4 in y2) { const t3 = y2[e4], r3 = l2[e4]?.spatialReference; r(t3) && !r3 && (t3.spatialReference = o2); } s2.push(a); } return s2; } writeGeometryType(e3, t, r3, o2) { if (e3) return void g2.write(e3, t, r3, o2); const { features: s2 } = this; if (s2) { for (const i2 of s2) if (i2 && r(i2.geometry)) return void g2.write(i2.geometry.type, t, r3, o2); } } readQueryGeometry(e3, t) { if (!e3) return null; const r3 = !!e3.spatialReference, o2 = d2(e3); return !r3 && t.spatialReference && (o2.spatialReference = k.fromJSON(t.spatialReference)), o2; } writeSpatialReference(e3, t) { if (e3) return void (t.spatialReference = e3.toJSON()); const { features: r3 } = this; if (r3) { for (const o2 of r3) if (o2 && r(o2.geometry) && o2.geometry.spatialReference) return void (t.spatialReference = o2.geometry.spatialReference.toJSON()); } } clone() { return new d3(this.cloneProperties()); } cloneProperties() { return m({ displayFieldName: this.displayFieldName, exceededTransferLimit: this.exceededTransferLimit, features: this.features, fields: this.fields, geometryType: this.geometryType, hasM: this.hasM, hasZ: this.hasZ, queryGeometry: this.queryGeometry, spatialReference: this.spatialReference, transform: this.transform }); } toJSON(e3) { const t = this.write(); if (t.features && Array.isArray(e3) && e3.length > 0) for (let r3 = 0; r3 < t.features.length; r3++) { const o2 = t.features[r3]; if (o2.geometry) { const t2 = e3 && e3[r3]; o2.geometry = t2 && t2.toJSON() || o2.geometry; } } return t; } quantize(e3) { const { scale: [t, r3], translate: [o2, s2] } = e3, i2 = (e4) => Math.round((e4 - o2) / t), n2 = (e4) => Math.round((s2 - e4) / r3), p = this.features, l2 = this._getQuantizationFunction(this.geometryType, i2, n2); for (let y2 = 0, m2 = p.length; y2 < m2; y2++) l2(e2(p[y2].geometry)) || (p.splice(y2, 1), y2--, m2--); return this.transform = e3, this; } unquantize() { const { geometryType: e3, features: t, transform: r3 } = this; if (!r3) return this; const { translate: [o2, s2], scale: [i2, a] } = r3, p = (e4) => e4 * i2 + o2, l2 = (e4) => s2 - e4 * a, y2 = this._getHydrationFunction(e3, p, l2); for (const { geometry: m2 } of t) r(m2) && y2(m2); return this.transform = null, this; } _quantizePoints(e3, t, r3) { let o2, s2; const i2 = []; for (let n2 = 0, a = e3.length; n2 < a; n2++) { const a2 = e3[n2]; if (n2 > 0) { const e4 = t(a2[0]), n3 = r3(a2[1]); e4 === o2 && n3 === s2 || (i2.push([e4 - o2, n3 - s2]), o2 = e4, s2 = n3); } else o2 = t(a2[0]), s2 = r3(a2[1]), i2.push([o2, s2]); } return i2.length > 0 ? i2 : null; } _getQuantizationFunction(e3, t, r3) { return e3 === "point" ? (e4) => (e4.x = t(e4.x), e4.y = r3(e4.y), e4) : e3 === "polyline" || e3 === "polygon" ? (e4) => { const o2 = c(e4) ? e4.rings : e4.paths, s2 = []; for (let i2 = 0, n2 = o2.length; i2 < n2; i2++) { const e5 = o2[i2], n3 = this._quantizePoints(e5, t, r3); n3 && s2.push(n3); } return s2.length > 0 ? (c(e4) ? e4.rings = s2 : e4.paths = s2, e4) : null; } : e3 === "multipoint" ? (e4) => { const o2 = this._quantizePoints(e4.points, t, r3); return o2.length > 0 ? (e4.points = o2, e4) : null; } : e3 === "extent" ? (e4) => e4 : null; } _getHydrationFunction(e3, t, r3) { return e3 === "point" ? (e4) => { e4.x = t(e4.x), e4.y = r3(e4.y); } : e3 === "polyline" || e3 === "polygon" ? (e4) => { const o2 = c(e4) ? e4.rings : e4.paths; let s2, i2; for (let n2 = 0, a = o2.length; n2 < a; n2++) { const e5 = o2[n2]; for (let o3 = 0, n3 = e5.length; o3 < n3; o3++) { const n4 = e5[o3]; o3 > 0 ? (s2 += n4[0], i2 += n4[1]) : (s2 = n4[0], i2 = n4[1]), n4[0] = t(s2), n4[1] = r3(i2); } } } : e3 === "extent" ? (e4) => { e4.xmin = t(e4.xmin), e4.ymin = r3(e4.ymin), e4.xmax = t(e4.xmax), e4.ymax = r3(e4.ymax); } : e3 === "multipoint" ? (e4) => { const o2 = e4.points; let s2, i2; for (let n2 = 0, a = o2.length; n2 < a; n2++) { const e5 = o2[n2]; n2 > 0 ? (s2 += e5[0], i2 += e5[1]) : (s2 = e5[0], i2 = e5[1]), e5[0] = t(s2), e5[1] = r3(i2); } } : void 0; } }; e([d({ type: String, json: { write: true } })], j.prototype, "displayFieldName", void 0), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "exceededTransferLimit", void 0), e([d({ type: [g], json: { write: true } })], j.prototype, "features", void 0), e([o("features")], j.prototype, "readFeatures", null), e([d({ type: [y], json: { write: true } })], j.prototype, "fields", void 0), e([d({ type: ["point", "multipoint", "polyline", "polygon", "extent", "mesh"], json: { read: { reader: g2.read } } })], j.prototype, "geometryType", void 0), e([r2("geometryType")], j.prototype, "writeGeometryType", null), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "hasM", void 0), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "hasZ", void 0), e([d({ types: i, json: { write: true } })], j.prototype, "queryGeometry", void 0), e([o("queryGeometry")], j.prototype, "readQueryGeometry", null), e([d({ type: k, json: { write: true } })], j.prototype, "spatialReference", void 0), e([r2("spatialReference")], j.prototype, "writeSpatialReference", null), e([d({ json: { write: true } })], j.prototype, "transform", void 0), j = d3 = e([n("esri.rest.support.FeatureSet")], j), j.prototype.toJSON.isDefaultToJSON = true; var x = j; export { x }; //# sourceMappingURL=chunk-2VFJVI2I.js.map