chunk-3IU4W5A7.js 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. import {
  2. d as d3,
  3. s as s3
  4. } from "./chunk-FJ72FJKM.js";
  5. import {
  6. c2 as c,
  7. d2,
  8. f,
  9. m as m2,
  10. x as x3,
  11. z
  12. } from "./chunk-3RTOMVBL.js";
  13. import {
  14. e as e4
  15. } from "./chunk-YR7YKE3S.js";
  16. import {
  17. v
  18. } from "./chunk-GSORSXL5.js";
  19. import {
  20. i
  21. } from "./chunk-EAUVYZHD.js";
  22. import {
  23. f as f2,
  24. u as u2
  25. } from "./chunk-MNZXIBJ7.js";
  26. import {
  27. h as h2
  28. } from "./chunk-YJKEIUMW.js";
  29. import {
  30. S
  31. } from "./chunk-WFSV2B2I.js";
  32. import {
  33. o as o2
  34. } from "./chunk-AMQJEM7V.js";
  35. import {
  36. l as l2
  37. } from "./chunk-LMCIAW5S.js";
  38. import {
  39. l as l3
  40. } from "./chunk-6RAL4JPQ.js";
  41. import {
  42. l as l4
  43. } from "./chunk-4E6K4P67.js";
  44. import {
  45. w as w2,
  46. y as y2
  47. } from "./chunk-GD5TMIPM.js";
  48. import {
  49. u
  50. } from "./chunk-VEAEIBHK.js";
  51. import {
  52. x as x2
  53. } from "./chunk-2VFJVI2I.js";
  54. import {
  55. e as e3
  56. } from "./chunk-FIYKFRB2.js";
  57. import {
  58. g as g4
  59. } from "./chunk-RZFGRBD7.js";
  60. import {
  61. b as b2
  62. } from "./chunk-UD63WBG3.js";
  63. import {
  64. a as a2,
  65. h,
  66. j as j3,
  67. l,
  68. w
  69. } from "./chunk-YIS6BAC3.js";
  70. import {
  71. g as g2
  72. } from "./chunk-PSV473TI.js";
  73. import {
  74. A,
  75. F,
  76. I,
  77. N,
  78. V,
  79. _ as _2,
  80. de,
  81. g as g3,
  82. j as j4,
  83. y as y3
  84. } from "./chunk-WZQZRKNH.js";
  85. import {
  86. a as a3
  87. } from "./chunk-LRDX4TO7.js";
  88. import {
  89. _
  90. } from "./chunk-YBSUITLL.js";
  91. import {
  92. j as j2
  93. } from "./chunk-ALDCDSPV.js";
  94. import {
  95. M2 as M
  96. } from "./chunk-ECW2QABR.js";
  97. import {
  98. d,
  99. e,
  100. n2 as n,
  101. y3 as y
  102. } from "./chunk-Y3WMVFTW.js";
  103. import {
  104. D,
  105. E,
  106. b,
  107. g,
  108. j,
  109. r as r2,
  110. x
  111. } from "./chunk-ULGDPLM2.js";
  112. import {
  113. s,
  114. s3 as s2
  115. } from "./chunk-EMJ4ZSM2.js";
  116. import {
  117. m
  118. } from "./chunk-IKP3YN53.js";
  119. import {
  120. a,
  121. e as e2,
  122. o,
  123. r,
  124. t
  125. } from "./chunk-GZT4BVFP.js";
  126. // node_modules/@arcgis/core/AggregateGraphic.js
  127. var p = class extends g4 {
  128. constructor() {
  129. super(...arguments), this.isAggregate = true;
  130. }
  131. getEffectivePopupTemplate(e6 = false) {
  132. if (this.popupTemplate)
  133. return this.popupTemplate;
  134. const r3 = this.sourceLayer && this.sourceLayer.featureReduction;
  135. return r3 && "popupTemplate" in r3 && r3.popupEnabled ? r3.popupTemplate : null;
  136. }
  137. getObjectId() {
  138. return this.objectId;
  139. }
  140. };
  141. e([d({ type: Boolean })], p.prototype, "isAggregate", void 0), e([d({ type: [String, Number], json: { read: true } })], p.prototype, "objectId", void 0), p = e([n("esri.AggregateGraphic")], p);
  142. var s4 = p;
  143. // node_modules/@arcgis/core/layers/effects/FeatureEffectView.js
  144. var o3 = class extends y {
  145. constructor(e6) {
  146. super(e6), this._filter = null, this.duration = a("mapview-transitions-duration"), this._excludedEffectView = new h2(e6), this._includedEffectView = new h2(e6);
  147. }
  148. get excludedEffects() {
  149. return this._excludedEffectView.effects;
  150. }
  151. set featureEffect(e6) {
  152. this._get("featureEffect") !== e6 && this._transitionTo(e6);
  153. }
  154. get filter() {
  155. return this._filter || e2(this.featureEffect)?.filter || null;
  156. }
  157. get hasEffects() {
  158. return this._excludedEffectView.hasEffects || this._includedEffectView.hasEffects;
  159. }
  160. get includedEffects() {
  161. return this._includedEffectView.effects;
  162. }
  163. set scale(e6) {
  164. this._set("scale", e6), this._excludedEffectView.scale = e6, this._includedEffectView.scale = e6;
  165. }
  166. get transitioning() {
  167. return this._excludedEffectView.transitioning || this._includedEffectView.transitioning;
  168. }
  169. transitionStep(e6, t2) {
  170. this._set("scale", t2), this.transitioning ? (this._includedEffectView.transitionStep(e6, t2), this._excludedEffectView.transitionStep(e6, t2), this.transitioning || (this._filter = null)) : (this._excludedEffectView.scale = t2, this._includedEffectView.scale = t2);
  171. }
  172. end() {
  173. this._includedEffectView.end(), this._excludedEffectView.end(), this._filter = null;
  174. }
  175. _transitionTo(e6) {
  176. const t2 = this._get("featureEffect"), i3 = e2(e6), f3 = e2(i3?.includedEffect), c4 = e2(i3?.excludedEffect), r3 = this._includedEffectView.canTransitionTo(f3) && this._excludedEffectView.canTransitionTo(c4);
  177. this._includedEffectView.effect = f3, this._excludedEffectView.effect = c4, this._set("featureEffect", i3), this._filter = i3?.filter || t2?.filter || null, r3 || this.end();
  178. }
  179. };
  180. e([d()], o3.prototype, "_filter", void 0), e([d()], o3.prototype, "_excludedEffectView", void 0), e([d()], o3.prototype, "_includedEffectView", void 0), e([d()], o3.prototype, "duration", void 0), e([d()], o3.prototype, "excludedEffects", null), e([d()], o3.prototype, "featureEffect", null), e([d()], o3.prototype, "filter", null), e([d()], o3.prototype, "hasEffects", null), e([d()], o3.prototype, "includedEffects", null), e([d({ value: 0 })], o3.prototype, "scale", null), e([d()], o3.prototype, "transitioning", null), o3 = e([n("esri.layers.effects.FeatureEffectView")], o3);
  181. var n2 = o3;
  182. // node_modules/@arcgis/core/views/2d/layers/features/tileRenderers.js
  183. async function e5(e6, r3) {
  184. if (!e6)
  185. return null;
  186. switch (e6.type) {
  187. case "symbol":
  188. return new (await import("./SymbolTileRenderer-5NOPNHXV.js")).default(r3);
  189. case "heatmap":
  190. return new (await import("./HeatmapTileRenderer-3ZS5N3L7.js")).default(r3);
  191. }
  192. }
  193. // node_modules/@arcgis/core/views/2d/layers/support/FeatureCommandQueue.js
  194. function a4(e6) {
  195. return e6.some((e7) => e7.globalId);
  196. }
  197. function d4(e6) {
  198. return e6.filter((e7) => !e7.error).map((e7) => e7.objectId ?? e7.globalId);
  199. }
  200. function i2(e6, r3) {
  201. const s6 = new Set(e6);
  202. for (const t2 of r3.values())
  203. s6.add(t2);
  204. return s6;
  205. }
  206. function n3(e6, r3) {
  207. const s6 = new Set(e6);
  208. for (const t2 of r3.values())
  209. s6.delete(t2);
  210. return s6;
  211. }
  212. var c2 = class extends y {
  213. constructor(e6) {
  214. super(e6), this._hasGlobalIds = false;
  215. }
  216. normalizeCtorArgs(e6) {
  217. return this._queueProcessor = new l2({ concurrency: 1, process: e6.process }), {};
  218. }
  219. destroy() {
  220. this.clear();
  221. }
  222. get updating() {
  223. return this._queueProcessor.length > 0;
  224. }
  225. clear() {
  226. this._queueProcessor.clear();
  227. }
  228. push(e6) {
  229. const r3 = this._queueProcessor, s6 = r3.last();
  230. switch (e6.type) {
  231. case "update":
  232. case "refresh":
  233. if (s6?.type === e6.type)
  234. return;
  235. r3.push(e6).finally(() => this.notifyChange("updating"));
  236. break;
  237. case "edit": {
  238. const t2 = s6?.type === "processed-edit" ? s6 : null;
  239. t2 && r3.popLast();
  240. const o4 = this._mergeEdits(t2, e6);
  241. for (const e7 of o4)
  242. r3.push(e7).finally(() => this.notifyChange("updating"));
  243. break;
  244. }
  245. }
  246. this.notifyChange("updating");
  247. }
  248. _mergeEdits(e6, r3) {
  249. const { addedFeatures: s6, deletedFeatures: t2, updatedFeatures: o4 } = r3.edits;
  250. if (this._hasGlobalIds = this._hasGlobalIds || a4(s6) || a4(o4) || a4(t2), this._hasGlobalIds) {
  251. return [e6, { type: "processed-edit", edits: { addOrModified: [...s6, ...o4], removed: t2 } }];
  252. }
  253. const c4 = new Set(d4(e6?.edits.addOrModified ?? [])), u5 = new Set(d4(e6?.edits.removed ?? [])), p2 = new Set([...d4(s6), ...d4(o4)]), l7 = new Set(d4(t2));
  254. return [{ type: "processed-edit", edits: { addOrModified: Array.from(i2(n3(c4, l7), p2)).map((e7) => ({ objectId: e7 })), removed: Array.from(i2(n3(u5, p2), l7)).map((e7) => ({ objectId: e7 })) } }];
  255. }
  256. };
  257. e([d({ readOnly: true })], c2.prototype, "updating", null), c2 = e([n("esri.views.2d.layers.support.FeatureCommandQueue")], c2);
  258. var u3 = c2;
  259. // node_modules/@arcgis/core/views/2d/layers/support/FeatureLayerProxy.js
  260. function c3(e6) {
  261. return Array.isArray(e6);
  262. }
  263. var l5 = class extends _ {
  264. constructor(e6) {
  265. super(e6), this._startupResolver = D(), this.isReady = false;
  266. }
  267. initialize() {
  268. this._controller = new AbortController(), this.addResolvingPromise(this._startWorker(this._controller.signal));
  269. }
  270. destroy() {
  271. this._controller.abort(), this._connection && this._connection.close();
  272. }
  273. set tileRenderer(e6) {
  274. this.client.tileRenderer = e6;
  275. }
  276. get closed() {
  277. return this._connection.closed;
  278. }
  279. async startup(e6, t2, r3, s6) {
  280. await this.when();
  281. const o4 = this._controller.signal, i3 = c3(r3.source) ? { transferList: r3.source, signal: o4 } : void 0, n4 = { service: r3, config: t2, tileInfo: e6.tileInfo.toJSON(), tiles: s6 };
  282. await this._connection.invoke("startup", n4, i3), this._startupResolver.resolve(), this._set("isReady", true);
  283. }
  284. async updateTiles(e6) {
  285. return await this._startupResolver.promise, j(this._connection.invoke("updateTiles", e6));
  286. }
  287. async update(e6) {
  288. const t2 = { config: e6 };
  289. return await this._startupResolver.promise, this._connection.invoke("update", t2);
  290. }
  291. async applyUpdate(e6) {
  292. return await this._startupResolver.promise, this._connection.invoke("applyUpdate", e6);
  293. }
  294. async setHighlight(e6) {
  295. return await this._startupResolver.promise, j(this._connection.invoke("controller.setHighlight", e6));
  296. }
  297. async stop() {
  298. if (await this._startupResolver.promise, !this.closed)
  299. return j(this._connection.invoke("stop"));
  300. }
  301. async refresh(e6) {
  302. return await this._startupResolver.promise, j(this._connection.invoke("controller.refresh", e6));
  303. }
  304. async querySummaryStatistics(e6, t2, r3) {
  305. return await this._startupResolver.promise, this._connection.invoke("controller.querySummaryStatistics", { query: e6.toJSON(), params: t2 }, r3);
  306. }
  307. async queryUniqueValues(e6, t2, r3) {
  308. return await this._startupResolver.promise, this._connection.invoke("controller.queryUniqueValues", { query: e6.toJSON(), params: t2 }, r3);
  309. }
  310. async queryClassBreaks(e6, t2, r3) {
  311. return await this._startupResolver.promise, this._connection.invoke("controller.queryClassBreaks", { query: e6.toJSON(), params: t2 }, r3);
  312. }
  313. async queryHistogram(e6, t2, r3) {
  314. return await this._startupResolver.promise, this._connection.invoke("controller.queryHistogram", { query: e6.toJSON(), params: t2 }, r3);
  315. }
  316. async queryFeatures(e6, t2) {
  317. return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatures", e6.toJSON(), t2);
  318. }
  319. async queryVisibleFeatures(e6, t2) {
  320. return await this._startupResolver.promise, this._connection.invoke("controller.queryVisibleFeatures", e6.toJSON(), t2);
  321. }
  322. async queryObjectIds(e6, t2) {
  323. return await this._startupResolver.promise, this._connection.invoke("controller.queryObjectIds", e6.toJSON(), t2);
  324. }
  325. async queryFeatureCount(e6, t2) {
  326. return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatureCount", e6.toJSON(), t2);
  327. }
  328. async queryExtent(e6, t2) {
  329. return this._connection.invoke("controller.queryExtent", e6.toJSON(), t2);
  330. }
  331. async queryLatestObservations(e6, t2) {
  332. return await this._startupResolver.promise, this._connection.invoke("controller.queryLatestObservations", e6.toJSON(), t2);
  333. }
  334. async queryStatistics(e6) {
  335. return await this._startupResolver.promise, this._connection.invoke("controller.queryStatistics", e6);
  336. }
  337. async getObjectId(e6) {
  338. return await this._startupResolver.promise, this._connection.invoke("controller.getObjectId", e6);
  339. }
  340. async getDisplayId(e6) {
  341. return await this._startupResolver.promise, this._connection.invoke("controller.getDisplayId", e6);
  342. }
  343. async getFeatures(e6) {
  344. return await this._startupResolver.promise, this._connection.invoke("controller.getFeatures", e6);
  345. }
  346. async getAggregates() {
  347. return await this._startupResolver.promise, this._connection.invoke("controller.getAggregates");
  348. }
  349. async getAggregateValueRanges() {
  350. return await this._startupResolver.promise, this._connection.invoke("controller.getAggregateValueRanges");
  351. }
  352. async mapValidDisplayIds(e6) {
  353. return await this._startupResolver.promise, this._connection.invoke("controller.mapValidDisplayIds", e6);
  354. }
  355. async onEdits(e6) {
  356. return await this._startupResolver.promise, j(this._connection.invoke("controller.onEdits", e6));
  357. }
  358. async enableEvent(e6, t2) {
  359. return await this._startupResolver.promise, j(this._connection.invoke("controller.enableEvent", { name: e6, value: t2 }));
  360. }
  361. pauseStream() {
  362. return j(this._connection.invoke("controller.pauseStream"));
  363. }
  364. resumeStream() {
  365. return j(this._connection.invoke("controller.resumeStream"));
  366. }
  367. async _startWorker(e6) {
  368. try {
  369. this._connection = await u("Pipeline", { client: this.client, strategy: "dedicated", signal: e6 });
  370. } catch (t2) {
  371. b(t2);
  372. }
  373. }
  374. };
  375. e([d()], l5.prototype, "isReady", void 0), e([d()], l5.prototype, "client", void 0), e([d()], l5.prototype, "tileRenderer", null), l5 = e([n("esri.views.2d.layers.support.FeatureLayerProxy")], l5);
  376. var u4 = l5;
  377. // node_modules/@arcgis/core/views/2d/tiling/TileManager.js
  378. var l6 = 1e-6;
  379. var s5 = class {
  380. constructor(e6) {
  381. this._tiles = new Map(), this.buffer = 0, this.acquireTile = e6.acquireTile, this.releaseTile = e6.releaseTile, this.tileInfoView = e6.tileInfoView, this.buffer = e6.buffer;
  382. }
  383. destroy() {
  384. }
  385. clear() {
  386. this._tiles.forEach((e6) => this._releaseTile(e6));
  387. }
  388. tileKeys() {
  389. const e6 = [];
  390. return this._tiles.forEach((i3, t2) => e6.push(t2)), e6;
  391. }
  392. update(e6) {
  393. const l7 = this.tileInfoView.getTileCoverage(e6.state, this.buffer, "closest"), { spans: s6, lodInfo: r3 } = l7, { level: a5 } = r3, o4 = [], d5 = [], h3 = new Set(), n4 = new Set();
  394. for (const { row: i3, colFrom: c4, colTo: f3 } of s6)
  395. for (let e7 = c4; e7 <= f3; e7++) {
  396. const l8 = e3.getId(a5, i3, r3.normalizeCol(e7), r3.getWorldForColumn(e7)), s7 = this._getOrAcquireTile(o4, l8);
  397. h3.add(l8), s7.isReady ? s7.visible = true : n4.add(s7.key);
  398. }
  399. n4.forEach((e7) => this._addPlaceholders(h3, e7)), this._tiles.forEach((e7) => {
  400. h3.has(e7.key.id) || (d5.push(e7.key.id), this._releaseTile(e7));
  401. }), l3.pool.release(l7);
  402. return { hasMissingTiles: n4.size > 0, added: o4, removed: d5 };
  403. }
  404. _getOrAcquireTile(e6, i3) {
  405. if (!this._tiles.has(i3)) {
  406. const l7 = this.acquireTile(new e3(i3));
  407. e6.push(i3), this._tiles.set(i3, l7), l7.visible = false;
  408. }
  409. return this._tiles.get(i3);
  410. }
  411. _getTile(e6) {
  412. return this._tiles.get(e6);
  413. }
  414. _releaseTile(e6) {
  415. this._tiles.delete(e6.key.id), this.releaseTile(e6);
  416. }
  417. _addPlaceholders(e6, i3) {
  418. const t2 = this._addPlaceholderChildren(e6, i3);
  419. if (!(Math.abs(1 - t2) < l6)) {
  420. if (!this._addPlaceholderParent(e6, i3)) {
  421. this._getTile(i3.id).visible = true;
  422. }
  423. }
  424. }
  425. _addPlaceholderChildren(e6, i3) {
  426. let t2 = 0;
  427. return this._tiles.forEach((l7) => {
  428. t2 += this._addPlaceholderChild(e6, l7, i3);
  429. }), t2;
  430. }
  431. _addPlaceholderChild(e6, i3, t2) {
  432. if (i3.key.level <= t2.level || !i3.hasData || !t2.contains(i3.key))
  433. return 0;
  434. i3.visible = true, e6.add(i3.key.id);
  435. return 1 / (1 << 2 * (i3.key.level - t2.level));
  436. }
  437. _addPlaceholderParent(i3, t2) {
  438. let l7 = t2.getParentKey(), s6 = 0, r3 = null;
  439. for (; r(l7); ) {
  440. if (i3.has(l7.id))
  441. return true;
  442. const e6 = this._getTile(l7.id);
  443. if (e6?.isReady)
  444. return e6.visible = true, i3.add(e6.key.id), true;
  445. e6?.hasData && e6.patchCount > s6 && (s6 = e6.patchCount, r3 = e6), l7 = l7.getParentKey();
  446. }
  447. return !!r3 && (r3.visible = true, i3.add(r3.key.id), true);
  448. }
  449. };
  450. // node_modules/@arcgis/core/views/layers/FeatureLayerView.js
  451. var O = s.getLogger("esri.views.layers.FeatureLayerView");
  452. var A2 = (i3) => {
  453. let A4 = class extends i3 {
  454. constructor(...e6) {
  455. super(...e6), this._updatingRequiredFieldsPromise = null, this.filter = null, this.timeExtent = null, this.layer = null, this.requiredFields = [], this.view = null;
  456. }
  457. initialize() {
  458. this.handles.add([l(() => {
  459. const e6 = this.layer;
  460. return [e6?.elevationInfo?.featureExpressionInfo, e6?.displayField, e6?.timeInfo, e6 && "renderer" in e6 && e6.renderer, e6 && "labelingInfo" in e6 && e6.labelingInfo, e6 && "floorInfo" in e6 && e6.floorInfo, this.filter, this.featureEffect, this.timeExtent];
  461. }, () => this._handleRequiredFieldsChange(), w), a2(() => this.view?.floors, "change", () => this._handleRequiredFieldsChange()), a2(() => {
  462. const e6 = this.layer;
  463. return e6 && "sublayers" in e6 && e6.sublayers;
  464. }, "change", () => this._handleRequiredFieldsChange())]);
  465. }
  466. get availableFields() {
  467. const { layer: e6, layer: { fieldsIndex: t2 }, requiredFields: r3 } = this;
  468. return "outFields" in e6 && e6.outFields ? y3(t2, [...I(t2, e6.outFields), ...r3]) : y3(t2, r3);
  469. }
  470. set effect(e6) {
  471. r2(O, "effect", { replacement: "featureEffect", version: "4.22" }), this.featureEffect = e6;
  472. }
  473. get effect() {
  474. return r2(O, "effect", { replacement: "featureEffect", version: "4.22" }), this.featureEffect;
  475. }
  476. get featureEffect() {
  477. return this.layer && "featureEffect" in this.layer ? this.layer.featureEffect : null;
  478. }
  479. set featureEffect(e6) {
  480. e6 !== void 0 ? this._override("featureEffect", e6) : this._clearOverride("featureEffect");
  481. }
  482. get maximumNumberOfFeatures() {
  483. return 0;
  484. }
  485. set maximumNumberOfFeatures(e6) {
  486. O.error("#maximumNumberOfFeatures=", "Setting maximum number of features is not supported");
  487. }
  488. get maximumNumberOfFeaturesExceeded() {
  489. return false;
  490. }
  491. highlight(e6) {
  492. throw new Error("missing implementation");
  493. }
  494. createQuery() {
  495. const e6 = { outFields: ["*"], returnGeometry: true, outSpatialReference: this.view.spatialReference }, t2 = r(this.filter) ? this.filter.createQuery(e6) : new b2(e6);
  496. if (this.layer.type === "feature") {
  497. const e7 = o2(this);
  498. r(e7) && (t2.where = t2.where ? `(${t2.where}) AND (${e7})` : e7);
  499. }
  500. return r(this.timeExtent) && (t2.timeExtent = r(t2.timeExtent) ? t2.timeExtent.intersection(this.timeExtent) : this.timeExtent.clone()), t2;
  501. }
  502. queryFeatures(e6, t2) {
  503. throw new Error("missing implementation");
  504. }
  505. queryObjectIds(e6, t2) {
  506. throw new Error("missing implementation");
  507. }
  508. queryFeatureCount(e6, t2) {
  509. throw new Error("missing implementation");
  510. }
  511. queryExtent(e6, t2) {
  512. throw new Error("missing implementation");
  513. }
  514. async fetchPopupFeatures(e6, t2) {
  515. const r3 = this.validateFetchPopupFeatures(t2);
  516. if (r3)
  517. throw r3;
  518. return this.fetchClientPopupFeatures(t2);
  519. }
  520. _loadArcadeModules(e6) {
  521. if (e6.get("expressionInfos.length") || Array.isArray(e6.content) && e6.content.some((e7) => e7.type === "expression"))
  522. return a3();
  523. }
  524. _handleRequiredFieldsChange() {
  525. const e6 = this._updateRequiredFields();
  526. this._set("_updatingRequiredFieldsPromise", e6), e6.then(() => {
  527. this._updatingRequiredFieldsPromise === e6 && this._set("_updatingRequiredFieldsPromise", null);
  528. });
  529. }
  530. async _updateRequiredFields() {
  531. if (!this.layer || !this.view)
  532. return;
  533. const e6 = this.view.type === "3d", { layer: t2, layer: { fieldsIndex: r3, objectIdField: i4 } } = this, o4 = "renderer" in t2 && t2.renderer, a5 = "orderBy" in t2 && t2.orderBy, l7 = t2.featureReduction, u5 = new Set(), p2 = await E([o4 ? o4.collectRequiredFields(u5, r3) : null, j4(u5, t2), e6 ? A(u5, t2) : null, r(this.filter) ? V(u5, t2, this.filter) : null, r(this.featureEffect) ? V(u5, t2, this.featureEffect.filter) : null, l7 ? N(u5, t2, l7) : null, a5 ? _2(u5, t2, a5) : null]);
  534. if (t2.timeInfo && this.timeExtent && g3(u5, t2.fieldsIndex, [t2.timeInfo.startField, t2.timeInfo.endField]), t2.type === "feature" && t2.floorInfo && g3(u5, t2.fieldsIndex, [t2.floorInfo.floorField]), t2.type === "subtype-group") {
  535. F(u5, r3, t2.subtypeField);
  536. const e7 = t2.sublayers.map((e8) => Promise.all([e8.renderer?.collectRequiredFields(u5, r3), j4(u5, e8)]));
  537. await E(e7);
  538. }
  539. for (const s6 of p2)
  540. s6.error && O.error(s6.error);
  541. F(u5, r3, i4), e6 && "displayField" in t2 && t2.displayField && F(u5, r3, t2.displayField);
  542. const f3 = Array.from(u5).sort();
  543. this._set("requiredFields", f3);
  544. }
  545. validateFetchPopupFeatures(e6) {
  546. if (t(e6))
  547. return null;
  548. for (const t2 of e6.clientGraphics) {
  549. const i4 = t2.layer;
  550. if ("popupEnabled" in i4 && !i4.popupEnabled)
  551. return new s2("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: i4 });
  552. if (t2.isAggregate) {
  553. if (!(i4.featureReduction && "popupTemplate" in i4.featureReduction && i4.featureReduction.popupEnabled && i4.featureReduction.popupTemplate))
  554. return new s2("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: i4 });
  555. } else if ("popupTemplate" in i4) {
  556. if (!s3(i4, e6))
  557. return new s2("featurelayerview:fetchPopupFeatures", "Layer does not define a popup template", { layer: i4 });
  558. }
  559. }
  560. }
  561. async fetchClientPopupFeatures(e6) {
  562. const t2 = r(e6) ? e6.clientGraphics : null;
  563. if (!t2 || t2.length === 0)
  564. return [];
  565. const r3 = new Array(t2.length), i4 = new Map(), n4 = await this.createPopupQuery(e6);
  566. for (let s6 = 0; s6 < t2.length; s6++) {
  567. const a5 = t2[s6];
  568. if (a5.isAggregate) {
  569. r3[s6] = a5;
  570. continue;
  571. }
  572. const { layer: l7 } = a5;
  573. if (!("popupEnabled" in l7))
  574. continue;
  575. const u5 = I(this.layer.fieldsIndex, n4.outFields), p2 = s3(l7, e6);
  576. if (t(p2))
  577. continue;
  578. const f3 = await this._loadArcadeModules(p2);
  579. f3 && f3.arcadeUtils.hasGeometryOperations(p2) || !de(u5, a5) ? i4.set(a5.getObjectId(), s6) : r3[s6] = a5;
  580. }
  581. if (this.layer.type === "stream" || i4.size === 0)
  582. return r3.filter(Boolean);
  583. n4.objectIds = Array.from(i4.keys());
  584. try {
  585. const e7 = await this.layer.queryFeatures(n4);
  586. for (const t3 of e7.features) {
  587. r3[i4.get(t3.getObjectId())] = t3;
  588. }
  589. } catch {
  590. }
  591. return r3.filter(Boolean);
  592. }
  593. async createPopupQuery(e6) {
  594. const t2 = this.layer.createQuery(), r3 = new Set();
  595. let i4 = false;
  596. const n4 = r(e6) && e6.clientGraphics ? e6.clientGraphics.map((e7) => e7.layer) : [this.layer];
  597. for (const s6 of n4) {
  598. if (!("popupEnabled" in s6))
  599. continue;
  600. const t3 = s3(s6, e6);
  601. if (t(t3))
  602. continue;
  603. const n5 = await this._loadArcadeModules(t3), a5 = n5 && n5.arcadeUtils.hasGeometryOperations(t3);
  604. i4 = !(this.layer.geometryType !== "point" && !a5);
  605. const l7 = await d3(this.layer, t3);
  606. for (const e7 of l7)
  607. r3.add(e7);
  608. }
  609. if (t2.returnGeometry = i4, t2.returnZ = i4, t2.returnM = i4, t2.outFields = Array.from(r3), t2.outSpatialReference = this.view.spatialReference, this.layer.type === "feature") {
  610. const e7 = o2(this);
  611. r(e7) && (t2.where = t2.where ? `(${t2.where}) AND (${e7})` : e7);
  612. }
  613. return t2;
  614. }
  615. canResume() {
  616. return !!super.canResume() && (!r(this.timeExtent) || !this.timeExtent.isEmpty);
  617. }
  618. };
  619. return e([d()], A4.prototype, "_updatingRequiredFieldsPromise", void 0), e([d({ readOnly: true })], A4.prototype, "availableFields", null), e([d()], A4.prototype, "effect", null), e([d({ type: w2 })], A4.prototype, "featureEffect", null), e([d({ type: y2 })], A4.prototype, "filter", void 0), e([d(g2)], A4.prototype, "timeExtent", void 0), e([d()], A4.prototype, "layer", void 0), e([d({ type: Number })], A4.prototype, "maximumNumberOfFeatures", null), e([d({ readOnly: true, type: Boolean })], A4.prototype, "maximumNumberOfFeaturesExceeded", null), e([d({ readOnly: true })], A4.prototype, "requiredFields", void 0), e([d()], A4.prototype, "suspended", void 0), e([d()], A4.prototype, "view", void 0), A4 = e([n("esri.views.layers.FeatureLayerView")], A4), A4;
  620. };
  621. // node_modules/@arcgis/core/views/2d/layers/FeatureLayerView2D.js
  622. function Q(e6) {
  623. return e6 && "openPorts" in e6;
  624. }
  625. var A3 = s.getLogger("esri.views.2d.layers.FeatureLayerView2D");
  626. var M2 = class extends A2(i(f2(u2))) {
  627. constructor() {
  628. super(...arguments), this._pipelineIsUpdating = true, this._commandsQueue = new u3({ process: (e6) => {
  629. switch (e6.type) {
  630. case "processed-edit":
  631. return this._doEdit(e6);
  632. case "refresh":
  633. return this._doRefresh(e6.dataChanged);
  634. case "update":
  635. return this._doUpdate();
  636. }
  637. } }), this._visibilityOverrides = new Set(), this._highlightIds = new Map(), this._updateHighlight = x(async () => this._proxy.setHighlight(Array.from(this._highlightIds.keys()))), this._uploadsLocked = false, this._needsClusterSizeUpdate = false, this.featureEffectView = new n2(), this._lastDefinitionExpression = null;
  638. }
  639. destroy() {
  640. o(this._updateClusterSizeTask, (e6) => e6.remove()), this._proxy?.destroy(), this._commandsQueue.destroy();
  641. }
  642. initialize() {
  643. this.addResolvingPromise(Promise.all([this._initProxy(), this._initServiceOptions()])), this.handles.add([this.on("valueRangesChanged", (e6) => {
  644. this._set("_aggregateValueRanges", e6.valueRanges);
  645. }), l(() => this.featureEffect, (e6) => {
  646. this.featureEffectView.featureEffect = e6;
  647. }, { initial: true, sync: true })]);
  648. }
  649. async _initProxy() {
  650. const e6 = this.layer;
  651. if ("isTable" in e6 && e6.isTable)
  652. throw new s2("featurelayerview:table-not-supported", "table feature layer can't be displayed", { layer: this.layer });
  653. const t2 = e6.type === "feature" || e6.type === "subtype-group", i3 = "capabilities" in e6 && e6.capabilities.operations.supportsQuery;
  654. if (t2 && !i3)
  655. throw new s2("featurelayerview:query-not-supported", "layer view requires a layer with query capability", { layer: e6 });
  656. this._proxy && this._proxy.destroy();
  657. const r3 = this._createClientOptions();
  658. return this._set("_proxy", new u4({ client: r3 })), this._proxy.when();
  659. }
  660. async _initServiceOptions() {
  661. return this._set("_serviceOptions", await this._createServiceOptions()), this._serviceOptions;
  662. }
  663. get orderByFields() {
  664. return this._serviceOptions.type !== "stream" && this._serviceOptions.orderByFields;
  665. }
  666. get labelsVisible() {
  667. const e6 = this.layer.type === "subtype-group" ? this.layer.sublayers.items : [this.layer];
  668. return !this.suspended && e6.some((e7) => e7.labelingInfo && e7.labelsVisible);
  669. }
  670. get queryMode() {
  671. return this._serviceOptions.type;
  672. }
  673. get renderingConfigHash() {
  674. if (!this.layer)
  675. return null;
  676. const e6 = this.availableFields, t2 = this.layer, i3 = this.view.floors, { definitionExpression: r3 } = t2, s6 = this.layer.type !== "subtype-group" && this.layer.labelsVisible && this.layer.labelingInfo, a5 = "renderer" in t2 && t2.renderer, n4 = t2.type === "feature" ? t2.gdbVersion : void 0, o4 = t2.type === "feature" && t2.historicMoment ? t2.historicMoment.getTime() : void 0, { timeExtent: l7 } = this, u5 = "customParameters" in t2 ? JSON.stringify(t2.customParameters) : void 0, d5 = "apiKey" in t2 ? t2.apiKey : void 0, p2 = t2.type === "stream" ? `${JSON.stringify(t2.geometryDefinition)}${t2.definitionExpression}` : null, y4 = JSON.stringify(this.clips), c4 = t2.featureReduction && t2.featureReduction.toJSON(), f3 = "orderBy" in this.layer && JSON.stringify(this.layer.orderBy), g5 = "sublayers" in this.layer && this.layer.sublayers.items.reduce((e7, t3) => e7 + `${t3.visible ? 1 : 0}.${JSON.stringify(t3.renderer)}.${t3.labelsVisible}
  677. .${JSON.stringify(t3.labelingInfo)}`, ""), m3 = "subtypeCode" in this.layer && this.layer.subtypeCode;
  678. return JSON.stringify({ orderBy: f3, sublayerHash: g5, subtypeCode: m3, filterHash: r(this.filter) && this.filter.toJSON(), effectHash: r(this.featureEffect) && this.featureEffect.toJSON(), streamFilter: p2, gdbVersion: n4, definitionExpression: r3, historicMoment: o4, availableFields: e6, renderer: a5, labelingInfo: s6, timeExtent: l7, floors: i3, clipsHash: y4, featureReduction: c4, customParameters: u5, apiKey: d5 });
  679. }
  680. highlight(e6) {
  681. let t2;
  682. return e6 instanceof g4 ? t2 = [e6.getObjectId()] : typeof e6 == "number" || typeof e6 == "string" ? t2 = [e6] : Array.isArray(e6) && e6.length > 0 ? t2 = typeof e6[0] == "number" || typeof e6[0] == "string" ? e6 : e6.map((e7) => e7?.getObjectId()) : j2.isCollection(e6) && e6.length > 0 && (t2 = e6.map((e7) => e7?.getObjectId()).toArray()), t2 = t2?.filter((e7) => e7 != null), t2 && t2.length ? (this._addHighlight(t2), { remove: () => this._removeHighlight(t2) }) : { remove: () => {
  683. } };
  684. }
  685. hasHighlight() {
  686. return !!this._highlightIds.size;
  687. }
  688. async hitTest(e6, r3) {
  689. if (!this.tileRenderer)
  690. return null;
  691. const s6 = await this.tileRenderer.hitTest(r3);
  692. if (s6.length === 0)
  693. return null;
  694. const { features: a5, aggregates: n4 } = await this._proxy.getFeatures(s6);
  695. return [...n4.map((i3) => this._createGraphicHit(e6, s4.fromJSON(i3))), ...a5.map((t2) => this._createGraphicHit(e6, g4.fromJSON(t2)))];
  696. }
  697. async queryAggregates() {
  698. return (await this._proxy.getAggregates()).map((e6) => s4.fromJSON(e6));
  699. }
  700. queryStatistics() {
  701. return this._proxy.queryStatistics();
  702. }
  703. async querySummaryStatistics(e6, t2, i3) {
  704. const r3 = { ...t2, scale: this.view.scale };
  705. return this._proxy.querySummaryStatistics(this._cleanUpQuery(e6), r3, i3);
  706. }
  707. async queryUniqueValues(e6, t2, i3) {
  708. const r3 = { ...t2, scale: this.view.scale };
  709. return this._proxy.queryUniqueValues(this._cleanUpQuery(e6), r3, i3);
  710. }
  711. async queryClassBreaks(e6, t2, i3) {
  712. const r3 = { ...t2, scale: this.view.scale };
  713. return this._proxy.queryClassBreaks(this._cleanUpQuery(e6), r3, i3);
  714. }
  715. async queryHistogram(e6, t2, i3) {
  716. const r3 = { ...t2, scale: this.view.scale };
  717. return this._proxy.queryHistogram(this._cleanUpQuery(e6), r3, i3);
  718. }
  719. queryFeatures(e6, t2) {
  720. return this.queryFeaturesJSON(e6, t2).then((e7) => {
  721. const t3 = x2.fromJSON(e7);
  722. return t3.features.forEach((e8) => this._setLayersForFeature(e8)), t3;
  723. });
  724. }
  725. queryVisibleFeatures(e6, t2) {
  726. return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e6), t2).then((e7) => {
  727. const t3 = x2.fromJSON(e7);
  728. return t3.features.forEach((e8) => this._setLayersForFeature(e8)), t3;
  729. });
  730. }
  731. queryFeaturesJSON(e6, t2) {
  732. return this._proxy.queryFeatures(this._cleanUpQuery(e6), t2);
  733. }
  734. queryObjectIds(e6, t2) {
  735. return this._proxy.queryObjectIds(this._cleanUpQuery(e6), t2);
  736. }
  737. queryFeatureCount(e6, t2) {
  738. return this._proxy.queryFeatureCount(this._cleanUpQuery(e6), t2);
  739. }
  740. queryExtent(e6, t2) {
  741. return this._proxy.queryExtent(this._cleanUpQuery(e6), t2).then((e7) => ({ count: e7.count, extent: M.fromJSON(e7.extent) }));
  742. }
  743. setVisibility(e6, t2) {
  744. t2 ? this._visibilityOverrides.delete(e6) : this._visibilityOverrides.add(e6), this._update();
  745. }
  746. update(e6) {
  747. if (!this._tileStrategy || !this.tileRenderer)
  748. return;
  749. const { hasMissingTiles: t2, added: i3, removed: r3 } = this._tileStrategy.update(e6);
  750. (i3.length || r3.length) && this._proxy.updateTiles({ added: i3, removed: r3 }), t2 && this.requestUpdate(), this.notifyChange("updating");
  751. }
  752. attach() {
  753. this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`), this._tileStrategy = new s5({ acquireTile: (e6) => this._acquireTile(e6), releaseTile: (e6) => this._releaseTile(e6), tileInfoView: this.view.featuresTilingScheme, buffer: 0 }), this.handles.add(l(() => this.renderingConfigHash, () => this._update(), h), "attach"), this.layer.type !== "stream" && this.handles.add(this.layer.on("edits", (e6) => this._edit(e6)), "attach");
  754. }
  755. detach() {
  756. this._commandsQueue.clear(), this._proxy?.stop(), this.container.removeAllChildren(), this.handles.remove("attach"), this.tileRenderer && (this.tileRenderer.uninstall(this.container), this.tileRenderer = null), this._tileStrategy && (this._tileStrategy.destroy(), this._tileStrategy = null), this._tileRendererHash = null;
  757. }
  758. moveStart() {
  759. this.requestUpdate();
  760. }
  761. viewChange() {
  762. this.requestUpdate();
  763. }
  764. moveEnd() {
  765. this.requestUpdate();
  766. }
  767. isUpdating() {
  768. const e6 = "renderer" in this.layer && this.layer.renderer != null, t2 = this._commandsQueue.updating, i3 = this._updatingRequiredFieldsPromise != null, r3 = !this._proxy || !this._proxy.isReady, s6 = this._pipelineIsUpdating, n4 = this.tileRenderer == null || this.tileRenderer?.updating, o4 = e6 && (t2 || i3 || r3 || s6 || n4);
  769. return a("esri-2d-log-updating") && console.log(`Updating FLV2D: ${o4}
  770. -> hasRenderer ${e6}
  771. -> hasPendingCommand ${t2}
  772. -> updatingRequiredFields ${i3}
  773. -> updatingProxy ${r3}
  774. -> updatingPipeline ${s6}
  775. -> updatingTileRenderer ${n4}
  776. `), o4;
  777. }
  778. _createClientOptions() {
  779. return { setUpdating: (e6) => {
  780. this._set("_pipelineIsUpdating", e6);
  781. }, emitEvent: (e6) => {
  782. this.emit(e6.name, e6.event);
  783. } };
  784. }
  785. async _detectQueryMode(e6) {
  786. const t2 = "path" in e6, i3 = "editingInfo" in this.layer && this.layer.editingInfo?.lastEditDate, r3 = !!this.layer.refreshInterval, s6 = !i3 && r3;
  787. if (t2 && (this.layer.type === "feature" || this.layer.type === "subtype-group") && this.layer.geometryType === "point" && this.layer.capabilities.query.supportsPagination && !this.layer.capabilities.operations.supportsEditing && !s6 && a("featurelayer-snapshot-enabled"))
  788. try {
  789. const e7 = await this.layer.queryFeatureCount();
  790. if (e7 <= a("featurelayer-snapshot-point-min-threshold"))
  791. return { mode: "snapshot", featureCount: e7 };
  792. const t3 = a("featurelayer-snapshot-point-max-threshold"), i4 = a("featurelayer-snapshot-point-coverage"), r4 = this.view.extent, s7 = e2(this.layer.fullExtent), n4 = s7?.clone().intersection(r4), o4 = r(n4) ? n4.width * n4.height : 0, l7 = s7?.width * s7?.height, d5 = l7 === 0 ? 0 : o4 / l7;
  793. if (e7 <= t3 && d5 >= i4)
  794. return { mode: "snapshot", featureCount: e7 };
  795. } catch (n4) {
  796. A3.warn("mapview-feature-layer", "Encountered an error when querying for featureCount", { error: n4 });
  797. }
  798. return { mode: "on-demand" };
  799. }
  800. async _createServiceOptions() {
  801. const e6 = this.layer;
  802. if (e6.type === "stream")
  803. return null;
  804. const { capabilities: t2, objectIdField: i3 } = e6, r3 = e6.fields.map((e7) => e7.toJSON()), s6 = r(e6.fullExtent) && e6.fullExtent.toJSON(), a5 = e4(e6.geometryType), o4 = e6.timeInfo && e6.timeInfo.toJSON() || null, l7 = e6.spatialReference ? e6.spatialReference.toJSON() : null, u5 = e6.type === "feature" ? e6.globalIdField : null;
  805. let d5;
  806. e6.type === "ogc-feature" ? d5 = e6.source.getFeatureDefinition() : Q(e6.source) ? d5 = await e6.source.openPorts() : e6.parsedUrl && (d5 = m(e6.parsedUrl), "dynamicDataSource" in e6 && e6.dynamicDataSource && (d5.query = { layer: JSON.stringify({ source: e6.dynamicDataSource }) }));
  807. const p2 = "datesInUnknownTimezone" in this.layer && this.layer.datesInUnknownTimezone, y4 = ("subtypeField" in this.layer && this.layer.subtypeField) ?? null, { mode: c4, featureCount: f3 } = await this._detectQueryMode(d5);
  808. let g5 = this.layer.objectIdField;
  809. if (this.layer.type === "feature" && r(this.layer.orderBy) && this.layer.orderBy.length) {
  810. const e7 = !this.layer.orderBy[0].valueExpression && this.layer.orderBy[0].field;
  811. e7 && (g5 = e7);
  812. }
  813. return { type: c4, timeReferenceUnknownClient: p2, subtypeField: y4, featureCount: f3, globalIdField: u5, maxRecordCount: t2.query.maxRecordCount, tileMaxRecordCount: t2.query.tileMaxRecordCount, capabilities: t2, fields: r3, fullExtent: s6, geometryType: a5, objectIdField: i3, source: d5, timeInfo: o4, spatialReference: l7, orderByFields: g5 };
  814. }
  815. async _createMemoryServiceOptions(e6) {
  816. const t2 = await e6.openPorts();
  817. return { ...this._createServiceOptions(), type: "memory", source: t2 };
  818. }
  819. _cleanUpQuery(e6) {
  820. const t2 = b2.from(e6) || this.createQuery();
  821. return t2.outSpatialReference || (t2.outSpatialReference = this.view.spatialReference), t2;
  822. }
  823. async _update() {
  824. return this._commandsQueue.push({ type: "update" });
  825. }
  826. async _edit(e6) {
  827. if (this.suspended)
  828. return void this._clearTiles();
  829. return this._validateEdit(e6) ? this._commandsQueue.push({ type: "edit", edits: e6 }) : void 0;
  830. }
  831. async doRefresh(e6) {
  832. if (this._tileStrategy.tileKeys().length)
  833. return this.suspended && e6 ? void this._clearTiles() : this._commandsQueue.push({ type: "refresh", dataChanged: e6 });
  834. }
  835. _clearTiles() {
  836. this._tileStrategy.tileKeys().length && (this._proxy.updateTiles({ added: [], removed: this._tileStrategy.tileKeys() }), this._tileStrategy.clear(), this.requestUpdate(), this._commandsQueue.clear(), this._update());
  837. }
  838. _validateEdit(e6) {
  839. const t2 = "globalIdField" in this.layer && this.layer.globalIdField, i3 = e6.deletedFeatures.some((e7) => e7.objectId === -1 || !e7.objectId), r3 = t2 && this.availableFields.includes(t2);
  840. return i3 && !r3 ? (A3.error(new s2("mapview-apply-edits", `Editing the specified service requires the layer's globalIdField, ${t2} to be included the layer's outFields for updates to be reflected on the map`)), null) : e6;
  841. }
  842. async _doUpdate() {
  843. try {
  844. if (this.destroyed || !this._hasRequiredSupport(this.layer) || !this._tileStrategy)
  845. return;
  846. const { featureEffectView: t2, filter: i3 } = this;
  847. await this._updateRequiredFields();
  848. const { renderer: r3 } = this._getEffectiveRenderer();
  849. this._set("_effectiveRenderer", r3);
  850. const s6 = this._createSchemaConfig(), a5 = this._createConfiguration(s6, i3, t2.filter), n4 = this._lastDefinitionExpression !== a5.schema.source.definitionExpression;
  851. this._lastDefinitionExpression = a5.schema.source.definitionExpression;
  852. const o4 = a5.schema.tileRenderer, l7 = this._createTileRendererHash(o4);
  853. if (this._serviceOptions.type === "snapshot" && (a5.schema.source.featureCount = this._serviceOptions.featureCount), l7 !== this._tileRendererHash) {
  854. await this._initTileRenderer(o4, r3);
  855. const e6 = this.layer, t3 = e6.type === "stream" ? await this._initServiceOptions() : this._serviceOptions;
  856. this.tileRenderer.onConfigUpdate(r3), e6.type !== "stream" && Q(e6.source) && (t3.source = await e6.source.openPorts());
  857. const i4 = { added: this._tileStrategy.tileKeys(), removed: [] };
  858. await this._proxy.startup(this.view.featuresTilingScheme, a5, t3, i4), this.hasHighlight() && await this._proxy.setHighlight(Array.from(this._highlightIds.keys())), await this._onceTilesUpdated(), this.tileRenderer.onConfigUpdate(r3);
  859. } else {
  860. this._serviceOptions.type === "snapshot" && n4 && (a5.schema.source.featureCount = await this.layer.queryFeatureCount());
  861. const t3 = await this._proxy.update(a5);
  862. (t3.mesh || t3.targets.aggregate) && this._lockGPUUploads();
  863. try {
  864. await this._proxy.applyUpdate(t3);
  865. } catch (e6) {
  866. g(e6) || A3.error(e6);
  867. }
  868. (t3.mesh || t3.targets.aggregate) && this._unlockGPUUploads(), this.tileRenderer.onConfigUpdate(r3), this._updateClusterSizeVariable(), this._forceAttributeTextureUpload();
  869. }
  870. this._tileRendererHash = l7, this.tileRenderer.invalidateLabels(), this.requestUpdate();
  871. } catch (e6) {
  872. }
  873. }
  874. async _doEdit(e6) {
  875. try {
  876. await this._proxy.onEdits(e6);
  877. } catch (t2) {
  878. g(t2), 0;
  879. }
  880. }
  881. async _doRefresh(e6) {
  882. this._lockGPUUploads();
  883. try {
  884. await this._proxy.refresh(e6);
  885. } catch (t2) {
  886. g(t2), 0;
  887. }
  888. this._unlockGPUUploads(), this.layer?.featureReduction && this._updateClusterSizeVariable();
  889. }
  890. _updateClusterSizeVariable() {
  891. this._needsClusterSizeUpdate && (this.tileRenderer.onConfigUpdate(this._effectiveRenderer), this._needsClusterSizeUpdate = false);
  892. }
  893. _createUpdateClusterSizeTask(e6, t2) {
  894. return l(() => this._aggregateValueRanges, (i3) => {
  895. this._updateClusterEffectiveRendererSizeVariable(e6, t2, i3), this._needsClusterSizeUpdate = true, this._uploadsLocked || this._updateClusterSizeVariable();
  896. });
  897. }
  898. async _updateClusterEffectiveRendererSizeVariable(e6, t2, i3) {
  899. if (e6.dynamicClusterSize && "visualVariables" in e6 && e6.visualVariables) {
  900. const r3 = d2(e6.visualVariables);
  901. if (r(r3) && r3.field === "cluster_count") {
  902. const s6 = e6.visualVariables.indexOf(r3);
  903. e6.visualVariables[s6] = f(t2, i3);
  904. const a5 = e6.clone();
  905. a5.dynamicClusterSize = true, this._set("_effectiveRenderer", a5);
  906. }
  907. }
  908. }
  909. _getEffectiveRenderer() {
  910. const e6 = "renderer" in this.layer && this.layer.renderer, t2 = this.layer.featureReduction;
  911. if (r(this._updateClusterSizeTask) && (this._updateClusterSizeTask.remove(), this._updateClusterSizeTask = null), t2 && "renderer" in t2 && t2.renderer) {
  912. const e7 = [];
  913. for (const i3 of t2.fields ?? [])
  914. x3(e7, i3);
  915. return { renderer: t2.renderer, aggregateFields: e7, featureReduction: t2 };
  916. }
  917. if (t2 && t2.type === "cluster" && m2(e6)) {
  918. const i3 = t2, r3 = [], s6 = c(r3, e6, i3, this._aggregateValueRanges);
  919. return o(this._updateClusterSizeTask, (e7) => e7.remove()), this._updateClusterSizeTask = this._createUpdateClusterSizeTask(s6, i3), { renderer: s6, aggregateFields: r3, featureReduction: t2 };
  920. }
  921. return { renderer: e6, aggregateFields: [], featureReduction: null };
  922. }
  923. _acquireTile(e6) {
  924. const t2 = this.tileRenderer.acquireTile(e6);
  925. return t2.once("attach", () => {
  926. this.requestUpdate();
  927. }), t2;
  928. }
  929. _releaseTile(e6) {
  930. this.tileRenderer.releaseTile(e6);
  931. }
  932. async _initTileRenderer(e6, t2) {
  933. const i3 = await e5(e6, { layerView: this, tileInfoView: this.view.featuresTilingScheme, layer: this.layer });
  934. return this.tileRenderer && (this._tileStrategy.clear(), this.tileRenderer.uninstall(this.container), this.tileRenderer.destroy(), this.tileRenderer = null), this.destroyed ? null : (this._proxy.tileRenderer = i3, this._set("tileRenderer", i3), this.tileRenderer.install(this.container), this.tileRenderer.onConfigUpdate(t2), this.requestUpdate(), this.tileRenderer);
  935. }
  936. _createTileRendererHash(e6) {
  937. return `${e6.type}`;
  938. }
  939. get hasFilter() {
  940. const e6 = !!("floorInfo" in this.layer && this.layer.floorInfo && this.view.floors && this.view.floors.length);
  941. return !!this.filter || e6 || !!this._visibilityOverrides.size || !!this.timeExtent;
  942. }
  943. _injectOverrides(e6) {
  944. const t2 = r(e6) ? e6.timeExtent : null, i3 = r(this.timeExtent) && r(t2) ? this.timeExtent.intersection(t2) : this.timeExtent || t2;
  945. let r3 = null;
  946. const s6 = "floorInfo" in this.layer && this.layer.floorInfo;
  947. if (s6) {
  948. const t3 = r(e6) && e6.where;
  949. r3 = this._addFloorFilterClause(t3);
  950. }
  951. if (!this._visibilityOverrides.size && !i3 && !s6)
  952. return r(e6) ? e6.toJSON() : null;
  953. (e6 = r(e6) && e6.clone() || new y2()).timeExtent = i3, r3 && (e6.where = r3);
  954. const a5 = e6.toJSON();
  955. return a5.hiddenIds = Array.from(this._visibilityOverrides), a5;
  956. }
  957. _addFloorFilterClause(e6) {
  958. const t2 = this.layer;
  959. let i3 = e6 || "";
  960. if ("floorInfo" in t2 && t2.floorInfo) {
  961. let e7 = this.view.floors;
  962. if (!e7 || !e7.length)
  963. return i3;
  964. t2.floorInfo.viewAllLevelIds?.length && (e7 = t2.floorInfo.viewAllLevelIds);
  965. const r3 = e7.filter((e8) => e8 !== "").map((e8) => "'" + e8 + "'");
  966. r3.push("''");
  967. const s6 = t2.floorInfo.floorField;
  968. let a5 = "(" + s6 + " IN ({ids}) OR " + s6 + " IS NULL)";
  969. if (a5 = a5.replace("{ids}", r3.join(", ")), r(i3) && i3.includes(s6)) {
  970. let e8 = new RegExp("AND \\(" + s6 + ".*NULL\\)", "g");
  971. i3 = i3.replace(e8, ""), e8 = new RegExp("\\(" + s6 + ".*NULL\\)", "g"), i3 = i3.replace(e8, ""), i3 = i3.replace(/\s+/g, " ").trim();
  972. }
  973. i3 = i3 !== "" ? "(" + i3 + ") AND " + a5 : a5;
  974. }
  975. return i3 !== "" ? i3 : null;
  976. }
  977. _createConfiguration(e6, t2, i3) {
  978. const r3 = this.layer.type === "feature" && this.layer.historicMoment ? this.layer.historicMoment.getTime() : void 0, s6 = this.layer.type === "feature" ? this.layer.gdbVersion : void 0, a5 = new Array(S), n4 = this._injectOverrides(t2);
  979. a5[0] = n4, a5[1] = r(i3) ? i3.toJSON() : null;
  980. const o4 = z(e6);
  981. if (t(o4))
  982. return null;
  983. const l7 = l4("2d");
  984. return { availableFields: this.availableFields, gdbVersion: s6, historicMoment: r3, devicePixelRatio: window.devicePixelRatio || 1, filters: a5, schema: o4, supportsTextureFloat: l7.supportsTextureFloat, maxTextureSize: l7.maxTextureSize };
  985. }
  986. _hasRequiredSupport(e6) {
  987. return !("renderer" in e6) || v(e6.renderer);
  988. }
  989. _onceTilesUpdated() {
  990. return this.requestUpdate(), j3(() => !this._pipelineIsUpdating);
  991. }
  992. _lockGPUUploads() {
  993. this.tileRenderer && (this._uploadsLocked = true, this.tileRenderer.lockGPUUploads());
  994. }
  995. _unlockGPUUploads() {
  996. this.tileRenderer && (this._uploadsLocked = false, this.tileRenderer.unlockGPUUploads());
  997. }
  998. _forceAttributeTextureUpload() {
  999. this.tileRenderer && this.tileRenderer.forceAttributeTextureUpload();
  1000. }
  1001. _createSchemaConfig() {
  1002. const e6 = this.layer.type === "feature" ? this.layer.historicMoment : null, t2 = this.layer.type === "feature" ? this.layer.gdbVersion : null;
  1003. return { renderer: "renderer" in this.layer && this.layer.renderer, spatialReference: this.layer.spatialReference, timeExtent: this.layer.timeExtent, definitionExpression: this.layer.definitionExpression, featureReduction: this.layer.featureReduction, fields: this.layer.fields, geometryType: this.layer.geometryType, historicMoment: e6, labelsVisible: "labelsVisible" in this.layer && this.layer.labelsVisible, labelingInfo: "labelingInfo" in this.layer && this.layer.labelingInfo, availableFields: this.availableFields, featureEffect: this.featureEffect, filter: this.filter, gdbVersion: t2, pixelBuffer: 0, orderBy: "orderBy" in this.layer && this.layer.orderBy ? this.layer.orderBy : null, customParameters: { ..."customParameters" in this.layer ? this.layer.customParameters : void 0, token: "apiKey" in this.layer ? this.layer.apiKey : void 0 }, subtypeCode: "subtypeCode" in this.layer ? this.layer.subtypeCode : void 0, subtypeField: "subtypeField" in this.layer ? this.layer.subtypeField : void 0 };
  1004. }
  1005. _addHighlight(e6) {
  1006. for (const t2 of e6)
  1007. if (this._highlightIds.has(t2)) {
  1008. const e7 = this._highlightIds.get(t2);
  1009. this._highlightIds.set(t2, e7 + 1);
  1010. } else
  1011. this._highlightIds.set(t2, 1);
  1012. this._updateHighlight().catch((e7) => {
  1013. g(e7) || A3.error(e7);
  1014. });
  1015. }
  1016. _removeHighlight(e6) {
  1017. for (const t2 of e6)
  1018. if (this._highlightIds.has(t2)) {
  1019. const e7 = this._highlightIds.get(t2) - 1;
  1020. e7 === 0 ? this._highlightIds.delete(t2) : this._highlightIds.set(t2, e7);
  1021. }
  1022. this._updateHighlight().catch((e7) => {
  1023. g(e7) || A3.error(e7);
  1024. });
  1025. }
  1026. _setLayersForFeature(e6) {
  1027. const t2 = this.layer;
  1028. e6.layer = t2, e6.sourceLayer = t2;
  1029. }
  1030. _createGraphicHit(e6, t2) {
  1031. return this._setLayersForFeature(t2), r(t2.geometry) && (t2.geometry.spatialReference = this.view.spatialReference), { type: "graphic", graphic: t2, layer: this.layer, mapPoint: e6 };
  1032. }
  1033. };
  1034. e([d()], M2.prototype, "_serviceOptions", void 0), e([d()], M2.prototype, "_proxy", void 0), e([d()], M2.prototype, "_pipelineIsUpdating", void 0), e([d()], M2.prototype, "_effectiveRenderer", void 0), e([d()], M2.prototype, "_aggregateValueRanges", void 0), e([d()], M2.prototype, "_commandsQueue", void 0), e([d()], M2.prototype, "featureEffectView", void 0), e([d()], M2.prototype, "labelsVisible", null), e([d({ readOnly: true })], M2.prototype, "queryMode", null), e([d()], M2.prototype, "renderingConfigHash", null), e([d()], M2.prototype, "tileRenderer", void 0), e([d()], M2.prototype, "updating", void 0), M2 = e([n("esri.views.2d.layers.FeatureLayerView2D")], M2);
  1035. var B = M2;
  1036. export {
  1037. B
  1038. };
  1039. //# sourceMappingURL=chunk-3IU4W5A7.js.map