chunk-OQSZOHTF.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. import {
  2. E as E2,
  3. b,
  4. v as v3
  5. } from "./chunk-Y7BZ6TKQ.js";
  6. import {
  7. g
  8. } from "./chunk-VEJPYAE4.js";
  9. import {
  10. f as f2
  11. } from "./chunk-4GGDRIJK.js";
  12. import {
  13. D,
  14. F,
  15. N,
  16. S,
  17. T,
  18. V,
  19. c,
  20. d,
  21. f,
  22. m,
  23. p,
  24. v as v2,
  25. x
  26. } from "./chunk-PZ7XDUL6.js";
  27. import {
  28. s as s2
  29. } from "./chunk-UMUHMVL4.js";
  30. import {
  31. e as e2
  32. } from "./chunk-OKUFE7TO.js";
  33. import {
  34. te
  35. } from "./chunk-CRGY2SDS.js";
  36. import {
  37. i
  38. } from "./chunk-4T5ZGMEN.js";
  39. import {
  40. e,
  41. l,
  42. r as r2,
  43. v
  44. } from "./chunk-VCH45Q2I.js";
  45. import {
  46. E,
  47. I
  48. } from "./chunk-PQFTYGF5.js";
  49. import {
  50. s3 as s
  51. } from "./chunk-E5O6P5I2.js";
  52. import {
  53. r,
  54. t
  55. } from "./chunk-YXWMMD76.js";
  56. // node_modules/@arcgis/core/core/sql/WhereClauseCache.js
  57. var c2 = class {
  58. constructor(e4, c4) {
  59. this._cache = new e2(e4), this._invalidCache = new e2(c4);
  60. }
  61. get(t4, c4) {
  62. const i2 = `${c4.uid}:${t4}`, r5 = this._cache.get(i2);
  63. if (r5)
  64. return r5;
  65. if (void 0 !== this._invalidCache.get(i2))
  66. return null;
  67. try {
  68. const r6 = f2.create(t4, c4);
  69. return this._cache.put(i2, r6), r6;
  70. } catch {
  71. return this._invalidCache.put(i2, null), null;
  72. }
  73. }
  74. };
  75. // node_modules/@arcgis/core/layers/graphics/data/attributeSupport.js
  76. var s3 = new c2(50, 500);
  77. var n = "feature-store:unsupported-query";
  78. var t2 = " as ";
  79. var r3 = /* @__PURE__ */ new Set(["esriFieldTypeOID", "esriFieldTypeSmallInteger", "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble", "esriFieldTypeLong", "esriFieldTypeDate"]);
  80. function o(i2, t4) {
  81. if (!t4)
  82. return true;
  83. const r5 = s3.get(t4, i2);
  84. if (!r5)
  85. throw new s(n, "invalid SQL expression", { where: t4 });
  86. if (!r5.isStandardized)
  87. throw new s(n, "where clause is not standard", { where: t4 });
  88. return c3(i2, r5.fieldNames, "where clause contains missing fields"), true;
  89. }
  90. function a(i2, t4, r5) {
  91. if (!t4)
  92. return true;
  93. const o2 = s3.get(t4, i2);
  94. if (!o2)
  95. throw new s(n, "invalid SQL expression", { having: t4 });
  96. if (!o2.isAggregate)
  97. throw new s(n, "having does not contain a valid aggregate function", { having: t4 });
  98. const a2 = o2.fieldNames;
  99. c3(i2, a2, "having contains missing fields");
  100. if (!o2.getExpressions().every((e4) => {
  101. const { aggregateType: s4, field: n2 } = e4, t5 = i2.has(n2) && i2.get(n2).name;
  102. return r5.some((e5) => {
  103. const { onStatisticField: n3, statisticType: r6 } = e5;
  104. return (i2.has(n3) && i2.get(n3).name) === t5 && r6.toLowerCase().trim() === s4;
  105. });
  106. }))
  107. throw new s(n, "expressions in having should also exist in outStatistics", { having: t4 });
  108. return true;
  109. }
  110. function l2(e4, i2) {
  111. return e4 ? s3.get(e4, i2) : null;
  112. }
  113. function c3(i2, s4, t4, r5 = true) {
  114. const o2 = [];
  115. for (const u2 of s4)
  116. if ("*" !== u2 && !i2.has(u2))
  117. if (r5) {
  118. const s5 = d2(u2);
  119. try {
  120. const t5 = l2(s5, i2);
  121. if (!t5)
  122. throw new s(n, "invalid SQL expression", { where: s5 });
  123. if (!t5.isStandardized)
  124. throw new s(n, "expression is not standard", { clause: t5 });
  125. c3(i2, t5.fieldNames, "expression contains missing fields");
  126. } catch (a2) {
  127. const e4 = a2 && a2.details;
  128. if (e4 && (e4.clause || e4.where))
  129. throw a2;
  130. e4 && e4.missingFields ? o2.push(...e4.missingFields) : o2.push(u2);
  131. }
  132. } else
  133. o2.push(u2);
  134. if (o2.length)
  135. throw new s(n, t4, { missingFields: o2 });
  136. }
  137. function d2(e4) {
  138. return e4.split(t2)[0];
  139. }
  140. function u(e4) {
  141. return e4.split(t2)[1];
  142. }
  143. function f3(e4, i2) {
  144. const s4 = i2.get(e4);
  145. return !!s4 && !r3.has(s4.type);
  146. }
  147. // node_modules/@arcgis/core/layers/graphics/data/AttributesBuilder.js
  148. var r4 = class {
  149. constructor(t4, a2, l3) {
  150. var _a;
  151. this._fieldDataCache = /* @__PURE__ */ new Map(), this._returnDistinctMap = /* @__PURE__ */ new Map(), this.returnDistinctValues = (_a = t4.returnDistinctValues) != null ? _a : false, this.fieldsIndex = l3, this.featureAdapter = a2;
  152. const r5 = t4.outFields;
  153. if (r5 && !r5.includes("*")) {
  154. this.outFields = r5;
  155. let t5 = 0;
  156. for (const a3 of r5) {
  157. const r6 = d2(a3), n2 = this.fieldsIndex.get(r6), u2 = n2 ? null : l2(r6, l3), d3 = n2 ? n2.name : u(a3) || "FIELD_EXP_" + t5++;
  158. this._fieldDataCache.set(a3, { alias: d3, clause: u2 });
  159. }
  160. }
  161. }
  162. countDistinctValues(t4) {
  163. return this.returnDistinctValues ? (t4.forEach((t5) => this.getAttributes(t5)), this._returnDistinctMap.size) : t4.length;
  164. }
  165. getAttributes(t4) {
  166. const e4 = this._processAttributesForOutFields(t4);
  167. return this._processAttributesForDistinctValues(e4);
  168. }
  169. getFieldValue(t4, e4, s4) {
  170. const a2 = s4 ? s4.name : e4;
  171. let l3 = null;
  172. return this._fieldDataCache.has(a2) ? l3 = this._fieldDataCache.get(a2).clause : s4 || (l3 = l2(e4, this.fieldsIndex), this._fieldDataCache.set(a2, { alias: a2, clause: l3 })), s4 ? this.featureAdapter.getAttribute(t4, a2) : l3.calculateValue(t4, this.featureAdapter);
  173. }
  174. getDataValue(t4, e4) {
  175. const i2 = e4.normalizationType, s4 = e4.normalizationTotal;
  176. let r5 = this.getFieldValue(t4, e4.field, this.fieldsIndex.get(e4.field));
  177. if (e4.field2 && (r5 = `${c(r5)}${e4.fieldDelimiter}${c(this.getFieldValue(t4, e4.field2, this.fieldsIndex.get(e4.field2)))}`, e4.field3 && (r5 = `${r5}${e4.fieldDelimiter}${c(this.getFieldValue(t4, e4.field3, this.fieldsIndex.get(e4.field3)))}`)), i2 && Number.isFinite(r5)) {
  178. const a2 = "field" === i2 && e4.normalizationField ? this.getFieldValue(t4, e4.normalizationField, this.fieldsIndex.get(e4.normalizationField)) : null;
  179. r5 = x(r5, i2, a2, s4);
  180. }
  181. return r5;
  182. }
  183. getExpressionValue(t4, e4, i2, s4) {
  184. const a2 = { attributes: this.featureAdapter.getAttributes(t4), layer: { fields: this.fieldsIndex.fields } }, l3 = s4.createExecContext(a2, i2);
  185. return s4.executeFunction(e4, l3);
  186. }
  187. getExpressionValues(t4, e4, i2, s4) {
  188. const a2 = { fields: this.fieldsIndex.fields };
  189. return t4.map((t5) => {
  190. const l3 = { attributes: this.featureAdapter.getAttributes(t5), layer: a2 }, r5 = s4.createExecContext(l3, i2);
  191. return s4.executeFunction(e4, r5);
  192. });
  193. }
  194. validateItem(t4, e4) {
  195. return this._fieldDataCache.has(e4) || this._fieldDataCache.set(e4, { alias: e4, clause: l2(e4, this.fieldsIndex) }), this._fieldDataCache.get(e4).clause.testFeature(t4, this.featureAdapter);
  196. }
  197. validateItems(t4, e4) {
  198. return this._fieldDataCache.has(e4) || this._fieldDataCache.set(e4, { alias: e4, clause: l2(e4, this.fieldsIndex) }), this._fieldDataCache.get(e4).clause.testSet(t4, this.featureAdapter);
  199. }
  200. _processAttributesForOutFields(t4) {
  201. const e4 = this.outFields;
  202. if (!e4 || !e4.length)
  203. return this.featureAdapter.getAttributes(t4);
  204. const i2 = {};
  205. for (const s4 of e4) {
  206. const { alias: e5, clause: a2 } = this._fieldDataCache.get(s4);
  207. i2[e5] = a2 ? a2.calculateValue(t4, this.featureAdapter) : this.featureAdapter.getAttribute(t4, e5);
  208. }
  209. return i2;
  210. }
  211. _processAttributesForDistinctValues(e4) {
  212. if (t(e4) || !this.returnDistinctValues)
  213. return e4;
  214. const i2 = this.outFields, s4 = [];
  215. if (i2)
  216. for (const t4 of i2) {
  217. const { alias: i3 } = this._fieldDataCache.get(t4);
  218. s4.push(e4[i3]);
  219. }
  220. else
  221. for (const t4 in e4)
  222. s4.push(e4[t4]);
  223. const a2 = `${(i2 || ["*"]).join(",")}=${s4.join(",")}`;
  224. let l3 = this._returnDistinctMap.get(a2) || 0;
  225. return this._returnDistinctMap.set(a2, ++l3), l3 > 1 ? null : e4;
  226. }
  227. };
  228. // node_modules/@arcgis/core/layers/graphics/data/SnappingCandidate.js
  229. function t3(t4, e4, r5) {
  230. return { objectId: t4, target: e4, distance: r5, type: "vertex" };
  231. }
  232. function e3(t4, e4, r5, n2, d3, a2 = false) {
  233. return { objectId: t4, target: e4, distance: r5, type: "edge", start: n2, end: d3, draped: a2 };
  234. }
  235. // node_modules/@arcgis/core/layers/graphics/data/QueryEngineResult.js
  236. var A = class {
  237. constructor(e4, t4, i2) {
  238. this.items = e4, this.query = t4, this.geometryType = i2.geometryType, this.hasM = i2.hasM, this.hasZ = i2.hasZ, this.fieldsIndex = i2.fieldsIndex, this.objectIdField = i2.objectIdField, this.spatialReference = i2.spatialReference, this.featureAdapter = i2.featureAdapter;
  239. }
  240. get size() {
  241. return this.items.length;
  242. }
  243. createQueryResponseForCount() {
  244. const e4 = new r4(this.query, this.featureAdapter, this.fieldsIndex);
  245. if (!this.query.outStatistics)
  246. return e4.countDistinctValues(this.items);
  247. const { groupByFieldsForStatistics: t4, having: i2, outStatistics: s4 } = this.query, a2 = t4 == null ? void 0 : t4.length;
  248. if (!!!a2)
  249. return 1;
  250. const r5 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), o2 = /* @__PURE__ */ new Set();
  251. for (const l3 of s4) {
  252. const { statisticType: s5 } = l3, a3 = "exceedslimit" !== s5 ? l3.onStatisticField : void 0;
  253. if (!n2.has(a3)) {
  254. const i3 = [];
  255. for (const s6 of t4) {
  256. const t5 = this._getAttributeValues(e4, s6, r5);
  257. i3.push(t5);
  258. }
  259. n2.set(a3, this._calculateUniqueValues(i3, e4.returnDistinctValues));
  260. }
  261. const u2 = n2.get(a3);
  262. for (const t5 in u2) {
  263. const { data: s6, items: a4 } = u2[t5], r6 = s6.join(",");
  264. i2 && !e4.validateItems(a4, i2) || o2.add(r6);
  265. }
  266. }
  267. return o2.size;
  268. }
  269. async createQueryResponse() {
  270. let e4;
  271. if (this.query.outStatistics) {
  272. e4 = this.query.outStatistics.some((e5) => "exceedslimit" === e5.statisticType) ? this._createExceedsLimitQueryResponse(this.query) : await this._createStatisticsQueryResponse(this.query);
  273. } else
  274. e4 = this._createFeatureQueryResponse(this.query);
  275. return this.query.returnQueryGeometry && (I(this.query.outSR) && !E(this.query.geometry.spatialReference, this.query.outSR) ? e4.queryGeometry = E2({ spatialReference: this.query.outSR, ...g(this.query.geometry, this.query.geometry.spatialReference, this.query.outSR) }) : e4.queryGeometry = E2({ spatialReference: this.query.outSR, ...this.query.geometry })), e4;
  276. }
  277. createSnappingResponse(t4, i2) {
  278. const s4 = this.featureAdapter, a2 = N2(this.hasZ, this.hasM), { point: r5 } = t4, n2 = "number" == typeof t4.distance ? t4.distance : t4.distance.x, o2 = "number" == typeof t4.distance ? t4.distance : t4.distance.y, l3 = { candidates: [] }, u2 = "esriGeometryPolygon" === this.geometryType, c4 = null != r5.z, h = null != r5.m, f4 = this._getPointCreator(r5, c4, h, this.spatialReference, i2), g2 = new D2(null, 0), p2 = new D2(null, 0), y = { x: 0, y: 0, z: 0 };
  279. for (const x2 of this.items) {
  280. const i3 = s4.getGeometry(x2);
  281. if (t(i3))
  282. continue;
  283. const { coords: c5, lengths: h2 } = i3;
  284. if (g2.coords = c5, p2.coords = c5, t4.types & q.EDGE) {
  285. let e4 = 0;
  286. for (let t5 = 0; t5 < h2.length; t5++) {
  287. const i4 = h2[t5];
  288. for (let t6 = 0; t6 < i4; t6++, e4 += a2) {
  289. const u3 = g2;
  290. if (u3.coordsIndex = e4, t6 !== i4 - 1) {
  291. const t7 = p2;
  292. t7.coordsIndex = e4 + a2;
  293. const i5 = y;
  294. E3(y, r5, u3, t7);
  295. const c6 = (r5.x - i5.x) / n2, m2 = (r5.y - i5.y) / o2, h3 = c6 * c6 + m2 * m2;
  296. h3 <= 1 && l3.candidates.push(e3(s4.getObjectId(x2), f4(i5), Math.sqrt(h3), f4(u3), f4(t7)));
  297. }
  298. }
  299. }
  300. }
  301. if (t4.types & q.VERTEX) {
  302. const e4 = u2 ? c5.length - a2 : c5.length;
  303. for (let t5 = 0; t5 < e4; t5 += a2) {
  304. const e5 = g2;
  305. e5.coordsIndex = t5;
  306. const i4 = (r5.x - e5.x) / n2, a3 = (r5.y - e5.y) / o2, u3 = i4 * i4 + a3 * a3;
  307. u3 <= 1 && l3.candidates.push(t3(s4.getObjectId(x2), f4(e5), Math.sqrt(u3)));
  308. }
  309. }
  310. }
  311. return l3.candidates.sort((e4, t5) => e4.distance - t5.distance), l3;
  312. }
  313. _getPointCreator(e4, i2, s4, a2, r5) {
  314. const n2 = r(r5) && !E(a2, r5) ? (e5) => g(e5, a2, r5) : (e5) => e5, { hasZ: o2 } = this, u2 = 0, d3 = e4.m;
  315. return i2 && s4 ? o2 ? ({ x: e5, y: t4, z: i3 }) => n2({ x: e5, y: t4, z: i3, m: d3 }) : ({ x: e5, y: t4 }) => n2({ x: e5, y: t4, z: u2, m: d3 }) : i2 ? o2 ? ({ x: e5, y: t4, z: i3 }) => n2({ x: e5, y: t4, z: i3 }) : ({ x: e5, y: t4 }) => n2({ x: e5, y: t4, z: u2 }) : s4 ? ({ x: e5, y: t4 }) => n2({ x: e5, y: t4, m: d3 }) : ({ x: e5, y: t4 }) => n2({ x: e5, y: t4 });
  316. }
  317. async createSummaryStatisticsResponse(e4) {
  318. const { field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, minValue: n2, maxValue: o2, scale: l3 } = e4, u2 = this.fieldsIndex.isDateField(t4), c4 = await this._getDataValues({ field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, scale: l3 }), d3 = m({ normalizationType: a2, normalizationField: s4, minValue: n2, maxValue: o2 }), m2 = this.fieldsIndex.get(t4), h = { value: 0.5, fieldType: m2 == null ? void 0 : m2.type }, f4 = te(m2) ? f({ values: c4, supportsNullCount: d3, percentileParams: h }) : d({ values: c4, minValue: n2, maxValue: o2, useSampleStdDev: !a2, supportsNullCount: d3, percentileParams: h });
  319. return V(f4, u2);
  320. }
  321. async createUniqueValuesResponse(e4) {
  322. const { field: t4, valueExpression: i2, domains: s4, returnAllCodedValues: a2, scale: r5 } = e4, n2 = await this._getDataValues({ field: t4, field2: e4.field2, field3: e4.field3, fieldDelimiter: e4.fieldDelimiter, valueExpression: i2, scale: r5 }), o2 = T(n2);
  323. return F(o2, s4, a2, e4.fieldDelimiter);
  324. }
  325. async createClassBreaksResponse(e4) {
  326. const { field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, classificationMethod: n2, standardDeviationInterval: o2, minValue: l3, maxValue: u2, numClasses: c4, scale: d3 } = e4, m2 = await this._getDataValues({ field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, scale: d3 }), h = D(m2, { field: t4, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, classificationMethod: n2, standardDeviationInterval: o2, minValue: l3, maxValue: u2, numClasses: c4 });
  327. return N(h, n2);
  328. }
  329. async createHistogramResponse(e4) {
  330. const { field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, classificationMethod: n2, standardDeviationInterval: o2, minValue: l3, maxValue: u2, numBins: c4, scale: d3 } = e4, m2 = await this._getDataValues({ field: t4, valueExpression: i2, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, scale: d3 });
  331. return S(m2, { field: t4, normalizationField: s4, normalizationType: a2, normalizationTotal: r5, classificationMethod: n2, standardDeviationInterval: o2, minValue: l3, maxValue: u2, numBins: c4 });
  332. }
  333. _sortFeatures(e4, t4, i2) {
  334. if (e4.length > 1 && t4 && t4.length)
  335. for (const s4 of t4.reverse()) {
  336. const t5 = s4.split(" "), a2 = t5[0], r5 = this.fieldsIndex.get(a2), n2 = t5[1] && "desc" === t5[1].toLowerCase(), o2 = v2(r5 == null ? void 0 : r5.type, n2);
  337. e4.sort((e5, t6) => {
  338. const s5 = i2(e5, a2, r5), n3 = i2(t6, a2, r5);
  339. return o2(s5, n3);
  340. });
  341. }
  342. }
  343. _createFeatureQueryResponse(e4) {
  344. const t4 = this.items, { geometryType: i2, hasM: s4, hasZ: a2, objectIdField: r5, spatialReference: o2 } = this, { outFields: l3, outSR: u2, quantizationParameters: c4, resultRecordCount: d3, resultOffset: m2, returnZ: f4, returnM: g2 } = e4, p2 = null != d3 && t4.length > (m2 || 0) + d3, y = l3 && (l3.includes("*") ? [...this.fieldsIndex.fields] : l3.map((e5) => this.fieldsIndex.get(e5)));
  345. return { exceededTransferLimit: p2, features: this._createFeatures(e4, t4), fields: y, geometryType: i2, hasM: s4 && g2, hasZ: a2 && f4, objectIdFieldName: r5, spatialReference: E2(u2 || o2), transform: c4 && s2(c4) || null };
  346. }
  347. _createFeatures(e4, t4) {
  348. const i2 = new r4(e4, this.featureAdapter, this.fieldsIndex), { hasM: s4, hasZ: a2 } = this, { orderByFields: r5, quantizationParameters: o2, returnGeometry: l3, returnCentroid: c4, maxAllowableOffset: d3, resultOffset: m2, resultRecordCount: h, returnZ: p2 = false, returnM: y = false } = e4, x2 = a2 && p2, I2 = s4 && y;
  349. let T2 = [], V2 = 0;
  350. const F2 = [...t4];
  351. if (this._sortFeatures(F2, r5, (e5, t5, s5) => i2.getFieldValue(e5, t5, s5)), l3 || c4) {
  352. const e5 = s2(o2);
  353. if (l3 && !c4)
  354. for (const t5 of F2)
  355. T2[V2++] = { attributes: i2.getAttributes(t5), geometry: v3(this.geometryType, this.hasZ, this.hasM, this.featureAdapter.getGeometry(t5), d3, e5, x2, I2) };
  356. else if (!l3 && c4)
  357. for (const t5 of F2)
  358. T2[V2++] = { attributes: i2.getAttributes(t5), centroid: b(this, this.featureAdapter.getCentroid(t5, this), e5) };
  359. else
  360. for (const t5 of F2)
  361. T2[V2++] = { attributes: i2.getAttributes(t5), centroid: b(this, this.featureAdapter.getCentroid(t5, this), e5), geometry: v3(this.geometryType, this.hasZ, this.hasM, this.featureAdapter.getGeometry(t5), d3, e5, x2, I2) };
  362. } else
  363. for (const n2 of F2) {
  364. const e5 = i2.getAttributes(n2);
  365. e5 && (T2[V2++] = { attributes: e5 });
  366. }
  367. const z = m2 || 0;
  368. if (null != h) {
  369. const e5 = z + h;
  370. T2 = T2.slice(z, Math.min(T2.length, e5));
  371. }
  372. return T2;
  373. }
  374. _createExceedsLimitQueryResponse(e4) {
  375. let i2 = false, s4 = Number.POSITIVE_INFINITY, a2 = Number.POSITIVE_INFINITY, r5 = Number.POSITIVE_INFINITY;
  376. for (const t4 of e4.outStatistics)
  377. if ("exceedslimit" === t4.statisticType) {
  378. s4 = null != t4.maxPointCount ? t4.maxPointCount : Number.POSITIVE_INFINITY, a2 = null != t4.maxRecordCount ? t4.maxRecordCount : Number.POSITIVE_INFINITY, r5 = null != t4.maxVertexCount ? t4.maxVertexCount : Number.POSITIVE_INFINITY;
  379. break;
  380. }
  381. if ("esriGeometryPoint" === this.geometryType)
  382. i2 = this.items.length > s4;
  383. else if (this.items.length > a2)
  384. i2 = true;
  385. else {
  386. const e5 = N2(this.hasZ, this.hasM), s5 = this.featureAdapter;
  387. i2 = this.items.reduce((e6, i3) => {
  388. const a3 = s5.getGeometry(i3);
  389. return e6 + (r(a3) && a3.coords.length || 0);
  390. }, 0) / e5 > r5;
  391. }
  392. return { fields: [{ name: "exceedslimit", type: "esriFieldTypeInteger", alias: "exceedslimit", sqlType: "sqlTypeInteger", domain: null, defaultValue: null }], features: [{ attributes: { exceedslimit: Number(i2) } }] };
  393. }
  394. async _createStatisticsQueryResponse(e4) {
  395. const t4 = { attributes: {} }, i2 = [], s4 = /* @__PURE__ */ new Map(), a2 = /* @__PURE__ */ new Map(), r5 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), o2 = new r4(e4, this.featureAdapter, this.fieldsIndex), l3 = e4.outStatistics, { groupByFieldsForStatistics: c4, having: d3, orderByFields: m2 } = e4, h = c4 && c4.length, f4 = !!h, g2 = f4 && c4[0], p2 = f4 && !this.fieldsIndex.get(g2);
  396. for (const u2 of l3) {
  397. const { outStatisticFieldName: e5, statisticType: l4 } = u2, m3 = u2, y2 = "exceedslimit" !== l4 ? u2.onStatisticField : void 0, x2 = "percentile_disc" === l4 || "percentile_cont" === l4, I2 = "EnvelopeAggregate" === l4 || "CentroidAggregate" === l4 || "ConvexHullAggregate" === l4, T2 = f4 && 1 === h && (y2 === g2 || p2) && "count" === l4;
  398. if (f4) {
  399. if (!r5.has(y2)) {
  400. const e6 = [];
  401. for (const t6 of c4) {
  402. const i3 = this._getAttributeValues(o2, t6, s4);
  403. e6.push(i3);
  404. }
  405. r5.set(y2, this._calculateUniqueValues(e6, !I2 && o2.returnDistinctValues));
  406. }
  407. const t5 = r5.get(y2);
  408. for (const i3 in t5) {
  409. const { count: a3, data: r6, items: l5, itemPositions: u3 } = t5[i3], h2 = r6.join(",");
  410. if (!d3 || o2.validateItems(l5, d3)) {
  411. const t6 = n2.get(h2) || { attributes: {} };
  412. if (I2) {
  413. t6.aggregateGeometries || (t6.aggregateGeometries = {});
  414. const { aggregateGeometries: e6, outStatisticFieldName: i5 } = await this._getAggregateGeometry(m3, l5);
  415. t6.aggregateGeometries[i5] = e6;
  416. } else {
  417. let i5 = null;
  418. if (T2)
  419. i5 = a3;
  420. else {
  421. const e6 = this._getAttributeValues(o2, y2, s4), t7 = u3.map((t8) => e6[t8]);
  422. i5 = x2 && "statisticParameters" in m3 ? this._getPercentileValue(m3, t7) : this._getStatisticValue(m3, t7, null, o2.returnDistinctValues);
  423. }
  424. t6.attributes[e5] = i5;
  425. }
  426. let i4 = 0;
  427. c4.forEach((e6, s5) => t6.attributes[this.fieldsIndex.get(e6) ? e6 : "EXPR_" + ++i4] = r6[s5]), n2.set(h2, t6);
  428. }
  429. }
  430. } else if (I2) {
  431. t4.aggregateGeometries || (t4.aggregateGeometries = {});
  432. const { aggregateGeometries: e6, outStatisticFieldName: i3 } = await this._getAggregateGeometry(m3, this.items);
  433. t4.aggregateGeometries[i3] = e6;
  434. } else {
  435. const i3 = this._getAttributeValues(o2, y2, s4);
  436. t4.attributes[e5] = x2 && "statisticParameters" in m3 ? this._getPercentileValue(m3, i3) : this._getStatisticValue(m3, i3, a2, o2.returnDistinctValues);
  437. }
  438. i2.push({ name: e5, alias: e5, type: "esriFieldTypeDouble" });
  439. }
  440. const y = f4 ? Array.from(n2.values()) : [t4];
  441. return this._sortFeatures(y, m2, (e5, t5) => e5.attributes[t5]), { fields: i2, features: y };
  442. }
  443. async _getAggregateGeometry(e4, t4) {
  444. const n2 = await import("./geometryEngineJSON-CAFXKE3U.js"), { statisticType: o2, outStatisticFieldName: l3 } = e4, { featureAdapter: u2, spatialReference: c4, geometryType: d3, hasZ: m2, hasM: h } = this, g2 = t4.map((e5) => v3(d3, m2, h, u2.getGeometry(e5))), p2 = n2.convexHull(c4, g2, true)[0], y = { aggregateGeometries: null, outStatisticFieldName: null };
  445. if ("EnvelopeAggregate" === o2) {
  446. const e5 = p2 ? v(p2) : l(n2.union(c4, g2));
  447. y.aggregateGeometries = { ...e5, spatialReference: c4 }, y.outStatisticFieldName = l3 || "extent";
  448. } else if ("CentroidAggregate" === o2) {
  449. const e5 = p2 ? r2(p2) : e(l(n2.union(c4, g2)));
  450. y.aggregateGeometries = { x: e5[0], y: e5[1], spatialReference: c4 }, y.outStatisticFieldName = l3 || "centroid";
  451. } else
  452. "ConvexHullAggregate" === o2 && (y.aggregateGeometries = p2, y.outStatisticFieldName = l3 || "convexHull");
  453. return y;
  454. }
  455. _getStatisticValue(e4, t4, i2, s4) {
  456. const { onStatisticField: a2, statisticType: r5 } = e4;
  457. let n2 = null;
  458. n2 = (i2 == null ? void 0 : i2.has(a2)) ? i2.get(a2) : te(this.fieldsIndex.get(a2)) ? f({ values: t4, returnDistinct: s4 }) : d({ values: t4, minValue: null, maxValue: null, useSampleStdDev: true }), i2 && i2.set(a2, n2);
  459. return n2["var" === r5 ? "variance" : r5];
  460. }
  461. _getPercentileValue(e4, t4) {
  462. const { onStatisticField: i2, statisticParameters: s4, statisticType: a2 } = e4, { value: r5, orderBy: n2 } = s4, o2 = this.fieldsIndex.get(i2);
  463. return p(t4, { value: r5, orderBy: n2, fieldType: o2 == null ? void 0 : o2.type, isDiscrete: "percentile_disc" === a2 });
  464. }
  465. _getAttributeValues(e4, t4, i2) {
  466. if (i2.has(t4))
  467. return i2.get(t4);
  468. const s4 = this.fieldsIndex.get(t4), a2 = this.items.map((i3) => e4.getFieldValue(i3, t4, s4));
  469. return i2.set(t4, a2), a2;
  470. }
  471. _getAttributeDataValues(e4, t4) {
  472. return this.items.map((i2) => e4.getDataValue(i2, { field: t4.field, field2: t4.field2, field3: t4.field3, fieldDelimiter: t4.fieldDelimiter, normalizationField: t4.normalizationField, normalizationType: t4.normalizationType, normalizationTotal: t4.normalizationTotal }));
  473. }
  474. async _getAttributeExpressionValues(e4, t4, i2) {
  475. const { arcadeUtils: s4 } = await i(), a2 = s4.createFunction(t4), r5 = i2 && s4.getViewInfo(i2);
  476. return e4.getExpressionValues(this.items, a2, r5, s4);
  477. }
  478. _calculateUniqueValues(e4, t4) {
  479. const i2 = {}, s4 = this.items, a2 = s4.length;
  480. for (let r5 = 0; r5 < a2; r5++) {
  481. const a3 = s4[r5], n2 = [];
  482. for (const t5 of e4)
  483. n2.push(t5[r5]);
  484. const o2 = n2.join(",");
  485. t4 ? null == i2[o2] && (i2[o2] = { count: 1, data: n2, items: [a3], itemPositions: [r5] }) : null == i2[o2] ? i2[o2] = { count: 1, data: n2, items: [a3], itemPositions: [r5] } : (i2[o2].count++, i2[o2].items.push(a3), i2[o2].itemPositions.push(r5));
  486. }
  487. return i2;
  488. }
  489. async _getDataValues(e4) {
  490. const t4 = new r4(this.query, this.featureAdapter, this.fieldsIndex), { valueExpression: i2, field: s4, normalizationField: a2, normalizationType: r5, normalizationTotal: n2, scale: o2 } = e4, l3 = i2 ? { viewingMode: "map", scale: o2, spatialReference: this.query.outSR || this.spatialReference } : null;
  491. return i2 ? this._getAttributeExpressionValues(t4, i2, l3) : this._getAttributeDataValues(t4, { field: s4, field2: e4.field2, field3: e4.field3, fieldDelimiter: e4.fieldDelimiter, normalizationField: a2, normalizationType: r5, normalizationTotal: n2 });
  492. }
  493. };
  494. function E3(e4, t4, i2, s4) {
  495. const a2 = s4.x - i2.x, r5 = s4.y - i2.y, n2 = a2 * a2 + r5 * r5, o2 = (t4.x - i2.x) * a2 + (t4.y - i2.y) * r5, l3 = Math.min(1, Math.max(0, o2 / n2));
  496. e4.x = i2.x + a2 * l3, e4.y = i2.y + r5 * l3;
  497. }
  498. function N2(e4, t4) {
  499. return e4 ? t4 ? 4 : 3 : t4 ? 3 : 2;
  500. }
  501. var q;
  502. !function(e4) {
  503. e4[e4.NONE = 0] = "NONE", e4[e4.EDGE = 1] = "EDGE", e4[e4.VERTEX = 2] = "VERTEX";
  504. }(q || (q = {}));
  505. var D2 = class {
  506. constructor(e4, t4) {
  507. this.coords = e4, this.coordsIndex = t4;
  508. }
  509. get x() {
  510. return this.coords[this.coordsIndex];
  511. }
  512. get y() {
  513. return this.coords[this.coordsIndex + 1];
  514. }
  515. get z() {
  516. return this.coords[this.coordsIndex + 2];
  517. }
  518. };
  519. export {
  520. o,
  521. a,
  522. l2 as l,
  523. c3 as c,
  524. f3 as f,
  525. A,
  526. q
  527. };
  528. //# sourceMappingURL=chunk-OQSZOHTF.js.map