chunk-NP2BYFXT.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. import {
  2. E as E2,
  3. a as a3,
  4. c as c3,
  5. f as f3,
  6. l as l2,
  7. o as o2,
  8. v as v2
  9. } from "./chunk-6H5PP7QI.js";
  10. import {
  11. I as I2,
  12. P as P2,
  13. n,
  14. t as t3,
  15. v as v3
  16. } from "./chunk-HSPVIAVJ.js";
  17. import {
  18. J,
  19. P,
  20. U,
  21. x
  22. } from "./chunk-XIEPNAEI.js";
  23. import {
  24. M,
  25. f as f2,
  26. g
  27. } from "./chunk-M5BTTMP6.js";
  28. import {
  29. t as t2
  30. } from "./chunk-WQJRLXWG.js";
  31. import {
  32. w
  33. } from "./chunk-ROWZMUVJ.js";
  34. import {
  35. L
  36. } from "./chunk-P4UZNLD5.js";
  37. import {
  38. te
  39. } from "./chunk-FYNVVMWY.js";
  40. import {
  41. d as d2
  42. } from "./chunk-KMAHKQ2G.js";
  43. import {
  44. h,
  45. r as r2
  46. } from "./chunk-522WBHUO.js";
  47. import {
  48. A,
  49. D,
  50. a as a2,
  51. f
  52. } from "./chunk-WNCU6BFU.js";
  53. import {
  54. a as a4
  55. } from "./chunk-LRDX4TO7.js";
  56. import {
  57. o,
  58. u
  59. } from "./chunk-N2663GRX.js";
  60. import {
  61. z
  62. } from "./chunk-O4FY3ITT.js";
  63. import {
  64. c as c2,
  65. d,
  66. s as s2
  67. } from "./chunk-2Z6LERTI.js";
  68. import {
  69. c
  70. } from "./chunk-OWVBLVP3.js";
  71. import {
  72. E,
  73. I
  74. } from "./chunk-MRJEICT6.js";
  75. import {
  76. s3 as s
  77. } from "./chunk-EMJ4ZSM2.js";
  78. import {
  79. m
  80. } from "./chunk-IKP3YN53.js";
  81. import {
  82. a2 as a,
  83. l,
  84. r,
  85. t,
  86. v2 as v,
  87. y2 as y
  88. } from "./chunk-GZT4BVFP.js";
  89. // node_modules/@arcgis/core/layers/graphics/data/QueryEngine.js
  90. function V(e) {
  91. return e.every((e2) => e2.statisticType !== "exceedslimit");
  92. }
  93. var W = "feature-store:unsupported-query";
  94. var K = new h(2e6);
  95. var X = 0;
  96. var Y = class {
  97. constructor(e) {
  98. this.capabilities = { query: t2 }, this.geometryType = e.geometryType, this.hasM = e.hasM, this.hasZ = e.hasZ, this.objectIdField = e.objectIdField, this.spatialReference = e.spatialReference, this.definitionExpression = e.definitionExpression, this.featureStore = e.featureStore, this.aggregateAdapter = e.aggregateAdapter, this._changeHandle = this.featureStore.events.on("changed", () => this.clearCache()), this.timeInfo = e.timeInfo, e.cacheSpatialQueries && (this._geometryQueryCache = new r2(X++ + "$$", K)), this.fieldsIndex = new d2(e.fields), e.scheduler && e.priority && (this._frameTask = e.scheduler.registerTask(e.priority));
  99. }
  100. destroy() {
  101. this._frameTask = a(this._frameTask), this.clearCache(), l(this._geometryQueryCache), this._changeHandle = a(this._changeHandle), l(this.fieldsIndex);
  102. }
  103. get featureAdapter() {
  104. return this.featureStore.featureAdapter;
  105. }
  106. get fullExtent() {
  107. const e = this.featureStore.fullBounds;
  108. return t(e) ? null : { xmin: e[0], ymin: e[1], xmax: e[2], ymax: e[3], spatialReference: x(this.spatialReference) };
  109. }
  110. get timeExtent() {
  111. return this.timeInfo ? (this._timeExtent || (this._timeExtent = t3(this.timeInfo, this.featureStore)), this._timeExtent) : null;
  112. }
  113. clearCache() {
  114. this._geometryQueryCache?.clear(), this._allItems = null, this._timeExtent = null;
  115. }
  116. async executeQuery(e, t4) {
  117. try {
  118. return (await this._executeQuery(e, {}, t4)).createQueryResponse();
  119. } catch (i) {
  120. if (i !== U)
  121. throw i;
  122. return new v2([], e, this).createQueryResponse();
  123. }
  124. }
  125. async executeQueryForCount(e = {}, t4) {
  126. try {
  127. return (await this._executeQuery(e, { returnGeometry: false, returnCentroid: false, outSR: null }, t4)).createQueryResponseForCount();
  128. } catch (i) {
  129. if (i !== U)
  130. throw i;
  131. return 0;
  132. }
  133. }
  134. async executeQueryForExtent(e, t4) {
  135. const i = e.outSR;
  136. try {
  137. const s3 = await this._executeQuery(e, { returnGeometry: true, returnCentroid: false, outSR: null }, t4), r3 = s3.size;
  138. if (!r3)
  139. return { count: 0, extent: null };
  140. A(te2, D), this.featureStore.forEachBounds(s3.items, (e2) => f(te2, e2), ee);
  141. const a5 = { xmin: te2[0], ymin: te2[1], xmax: te2[3], ymax: te2[4], spatialReference: x(this.spatialReference) };
  142. this.hasZ && isFinite(te2[2]) && isFinite(te2[5]) && (a5.zmin = te2[2], a5.zmax = te2[5]);
  143. const n2 = g(a5, s3.spatialReference, i);
  144. if (n2.spatialReference = x(i || this.spatialReference), n2.xmax - n2.xmin == 0) {
  145. const e2 = z(n2.spatialReference);
  146. n2.xmin -= e2, n2.xmax += e2;
  147. }
  148. if (n2.ymax - n2.ymin == 0) {
  149. const e2 = z(n2.spatialReference);
  150. n2.ymin -= e2, n2.ymax += e2;
  151. }
  152. if (this.hasZ && n2.zmin != null && n2.zmax != null && n2.zmax - n2.zmin == 0) {
  153. const e2 = z(n2.spatialReference);
  154. n2.zmin -= e2, n2.zmax += e2;
  155. }
  156. return { count: r3, extent: n2 };
  157. } catch (s3) {
  158. if (s3 === U)
  159. return { count: 0, extent: null };
  160. throw s3;
  161. }
  162. }
  163. async executeQueryForIds(e, t4) {
  164. return this.executeQueryForIdSet(e, t4).then((e2) => Array.from(e2));
  165. }
  166. async executeQueryForIdSet(e, t4) {
  167. try {
  168. const i = await this._executeQuery(e, { returnGeometry: true, returnCentroid: false, outSR: null }, t4), s3 = i.items, r3 = new Set();
  169. return await this._reschedule(() => {
  170. for (const e2 of s3)
  171. r3.add(i.featureAdapter.getObjectId(e2));
  172. }, t4), r3;
  173. } catch (i) {
  174. if (i === U)
  175. return new Set();
  176. throw i;
  177. }
  178. }
  179. async executeQueryForSnapping(e, t4) {
  180. const { point: i, distance: s3, types: r3 } = e;
  181. if (r3 === E2.NONE)
  182. return { candidates: [] };
  183. const a5 = await this._reschedule(() => this._checkQuerySupport(e.query), t4), o3 = !E(i.spatialReference, this.spatialReference);
  184. o3 && await f2(i.spatialReference, this.spatialReference);
  185. const u2 = typeof s3 == "number" ? s3 : s3.x, c4 = typeof s3 == "number" ? s3 : s3.y, h2 = { xmin: i.x - u2, xmax: i.x + u2, ymin: i.y - c4, ymax: i.y + c4, spatialReference: i.spatialReference }, l3 = o3 ? g(h2, this.spatialReference) : h2;
  186. if (!l3)
  187. return { candidates: [] };
  188. const m2 = (await L(d(i), null, { signal: t4 }))[0], p = (await L(d(l3), null, { signal: t4 }))[0];
  189. if (t(m2) || t(p))
  190. return { candidates: [] };
  191. const f4 = new v2(this._searchFeatures(this._getQueryBBoxes(p.toJSON())), a5, this);
  192. await this._reschedule(() => this._executeObjectIdsQuery(f4), t4), await this._reschedule(() => this._executeTimeQuery(f4), t4), await this._reschedule(() => this._executeAttributesQuery(f4), t4);
  193. const d3 = m2.toJSON(), y2 = o3 ? g(d3, this.spatialReference) : d3, g2 = o3 ? Math.max(l3.xmax - l3.xmin, l3.ymax - l3.ymin) / 2 : s3;
  194. return f4.createSnappingResponse({ ...e, point: y2, distance: g2 }, i.spatialReference);
  195. }
  196. async executeQueryForLatestObservations(e, t4) {
  197. if (!this.timeInfo || !this.timeInfo.trackIdField)
  198. throw new s(W, "Missing timeInfo or timeInfo.trackIdField", { query: e, timeInfo: this.timeInfo });
  199. try {
  200. const i = await this._executeQuery(e, {}, t4);
  201. return await this._reschedule(() => this._filterLatest(i), t4), i.createQueryResponse();
  202. } catch (s3) {
  203. if (s3 !== U)
  204. throw s3;
  205. return new v2([], e, this).createQueryResponse();
  206. }
  207. }
  208. async executeQueryForSummaryStatistics(e = {}, t4, i) {
  209. const { field: s3, normalizationField: r3, valueExpression: a5 } = t4;
  210. return (await this._getQueryEngineResultForStats(e, { field: s3, normalizationField: r3, valueExpression: a5 }, i)).createSummaryStatisticsResponse(t4);
  211. }
  212. async executeQueryForUniqueValues(e = {}, t4, i) {
  213. const { field: s3, valueExpression: r3 } = t4;
  214. return (await this._getQueryEngineResultForStats(e, { field: s3, valueExpression: r3 }, i)).createUniqueValuesResponse(t4);
  215. }
  216. async executeQueryForClassBreaks(e = {}, t4, i) {
  217. const { field: s3, normalizationField: r3, valueExpression: a5 } = t4;
  218. return (await this._getQueryEngineResultForStats(e, { field: s3, normalizationField: r3, valueExpression: a5 }, i)).createClassBreaksResponse(t4);
  219. }
  220. async executeQueryForHistogram(e = {}, t4, i) {
  221. const { field: s3, normalizationField: r3, valueExpression: a5 } = t4;
  222. return (await this._getQueryEngineResultForStats(e, { field: s3, normalizationField: r3, valueExpression: a5 }, i)).createHistogramResponse(t4);
  223. }
  224. async _schedule(e, t4) {
  225. return r(this._frameTask) ? this._frameTask.schedule(e, t4) : e(w);
  226. }
  227. async _reschedule(e, t4) {
  228. return r(this._frameTask) ? this._frameTask.reschedule(e, t4) : e(w);
  229. }
  230. _getAll(e) {
  231. return t(this._allItems) && (this._allItems = this.featureStore.toArray()), new v2(this._allItems, e, this);
  232. }
  233. async _executeQuery(e, t4, i) {
  234. e = m(e), e = await this._schedule(() => P(e, this.definitionExpression, this.spatialReference), i), e = await this._reschedule(() => this._checkQuerySupport(e), i), e = { ...e, ...t4 };
  235. const r3 = await this._reschedule(() => this._executeSceneFilterQuery(e, i), i), a5 = await this._reschedule(() => this._executeGeometryQuery(e, r3, i), i);
  236. return await this._reschedule(() => this._executeAggregateIdsQuery(a5), i), await this._reschedule(() => this._executeObjectIdsQuery(a5), i), await this._reschedule(() => this._executeTimeQuery(a5), i), await this._reschedule(() => this._executeAttributesQuery(a5), i), a5;
  237. }
  238. async _executeSceneFilterQuery(e, t4) {
  239. if (t(e.sceneFilter))
  240. return null;
  241. const { outSR: i, returnGeometry: s3, returnCentroid: r3 } = e, a5 = this.featureStore.featureSpatialReference, o3 = e.sceneFilter.geometry, u2 = t(a5) || E(a5, o3.spatialReference) ? o3 : g(o3, a5);
  242. if (!u2)
  243. return null;
  244. const c4 = s3 || r3, h2 = I(i) && !E(this.spatialReference, i) && c4 ? async (e2) => this._project(e2, i) : (e2) => e2, l3 = this.featureAdapter, m2 = this._searchFeatures(this._getQueryBBoxes(u2));
  245. if (e.sceneFilter.spatialRelationship === "disjoint") {
  246. if (!m2.length)
  247. return null;
  248. const i2 = new Set();
  249. for (const e2 of m2)
  250. i2.add(l3.getObjectId(e2));
  251. const s4 = await this._reschedule(() => this.featureStore.toArray(), t4), r4 = await this._reschedule(async () => {
  252. const r5 = await v3("esriSpatialRelDisjoint", u2, this.geometryType, this.hasZ, this.hasM), a6 = (e2) => !i2.has(l3.getObjectId(e2)) || r5(l3.getGeometry(e2)), n2 = await this._runSpatialFilter(s4, a6, t4);
  253. return new v2(n2, e, this);
  254. }, t4);
  255. return h2(r4);
  256. }
  257. if (!m2.length)
  258. return new v2([], e, this);
  259. if (this._canExecuteSinglePass(u2, e))
  260. return h2(new v2(m2, e, this));
  261. const p = await v3("esriSpatialRelContains", u2, this.geometryType, this.hasZ, this.hasM), f4 = await this._runSpatialFilter(m2, (e2) => p(l3.getGeometry(e2)), t4);
  262. return h2(new v2(f4, e, this));
  263. }
  264. async _executeGeometryQuery(i, s3, r3) {
  265. if (r(s3) && s3.items.length === 0)
  266. return s3;
  267. i = r(s3) ? s3.query : i;
  268. const { geometry: a5, outSR: u2, spatialRel: c4, returnGeometry: h2, returnCentroid: l3 } = i, m2 = this.featureStore.featureSpatialReference, p = !a5 || t(m2) || E(m2, a5.spatialReference) ? a5 : g(a5, m2), f4 = h2 || l3, d3 = I(u2) && !E(this.spatialReference, u2), y2 = this._geometryQueryCache && t(s3) ? d3 && f4 ? JSON.stringify({ originalFilterGeometry: a5, spatialRelationship: c4, outSpatialReference: u2 }) : JSON.stringify({ originalFilterGeometry: a5, spatialRelationship: c4 }) : null, g2 = y2 ? this._geometryQueryCache.get(y2) : null;
  269. if (r(g2))
  270. return new v2(g2, i, this);
  271. const x2 = async (e) => (d3 && f4 && await this._project(e, u2), y2 && this._geometryQueryCache.put(y2, e.items, e.items.length + 1), e);
  272. if (!p)
  273. return x2(r(s3) ? s3 : this._getAll(i));
  274. const _ = this.featureAdapter;
  275. let w2 = this._searchFeatures(this._getQueryBBoxes(a5));
  276. if (c4 === "esriSpatialRelDisjoint") {
  277. if (!w2.length)
  278. return x2(r(s3) ? s3 : this._getAll(i));
  279. const e = new Set();
  280. for (const i2 of w2)
  281. e.add(_.getObjectId(i2));
  282. const t4 = r(s3) ? s3.items : await this._reschedule(() => this.featureStore.toArray(), r3), a6 = await this._reschedule(async () => {
  283. const s4 = await v3(c4, p, this.geometryType, this.hasZ, this.hasM), a7 = (t5) => !e.has(_.getObjectId(t5)) || s4(_.getGeometry(t5)), n2 = await this._runSpatialFilter(t4, a7, r3);
  284. return new v2(n2, i, this);
  285. }, r3);
  286. return x2(a6);
  287. }
  288. if (r(s3)) {
  289. const i2 = new y();
  290. w2 = w2.filter((e) => v(s3.items, e, s3.items.length, i2) >= 0);
  291. }
  292. if (!w2.length) {
  293. const e = new v2([], i, this);
  294. return y2 && this._geometryQueryCache.put(y2, e.items, 1), e;
  295. }
  296. if (this._canExecuteSinglePass(p, i))
  297. return x2(new v2(w2, i, this));
  298. const S = await v3(c4, p, this.geometryType, this.hasZ, this.hasM), Q = await this._runSpatialFilter(w2, (e) => S(_.getGeometry(e)), r3);
  299. return x2(new v2(Q, i, this));
  300. }
  301. _executeAggregateIdsQuery(e) {
  302. if (e.items.length === 0 || !e.query.aggregateIds || !e.query.aggregateIds.length || t(this.aggregateAdapter))
  303. return;
  304. const t4 = new Set();
  305. for (const s3 of e.query.aggregateIds) {
  306. this.aggregateAdapter.getFeatureObjectIds(s3).forEach((e2) => t4.add(e2));
  307. }
  308. const i = this.featureAdapter.getObjectId;
  309. e.items = e.items.filter((e2) => t4.has(i(e2)));
  310. }
  311. _executeObjectIdsQuery(e) {
  312. if (e.items.length === 0 || !e.query.objectIds || !e.query.objectIds.length)
  313. return;
  314. const t4 = new Set(e.query.objectIds), i = this.featureAdapter.getObjectId;
  315. e.items = e.items.filter((e2) => t4.has(i(e2)));
  316. }
  317. _executeTimeQuery(e) {
  318. if (e.items.length === 0)
  319. return;
  320. const t4 = n(this.timeInfo, e.query.timeExtent, this.featureAdapter);
  321. t(t4) || (e.items = e.items.filter(t4));
  322. }
  323. _executeAttributesQuery(e) {
  324. if (e.items.length === 0)
  325. return;
  326. const t4 = l2(e.query.where, this.fieldsIndex);
  327. if (t4) {
  328. if (!t4.isStandardized)
  329. throw new TypeError("Where clause is not standardized");
  330. e.items = e.items.filter((e2) => t4.testFeature(e2, this.featureAdapter));
  331. }
  332. }
  333. async _runSpatialFilter(e, t4, i) {
  334. if (!t4)
  335. return e;
  336. if (t(this._frameTask))
  337. return e.filter((e2) => t4(e2));
  338. let s3 = 0;
  339. const r3 = new Array(), a5 = async (n2) => {
  340. for (; s3 < e.length; ) {
  341. const o3 = e[s3++];
  342. t4(o3) && (r3.push(o3), n2.madeProgress()), n2.done && await this._reschedule((e2) => a5(e2), i);
  343. }
  344. };
  345. return this._reschedule((e2) => a5(e2), i).then(() => r3);
  346. }
  347. _filterLatest(e) {
  348. const { trackIdField: t4, startTimeField: i, endTimeField: s3 } = this.timeInfo, r3 = s3 || i, a5 = new Map(), n2 = this.featureAdapter.getAttribute;
  349. for (const o3 of e.items) {
  350. const e2 = n2(o3, t4), i2 = n2(o3, r3), s4 = a5.get(e2);
  351. (!s4 || i2 > n2(s4, r3)) && a5.set(e2, o3);
  352. }
  353. e.items = Array.from(a5.values());
  354. }
  355. _canExecuteSinglePass(e, t4) {
  356. const { spatialRel: i } = t4;
  357. return I2(e) && (i === "esriSpatialRelEnvelopeIntersects" || this.geometryType === "esriGeometryPoint" && (i === "esriSpatialRelIntersects" || i === "esriSpatialRelContains" || i === "esriSpatialRelWithin"));
  358. }
  359. async _project(e, t4) {
  360. if (!t4 || E(this.spatialReference, t4))
  361. return e;
  362. const i = this.featureAdapter, s3 = await M(e.items.map((e2) => J(this.geometryType, this.hasZ, this.hasM, i.getGeometry(e2))), this.spatialReference, t4);
  363. return e.items = s3.map((t5, s4) => i.cloneWithGeometry(e.items[s4], te(t5, this.hasZ, this.hasM))), e;
  364. }
  365. _getQueryBBoxes(e) {
  366. if (I2(e)) {
  367. if (s2(e))
  368. return [o(e.xmin, e.ymin, e.xmax, e.ymax)];
  369. if (c2(e))
  370. return e.rings.map((e2) => o(Math.min(e2[0][0], e2[2][0]), Math.min(e2[0][1], e2[2][1]), Math.max(e2[0][0], e2[2][0]), Math.max(e2[0][1], e2[2][1])));
  371. }
  372. return [c(u(), e)];
  373. }
  374. _searchFeatures(e) {
  375. for (const i of e)
  376. this.featureStore.forEachInBounds(i, (e2) => ie.add(e2));
  377. const t4 = Array.from(ie.values());
  378. return ie.clear(), t4;
  379. }
  380. async _checkStatisticsSupport(e, t4) {
  381. if (e.distance < 0 || e.geometryPrecision != null || e.multipatchOption || e.pixelSize || e.relationParam || e.text || e.outStatistics || e.groupByFieldsForStatistics || e.having || e.orderByFields)
  382. throw new s(W, "Unsupported query options", { query: e });
  383. return this._checkAttributesQuerySupport(e), Promise.all([this._checkStatisticsParamsSupport(t4), P2(e, this.geometryType, this.spatialReference), f2(this.spatialReference, e.outSR)]).then(() => e);
  384. }
  385. async _checkStatisticsParamsSupport(e) {
  386. let t4 = [];
  387. if (e.valueExpression) {
  388. const { arcadeUtils: i } = await a4();
  389. t4 = i.extractFieldNames(e.valueExpression);
  390. }
  391. if (e.field && t4.push(e.field), e.normalizationField && t4.push(e.normalizationField), !t4.length)
  392. throw new s(W, "params should have at least a field or valueExpression", { params: e });
  393. c3(this.fieldsIndex, t4, "params contains missing fields");
  394. }
  395. async _checkQuerySupport(e) {
  396. if (e.distance < 0 || e.geometryPrecision != null || e.multipatchOption || e.pixelSize || e.relationParam || e.text)
  397. throw new s(W, "Unsupported query options", { query: e });
  398. return this._checkAttributesQuerySupport(e), this._checkStatisticsQuerySupport(e), Promise.all([P2(e, this.geometryType, this.spatialReference), f2(this.spatialReference, e.outSR)]).then(() => e);
  399. }
  400. _checkAttributesQuerySupport(e) {
  401. const { outFields: t4, orderByFields: s3, returnDistinctValues: r3, outStatistics: a5 } = e, n2 = a5 ? a5.map((e2) => e2.outStatisticFieldName && e2.outStatisticFieldName.toLowerCase()).filter(Boolean) : [];
  402. if (s3 && s3.length > 0) {
  403. const e2 = " asc", t5 = " desc", i = s3.map((i2) => {
  404. const s4 = i2.toLowerCase();
  405. return s4.includes(e2) ? s4.split(e2)[0] : s4.includes(t5) ? s4.split(t5)[0] : i2;
  406. }).filter((e3) => !n2.includes(e3));
  407. c3(this.fieldsIndex, i, "orderByFields contains missing fields");
  408. }
  409. if (t4 && t4.length > 0)
  410. c3(this.fieldsIndex, t4, "outFields contains missing fields");
  411. else if (r3)
  412. throw new s(W, "outFields should be specified for returnDistinctValues", { query: e });
  413. o2(this.fieldsIndex, e.where);
  414. }
  415. _checkStatisticsQuerySupport(e) {
  416. const { outStatistics: t4, groupByFieldsForStatistics: s3, having: r3 } = e, a5 = s3 && s3.length, n2 = t4 && t4.length;
  417. if (r3) {
  418. if (!a5 || !n2)
  419. throw new s(W, "outStatistics and groupByFieldsForStatistics should be specified with having", { query: e });
  420. a3(this.fieldsIndex, r3, t4);
  421. }
  422. if (n2) {
  423. if (!V(t4))
  424. return;
  425. const r4 = t4.map((e2) => e2.onStatisticField).filter(Boolean);
  426. c3(this.fieldsIndex, r4, "onStatisticFields contains missing fields"), a5 && c3(this.fieldsIndex, s3, "groupByFieldsForStatistics contains missing fields");
  427. for (const s4 of t4) {
  428. const { onStatisticField: t5, statisticType: r5 } = s4;
  429. if ((r5 === "percentile_disc" || r5 === "percentile_cont") && "statisticParameters" in s4) {
  430. const { statisticParameters: t6 } = s4;
  431. if (!t6)
  432. throw new s(W, "statisticParamters should be set for percentile type", { definition: s4, query: e });
  433. } else if (r5 !== "count" && t5 && f3(t5, this.fieldsIndex))
  434. throw new s(W, "outStatistics contains non-numeric fields", { definition: s4, query: e });
  435. }
  436. }
  437. }
  438. async _getQueryEngineResultForStats(e, t4, i) {
  439. e = m(e);
  440. try {
  441. e = await this._schedule(() => P(e, this.definitionExpression, this.spatialReference), i), e = await this._reschedule(() => this._checkStatisticsSupport(e, t4), i);
  442. const s3 = await this._reschedule(() => this._executeSceneFilterQuery(e, i), i), r3 = await this._reschedule(() => this._executeGeometryQuery(e, s3, i), i);
  443. return await this._reschedule(() => this._executeAggregateIdsQuery(r3), i), await this._reschedule(() => this._executeObjectIdsQuery(r3), i), await this._reschedule(() => this._executeTimeQuery(r3), i), await this._reschedule(() => this._executeAttributesQuery(r3), i), r3;
  444. } catch (r3) {
  445. if (r3 !== U)
  446. throw r3;
  447. return new v2([], e, this);
  448. }
  449. }
  450. };
  451. var ee = a2();
  452. var te2 = a2();
  453. var ie = new Set();
  454. export {
  455. Y
  456. };
  457. //# sourceMappingURL=chunk-NP2BYFXT.js.map