chunk-ZELEU5PN.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. import {
  2. l,
  3. n as n2,
  4. r as r3
  5. } from "./chunk-O7E4VYJT.js";
  6. import {
  7. b,
  8. t as t2
  9. } from "./chunk-PHAKVYRM.js";
  10. import {
  11. c as c2,
  12. e as e3,
  13. f,
  14. i,
  15. n,
  16. s as s3,
  17. u
  18. } from "./chunk-XBFCIW4K.js";
  19. import {
  20. me
  21. } from "./chunk-T2SKWJGU.js";
  22. import {
  23. N,
  24. O,
  25. P,
  26. S,
  27. T,
  28. c
  29. } from "./chunk-XO5VJRK4.js";
  30. import {
  31. G
  32. } from "./chunk-3OFVLRSL.js";
  33. import {
  34. Mt,
  35. lt,
  36. ot,
  37. pt,
  38. rt,
  39. tt
  40. } from "./chunk-JKFWEHNK.js";
  41. import {
  42. e as e2
  43. } from "./chunk-3IRT3YKJ.js";
  44. import {
  45. m
  46. } from "./chunk-IEU3AM37.js";
  47. import {
  48. r as r2
  49. } from "./chunk-JLSNMUQJ.js";
  50. import {
  51. a
  52. } from "./chunk-RYY6632W.js";
  53. import {
  54. D,
  55. j
  56. } from "./chunk-V6P2MAQQ.js";
  57. import {
  58. s2 as s,
  59. s3 as s2
  60. } from "./chunk-E5O6P5I2.js";
  61. import {
  62. has
  63. } from "./chunk-SPWQ3AWG.js";
  64. import {
  65. A,
  66. E,
  67. e,
  68. o,
  69. r,
  70. t
  71. } from "./chunk-YXWMMD76.js";
  72. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderJSON.js
  73. function d({ coords: t3, lengths: e4 }) {
  74. let r6 = 0;
  75. for (const s4 of e4) {
  76. for (let e5 = 1; e5 < s4; e5++)
  77. t3[2 * (r6 + e5)] += t3[2 * (r6 + e5) - 2], t3[2 * (r6 + e5) + 1] += t3[2 * (r6 + e5) - 1];
  78. r6 += s4;
  79. }
  80. }
  81. var c3 = class extends b {
  82. constructor(t3, e4, r6) {
  83. super(t3, r6), this._exceededTransferLimit = false, this._featureIndex = -1, this._dateFields = /* @__PURE__ */ new Set(), this._geometryType = r6 == null ? void 0 : r6.geometryType, this._features = e4;
  84. }
  85. static fromFeatures(t3, e4) {
  86. const { objectIdField: s4, geometryType: i2 } = e4, n4 = tt([], t3, i2, false, false, s4);
  87. for (let r6 = 0; r6 < n4.length; r6++)
  88. n4[r6].displayId = t3[r6].displayId;
  89. return c3.fromOptimizedFeatures(n4, e4);
  90. }
  91. static fromFeatureSet(t3, e4) {
  92. const r6 = lt(t3, e4.objectIdField);
  93. return c3.fromOptimizedFeatureSet(r6, e4);
  94. }
  95. static fromOptimizedFeatureSet(t3, e4) {
  96. const { features: r6 } = t3, s4 = c3.fromOptimizedFeatures(r6, e4);
  97. s4._exceededTransferLimit = t3.exceededTransferLimit, s4._transform = t3.transform;
  98. for (const i2 of t3.fields)
  99. "esriFieldTypeDate" === i2.type && s4._dateFields.add(i2.name);
  100. return s4;
  101. }
  102. static fromOptimizedFeatures(t3, e4, r6) {
  103. const s4 = b.createInstance(), i2 = new c3(s4, t3, e4);
  104. return i2._transform = r6, i2;
  105. }
  106. get _current() {
  107. return this._features[this._featureIndex];
  108. }
  109. get geometryType() {
  110. return this._geometryType;
  111. }
  112. get hasFeatures() {
  113. return !!this._features.length;
  114. }
  115. get hasNext() {
  116. return this._featureIndex + 1 < this._features.length;
  117. }
  118. get exceededTransferLimit() {
  119. return this._exceededTransferLimit;
  120. }
  121. get hasZ() {
  122. return false;
  123. }
  124. get hasM() {
  125. return false;
  126. }
  127. removeIds(t3) {
  128. const e4 = new Set(t3);
  129. this._features = this._features.filter((t4) => !(t4.objectId && e4.has(t4.objectId)));
  130. }
  131. append(t3) {
  132. for (const e4 of t3)
  133. this._features.push(e4);
  134. }
  135. getSize() {
  136. return this._features.length;
  137. }
  138. getCursor() {
  139. return this.copy();
  140. }
  141. getQuantizationTransform() {
  142. return this._transform;
  143. }
  144. getAttributeHash() {
  145. let t3 = "";
  146. for (const e4 in this._current.attributes)
  147. t3 += this._current.attributes[e4];
  148. return t3;
  149. }
  150. getIndex() {
  151. return this._featureIndex;
  152. }
  153. setIndex(t3) {
  154. this._featureIndex = t3;
  155. }
  156. getObjectId() {
  157. return this._current.objectId;
  158. }
  159. getDisplayId() {
  160. return this._current.displayId;
  161. }
  162. setDisplayId(t3) {
  163. this._current.displayId = t3;
  164. }
  165. getGroupId() {
  166. return this._current.groupId;
  167. }
  168. setGroupId(t3) {
  169. this._current.groupId = t3;
  170. }
  171. copy() {
  172. const t3 = new c3(this.instance, this._features, this.fullSchema());
  173. return this.copyInto(t3), t3;
  174. }
  175. next() {
  176. for (; ++this._featureIndex < this._features.length && !this._getExists(); )
  177. ;
  178. return this._featureIndex < this._features.length;
  179. }
  180. readLegacyFeature() {
  181. return ot(this._current, this.geometryType, this.hasZ, this.hasM);
  182. }
  183. readOptimizedFeature() {
  184. return this._current;
  185. }
  186. readLegacyPointGeometry() {
  187. return this.readGeometry() ? { x: this.getX(), y: this.getY() } : null;
  188. }
  189. readLegacyGeometry() {
  190. const t3 = this.readGeometry();
  191. return rt(t3, this.geometryType, this.hasZ, this.hasM);
  192. }
  193. readLegacyCentroid() {
  194. const e4 = this.readCentroid();
  195. return t(e4) ? null : { x: e4.coords[0] * this._sx + this._tx, y: e4.coords[1] * this._sy + this._ty };
  196. }
  197. readGeometryArea() {
  198. return e2(this._current) ? Mt(this._current.geometry, 2) : 0;
  199. }
  200. readUnquantizedGeometry() {
  201. const t3 = this.readGeometry();
  202. if ("esriGeometryPoint" === this.geometryType || !t3)
  203. return t3;
  204. const e4 = t3.clone();
  205. return d(e4), e4;
  206. }
  207. readHydratedGeometry() {
  208. const r6 = this._current.geometry;
  209. if (t(r6))
  210. return null;
  211. const s4 = r6.clone();
  212. return r(this._transform) && pt(s4, s4, this.hasZ, this.hasM, this._transform), s4;
  213. }
  214. getXHydrated() {
  215. if (!e2(this._current))
  216. return 0;
  217. const e4 = this._current.geometry.coords[0], r6 = this.getQuantizationTransform();
  218. return t(r6) ? e4 : e4 * r6.scale[0] + r6.translate[0];
  219. }
  220. getYHydrated() {
  221. if (!e2(this._current))
  222. return 0;
  223. const e4 = this._current.geometry.coords[1], r6 = this.getQuantizationTransform();
  224. return t(r6) ? e4 : r6.translate[1] - e4 * r6.scale[1];
  225. }
  226. getX() {
  227. return e2(this._current) ? this._current.geometry.coords[0] * this._sx + this._tx : 0;
  228. }
  229. getY() {
  230. return e2(this._current) ? this._current.geometry.coords[1] * this._sy + this._ty : 0;
  231. }
  232. readGeometry() {
  233. if (!e2(this._current)) {
  234. if (r(this._current.centroid)) {
  235. const [t4, e4] = this._current.centroid.coords;
  236. return this.createQuantizedExtrudedQuad(t4, e4);
  237. }
  238. return null;
  239. }
  240. const t3 = this._current.geometry.clone();
  241. if (t3.isPoint)
  242. return t3.coords[0] = t3.coords[0] * this._sx + this._tx, t3.coords[1] = t3.coords[1] * this._sy + this._ty, t3;
  243. let r6 = 0;
  244. for (const e4 of t3.lengths)
  245. t3.coords[2 * r6] = t3.coords[2 * r6] * this._sx + this._tx, t3.coords[2 * r6 + 1] = t3.coords[2 * r6 + 1] * this._sy + this._ty, r6 += e4;
  246. return t3;
  247. }
  248. readCentroid() {
  249. return e2(this._current) ? this._computeCentroid() : this._current.centroid;
  250. }
  251. hasField(t3) {
  252. if (t3 in this._current.attributes)
  253. return true;
  254. return this.getFieldNames().map((t4) => t4.toLowerCase()).includes(t3.toLowerCase());
  255. }
  256. getFieldNames() {
  257. return Object.keys(this._current.attributes);
  258. }
  259. _readAttribute(t3, e4) {
  260. const r6 = this._current.attributes[t3];
  261. if (void 0 !== r6)
  262. return null != r6 && e4 && this._dateFields.has(t3) ? new Date(r6) : r6;
  263. const s4 = this.readAttributes(), i2 = t3.toLocaleLowerCase().trim();
  264. for (const n4 in s4)
  265. if (n4.toLocaleLowerCase().trim() === i2) {
  266. const t4 = this._current.attributes[n4];
  267. return null != t4 && e4 && this._dateFields.has(n4) ? new Date(t4) : t4;
  268. }
  269. }
  270. copyInto(t3) {
  271. super.copyInto(t3), t3._featureIndex = this._featureIndex, t3._transform = this._transform, t3._dateFields = this._dateFields;
  272. }
  273. _readAttributes() {
  274. return this._current.attributes;
  275. }
  276. };
  277. // node_modules/@arcgis/core/views/2d/layers/features/support/AttributeStore.js
  278. var k = s.getLogger("esri.views.layers.2d.features.support.AttributeStore");
  279. var F = n2(l, k);
  280. var M = { sharedArrayBuffer: has("esri-shared-array-buffer"), atomics: has("esri-atomics") };
  281. function B(t3, e4) {
  282. return (i2) => e4(t3(i2));
  283. }
  284. var C = class {
  285. constructor(t3, e4, i2, s4) {
  286. this.size = 0, this.texelSize = 4;
  287. const { pixelType: r6, layout: a2, textureOnly: o2 } = s4;
  288. this.textureOnly = o2 || false, this.pixelType = r6, this._ctype = e4, this.layout = a2, this._resetRange(), this._shared = t3, this.size = i2, o2 || (this.data = this._initData(r6, i2, t3, e4));
  289. }
  290. get buffer() {
  291. return o(this.data, (t3) => t3.buffer);
  292. }
  293. unsetComponentAllTexels(t3, e4) {
  294. const i2 = e(this.data);
  295. for (let s4 = 0; s4 < this.size * this.size; s4++)
  296. i2[s4 * this.texelSize + t3] &= ~e4;
  297. this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1;
  298. }
  299. setComponentAllTexels(t3, e4) {
  300. const i2 = e(this.data);
  301. for (let s4 = 0; s4 < this.size * this.size; s4++)
  302. i2[s4 * this.texelSize + t3] |= 255 & e4;
  303. this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1;
  304. }
  305. setComponent(t3, e4, i2) {
  306. const s4 = e(this.data);
  307. for (const r6 of i2)
  308. s4[r6 * this.texelSize + t3] |= e4, this.dirtyStart = Math.min(this.dirtyStart, r6), this.dirtyEnd = Math.max(this.dirtyEnd, r6);
  309. }
  310. setComponentTexel(t3, e4, i2) {
  311. e(this.data)[i2 * this.texelSize + t3] |= e4, this.dirtyStart = Math.min(this.dirtyStart, i2), this.dirtyEnd = Math.max(this.dirtyEnd, i2);
  312. }
  313. unsetComponentTexel(t3, e4, i2) {
  314. e(this.data)[i2 * this.texelSize + t3] &= ~e4, this.dirtyStart = Math.min(this.dirtyStart, i2), this.dirtyEnd = Math.max(this.dirtyEnd, i2);
  315. }
  316. getData(t3, e4) {
  317. const i2 = f(t3);
  318. return e(this.data)[i2 * this.texelSize + e4];
  319. }
  320. setData(t3, e4, i2) {
  321. const s4 = f(t3), r6 = 1 << e4;
  322. 0 != (this.layout & r6) ? (this.data[s4 * this.texelSize + e4] = i2, this.dirtyStart = Math.min(this.dirtyStart, s4), this.dirtyEnd = Math.max(this.dirtyEnd, s4)) : k.error("mapview-attributes-store", "Tried to set a value for a texel's readonly component");
  323. }
  324. lock() {
  325. this.pixelType === G.UNSIGNED_BYTE && this._shared && M.atomics && "local" !== this._ctype && Atomics.store(this.data, 0, 1);
  326. }
  327. unlock() {
  328. this.pixelType === G.UNSIGNED_BYTE && this._shared && M.atomics && "local" !== this._ctype && Atomics.store(this.data, 0, 0);
  329. }
  330. expand(t3) {
  331. if (this.size = t3, !this.textureOnly) {
  332. const e4 = this._initData(this.pixelType, t3, this._shared, this._ctype), i2 = e(this.data);
  333. e4.set(i2), this.data = e4;
  334. }
  335. }
  336. toMessage() {
  337. const t3 = this.dirtyStart, e4 = this.dirtyEnd, i2 = this.texelSize;
  338. if (t3 > e4)
  339. return null;
  340. this._resetRange();
  341. const s4 = !(this._shared || "local" === this._ctype), r6 = this.pixelType, a2 = this.layout, o2 = e(this.data);
  342. return { start: t3, end: e4, data: s4 && o2.slice(t3 * i2, (e4 + 1) * i2) || null, pixelType: r6, layout: a2 };
  343. }
  344. _initData(t3, e4, i2, s4) {
  345. const r6 = i2 && "local" !== s4 ? SharedArrayBuffer : ArrayBuffer, a2 = me(t3), o2 = new a2(new r6(e4 * e4 * 4 * a2.BYTES_PER_ELEMENT));
  346. for (let n4 = 0; n4 < o2.length; n4 += 4)
  347. o2[n4 + 1] = 255;
  348. return o2;
  349. }
  350. _resetRange() {
  351. this.dirtyStart = 2147483647, this.dirtyEnd = 0;
  352. }
  353. };
  354. var v = class {
  355. constructor(t3, e4, i2 = () => {
  356. }) {
  357. this._client = t3, this.config = e4, this._notifyChange = i2, this._attributeComputeMap = /* @__PURE__ */ new Map(), this._blocks = new Array(), this._filters = new Array(S), this._targetType = 0, this._abortController = new AbortController(), this._hasScaleExpr = false, this._size = 32, this._idsToHighlight = /* @__PURE__ */ new Set();
  358. const s4 = e4.supportsTextureFloat ? G.FLOAT : G.UNSIGNED_BYTE;
  359. F(`Creating AttributeStore ${M.sharedArrayBuffer ? "with" : "without"} shared memory`), this._blockDescriptors = [{ pixelType: G.UNSIGNED_BYTE, layout: 1 }, { pixelType: G.UNSIGNED_BYTE, layout: 15, textureOnly: true }, { pixelType: G.UNSIGNED_BYTE, layout: 15, textureOnly: true }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }], this._blocks = this._blockDescriptors.map(() => null);
  360. }
  361. destroy() {
  362. this._abortController.abort();
  363. }
  364. get hasScaleExpr() {
  365. return this._hasScaleExpr;
  366. }
  367. get _signal() {
  368. return this._abortController.signal;
  369. }
  370. get hasHighlight() {
  371. return this._idsToHighlight.size > 0;
  372. }
  373. isUpdating() {
  374. return !!this._currUpdate || !!this._nextUpdate;
  375. }
  376. update(t3, e4) {
  377. this.config = e4;
  378. const i2 = e4.schema.processors[0].storage, a2 = m(this._schema, i2);
  379. if ((t3.targets.feature || t3.targets.aggregate) && (t3.storage.data = true), a2 && (has("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", a2), t3.storage.data = true, this._schema = i2, this._attributeComputeMap.clear(), !t(i2))) {
  380. switch (i2.target) {
  381. case "feature":
  382. this._targetType = u;
  383. break;
  384. case "aggregate":
  385. this._targetType = c2;
  386. }
  387. if ("subtype" === i2.type)
  388. for (const t4 in i2.mapping) {
  389. const e5 = i2.mapping[t4];
  390. if (r(e5) && r(e5.vvMapping))
  391. for (const t5 of e5.vvMapping)
  392. this._bindAttribute(t5);
  393. }
  394. else {
  395. if (r(i2.vvMapping))
  396. for (const t4 of i2.vvMapping)
  397. this._bindAttribute(t4);
  398. if (r(i2.attributeMapping))
  399. for (const t4 of i2.attributeMapping)
  400. this._bindAttribute(t4);
  401. }
  402. }
  403. }
  404. onTileData(t3, e4) {
  405. if (t(e4.addOrUpdate))
  406. return;
  407. const i2 = e4.addOrUpdate.getCursor();
  408. for (; i2.next(); ) {
  409. const t4 = i2.getDisplayId();
  410. this.setAttributeData(t4, i2);
  411. }
  412. }
  413. async setHighlight(t3, e4) {
  414. const i2 = 1, s4 = this._getBlock(0), r6 = e4.map((t4) => f(t4));
  415. s4.lock(), s4.unsetComponentAllTexels(0, i2), s4.setComponent(0, i2, r6), s4.unlock(), this._idsToHighlight.clear();
  416. for (const a2 of t3)
  417. this._idsToHighlight.add(a2);
  418. await this.sendUpdates();
  419. }
  420. async updateFilters(t3, e4, i2) {
  421. const { service: s4, spatialReference: r6 } = i2, { filters: a2 } = e4, o2 = a2.map((t4, e5) => this._updateFilter(t4, e5, s4, r6));
  422. (await Promise.all(o2)).some((t4) => t4) && (t3.storage.filters = true, has("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", "Filters changed"));
  423. }
  424. setData(t3, e4, i2, s4) {
  425. const r6 = f(t3);
  426. this._ensureSizeForTexel(r6), this._getBlock(e4).setData(t3, i2, s4);
  427. }
  428. getData(t3, e4, i2) {
  429. return this._getBlock(e4).getData(t3, i2);
  430. }
  431. getHighlightFlag(t3) {
  432. return this._idsToHighlight.has(t3) ? T : 0;
  433. }
  434. unsetAttributeData(t3) {
  435. const e4 = f(t3);
  436. this._getBlock(0).setData(e4, 0, 0);
  437. }
  438. setAttributeData(t3, e4) {
  439. const s4 = f(t3);
  440. if (this._ensureSizeForTexel(s4), this._getBlock(0).setData(s4, 0, this.getFilterFlags(e4)), this._targetType !== e3(t3))
  441. return;
  442. const r6 = this._attributeComputeMap, a2 = this.config.supportsTextureFloat ? 1 : 2, o2 = 4;
  443. r6.size && r6.forEach((t4, r7) => {
  444. const n4 = r7 * a2 % o2, h = Math.floor(r7 * a2 / o2), l2 = this._getBlock(h + P), u2 = t4(e4);
  445. if (this.config.supportsTextureFloat)
  446. l2.setData(s4, n4, u2);
  447. else if (u2 === c)
  448. l2.setData(s4, n4, 255), l2.setData(s4, n4 + 1, 255);
  449. else {
  450. const t5 = a(Math.round(u2), -32767, 32766) + 32768, e5 = 255 & t5, r8 = (65280 & t5) >> 8;
  451. l2.setData(s4, n4, e5), l2.setData(s4, n4 + 1, r8);
  452. }
  453. });
  454. }
  455. sendUpdates() {
  456. if (has("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate"), this._notifyChange(), this._nextUpdate)
  457. return this._nextUpdate.promise;
  458. if (this._currUpdate)
  459. return this._nextUpdate = D(), this._nextUpdate.promise;
  460. const e4 = { blocks: this._blocks.map((t3) => r(t3) ? t3.toMessage() : null) };
  461. return this._currUpdate = this._createResources().then(() => {
  462. const t3 = () => {
  463. if (this._currUpdate = null, this._nextUpdate) {
  464. const t4 = this._nextUpdate;
  465. this._nextUpdate = null, this.sendUpdates().then(() => t4.resolve());
  466. } else
  467. has("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::No additional updates queued");
  468. this._notifyChange();
  469. };
  470. has("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::client.update");
  471. const i2 = this._client.update(e4, this._signal).then(t3).catch(t3);
  472. return this._client.render(this._signal), i2;
  473. }).catch((e5) => {
  474. if (j(e5))
  475. return this._createResourcesPromise = null, this._createResources();
  476. this._notifyChange(), k.error(new s2("mapview-attribute-store", "Encountered an error during client update", e5));
  477. }), this._currUpdate;
  478. }
  479. _ensureSizeForTexel(t3) {
  480. for (; t3 >= this._size * this._size; )
  481. if (this._expand())
  482. return;
  483. }
  484. _bindAttribute(t3) {
  485. function e4() {
  486. return t3.normalizationField ? (e5) => {
  487. const i3 = e5.readAttribute(t3.normalizationField);
  488. if (!i3)
  489. return null;
  490. return e5.readAttribute(t3.field) / i3;
  491. } : (e5) => e5.readAttribute(t3.field);
  492. }
  493. function i2() {
  494. return t3.normalizationField && k.warn("mapview-arcade", "Ignoring normalizationField specified with an arcade expression which is not supported."), (e5) => e5.getComputedNumericAtIndex(t3.fieldIndex);
  495. }
  496. let s4;
  497. if (null != t3.fieldIndex)
  498. s4 = i2();
  499. else {
  500. if (!t3.field)
  501. return;
  502. s4 = e4();
  503. }
  504. if (t3.valueRepresentation) {
  505. s4 = B(s4, (e5) => r3(e5, t3.valueRepresentation));
  506. }
  507. const r6 = (t4) => null === t4 || isNaN(t4) || t4 === 1 / 0 || t4 === -1 / 0 ? c : t4;
  508. this._attributeComputeMap.set(t3.binding, B(s4, r6));
  509. }
  510. _createResources() {
  511. if (r(this._createResourcesPromise))
  512. return this._createResourcesPromise;
  513. this._getBlock(N), this._getBlock(O), F("Initializing AttributeStore");
  514. const e4 = { shared: M.sharedArrayBuffer && !("local" === this._client.type), size: this._size, blocks: A(this._blocks, (t3) => ({ textureOnly: t3.textureOnly, buffer: t3.buffer, pixelType: t3.pixelType })) }, i2 = this._client.initialize(e4, this._signal).catch((e5) => {
  515. j(e5) ? this._createResourcesPromise = null : k.error(new s2("mapview-attribute-store", "Encountered an error during client initialization", e5));
  516. });
  517. return this._createResourcesPromise = i2, i2.then(() => t(this._createResourcesPromise) ? this._createResources() : void 0), i2;
  518. }
  519. _getBlock(t3) {
  520. const e4 = this._blocks[t3];
  521. if (r(e4))
  522. return e4;
  523. F(`Initializing AttributeBlock at index ${t3}`);
  524. const i2 = M.sharedArrayBuffer, s4 = this._client.type, a2 = new C(i2, s4, this._size, this._blockDescriptors[t3]);
  525. return this._blocks[t3] = a2, this._createResourcesPromise = null, a2;
  526. }
  527. _expand() {
  528. if (this._size < this.config.maxTextureSize) {
  529. const t3 = this._size <<= 1;
  530. return F("Expanding block size to", t3, this._blocks), E(this._blocks, (e4) => e4.expand(t3)), this._createResourcesPromise = null, this._size = t3, 0;
  531. }
  532. return k.error(new s2("mapview-limitations", "Maximum number of onscreen features exceeded.")), -1;
  533. }
  534. async _updateFilter(t3, e4, i2, a2) {
  535. const o2 = this._filters[e4], n4 = r(o2) && o2.hash;
  536. if (!o2 && !t3)
  537. return false;
  538. if (n4 === JSON.stringify(t3))
  539. return false;
  540. if (t(t3)) {
  541. if (!o2)
  542. return false;
  543. const t4 = 1 << e4 + 1, i3 = this._getBlock(0);
  544. return this._filters[e4] = null, i3.setComponentAllTexels(0, t4), this.sendUpdates(), true;
  545. }
  546. const h = await this._getFilter(e4, i2);
  547. return await h.update(t3, a2), true;
  548. }
  549. async _getFilter(t3, e4) {
  550. const i2 = this._filters[t3];
  551. if (r(i2))
  552. return i2;
  553. const { default: s4 } = await import("./FeatureFilter-DOO77BOI.js"), a2 = new s4({ geometryType: e4.geometryType, hasM: false, hasZ: false, timeInfo: e4.timeInfo, fieldsIndex: new r2(e4.fields) });
  554. return this._filters[t3] = a2, a2;
  555. }
  556. isVisible(t3) {
  557. return !!(2 & this._getBlock(0).getData(t3, 0));
  558. }
  559. getFilterFlags(t3) {
  560. let e4 = 0;
  561. const i2 = i(t3.getDisplayId());
  562. for (let a2 = 0; a2 < this._filters.length; a2++) {
  563. const r7 = !!(i2 & 1 << a2), o2 = this._filters[a2];
  564. e4 |= (!r7 || t(o2) || o2.check(t3) ? 1 : 0) << a2;
  565. }
  566. let r6 = 0;
  567. if (this._idsToHighlight.size) {
  568. const e5 = t3.getObjectId();
  569. r6 = this.getHighlightFlag(e5);
  570. }
  571. return e4 << 1 | r6;
  572. }
  573. };
  574. // node_modules/@arcgis/core/views/2d/layers/features/support/DisplayIdGenerator.js
  575. var r4 = class {
  576. constructor() {
  577. this._freeIds = [], this._idCounter = 1;
  578. }
  579. createId(r6 = false) {
  580. return s3(this._getFreeId(), r6);
  581. }
  582. releaseId(e4) {
  583. this._freeIds.push(e4);
  584. }
  585. _getFreeId() {
  586. return this._freeIds.length ? this._freeIds.pop() : this._idCounter++;
  587. }
  588. };
  589. // node_modules/@arcgis/core/views/2d/layers/features/support/ComputedAttributeStorage.js
  590. function n3(t3, e4, s4) {
  591. if (!(t3.length > e4))
  592. for (; t3.length <= e4; )
  593. t3.push(s4);
  594. }
  595. var r5 = class {
  596. constructor() {
  597. this._numerics = [], this._strings = [], this._idGenerator = new r4(), this._allocatedSize = 256, this._bitsets = [], this._instanceIds = [], this._bounds = [];
  598. }
  599. createBitset() {
  600. const e4 = this._bitsets.length;
  601. return this._bitsets.push(t2.create(this._allocatedSize, n)), e4 + 1;
  602. }
  603. getBitset(t3) {
  604. return this._bitsets[t3 - 1];
  605. }
  606. _expand() {
  607. this._allocatedSize <<= 1;
  608. for (const t3 of this._bitsets)
  609. t3.resize(this._allocatedSize);
  610. }
  611. _ensureNumeric(t3, e4) {
  612. this._numerics[t3] || (this._numerics[t3] = []);
  613. n3(this._numerics[t3], e4, 0);
  614. }
  615. _ensureInstanceId(t3) {
  616. n3(this._instanceIds, t3, 0);
  617. }
  618. _ensureString(t3, e4) {
  619. this._strings[t3] || (this._strings[t3] = []);
  620. n3(this._strings[t3], e4, null);
  621. }
  622. createDisplayId(t3 = false) {
  623. const s4 = this._idGenerator.createId();
  624. return s4 > this._allocatedSize && this._expand(), s3(s4, t3);
  625. }
  626. releaseDisplayId(e4) {
  627. for (const t3 of this._bitsets)
  628. t3.unset(e4);
  629. return this._idGenerator.releaseId(e4 & n);
  630. }
  631. getComputedNumeric(e4, s4) {
  632. return this.getComputedNumericAtIndex(e4 & n, 0);
  633. }
  634. setComputedNumeric(e4, s4, i2) {
  635. return this.setComputedNumericAtIndex(e4 & n, i2, 0);
  636. }
  637. getComputedString(e4, s4) {
  638. return this.getComputedStringAtIndex(e4 & n, 0);
  639. }
  640. setComputedString(e4, s4, i2) {
  641. return this.setComputedStringAtIndex(e4 & n, 0, i2);
  642. }
  643. getComputedNumericAtIndex(e4, s4) {
  644. const i2 = e4 & n;
  645. return this._ensureNumeric(s4, i2), this._numerics[s4][i2];
  646. }
  647. setComputedNumericAtIndex(e4, s4, i2) {
  648. const n4 = e4 & n;
  649. this._ensureNumeric(s4, n4), this._numerics[s4][n4] = i2;
  650. }
  651. getInstanceId(e4) {
  652. const s4 = e4 & n;
  653. return this._ensureInstanceId(s4), this._instanceIds[s4];
  654. }
  655. setInstanceId(e4, s4) {
  656. const i2 = e4 & n;
  657. this._ensureInstanceId(i2), this._instanceIds[i2] = s4;
  658. }
  659. getComputedStringAtIndex(e4, s4) {
  660. const i2 = e4 & n;
  661. return this._ensureString(s4, i2), this._strings[s4][i2];
  662. }
  663. setComputedStringAtIndex(e4, s4, i2) {
  664. const n4 = e4 & n;
  665. this._ensureString(s4, n4), this._strings[s4][n4] = i2;
  666. }
  667. getXMin(e4) {
  668. return this._bounds[4 * (e4 & n)];
  669. }
  670. getYMin(e4) {
  671. return this._bounds[4 * (e4 & n) + 1];
  672. }
  673. getXMax(e4) {
  674. return this._bounds[4 * (e4 & n) + 2];
  675. }
  676. getYMax(e4) {
  677. return this._bounds[4 * (e4 & n) + 3];
  678. }
  679. setBounds(e4, s4) {
  680. const i2 = s4.readHydratedGeometry();
  681. if (!i2 || !i2.coords.length)
  682. return false;
  683. let r6 = 1 / 0, u2 = 1 / 0, o2 = -1 / 0, h = -1 / 0;
  684. i2.forEachVertex((t3, e5) => {
  685. r6 = Math.min(r6, t3), u2 = Math.min(u2, e5), o2 = Math.max(o2, t3), h = Math.max(h, e5);
  686. });
  687. const d2 = e4 & n;
  688. return n3(this._bounds, 4 * d2 + 4, 0), this._bounds[4 * d2] = r6, this._bounds[4 * d2 + 1] = u2, this._bounds[4 * d2 + 2] = o2, this._bounds[4 * d2 + 3] = h, true;
  689. }
  690. };
  691. export {
  692. c3 as c,
  693. v,
  694. r5 as r
  695. };
  696. //# sourceMappingURL=chunk-ZELEU5PN.js.map