chunk-U2FIWR5R.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. import {
  2. A
  3. } from "./chunk-P2L4QEOI.js";
  4. import {
  5. s as s2
  6. } from "./chunk-D6FGJON6.js";
  7. import {
  8. i
  9. } from "./chunk-VAY3LZG7.js";
  10. import {
  11. a as a2,
  12. m
  13. } from "./chunk-LY74KTXV.js";
  14. import {
  15. O
  16. } from "./chunk-WNCU6BFU.js";
  17. import {
  18. i as i2
  19. } from "./chunk-LRDX4TO7.js";
  20. import {
  21. n
  22. } from "./chunk-DT6EAZQ5.js";
  23. import {
  24. s
  25. } from "./chunk-EMJ4ZSM2.js";
  26. import {
  27. a,
  28. e,
  29. r,
  30. t
  31. } from "./chunk-GZT4BVFP.js";
  32. // node_modules/@arcgis/core/views/2d/arcade/callExpressionWithCursor.js
  33. function r2(r4, a3, t2) {
  34. r4.referencesGeometry();
  35. const n2 = a3.readArcadeFeature();
  36. try {
  37. return r4.evaluate({ ...t2, $feature: n2 });
  38. } catch (o2) {
  39. return s.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:", o2), null;
  40. }
  41. }
  42. // node_modules/@arcgis/core/views/2d/layers/features/Store2D.js
  43. var o = import("./labelFormatUtils-UVCDII77.js");
  44. var c = class {
  45. constructor(e2, s3) {
  46. this._canCacheExpressionValue = false, this._sourceInfo = e2, this._storage = s3, this._bitsets = { computed: s3.getBitset(s3.createBitset()) };
  47. }
  48. get storage() {
  49. return this._storage;
  50. }
  51. invalidate() {
  52. this._bitsets.computed.clear();
  53. }
  54. async updateSchema(r4, a3) {
  55. const o2 = m(this._schema, a3);
  56. if (this._schema = a3, !a3 || t(o2) || !a2(o2, "attributes"))
  57. return;
  58. a("esri-2d-update-debug") && console.debug("Applying Update - Store:", o2), this._bitsets.computed.clear(), r4.targets[a3.name] = true;
  59. const c3 = a3.attributes, n2 = [], d = [];
  60. for (const e2 in c3) {
  61. const s3 = c3[e2];
  62. switch (s3.type) {
  63. case "field":
  64. break;
  65. case "expression":
  66. n2.push(this._createArcadeComputedField(s3));
  67. break;
  68. case "label-expression":
  69. n2.push(this._createLabelArcadeComputedField(s3));
  70. break;
  71. case "statistic":
  72. d.push(s3);
  73. }
  74. }
  75. this._computedFields = await Promise.all(n2), this._canCacheExpressionValue = !this._computedFields.some((e2) => e2.type === "expression" && e2.expression.referencesScale()), this._statisticFields = d;
  76. }
  77. setComputedAttributes(e2, s3, t2, i3) {
  78. const r4 = this._bitsets.computed;
  79. if (!this._canCacheExpressionValue || !r4.has(t2)) {
  80. r4.set(t2);
  81. for (const r5 of this._computedFields) {
  82. const a3 = this._evaluateField(s3, r5, i3);
  83. switch (r5.resultType) {
  84. case "numeric":
  85. e2.setComputedNumericAtIndex(t2, r5.fieldIndex, a3);
  86. break;
  87. case "string":
  88. e2.setComputedStringAtIndex(t2, r5.fieldIndex, a3);
  89. }
  90. }
  91. }
  92. }
  93. async _createArcadeComputedField(e2) {
  94. const s3 = this._sourceInfo.spatialReference, t2 = this._sourceInfo.fieldsIndex;
  95. return { ...e2, expression: await i2(e2.valueExpression, s3, t2) };
  96. }
  97. async _createLabelArcadeComputedField(e2) {
  98. const s3 = this._sourceInfo.spatialReference, t2 = this._sourceInfo.fieldsIndex, { createLabelFunction: i3 } = await o, r4 = await i3(e2.label, t2, s3);
  99. return { ...e2, builder: r4 };
  100. }
  101. _evaluateField(e2, s3, t2) {
  102. switch (s3.type) {
  103. case "label-expression": {
  104. const t3 = e2.readArcadeFeature();
  105. return s3.builder.evaluate(t3) || "";
  106. }
  107. case "expression": {
  108. const { expression: i3 } = s3;
  109. return r2(i3, e2, { $view: { scale: t2 } });
  110. }
  111. }
  112. }
  113. };
  114. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js
  115. var r3 = class extends A {
  116. constructor(r4, t2) {
  117. super(A.createInstance(), r4.fullSchema()), this._currentIndex = -1, this._reader = r4, this._indices = t2;
  118. }
  119. static from(e2, t2) {
  120. return new r3(e2.copy(), t2);
  121. }
  122. get hasNext() {
  123. return this._currentIndex + 1 < this._indices.length;
  124. }
  125. getSize() {
  126. return this._indices.length;
  127. }
  128. getCursor() {
  129. return this.copy();
  130. }
  131. copy() {
  132. const e2 = new r3(this._reader.copy(), this._indices);
  133. return e2._currentIndex = this._currentIndex, e2;
  134. }
  135. next() {
  136. for (; this._nextIndex() && !this._reader._getExists(); )
  137. ;
  138. return this._currentIndex < this._indices.length;
  139. }
  140. _nextIndex() {
  141. return ++this._currentIndex < this._indices.length && (this._reader.setIndex(this._indices[this._currentIndex]), true);
  142. }
  143. setArcadeSpatialReference(e2) {
  144. this._reader.setArcadeSpatialReference(e2);
  145. }
  146. attachStorage(e2) {
  147. this._reader.attachStorage(e2);
  148. }
  149. get geometryType() {
  150. return this._reader.geometryType;
  151. }
  152. get hasFeatures() {
  153. return this._reader.hasFeatures;
  154. }
  155. get exceededTransferLimit() {
  156. return this._reader.exceededTransferLimit;
  157. }
  158. get hasZ() {
  159. return this._reader.hasZ;
  160. }
  161. get hasM() {
  162. return this._reader.hasM;
  163. }
  164. getStorage() {
  165. return this._reader.getStorage();
  166. }
  167. getComputedNumeric(e2) {
  168. return this._reader.getComputedNumericAtIndex(0);
  169. }
  170. setComputedNumeric(e2, r4) {
  171. return this._reader.setComputedNumericAtIndex(r4, 0);
  172. }
  173. getComputedString(e2) {
  174. return this._reader.getComputedStringAtIndex(0);
  175. }
  176. setComputedString(e2, r4) {
  177. return this._reader.setComputedStringAtIndex(0, r4);
  178. }
  179. getComputedNumericAtIndex(e2) {
  180. return this._reader.getComputedNumericAtIndex(e2);
  181. }
  182. setComputedNumericAtIndex(e2, r4) {
  183. this._reader.setComputedNumericAtIndex(e2, r4);
  184. }
  185. getComputedStringAtIndex(e2) {
  186. return this._reader.getComputedStringAtIndex(e2);
  187. }
  188. setComputedStringAtIndex(e2, r4) {
  189. return this._reader.setComputedStringAtIndex(e2, r4);
  190. }
  191. transform(e2, r4, t2, d) {
  192. const a3 = this.copy();
  193. return a3._reader = this._reader.transform(e2, r4, t2, d), a3;
  194. }
  195. readAttribute(e2, r4 = false) {
  196. return this._reader.readAttribute(e2, r4);
  197. }
  198. readAttributes() {
  199. return this._reader.readAttributes();
  200. }
  201. joinAttributes(e2) {
  202. return this._reader.joinAttributes(e2);
  203. }
  204. readArcadeFeature() {
  205. return this._reader.readArcadeFeature();
  206. }
  207. geometry() {
  208. return this._reader.geometry();
  209. }
  210. field(e2) {
  211. return this.readAttribute(e2, true);
  212. }
  213. hasField(e2) {
  214. return this._reader.hasField(e2);
  215. }
  216. setField(e2, r4) {
  217. return this._reader.setField(e2, r4);
  218. }
  219. keys() {
  220. return this._reader.keys();
  221. }
  222. castToText() {
  223. return this._reader.castToText();
  224. }
  225. getQuantizationTransform() {
  226. return this._reader.getQuantizationTransform();
  227. }
  228. getFieldNames() {
  229. return this._reader.getFieldNames();
  230. }
  231. getAttributeHash() {
  232. return this._reader.getAttributeHash();
  233. }
  234. getObjectId() {
  235. return this._reader.getObjectId();
  236. }
  237. getDisplayId() {
  238. return this._reader.getDisplayId();
  239. }
  240. setDisplayId(e2) {
  241. return this._reader.setDisplayId(e2);
  242. }
  243. getGroupId() {
  244. return this._reader.getGroupId();
  245. }
  246. setGroupId(e2) {
  247. return this._reader.setGroupId(e2);
  248. }
  249. getXHydrated() {
  250. return this._reader.getXHydrated();
  251. }
  252. getYHydrated() {
  253. return this._reader.getYHydrated();
  254. }
  255. getX() {
  256. return this._reader.getX();
  257. }
  258. getY() {
  259. return this._reader.getY();
  260. }
  261. setIndex(e2) {
  262. return this._reader.setIndex(e2);
  263. }
  264. getIndex() {
  265. return this._reader.getIndex();
  266. }
  267. readLegacyFeature() {
  268. return this._reader.readLegacyFeature();
  269. }
  270. readOptimizedFeature() {
  271. return this._reader.readOptimizedFeature();
  272. }
  273. readLegacyPointGeometry() {
  274. return this._reader.readLegacyPointGeometry();
  275. }
  276. readLegacyGeometry() {
  277. return this._reader.readLegacyGeometry();
  278. }
  279. readLegacyCentroid() {
  280. return this._reader.readLegacyCentroid();
  281. }
  282. readGeometryArea() {
  283. return this._reader.readGeometryArea();
  284. }
  285. readUnquantizedGeometry() {
  286. return this._reader.readUnquantizedGeometry();
  287. }
  288. readHydratedGeometry() {
  289. return this._reader.readHydratedGeometry();
  290. }
  291. readGeometry() {
  292. return this._reader.readGeometry();
  293. }
  294. readCentroid() {
  295. return this._reader.readCentroid();
  296. }
  297. _readAttribute(e2, r4) {
  298. throw new Error("Error: Should not be called. Underlying _reader should be used instead");
  299. }
  300. _readAttributes() {
  301. throw new Error("Error: Should not be called. Underlying _reader should be used instead");
  302. }
  303. };
  304. // node_modules/@arcgis/core/views/2d/layers/features/FeatureStore2D.js
  305. function h(t2, e2) {
  306. return t2 << 16 | e2;
  307. }
  308. function c2(t2) {
  309. return (4294901760 & t2) >>> 16;
  310. }
  311. function I(t2) {
  312. return 65535 & t2;
  313. }
  314. var u = { getObjectId: (t2) => t2.getObjectId(), getAttributes: (t2) => t2.readAttributes(), getAttribute: (t2, e2) => t2.readAttribute(e2), cloneWithGeometry: (t2, e2) => t2, getGeometry: (t2) => t2.readHydratedGeometry(), getCentroid: (t2, e2) => t2.readCentroid() };
  315. var l = class extends c {
  316. constructor(s3, a3, r4) {
  317. super(s3, a3), this.featureAdapter = u, this.events = new n(), this._featureSetsByInstance = new Map(), this._objectIdToDisplayId = new Map(), this._spatialIndexInvalid = true, this._indexSearchCache = new s2(50), this._index = i(9, (t2) => ({ minX: this._storage.getXMin(t2), minY: this._storage.getYMin(t2), maxX: this._storage.getXMax(t2), maxY: this._storage.getYMax(t2) })), this.mode = r4;
  318. }
  319. get storeStatistics() {
  320. let t2 = 0, e2 = 0, s3 = 0;
  321. return this.forEach((a3) => {
  322. const r4 = a3.readGeometry();
  323. r4 && (e2 += r4.isPoint ? 1 : r4.lengths.reduce((t3, e3) => t3 + e3, 0), s3 += r4.isPoint ? 1 : r4.lengths.length, t2 += 1);
  324. }), { featureCount: t2, vertexCount: e2, ringCount: s3 };
  325. }
  326. hasInstance(t2) {
  327. return this._featureSetsByInstance.has(t2);
  328. }
  329. onTileData(t2, e2) {
  330. if (t(e2.addOrUpdate))
  331. return e2;
  332. if (e2.addOrUpdate.attachStorage(this._storage), this.mode === "snapshot") {
  333. const s3 = e2.addOrUpdate.getCursor();
  334. for (; s3.next(); ) {
  335. const e3 = s3.getDisplayId();
  336. this.setComputedAttributes(this._storage, s3, e3, t2.scale);
  337. }
  338. return e2;
  339. }
  340. this._featureSetsByInstance.set(e2.addOrUpdate.instance, e2.addOrUpdate);
  341. const a3 = e2.addOrUpdate.getCursor();
  342. for (; a3.next(); )
  343. this._insertFeature(a3, t2.scale);
  344. return this._spatialIndexInvalid = true, this.events.emit("changed"), e2;
  345. }
  346. search(t2) {
  347. this._rebuildIndex();
  348. const e2 = t2.id, s3 = this._indexSearchCache.find((t3) => t3.tileId === e2);
  349. if (r(s3))
  350. return s3.readers;
  351. const r4 = new Map(), n2 = this._searchIndex(t2.bounds), i3 = [];
  352. for (const a3 of n2) {
  353. const t3 = this._storage.getInstanceId(a3), e3 = c2(t3), s4 = I(t3);
  354. r4.has(e3) || r4.set(e3, []);
  355. r4.get(e3).push(s4);
  356. }
  357. return r4.forEach((t3, e3) => {
  358. const s4 = this._featureSetsByInstance.get(e3);
  359. i3.push(r3.from(s4, t3));
  360. }), this._indexSearchCache.enqueue({ tileId: e2, readers: i3 }), i3;
  361. }
  362. insert(t2) {
  363. const e2 = t2.getCursor(), s3 = this._storage;
  364. for (; e2.next(); ) {
  365. const t3 = h(e2.instance, e2.getIndex()), a3 = e2.getObjectId(), r4 = this._objectIdToDisplayId.get(a3) ?? this._storage.createDisplayId();
  366. e2.setDisplayId(r4), s3.setInstanceId(r4, t3), this._objectIdToDisplayId.set(a3, r4);
  367. }
  368. this._featureSetsByInstance.set(t2.instance, t2), this._spatialIndexInvalid = true;
  369. }
  370. remove(t2) {
  371. const e2 = this._objectIdToDisplayId.get(t2);
  372. if (!e2)
  373. return;
  374. const s3 = this._storage.getInstanceId(e2), a3 = I(s3), r4 = c2(s3), n2 = this._featureSetsByInstance.get(r4);
  375. this._objectIdToDisplayId.delete(t2), this._storage.releaseDisplayId(e2), n2.removeAtIndex(a3), n2.isEmpty && this._featureSetsByInstance.delete(r4), this._spatialIndexInvalid = true;
  376. }
  377. toArray() {
  378. const t2 = new Array();
  379. return this.forEach((e2) => t2.push(e2)), t2;
  380. }
  381. forEach(t2) {
  382. this._objectIdToDisplayId.forEach((e2) => {
  383. const s3 = this._storage.getInstanceId(e2), a3 = this._lookupFeature(s3);
  384. t2(a3);
  385. });
  386. }
  387. forEachUnsafe(t2) {
  388. this._objectIdToDisplayId.forEach((e2) => {
  389. const s3 = this._storage.getInstanceId(e2), a3 = c2(s3), r4 = I(s3), n2 = this._getFeatureSet(a3);
  390. n2.setIndex(r4), t2(n2);
  391. });
  392. }
  393. forEachInBounds(t2, e2) {
  394. const s3 = this._searchIndex(t2);
  395. for (const a3 of s3) {
  396. const t3 = this.lookupFeatureByDisplayId(a3, this._storage);
  397. e2(e(t3));
  398. }
  399. }
  400. forEachBounds(t2, e2, s3) {
  401. this._rebuildIndex();
  402. const a3 = [0, 0, 0, 0];
  403. for (const r4 of t2) {
  404. if (!r4.readGeometry())
  405. continue;
  406. const t3 = r4.getDisplayId();
  407. a3[0] = this._storage.getXMin(t3), a3[1] = this._storage.getYMin(t3), a3[2] = this._storage.getXMax(t3), a3[3] = this._storage.getYMax(t3), e2(O(s3, a3));
  408. }
  409. }
  410. sweepFeatures(t2, e2, s3) {
  411. this._spatialIndexInvalid = true, this._objectIdToDisplayId.forEach((a3, r4) => {
  412. t2.has(a3) || (e2.releaseDisplayId(a3), s3 && s3.unsetAttributeData(a3), this._objectIdToDisplayId.delete(r4));
  413. }), this.events.emit("changed");
  414. }
  415. sweepFeatureSets(t2) {
  416. this._spatialIndexInvalid = true, this._featureSetsByInstance.forEach((e2, s3) => {
  417. t2.has(s3) || this._featureSetsByInstance.delete(s3);
  418. });
  419. }
  420. lookupObjectId(t2, e2) {
  421. const a3 = this.lookupFeatureByDisplayId(t2, e2);
  422. return t(a3) ? null : a3.getObjectId();
  423. }
  424. lookupDisplayId(t2) {
  425. return this._objectIdToDisplayId.get(t2);
  426. }
  427. lookupFeatureByDisplayId(t2, e2) {
  428. const s3 = e2.getInstanceId(t2);
  429. return this._lookupFeature(s3);
  430. }
  431. lookupByDisplayIdUnsafe(t2) {
  432. const e2 = this._storage.getInstanceId(t2), s3 = c2(e2), a3 = I(e2), r4 = this._getFeatureSet(s3);
  433. return r4 ? (r4.setIndex(a3), r4) : null;
  434. }
  435. _insertFeature(t2, e2) {
  436. const s3 = this._storage, a3 = t2.getObjectId(), r4 = h(t2.instance, t2.getIndex());
  437. s3.getInstanceId(t2.getDisplayId());
  438. let n2 = this._objectIdToDisplayId.get(a3);
  439. n2 || (n2 = s3.createDisplayId(), this._objectIdToDisplayId.set(a3, n2), this._spatialIndexInvalid = true), t2.setDisplayId(n2), s3.setInstanceId(n2, r4), this.setComputedAttributes(s3, t2, n2, e2);
  440. }
  441. _searchIndex(t2) {
  442. this._rebuildIndex();
  443. const e2 = { minX: t2[0], minY: t2[1], maxX: t2[2], maxY: t2[3] };
  444. return this._index.search(e2);
  445. }
  446. _rebuildIndex() {
  447. if (!this._spatialIndexInvalid)
  448. return;
  449. const t2 = [];
  450. this.mode === "snapshot" ? this._featureSetsByInstance.forEach((e2) => {
  451. const s3 = e2.getCursor();
  452. for (; s3.next(); ) {
  453. const e3 = s3.getDisplayId();
  454. this._storage.setBounds(e3, s3) && t2.push(e3);
  455. }
  456. }) : this._objectIdToDisplayId.forEach((e2) => {
  457. const s3 = this._storage.getInstanceId(e2);
  458. this._storage.setBounds(e2, this._lookupFeature(s3)) && t2.push(e2);
  459. }), this._index.clear(), this._index.load(t2), this._indexSearchCache.clear(), this._spatialIndexInvalid = false;
  460. }
  461. _lookupFeature(t2) {
  462. const e2 = c2(t2), s3 = this._getFeatureSet(e2);
  463. if (!s3)
  464. return null;
  465. const a3 = s3.getCursor(), r4 = I(t2);
  466. return a3.setIndex(r4), a3;
  467. }
  468. _getFeatureSet(t2) {
  469. return this._featureSetsByInstance.get(t2);
  470. }
  471. };
  472. export {
  473. c,
  474. r3 as r,
  475. u,
  476. l
  477. };
  478. //# sourceMappingURL=chunk-U2FIWR5R.js.map